类:ApigeeLlm.Builder

java.lang.Object
com.google.adk.models.ApigeeLlm.Builder
Enclosing class:
ApigeeLlm

public static class ApigeeLlm.Builder extends Object
“Builder for”是一个用于描述某种构建工具或框架的术语。它通常表示该工具/框架用于帮助开发者或系统管理员快速、高效地创建或构建特定类型的应用程序、系统或组件。例如:“Builder for Web Applications”(用于构建Web应用程序的工具)或“Builder for Cloud Services”(用于构建云服务的工具)。 ApigeeLlm.
  • 构造函数详细信息

    • Builder

      protected Builder()
  • 方法详细信息(Method Details)

    • modelName

      @CanIgnoreReturnValue public ApigeeLlm.Builder modelName(String modelName)
      用于设置模型字符串。该模型字符串指定了大型语言模型(LLM)的提供者(例如 Vertex AI、Gemini)、API 版本以及模型 ID。

      **格式:** apigee/[<provider>/][<version>/]<model_id>

      组件:

      • provider (可选): vertex_ai 始终使用 Vertex AI; gemini 总是使用 Gemini API。如果省略了 Gemini API,那么会使用 Vertex AI。 GOOGLE_GENAI_USE_VERTEXAI 是 true 或者 1否则,genai 客户端会从环境中自动选择合适的后端服务。 Gemini.
      • version (可选):API版本(例如:) v1, v1beta如果该参数被省略,则会使用该提供者的默认版本。
      • model_id (必填):模型标识符(例如:) gemini-2.5-flash).

      示例:

      • apigee/gemini-2.5-flash
      • apigee/v1/gemini-2.5-flash
      • apigee/vertex_ai/gemini-2.5-flash
      • apigee/gemini/v1/gemini-2.5-flash
      • apigee/vertex_ai/v1beta/gemini-2.5-flash
      Parameters:
      modelName - the model string.
      Returns:
      this builder.
    • proxyUrl

      @CanIgnoreReturnValue public ApigeeLlm.Builder proxyUrl(String proxyUrl)
      设置 Apigee 代理的 URL。如果未设置,则会从配置文件中读取该 URL。 APIGEE_PROXY_URL 环境变量(environment variable)。
      Parameters:
      proxyUrl - the Apigee proxy URL.
      Returns:
      this builder.
    • customHeaders

      @CanIgnoreReturnValue public ApigeeLlm.Builder customHeaders(Map<String,String> customHeaders)
      设置一个字典,其中包含需要随请求一起发送的头部信息(headers)。 user-agent 或者 x-goog-api-client 该值会进行不区分大小写的匹配;如果匹配成功,该值将被保留下来,并通过 ADK 功能进行扩展(即为其添加缺失的跟踪标签)。
      Parameters:
      customHeaders - the custom headers.
      Returns:
      this builder.
    • apiType

      @CanIgnoreReturnValue public ApigeeLlm.Builder apiType(ApigeeLlm.ApiType apiType)
      设置明确的值(或参数)。 ApigeeLlm.ApiType 用于指定要使用的功能或数据(例如:CHAT_COMPLETIONS 或 GENAI)。
      Parameters:
      apiType - the type of API.
      Returns:
      this builder.
      Throws:
      NullPointerException - if apiType is null.
    • build

      public ApigeeLlm build()
      构建(Builds the) ApigeeLlm `instance.`
      Returns:
      a new ApigeeLlm instance.
      Throws:
      NullPointerException - if modelName is null.
      IllegalArgumentException - if the model string is invalid.