AI Models for ADK agents¶
ADK 智能体的 AI 模型¶
Agent Development Kit (ADK) is designed for flexibility, allowing you to integrate various Large Language Models (LLMs) into your agents. This section details how to leverage Gemini and integrate other popular models effectively, including those hosted externally or running locally.
智能体开发工具包(ADK)设计灵活,允许您将各种大语言模型(LLMs)集成到您的智能体中。本节详细介绍如何利用 Gemini 并有效集成其他流行模型,包括外部托管或本地运行的模型。
ADK primarily uses two mechanisms for model integration:
ADK 主要使用两种机制进行模型集成:
-
Direct String / Registry: For models tightly integrated with Google Cloud, such as Gemini models accessed via Google AI Studio or Vertex AI, or models hosted on Vertex AI endpoints. You access these models by providing a model name or endpoint resource string and ADK's internal registry resolves this string to an appropriate backend client. 直接字符串/注册表: 对于与 Google Cloud 紧密集成的模型,例如通过 Google AI Studio 或 Vertex AI 访问的 Gemini 模型,或在 Vertex AI 端点上托管的模型。您通过提供模型名称或端点资源字符串来访问这些模型,ADK 的内部注册表将该字符串解析为适当的后端客户端。
-
Model connectors: For broader compatibility, especially models outside of Google ecosystem or those requiring specific client configurations, such as models accessed via Apigee or LiteLLM. You instantiate a specific wrapper class, such as
ApigeeLlmorLiteLlm, and pass this object as themodelparameter to yourLlmAgent. 模型连接器: 用于更广泛的兼容性,特别是 Google 生态系统之外的模型或需要特定客户端配置的模型,例如通过 Apigee 或 LiteLLM 访问的模型。您实例化一个特定的包装类,例如ApigeeLlm或LiteLlm,并将此对象作为LlmAgent的model参数传递。