@@ -108,10 +108,17 @@ def test_guided_json_completion(guided_decoding_backend: str,
108
108
"max_tokens" : 500 ,
109
109
})
110
110
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 :
115
122
prompts = [
116
123
f"Give an example JSON for an employee profile "
117
124
f"that fits this schema: { sample_json_schema } "
@@ -145,11 +152,17 @@ def test_guided_regex(guided_decoding_backend: str, sample_regex):
145
152
"temperature" : 0.8 ,
146
153
"top_p" : 0.95 ,
147
154
})
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
+ }
148
163
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 :
153
166
prompts = [
154
167
f"Give an example IPv4 address with this regex: { sample_regex } "
155
168
] * 2
0 commit comments