类:ApigeeLlm.Builder
java.lang.Object
com.google.adk.models.ApigeeLlm.Builder
- Enclosing class:
ApigeeLlm
-
构造函数概述
Constructors -
方法概述
Modifier and TypeMethodDescriptionapiType(ApigeeLlm.ApiType apiType) 设置明确的值(或参数)。ApigeeLlm.ApiType用于指定要使用的功能或数据(例如:CHAT_COMPLETIONS 或 GENAI)。build()构建(Builds the)ApigeeLlm`instance.`customHeaders(Map<String, String> customHeaders) 设置一个字典(其中包含请求头信息),该字典将随请求一起被发送。用于设置模型字符串。用于设置 Apigee 代理的 URL。
-
构造函数详细信息
-
Builder
protected Builder()
-
-
方法详细信息(Method Details)
-
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-flashapigee/v1/gemini-2.5-flashapigee/vertex_ai/gemini-2.5-flashapigee/gemini/v1/gemini-2.5-flashapigee/vertex_ai/v1beta/gemini-2.5-flash
- Parameters:
modelName- the model string.- Returns:
- this builder.
-
proxyUrl
设置 Apigee 代理的 URL。如果未设置,则会从配置文件中读取该 URL。APIGEE_PROXY_URL环境变量(environment variable)。- Parameters:
proxyUrl- the Apigee proxy URL.- Returns:
- this builder.
-
customHeaders
设置一个字典,其中包含需要随请求一起发送的头部信息(headers)。user-agent或者x-goog-api-client该值会进行不区分大小写的匹配;如果匹配成功,该值将被保留下来,并通过 ADK 功能进行扩展(即为其添加缺失的跟踪标签)。- Parameters:
customHeaders- the custom headers.- Returns:
- this builder.
-
apiType
设置明确的值(或参数)。ApigeeLlm.ApiType用于指定要使用的功能或数据(例如:CHAT_COMPLETIONS 或 GENAI)。- Parameters:
apiType- the type of API.- Returns:
- this builder.
- Throws:
NullPointerException- ifapiTypeis null.
-
build
构建(Builds the)ApigeeLlm`instance.`- Returns:
- a new
ApigeeLlminstance. - Throws:
NullPointerException- if modelName is null.IllegalArgumentException- if the model string is invalid.
-