mirror of
https://github.com/hwchase17/langchain.git
synced 2026-06-09 10:17:00 +00:00
openai, anthropic, ...: with_structured_output to pass in explicit tool choice (#23645)
...community, mistralai, groq, fireworks part of #23644
This commit is contained in:
@@ -986,7 +986,9 @@ class ChatAnthropic(BaseChatModel):
|
||||
# }
|
||||
|
||||
""" # noqa: E501
|
||||
llm = self.bind_tools([schema], tool_choice="any")
|
||||
|
||||
tool_name = convert_to_anthropic_tool(schema)["name"]
|
||||
llm = self.bind_tools([schema], tool_choice=tool_name)
|
||||
if isinstance(schema, type) and issubclass(schema, BaseModel):
|
||||
output_parser = ToolsOutputParser(
|
||||
first_tool_only=True, pydantic_schemas=[schema]
|
||||
|
||||
Reference in New Issue
Block a user