Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Update wording in tool choice guide #6732

Merged
merged 1 commit into from
Sep 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 5 additions & 26 deletions docs/core_docs/docs/how_to/tool_choice.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@
"const llmForcedToMultiply = llm.bindTools(tools, {\n",
" tool_choice: \"Multiply\",\n",
"})\n",
"const result = await llmForcedToMultiply.invoke(\"what is 2 + 4\");\n",
"console.log(JSON.stringify(result.tool_calls, null, 2));"
"const multiplyResult = await llmForcedToMultiply.invoke(\"what is 2 + 4\");\n",
"console.log(JSON.stringify(multiplyResult.tool_calls, null, 2));"
]
},
{
Expand All @@ -118,7 +118,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 `\"any\"` (or for OpenAI models, the equivalent, `\"required\"`) to the `tool_choice` parameter."
]
},
{
Expand Down Expand Up @@ -148,29 +148,8 @@
"const llmForcedToUseTool = llm.bindTools(tools, {\n",
" tool_choice: \"any\",\n",
"})\n",
"const result = await llmForcedToUseTool.invoke(\"What day is today?\");\n",
"console.log(JSON.stringify(result.tool_calls, null, 2));"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"```{=mdx}\n",
"\n",
":::note\n",
"\n",
"Currently, the following packages have a minimum version for this style of forced tool calls:\n",
"\n",
"| Package Name | Min Package Version | Min Core Version |\n",
"|---------------------|---------------------|------------------|\n",
"| `@langchain/aws` | `0.0.3` | `0.2.17` |\n",
"| `@langchain/openai` | `0.2.4` | `0.2.17` |\n",
"| `@langchain/groq` | `0.0.14` | `0.2.17` |\n",
"\n",
":::\n",
"\n",
"```"
"const anyToolResult = await llmForcedToUseTool.invoke(\"What day is today?\");\n",
"console.log(JSON.stringify(anyToolResult.tool_calls, null, 2));"
]
}
],
Expand Down
Loading