Clarify tool use in agent tutorial (#4860)

This commit is contained in:
Eric Zhu 2024-12-30 13:49:51 -08:00 committed by GitHub
parent 156c3f16c2
commit cc06ec531e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -114,6 +114,7 @@
"```{note}\n", "```{note}\n",
"Unlike in v0.2 AgentChat, the tools are executed by the same agent directly within\n", "Unlike in v0.2 AgentChat, the tools are executed by the same agent directly within\n",
"the same call to {py:meth}`~autogen_agentchat.agents.AssistantAgent.on_messages`.\n", "the same call to {py:meth}`~autogen_agentchat.agents.AssistantAgent.on_messages`.\n",
"By default, the agent will return the result of the tool call as the final response.\n",
"```" "```"
] ]
}, },
@ -205,10 +206,16 @@
"Refer to the documentation from [OpenAI](https://platform.openai.com/docs/guides/function-calling) \n", "Refer to the documentation from [OpenAI](https://platform.openai.com/docs/guides/function-calling) \n",
"and [Anthropic](https://docs.anthropic.com/en/docs/build-with-claude/tool-use) for more information about tool calling in LLMs.\n", "and [Anthropic](https://docs.anthropic.com/en/docs/build-with-claude/tool-use) for more information about tool calling in LLMs.\n",
"\n", "\n",
"In AgentChat, the assistant agent can use tools to perform specific actions.\n", "In AgentChat, the {py:class}`~autogen_agentchat.agents.AssistantAgent` can use tools to perform specific actions.\n",
"The `web_search` tool is one such tool that allows the assistant agent to search the web for information.\n", "The `web_search` tool is one such tool that allows the assistant agent to search the web for information.\n",
"A custom tool can be a Python function or a subclass of the {py:class}`~autogen_core.tools.BaseTool`.\n", "A custom tool can be a Python function or a subclass of the {py:class}`~autogen_core.tools.BaseTool`.\n",
"\n", "\n",
"By default, when {py:class}`~autogen_agentchat.agents.AssistantAgent` executes a tool,\n",
"it will return the tool's output as a string in {py:class}`~autogen_agentchat.messages.ToolCallSummaryMessage` in its response.\n",
"If your tool does not return a well-formed string in natural language, you\n",
"can add a reflection step to have the model summarize the tool's output,\n",
"by setting the `reflect_on_tool_use=True` parameter in the {py:class}`~autogen_agentchat.agents.AssistantAgent` constructor.\n",
"\n",
"### Langchain Tools\n", "### Langchain Tools\n",
"\n", "\n",
"In addition to custom tools, you can also use tools from the Langchain library\n", "In addition to custom tools, you can also use tools from the Langchain library\n",
@ -412,7 +419,7 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.11.5" "version": "3.12.7"
} }
}, },
"nbformat": 4, "nbformat": 4,