fix: forward base_url and api_key to instructor client#5374
Open
mango766 wants to merge 1 commit intocrewAIInc:mainfrom
Open
fix: forward base_url and api_key to instructor client#5374mango766 wants to merge 1 commit intocrewAIInc:mainfrom
mango766 wants to merge 1 commit intocrewAIInc:mainfrom
Conversation
…tructor When using an OpenAI-compatible provider with a custom base_url (e.g., vLLM, Ollama, or any self-hosted endpoint), InternalInstructor silently discards the base_url and sends requests to api.openai.com instead. This forwards the base_url and api_key from the LLM object to instructor.from_provider() so that structured output requests go to the correct endpoint. Fixes crewAIInc#5204 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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
Fixes #5204
When using an OpenAI-compatible provider with a custom
base_url(e.g., vLLM, Ollama, or any self-hosted endpoint),InternalInstructor._create_instructor_client()silently discards thebase_urland sends requests toapi.openai.cominstead.This PR forwards the
base_urlandapi_keyfrom the LLM object toinstructor.from_provider()so structured output parsing requests go to the correct endpoint.Changes
_create_instructor_client()ininternal_instructor.pyto extractbase_urlandapi_keyfrom the LLM object and pass them as kwargs toinstructor.from_provider()Test plan
base_urlwith an OpenAI-compatible LLM correctly routes requests to the specified endpointbase_url) still works correctly_create_instructor_client())