The agent engineering platform.
Python agentsaiai-agentsanthropicchatgptdeepagentsenterpriseframeworkgeminigenerative-ailangchainlanggraphllmmultiagentopen-sourceopenaipydanticpythonragtypescript
docs: Add section on tool choice (#31692)
Mason Daughertyaf2188b8488c
diff --git a/docs/docs/concepts/tool_calling.mdx b/docs/docs/concepts/tool_calling.mdxindex 69051bd8d8..7f48142f41 100644--- a/docs/docs/concepts/tool_calling.mdx+++ b/docs/docs/concepts/tool_calling.mdx@@ -137,6 +137,16 @@ For more details on usage, see our [how-to guides](/docs/how_to/#tools)!:::+## Forcing tool use++By default, the model has the freedom to choose which tool to use based on the user's input. However, in certain scenarios, you might want to influence the model's decision-making process. LangChain allows you to enforce tool choice (using `tool_choice`), ensuring the model uses either a particular tool or *any* tool from a given list. This is useful for structuring the model's behavior and guiding it towards a desired outcome.++:::info[Further reading]++* See our [how-to guide](/docs/how_to/tool_choice) on forcing tool use.++:::+## Best practicesWhen designing [tools](/docs/concepts/tools/) to be used by a model, it is important to keep in mind that:diff --git a/docs/docs/how_to/tool_choice.ipynb b/docs/docs/how_to/tool_choice.ipynbindex 0a7ad581e0..2f5d67df93 100644--- a/docs/docs/how_to/tool_choice.ipynb+++ b/docs/docs/how_to/tool_choice.ipynb@@ -99,7 +99,7 @@"cell_type": "markdown","metadata": {},"source": [- "We can also just force our tool to select at least one of our tools by passing in the \"any\" (or \"required\" which is OpenAI specific) keyword to the `tool_choice` parameter."+ "We can also just force our tool to select at least one of our tools by passing in the \"any\" (or \"required\" [which is OpenAI specific](https://python.langchain.com/api_reference/openai/chat_models/langchain_openai.chat_models.base.BaseChatOpenAI.html#langchain_openai.chat_models.base.BaseChatOpenAI.bind_tools)) keyword to the `tool_choice` parameter."]},{