Skip to content

Commit

Permalink
[chore]: tool_choice overiding for with_structured_output
Browse files Browse the repository at this point in the history
  • Loading branch information
keenborder786 committed Jan 21, 2025
1 parent 06456c1 commit 1e347d3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libs/core/langchain_core/language_models/chat_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1239,7 +1239,7 @@ class AnswerWithJustification(BaseModel):
if self.bind_tools is BaseChatModel.bind_tools:
msg = "with_structured_output is not implemented for this model."
raise NotImplementedError(msg)
llm = self.bind_tools([schema], tool_choice="any")
llm = self.bind_tools([schema], tool_choice=kwargs.get("tool_choice", "any"))
if isinstance(schema, type) and is_basemodel_subclass(schema):
output_parser: OutputParserLike = PydanticToolsParser(
tools=[cast(TypeBaseModel, schema)], first_tool_only=True
Expand Down

0 comments on commit 1e347d3

Please sign in to comment.