Class Gemini.Builder
java.lang.Object
com.google.adk.models.Gemini.Builder
- Enclosing class:
Gemini
-
Method Summary
Modifier and TypeMethodDescriptionapiClient
(com.google.genai.Client apiClient) Sets the explicitClient
instance for making API calls.Sets the Google Gemini API key.build()
Builds theGemini
instance.Sets the name of the Gemini model to use.vertexCredentials
(VertexCredentials vertexCredentials) Sets the Vertex AI credentials.
-
Method Details
-
modelName
Sets the name of the Gemini model to use.- Parameters:
modelName
- The model name (e.g., "gemini-2.0-flash").- Returns:
- This builder.
-
apiClient
Sets the explicitClient
instance for making API calls. If this is set, apiKey and vertexCredentials will be ignored.- Parameters:
apiClient
- The client instance.- Returns:
- This builder.
-
apiKey
Sets the Google Gemini API key. IfapiClient(Client)
is also set, the explicit client will take precedence. IfvertexCredentials(VertexCredentials)
is also set, this apiKey will take precedence.- Parameters:
apiKey
- The API key.- Returns:
- This builder.
-
vertexCredentials
Sets the Vertex AI credentials. IfapiClient(Client)
orapiKey(String)
are also set, they will take precedence over these credentials.- Parameters:
vertexCredentials
- The Vertex AI credentials.- Returns:
- This builder.
-
build
Builds theGemini
instance.- Returns:
- A new
Gemini
instance. - Throws:
NullPointerException
- if modelName is null.
-