From 27ad65cc680203cccf81a8403d6bba6d0a026f34 Mon Sep 17 00:00:00 2001
From: Bagatur <22008038+baskaryan@users.noreply.github.com>
Date: Thu, 18 Jan 2024 07:59:54 -0800
Subject: [PATCH] docs: add tool use diagrams (#16207)
---
docs/docs/use_cases/tool_use/agents.ipynb | 8 +-
docs/docs/use_cases/tool_use/index.ipynb | 10 +-
docs/docs/use_cases/tool_use/quickstart.ipynb | 6 +-
docs/static/img/tool_agent.svg | 104 ++++++
docs/static/img/tool_chain.svg | 306 ++++++++++++++++++
5 files changed, 430 insertions(+), 4 deletions(-)
create mode 100644 docs/static/img/tool_agent.svg
create mode 100644 docs/static/img/tool_chain.svg
diff --git a/docs/docs/use_cases/tool_use/agents.ipynb b/docs/docs/use_cases/tool_use/agents.ipynb
index f542e465a3..77cbef71d6 100644
--- a/docs/docs/use_cases/tool_use/agents.ipynb
+++ b/docs/docs/use_cases/tool_use/agents.ipynb
@@ -13,7 +13,9 @@
{
"cell_type": "markdown",
"id": "1925a807-fa01-44bc-8a03-d9907311c7f9",
- "metadata": {},
+ "metadata": {
+ "jp-MarkdownHeadingCollapsed": true
+ },
"source": [
"## Agents\n",
"\n",
@@ -21,7 +23,9 @@
"\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",
- "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)"
]
},
{
diff --git a/docs/docs/use_cases/tool_use/index.ipynb b/docs/docs/use_cases/tool_use/index.ipynb
index 0ca033e3c1..5f85d631bc 100644
--- a/docs/docs/use_cases/tool_use/index.ipynb
+++ b/docs/docs/use_cases/tool_use/index.ipynb
@@ -23,7 +23,15 @@
"- A large collection of built-in [Tools](/docs/integrations/tools).\n",
"- Provides a lot of flexibility in how you call these tools.\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",
"To get started with both approaches, head to the [Quickstart](/docs/use_cases/tool_use/quickstart) page."
]
diff --git a/docs/docs/use_cases/tool_use/quickstart.ipynb b/docs/docs/use_cases/tool_use/quickstart.ipynb
index 3d31c5231b..921e9f1a2e 100644
--- a/docs/docs/use_cases/tool_use/quickstart.ipynb
+++ b/docs/docs/use_cases/tool_use/quickstart.ipynb
@@ -143,6 +143,8 @@
"\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",
+ "![chain](../../../static/img/tool_chain.svg)\n",
+ "\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",
"\n",
@@ -332,7 +334,9 @@
"\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",
- "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)"
]
},
{
diff --git a/docs/static/img/tool_agent.svg b/docs/static/img/tool_agent.svg
new file mode 100644
index 0000000000..0992054658
--- /dev/null
+++ b/docs/static/img/tool_agent.svg
@@ -0,0 +1,104 @@
+
+
diff --git a/docs/static/img/tool_chain.svg b/docs/static/img/tool_chain.svg
new file mode 100644
index 0000000000..35dc814e80
--- /dev/null
+++ b/docs/static/img/tool_chain.svg
@@ -0,0 +1,306 @@
+
+