Skip to content

fix: avoid mutating Gemini generation config - #2467

Closed
lntutor wants to merge 1 commit into
567-labs:mainfrom
lntutor:fix/gemini-config-mutation-2465
Closed

fix: avoid mutating Gemini generation config#2467
lntutor wants to merge 1 commit into
567-labs:mainfrom
lntutor:fix/gemini-config-mutation-2465

Conversation

@lntutor

@lntutor lntutor commented Jul 19, 2026

Copy link
Copy Markdown

Describe your changes

Copy the caller-owned generation_config before translating OpenAI-compatible option names to Gemini names. This keeps request preparation from deleting keys such as max_tokens from reusable caller state.

Adds a deterministic regression test and an Unreleased changelog entry.

Issue ticket number and link

Closes #2465

Validation

  • uv run pytest -q tests/v2/test_gemini_utils_deterministic.py (19 passed)
  • uv run ruff check instructor/v2/providers/gemini/utils.py tests/v2/test_gemini_utils_deterministic.py
  • uv run ruff format --check instructor/v2/providers/gemini/utils.py tests/v2/test_gemini_utils_deterministic.py
  • uv run ty check instructor/v2/providers/gemini/utils.py tests/v2/test_gemini_utils_deterministic.py

Checklist before requesting a review

  • I have performed a self-review of my code
  • If it is a core feature, I have added thorough tests.
  • If it is a core feature, I have added documentation.

@jxnl

jxnl commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

Consolidated and shipped in #2495. Closing this focused patch as superseded; thank you for the contribution.

@jxnl jxnl closed this Jul 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

update_gemini_kwargs mutates caller generation config

2 participants