类 GeminiChatModel.Builder
java.lang.Object
io.agentscope.core.model.GeminiChatModel.Builder
- 封闭类:
GeminiChatModel
Builder for creating GeminiChatModel instances.
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明Sets the API key (for Gemini API).Sets the custom base URL (for Gemini API).build()Builds the GeminiChatModel instance.clientOptions(com.google.genai.types.ClientOptions clientOptions) Sets the client options.credentials(com.google.auth.oauth2.GoogleCredentials credentials) Sets the Google credentials (for Vertex AI).defaultOptions(GenerateOptions defaultOptions) Sets the default generation options.formatter(Formatter<com.google.genai.types.Content, com.google.genai.types.GenerateContentResponse, com.google.genai.types.GenerateContentConfig.Builder> formatter) Sets the formatter.httpOptions(com.google.genai.types.HttpOptions httpOptions) Sets the HTTP options for the client.Sets the Google Cloud location (for Vertex AI).Sets the model name.Sets the Google Cloud project ID (for Vertex AI).streamEnabled(boolean streamEnabled) Sets whether streaming is enabled.vertexAI(boolean vertexAI) Sets whether to use Vertex AI APIs.
-
构造器详细资料
-
Builder
public Builder()
-
-
方法详细资料
-
apiKey
Sets the API key (for Gemini API).- 参数:
apiKey- the Gemini API key- 返回:
- this builder
-
baseUrl
Sets the custom base URL (for Gemini API).- 参数:
baseUrl- the custom Gemini API base URL- 返回:
- this builder
-
modelName
Sets the model name.- 参数:
modelName- the model name (default: "gemini-2.5-flash")- 返回:
- this builder
-
streamEnabled
Sets whether streaming is enabled.- 参数:
streamEnabled- true to enable streaming (default: false)- 返回:
- this builder
-
project
Sets the Google Cloud project ID (for Vertex AI).- 参数:
project- the project ID- 返回:
- this builder
-
location
Sets the Google Cloud location (for Vertex AI).- 参数:
location- the location (e.g., "us-central1")- 返回:
- this builder
-
vertexAI
Sets whether to use Vertex AI APIs.- 参数:
vertexAI- true to use Vertex AI, false for Gemini API- 返回:
- this builder
-
httpOptions
Sets the HTTP options for the client.- 参数:
httpOptions- the HTTP options- 返回:
- this builder
-
credentials
Sets the Google credentials (for Vertex AI).- 参数:
credentials- the Google credentials- 返回:
- this builder
-
clientOptions
Sets the client options.- 参数:
clientOptions- the client options- 返回:
- this builder
-
defaultOptions
Sets the default generation options.- 参数:
defaultOptions- the default options- 返回:
- this builder
-
formatter
public GeminiChatModel.Builder formatter(Formatter<com.google.genai.types.Content, com.google.genai.types.GenerateContentResponse, com.google.genai.types.GenerateContentConfig.Builder> formatter) Sets the formatter.- 参数:
formatter- the formatter to use- 返回:
- this builder
-
build
Builds the GeminiChatModel instance.- 返回:
- a new GeminiChatModel
-