admin管理员组

文章数量:1122846

Using the Anthropic messsages API directly and providing multiple tools to the model, it's possible to instruct the model to only invoke one tool at a time by setting disable_parallel_tool_use=true in the tool_choice field.

I'm using LangGraph, and I'd like to be able to do the same thing - instruct the model to only choose one tool at a time.

Below is the heart of my code. I'm leaving out the tool method definitions and prompts, because they're not directly relevant.

model = ChatAnthropic(model="claude-3-5-sonnet-20241022")
tools = [search_word_forms, search_dictionaries, WordDetermination]
model_with_tools = model.bind_tools(tools, tool_choice="any")
response = model_with_tools.invoke(state["messages"])

Using this framework, how can I instruct the model to disable parallel tool use?

本文标签: langchainUsing Langgraphinstruct Anthropic to disable parallel tool useStack Overflow