openai, anthropic, ...: with_structured_output to pass in explicit tool choice (#23645)

...community, mistralai, groq, fireworks

part of #23644
This commit is contained in:
Bagatur
2024-06-28 16:39:53 -07:00
committed by GitHub
parent c5f35a72da
commit fc8fd49328
7 changed files with 22 additions and 16 deletions

View File

@@ -794,6 +794,8 @@ class ChatMistralAI(BaseChatModel):
"schema must be specified when method is 'function_calling'. "
"Received None."
)
# TODO: Update to pass in tool name as tool_choice if/when Mistral supports
# specifying a tool.
llm = self.bind_tools([schema], tool_choice="any")
if is_pydantic_schema:
output_parser: OutputParserLike = PydanticToolsParser(