Skip to content

fix(genai): extract thinking_config from user-provided config object#1972

Merged
jxnl merged 1 commit into567-labs:mainfrom
majiayu000:fix/issue-1966-thinking-config-in-config
Dec 30, 2025
Merged

fix(genai): extract thinking_config from user-provided config object#1972
jxnl merged 1 commit into567-labs:mainfrom
majiayu000:fix/issue-1966-thinking-config-in-config

Conversation

@majiayu000
Copy link
Copy Markdown
Contributor

@majiayu000 majiayu000 commented Dec 24, 2025

Summary

  • When users pass thinking_config inside a GenerateContentConfig object, it was being ignored
  • This fix extracts thinking_config from the user-provided config object
  • Prioritizes separate kwarg thinking_config over config.thinking_config

Changes

  • Modified handle_genai_structured_outputs() to extract thinking_config from user config
  • Modified handle_genai_tools() with the same fix
  • Added tests to verify the fix works correctly

Test plan

  • Added unit tests for thinking_config extraction
  • Verified kwarg priority over config.thinking_config
  • Existing tests pass

Closes #1966


Important

Fixes issue #1966 by extracting thinking_config from user config in handle_genai_structured_outputs() and handle_genai_tools(), prioritizing kwarg over config.

  • Behavior:
  • Tests:
    • Adds test_handle_genai_structured_outputs_thinking_config_in_config() and test_handle_genai_tools_thinking_config_in_config() to verify extraction.
    • Adds test_handle_genai_structured_outputs_thinking_config_kwarg_priority() to verify kwarg priority.

This description was created by Ellipsis for 09f42bc. You can customize this summary. It will automatically update as commits are pushed.

When users pass thinking_config inside a GenerateContentConfig object
(e.g., config=GenerateContentConfig(thinking_config=...)), the
thinking_config was being ignored. This fix extracts thinking_config
from the user-provided config object and includes it in the final
configuration.

The fix:
- Checks for config parameter in handle_genai_structured_outputs and
  handle_genai_tools functions
- Extracts thinking_config from user's config if present
- Prioritizes separate kwarg thinking_config over config.thinking_config

Closes 567-labs#1966
Copy link
Copy Markdown
Contributor

@ellipsis-dev ellipsis-dev Bot left a comment

Choose a reason for hiding this comment

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

Important

Looks good to me! 👍

Reviewed everything up to 09f42bc in 1 minute and 40 seconds. Click for details.
  • Reviewed 142 lines of code in 2 files
  • Skipped 0 files when reviewing.
  • Skipped posting 2 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. instructor/providers/gemini/utils.py:837
  • Draft comment:
    Good fix for extracting thinking_config. Note that the extraction block appears nearly identical in both handle_genai_structured_outputs and handle_genai_tools. Consider refactoring this into a helper to adhere to DRY principles.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 85% vs. threshold = 85% This is a code quality refactoring suggestion that is actionable and clear. The comment correctly identifies duplicated code that was added in this diff (both blocks are new additions). The suggestion to extract this into a helper function is reasonable and follows the DRY principle, which is explicitly mentioned in the additional rules. The comment is about changes made in the diff (both blocks are new code), so it's relevant. This is exactly the type of comment that should be kept according to the rules: "Comments that suggest code quality refactors are good! But only if they are actionable and clear." Could this be considered too minor or obvious? The duplication is only 11 lines and appears in just 2 places. Perhaps the author intentionally duplicated it for simplicity or readability. Also, I should verify that both blocks are truly identical and that extracting them would actually improve the code. While the duplication is relatively small, it's still meaningful - 11 lines duplicated across 2 functions. The blocks are completely identical, including comments, which strongly suggests they should be extracted. The DRY principle is explicitly listed in the additional rules, and this is a clear, actionable suggestion. Even if the author intentionally duplicated it, the comment provides value by pointing out the opportunity for improvement. This comment should be kept. It identifies clear code duplication that violates the DRY principle (explicitly listed in the rules), provides an actionable suggestion (extract to helper function), and is about code that was changed in this diff. This is exactly the type of code quality refactoring comment that the rules say should be kept.
2. tests/llm/test_genai/test_utils.py:206
  • Draft comment:
    Comprehensive tests for thinking_config extraction and kwarg priority have been added. This effectively verifies the fix for issue #1966.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 85% None

Workflow ID: wflow_ltfY2TVWigLCTimn

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

@jxnl jxnl merged commit 5ac647f into 567-labs:main Dec 30, 2025
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.

thinking_config inside config parameter is ignored in GENAI_STRUCTURED_OUTPUTS mode

2 participants