通过工具扩展 ADK AI agent 的能力
In a nutshell, the AI agent equation is the following:
简而言之,AI agent equation 如下:
AI Agent = LLM + Memory + Planning + Tool Use
AI Agent = LLM + Memory + Planning + Tool Use
AI agents are nothing without tools! And they are actually more than mere Large Language Model calls. They require some memory management to handle the context of the interactions (short term, long term, or contextual information like in the Retrieval Augmented Generation approach. Planning is important (with variations around the Chain-of-Thought prompting approach, and LLM with reasoning or thinking capabilities) for an agent to realize its tasks.
没有工具,AI agents 就一无是处!它们实际上远不止简单的 Large Language Model 调用。它们需要某种记忆管理来处理交互的上下文(短期、长期,或像 Retrieval Augmented Generation approach 中的情境信息)。规划同样重要(围绕 Chain-of-Thought prompting 的变体,以及具备推理或思考能力的 LLM),以便 agent 完成其任务。
But for agents to be useful and to be able to sense or act upon their environment, the need access to tools. Generally speaking, tool use is about leveraging LLM’s function calling ability, to understand when it needs to request some kind of function to be called to proceed further in its next actions or next steps.
但为了让 agents 真正有用,并能够感知或作用于其环境,它们需要访问工具。一般而言,tool use 就是利用 LLM 的 function calling 能力,让它理解何时需要请求调用某个函数,以便在下一步行动或步骤中继续推进。
In my previous articles about ADK, I guided you through the creation of your first AI agent with ADK for Java, and I even shared a Github project template to help you get started faster. But today, I want to explore with you the concept of tools, and what tools are at your disposal when creating AI agents in Java with ADK.
在我之前关于 ADK 的文章中,我带你完成了用 ADK for Java 创建你的第一个 AI agent,甚至还分享了一个Github 项目模板来帮助你更快上手。但今天,我想和你一起探讨 tools 的概念,以及在用 ADK 创建 Java AI agent时,你手头有哪些 tools 可用。
ADK comes with a handful of very useful built-in tools:
ADK 附带了一些非常有用的内置工具:
- a Google Search tool,
- 一个 Google 搜索工具,
- a Python code executor,
- 一个 Python 代码执行器,
- an artifact service to store and load files.
- 一个用于存储和加载文件的 artifact 服务。
LLMs’ knowledge is as recent as the last information of the corpus of traini...