Class GenerativeModel.Builder (1.15.0)

public static class GenerativeModel.Builder

Builder class for GenerativeModel.

Inheritance

java.lang.Object > GenerativeModel.Builder

Constructors

Builder()

public Builder()

Methods

build()

public GenerativeModel build()
Returns
Type Description
GenerativeModel

setGenerationConfig(GenerationConfig generationConfig)

public GenerativeModel.Builder setGenerationConfig(GenerationConfig generationConfig)

Sets com.google.cloud.vertexai.api.GenerationConfig that will be used by default to interact with the generative model.

Parameter
Name Description
generationConfig GenerationConfig
Returns
Type Description
GenerativeModel.Builder

setModelName(String modelName)

public GenerativeModel.Builder setModelName(String modelName)

Sets the name of the generative model. This is required for building a GenerativeModel instance. Supported format: "gemini-pro", "models/gemini-pro", "publishers/google/models/gemini-pro", where "gemini-pro" is the model name. Valid model names can be found in the Gemini models documentation: https://cloud.google.com/vertex-ai/docs/generative-ai/learn/models#gemini-models

Parameter
Name Description
modelName String
Returns
Type Description
GenerativeModel.Builder

setSafetySettings(List<SafetySetting> safetySettings)

public GenerativeModel.Builder setSafetySettings(List<SafetySetting> safetySettings)

Sets a list of com.google.cloud.vertexai.api.SafetySetting that will be used by default to interact with the generative model.

Parameter
Name Description
safetySettings List<SafetySetting>
Returns
Type Description
GenerativeModel.Builder

setSystemInstruction(Content systemInstruction)

public GenerativeModel.Builder setSystemInstruction(Content systemInstruction)

Sets a system instruction that will be used by default to interact with the generative model.

Parameter
Name Description
systemInstruction Content
Returns
Type Description
GenerativeModel.Builder

setToolConfig(ToolConfig toolConfig)

public GenerativeModel.Builder setToolConfig(ToolConfig toolConfig)

Sets a com.google.cloud.vertexai.api.ToolConfig that will be used by default to interact with the generative model.

Parameter
Name Description
toolConfig ToolConfig
Returns
Type Description
GenerativeModel.Builder

setTools(List<Tool> tools)

public GenerativeModel.Builder setTools(List<Tool> tools)

Sets a list of com.google.cloud.vertexai.api.Tool that will be used by default to interact with the generative model.

Parameter
Name Description
tools List<Tool>
Returns
Type Description
GenerativeModel.Builder

setVertexAi(VertexAI vertexAi)

public GenerativeModel.Builder setVertexAi(VertexAI vertexAi)

Sets com.google.cloud.vertexai.VertexAI that contains the default configs for the generative model. This is required for building a GenerativeModel instance.

Parameter
Name Description
vertexAi VertexAI
Returns
Type Description
GenerativeModel.Builder