docs: add tool use diagrams (#16207)

This commit is contained in:
Bagatur 2024-01-18 07:59:54 -08:00 committed by GitHub
parent 7d444724d7
commit 27ad65cc68
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 430 additions and 4 deletions

View File

@ -13,7 +13,9 @@
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "1925a807-fa01-44bc-8a03-d9907311c7f9", "id": "1925a807-fa01-44bc-8a03-d9907311c7f9",
"metadata": {}, "metadata": {
"jp-MarkdownHeadingCollapsed": true
},
"source": [ "source": [
"## Agents\n", "## Agents\n",
"\n", "\n",
@ -21,7 +23,9 @@
"\n", "\n",
"LangChain comes with a number of built-in agents that are optimized for different use cases. Read about all the [agent types here](/docs/modules/agents/agent_types/).\n", "LangChain comes with a number of built-in agents that are optimized for different use cases. Read about all the [agent types here](/docs/modules/agents/agent_types/).\n",
"\n", "\n",
"As an example, let's try out the OpenAI tools agent, which makes use of the new OpenAI tool-calling API (this is only available in the latest OpenAI models, and differs from function-calling in that the model can return multiple function invocations at once):" "As an example, let's try out the OpenAI tools agent, which makes use of the new OpenAI tool-calling API (this is only available in the latest OpenAI models, and differs from function-calling in that the model can return multiple function invocations at once).\n",
"\n",
"![agent](../../../static/img/tool_agent.svg)"
] ]
}, },
{ {

View File

@ -23,7 +23,15 @@
"- A large collection of built-in [Tools](/docs/integrations/tools).\n", "- A large collection of built-in [Tools](/docs/integrations/tools).\n",
"- Provides a lot of flexibility in how you call these tools.\n", "- Provides a lot of flexibility in how you call these tools.\n",
"\n", "\n",
"There are two main ways to use tools: [chains](/docs/modules/chains) and [agents](/docs/modules/agents/). Chains lets you create a pre-defined sequence of tool usage(s). Agents let the model use tools in a loop, so that it can decide how many times to use tools.\n", "There are two main ways to use tools: [chains](/docs/modules/chains) and [agents](/docs/modules/agents/). \n",
"\n",
"Chains lets you create a pre-defined sequence of tool usage(s). \n",
"\n",
"![chain](../../../static/img/tool_chain.svg)\n",
"\n",
"Agents let the model use tools in a loop, so that it can decide how many times to use tools.\n",
"\n",
"![agent](../../../static/img/tool_agent.svg)\n",
"\n", "\n",
"To get started with both approaches, head to the [Quickstart](/docs/use_cases/tool_use/quickstart) page." "To get started with both approaches, head to the [Quickstart](/docs/use_cases/tool_use/quickstart) page."
] ]

View File

@ -143,6 +143,8 @@
"\n", "\n",
"If we know that we only need to use a tool a fixed number of times, we can create a chain for doing so. Let's create a simple chain that just multiplies user-specified numbers.\n", "If we know that we only need to use a tool a fixed number of times, we can create a chain for doing so. Let's create a simple chain that just multiplies user-specified numbers.\n",
"\n", "\n",
"![chain](../../../static/img/tool_chain.svg)\n",
"\n",
"### Function calling\n", "### Function calling\n",
"One of the most reliable ways to use tools with LLMs is with function calling APIs (also sometimes called tool calling or parallel function calling). This only works with models that explicitly support function calling, like OpenAI models.\n", "One of the most reliable ways to use tools with LLMs is with function calling APIs (also sometimes called tool calling or parallel function calling). This only works with models that explicitly support function calling, like OpenAI models.\n",
"\n", "\n",
@ -332,7 +334,9 @@
"\n", "\n",
"LangChain comes with a number of built-in agents that are optimized for different use cases. Read about all the [agent types here](/docs/modules/agents/agent_types/).\n", "LangChain comes with a number of built-in agents that are optimized for different use cases. Read about all the [agent types here](/docs/modules/agents/agent_types/).\n",
"\n", "\n",
"As an example, let's try out the OpenAI tools agent, which makes use of the new OpenAI tool-calling API (this is only available in the latest OpenAI models, and differs from function-calling in that the model can return multiple function invocations at once):" "As an example, let's try out the OpenAI tools agent, which makes use of the new OpenAI tool-calling API (this is only available in the latest OpenAI models, and differs from function-calling in that the model can return multiple function invocations at once)\n",
"\n",
"![agent](../../../static/img/tool_agent.svg)"
] ]
}, },
{ {

104
docs/static/img/tool_agent.svg vendored Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 100 KiB

306
docs/static/img/tool_chain.svg vendored Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 304 KiB