-
Notifications
You must be signed in to change notification settings - Fork 2.1k
vLLM: Move from guided_options_request to structured_outputs #1805
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -81,7 +81,7 @@ vision = [ | |
"selenium", | ||
] | ||
vllm = [ | ||
"vllm", | ||
"vllm>=0.10.2", | ||
"torch" | ||
] | ||
all = [ | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -623,6 +623,7 @@ def generate( | |||||
**kwargs, | ||||||
) -> ChatMessage: | ||||||
from vllm import SamplingParams # type: ignore | ||||||
from vllm.sampling_params import StructuredOutputsParams # type: ignore | ||||||
|
||||||
completion_kwargs = self._prepare_completion_kwargs( | ||||||
messages=messages, | ||||||
|
@@ -632,7 +633,7 @@ def generate( | |||||
**kwargs, | ||||||
) | ||||||
# Override the OpenAI schema for VLLM compatibility | ||||||
guided_options_request = {"guided_json": response_format["json_schema"]["schema"]} if response_format else None | ||||||
structured_outputs = StructuredOutputsParams(json=response_format["json_schema"]["schema"]) if response_format else None | ||||||
|
additional_args["response_format"] = CODEAGENT_RESPONSE_FORMAT |
CODEAGENT_RESPONSE_FORMAT
descriptionsmolagents/src/smolagents/models.py
Line 41 in f042c0c
"json_schema": { |
So I simplified his solution and incorporated it in the PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makes sense to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could add some version control logic like the following
But I think that adds unnecessary complexity. Might be simpler to just force the version to be >= 0.10.2
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested with vLLM 0.10.0, With the new code it will break
