Skip to content

fix(instructor): forward base_url and api_key to instructor.from_provider#5658

Merged
greysonlalonde merged 1 commit intomainfrom
gl/fix/instructor-forward-base-url
Apr 29, 2026
Merged

fix(instructor): forward base_url and api_key to instructor.from_provider#5658
greysonlalonde merged 1 commit intomainfrom
gl/fix/instructor-forward-base-url

Conversation

@greysonlalonde
Copy link
Copy Markdown
Contributor

@greysonlalonde greysonlalonde commented Apr 29, 2026

Closes #5204


Note

Medium Risk
Touches LLM client instantiation and credential propagation (api_key/base_url), which can affect runtime connectivity and authentication across providers. Change is small and guarded (only passes non-None values), with explicit unit coverage.

Overview
InternalInstructor._create_instructor_client now propagates base_url and api_key (when set on a non-string LLM) into instructor.from_provider, enabling custom endpoints/credentials to be honored.

Tests were updated to include base_url/api_key on the unsupported-provider mock and to add assertions that these fields are forwarded when provided and omitted when None.

Reviewed by Cursor Bugbot for commit 7a83f7a. Bugbot is set up for automated code reviews on this repo. Configure here.

Copy link
Copy Markdown
Contributor

@iris-clawd iris-clawd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — forwards base_url/api_key to instructor.from_provider when set, clean and backward-compatible.

@greysonlalonde greysonlalonde merged commit 14c3963 into main Apr 29, 2026
55 checks passed
@greysonlalonde greysonlalonde deleted the gl/fix/instructor-forward-base-url branch April 29, 2026 19:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] InternalInstructor discards base_url when creating instructor client — breaks OpenAI-compatible endpoints

2 participants