Class GenerativeModel.Builder (0.5.0)

public static class GenerativeModel.Builder

Builder class for GenerativeModel.

Inheritance

java.lang.Object > GenerativeModel.Builder

Methods

build()

public GenerativeModel build()
Returns
Type Description
GenerativeModel

setGenerationConfig(GenerationConfig generationConfig)

public GenerativeModel.Builder setGenerationConfig(GenerationConfig generationConfig)

Set 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)

Set 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 at 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)

Set 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

setTools(List<Tool> tools)

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

Set 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

setTransport(Transport transport)

public GenerativeModel.Builder setTransport(Transport transport)

Set the Transport layer for API calls in the generative model. It overrides the transport setting in com.google.cloud.vertexai.VertexAI

Parameter
Name Description
transport Transport
Returns
Type Description
GenerativeModel.Builder

setVertexAi(VertexAI vertexAi)

public GenerativeModel.Builder setVertexAi(VertexAI vertexAi)

Set 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