Skip to content

Commit fc6e3ff

Browse files
committed
version compatibility
Signed-off-by: wangli <wangli858794774@gmail.com>
1 parent e454efb commit fc6e3ff

File tree

1 file changed

+21
-8
lines changed

1 file changed

+21
-8
lines changed

tests/e2e/singlecard/test_guided_decoding.py

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,17 @@ def test_guided_json_completion(guided_decoding_backend: str,
108108
"max_tokens": 500,
109109
})
110110

111-
with VllmRunner(
112-
MODEL_NAME,
113-
seed=0,
114-
) as vllm_model:
111+
backwoards_compatibility_kwargs = {}
112+
if vllm_version_is("0.10.2"):
113+
backwoards_compatibility_kwargs["guided_decoding_backend"] = (
114+
guided_decoding_backend)
115+
else:
116+
backwoards_compatibility_kwargs["structured_outputs_config"] = {
117+
"backend": guided_decoding_backend
118+
}
119+
120+
with VllmRunner(MODEL_NAME, seed=0,
121+
**backwoards_compatibility_kwargs) as vllm_model:
115122
prompts = [
116123
f"Give an example JSON for an employee profile "
117124
f"that fits this schema: {sample_json_schema}"
@@ -145,11 +152,17 @@ def test_guided_regex(guided_decoding_backend: str, sample_regex):
145152
"temperature": 0.8,
146153
"top_p": 0.95,
147154
})
155+
backwoards_compatibility_kwargs = {}
156+
if vllm_version_is("0.10.2"):
157+
backwoards_compatibility_kwargs["guided_decoding_backend"] = (
158+
guided_decoding_backend)
159+
else:
160+
backwoards_compatibility_kwargs["structured_outputs_config"] = {
161+
"backend": guided_decoding_backend
162+
}
148163

149-
with VllmRunner(
150-
MODEL_NAME,
151-
seed=0,
152-
) as vllm_model:
164+
with VllmRunner(MODEL_NAME, seed=0,
165+
**backwoards_compatibility_kwargs) as vllm_model:
153166
prompts = [
154167
f"Give an example IPv4 address with this regex: {sample_regex}"
155168
] * 2

0 commit comments

Comments
 (0)