Repository navigation
Conversation
…experimental adapters VLLMInterpreter.__init__ and SglangInterpreter.__init__ forwarded **kwargs to both openai.OpenAI(...) and BaseOpenAIInterpreter.__init__(...), which does not accept arbitrary keyword arguments. Any standard openai.OpenAI constructor argument (e.g. timeout, max_retries, organization) therefore raised 'TypeError: BaseOpenAIInterpreter.__init__() got an unexpected keyword argument' at construction, while reasoning_effort, which the interpreter does accept, was rejected by openai.OpenAI() instead. Forward **kwargs only to openai.OpenAI and pass reasoning_effort explicitly to super(), matching OpenAIInterpreter.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
VLLMModelandSglangModelraisedTypeErrorat construction whenever any standardopenai.OpenAIconstructor argument (e.g.timeout,max_retries,organization) was passed, because**kwargswas forwarded to bothopenai.OpenAI(...)andBaseOpenAIInterpreter.__init__(...). The interpreter base class only acceptsmodel,clientandreasoning_effort, so every client kwarg crashed withTypeError: BaseOpenAIInterpreter.__init__() got an unexpected keyword argument 'timeout'. Conversely,reasoning_effort, which the interpreter does accept, was rejected byopenai.OpenAI()instead.Why
The unpatched constructors in
guidance/models/experimental/_vllm.py:27andguidance/models/experimental/_sglang.py:27did:BaseOpenAIInterpreter.__init__(guidance/models/_openai_base.py:258) has signature(self, model, client, *, reasoning_effort=None)and accepts no other keyword arguments. The siblingOpenAIInterpreteralready handles this correctly (guidance/models/_openai.py:30-31): it forwards**kwargsonly toopenai.OpenAI(...)and passesreasoning_effortexplicitly tosuper().__init__, and its docstring documents that "All extra keyword arguments are passed directly to theopenai.OpenAIconstructor" (guidance/models/_openai.py:56-58).Changes
guidance/models/experimental/_vllm.py,guidance/models/experimental/_sglang.py: add an explicitreasoning_effort: str | None = Noneparameter, forward**kwargsonly toopenai.OpenAI(...), and pass onlyreasoning_efforttosuper().__init__, mirroringOpenAIInterpreter.tests/unit/test_experimental_models.py: new regression tests asserting that client kwargs (timeout,max_retries) reach theopenai.OpenAIclient and thatreasoning_effortreaches the interpreter, for both models.Testing