Skip to content

Commit

Permalink
docs: Update wording in tool choice guide (#6732)
Browse files Browse the repository at this point in the history
  • Loading branch information
jacoblee93 authored Sep 11, 2024
1 parent 630283b commit 6a723fa
Showing 1 changed file with 5 additions and 26 deletions.
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

0 comments on commit 6a723fa

Please sign in to comment.