Repository navigation
feat(groq): Allow kwargs in with_structured_output to override tool_choice - #34053
Merged
ccurme (ccurme) merged 3 commits intoDec 12, 2025
Merged
ccurme (ccurme) merged 3 commits into
ccurme (ccurme) merged 3 commits into
Conversation
Fixes langchain-ai#33995 Allow users to pass additional kwargs (like tool_choice) to with_structured_output() to avoid 400 errors when the model doesn't trigger a tool call. This aligns ChatGroq with ChatOpenAI behavior. Users can now override the default tool_choice: llm.with_structured_output(Schema, tool_choice="auto")
Sidharth Rajmohan (dumko2001)
requested review from
ccurme (ccurme) and
Mason Daugherty (mdrxy)
as code owners
November 20, 2025 17:13
CodSpeed Performance ReportMerging #34053 will not alter performanceComparing Summary
Footnotes
|
8 of 30 tasks
ccurme (ccurme)
approved these changes
Dec 12, 2025
Collaborator
|
I'm not sure this will fix the issue as we are already specifying |
DreamZhongJu
pushed a commit
to DreamZhongJu/langchain
that referenced
this pull request
Aug 24, 2026
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.
Fixes #33995
Allow users to pass additional kwargs (like tool_choice) to with_structured_output() to avoid 400 errors when the model doesn't trigger a tool call. This aligns ChatGroq with ChatOpenAI behavior.
Users can now override the default tool_choice:
llm.with_structured_output(Schema, tool_choice="auto")
Description: Allow users to pass additional keyword arguments (like
tool_choice) to with_structured_output() to avoid 400 errors when the model doesn't trigger a tool call. This alignsChatGroq.with_structured_output()withChatOpenAI.with_structured_output()behavior by removing the kwargs restriction and passing them through to bind_tools() and bind() methods.Issue: Fixes #33995
Dependencies: None