public class GenerativeModel
This class holds a generative model that can complete what you provided.
Static Methods
newBuilder()
public static GenerativeModel.Builder newBuilder()
Returns | |
---|---|
Type | Description |
GenerativeModel.Builder |
Constructors
GenerativeModel(String modelName, VertexAI vertexAi)
public GenerativeModel(String modelName, VertexAI vertexAi)
Construct a GenerativeModel instance.
Parameters | |
---|---|
Name | Description |
modelName |
String the name of the generative model. 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 |
vertexAi |
VertexAI |
GenerativeModel(String modelName, VertexAI vertexAi, Transport transport)
public GenerativeModel(String modelName, VertexAI vertexAi, Transport transport)
Construct a GenerativeModel instance.
Parameters | |
---|---|
Name | Description |
modelName |
String the name of the generative model. Supported format: "gemini-pro", "models/gemini-pro", "publishers/google/models/gemini-pro" |
vertexAi |
VertexAI |
transport |
Transport the Transport layer for API calls in the generative model. It overrides the transport setting in com.google.cloud.vertexai.VertexAI |
GenerativeModel(String modelName, GenerationConfig generationConfig, VertexAI vertexAi)
public GenerativeModel(String modelName, GenerationConfig generationConfig, VertexAI vertexAi)
Construct a GenerativeModel instance with default generation config.
Parameters | |
---|---|
Name | Description |
modelName |
String the name of the generative model. Supported format: "gemini-pro", "models/gemini-pro", "publishers/google/models/gemini-pro" |
generationConfig |
GenerationConfig a com.google.cloud.vertexai.api.GenerationConfig instance that will be used by default for generating response |
vertexAi |
VertexAI |
GenerativeModel(String modelName, GenerationConfig generationConfig, VertexAI vertexAi, Transport transport)
public GenerativeModel(String modelName, GenerationConfig generationConfig, VertexAI vertexAi, Transport transport)
Construct a GenerativeModel instance with default generation config.
Parameters | |
---|---|
Name | Description |
modelName |
String the name of the generative model. Supported format: "gemini-pro", "models/gemini-pro", "publishers/google/models/gemini-pro" |
generationConfig |
GenerationConfig a com.google.cloud.vertexai.api.GenerationConfig instance that will be used by default for generating response |
vertexAi |
VertexAI |
transport |
Transport the Transport layer for API calls in the generative model. It overrides the transport setting in com.google.cloud.vertexai.VertexAI |
GenerativeModel(String modelName, GenerationConfig generationConfig, List<SafetySetting> safetySettings, VertexAI vertexAi)
public GenerativeModel(String modelName, GenerationConfig generationConfig, List<SafetySetting> safetySettings, VertexAI vertexAi)
Construct a GenerativeModel instance with default generation config and safety settings.
Parameters | |
---|---|
Name | Description |
modelName |
String the name of the generative model. Supported format: "gemini-pro", "models/gemini-pro", "publishers/google/models/gemini-pro" |
generationConfig |
GenerationConfig a com.google.cloud.vertexai.api.GenerationConfig instance that will be used by default for generating response |
safetySettings |
List<SafetySetting> a list of com.google.cloud.vertexai.api.SafetySetting instances that will be used by default for generating response |
vertexAi |
VertexAI |
GenerativeModel(String modelName, GenerationConfig generationConfig, List<SafetySetting> safetySettings, VertexAI vertexAi, Transport transport)
public GenerativeModel(String modelName, GenerationConfig generationConfig, List<SafetySetting> safetySettings, VertexAI vertexAi, Transport transport)
Construct a GenerativeModel instance with default generation config and safety settings.
Parameters | |
---|---|
Name | Description |
modelName |
String the name of the generative model. Supported format: "gemini-pro", "models/gemini-pro", "publishers/google/models/gemini-pro" |
generationConfig |
GenerationConfig a com.google.cloud.vertexai.api.GenerationConfig instance that will be used by default for generating response |
safetySettings |
List<SafetySetting> a list of com.google.cloud.vertexai.api.SafetySetting instances that will be used by default for generating response |
vertexAi |
VertexAI |
transport |
Transport the Transport layer for API calls in the generative model. It overrides the transport setting in com.google.cloud.vertexai.VertexAI |
GenerativeModel(String modelName, List<SafetySetting> safetySettings, VertexAI vertexAi)
public GenerativeModel(String modelName, List<SafetySetting> safetySettings, VertexAI vertexAi)
Construct a GenerativeModel instance with default safety settings.
Parameters | |
---|---|
Name | Description |
modelName |
String the name of the generative model. Supported format: "gemini-pro", "models/gemini-pro", "publishers/google/models/gemini-pro" |
safetySettings |
List<SafetySetting> a list of com.google.cloud.vertexai.api.SafetySetting instances that will be used by default for generating response |
vertexAi |
VertexAI |
GenerativeModel(String modelName, List<SafetySetting> safetySettings, VertexAI vertexAi, Transport transport)
public GenerativeModel(String modelName, List<SafetySetting> safetySettings, VertexAI vertexAi, Transport transport)
Construct a GenerativeModel instance with default safety settings.
Parameters | |
---|---|
Name | Description |
modelName |
String the name of the generative model. Supported format: "gemini-pro", "models/gemini-pro", "publishers/google/models/gemini-pro" |
safetySettings |
List<SafetySetting> a list of com.google.cloud.vertexai.api.SafetySetting instances that will be used by default for generating response |
vertexAi |
VertexAI |
transport |
Transport the Transport layer for API calls in the generative model. It overrides the transport setting in com.google.cloud.vertexai.VertexAI |
Methods
countTokens(Content content)
public CountTokensResponse countTokens(Content content)
Count tokens in a single content.
Parameter | |
---|---|
Name | Description |
content |
Content a com.google.cloud.vertexai.api.Content to count tokens |
Returns | |
---|---|
Type | Description |
CountTokensResponse |
a com.google.cloud.vertexai.api.CountTokensResponse instance that contains the total tokens and total billable characters of the given list of contents |
Exceptions | |
---|---|
Type | Description |
IOException |
if an I/O error occurs while making the API call |
countTokens(String text)
public CountTokensResponse countTokens(String text)
Count tokens in a text message.
Parameter | |
---|---|
Name | Description |
text |
String a text message to count tokens |
Returns | |
---|---|
Type | Description |
CountTokensResponse |
a com.google.cloud.vertexai.api.CountTokensResponse instance that contains the total tokens and total billable characters of the given list of contents |
Exceptions | |
---|---|
Type | Description |
IOException |
if an I/O error occurs while making the API call |
countTokens(List<Content> contents)
public CountTokensResponse countTokens(List<Content> contents)
Count tokens in a list of contents.
Parameter | |
---|---|
Name | Description |
contents |
List<Content> a list of com.google.cloud.vertexai.api.Content to count tokens |
Returns | |
---|---|
Type | Description |
CountTokensResponse |
a com.google.cloud.vertexai.api.CountTokensResponse instance that contains the total tokens and total billable characters of the given list of contents |
Exceptions | |
---|---|
Type | Description |
IOException |
if an I/O error occurs while making the API call |
generateContent(Content content)
public GenerateContentResponse generateContent(Content content)
Generate content from this model given a single content.
Parameter | |
---|---|
Name | Description |
content |
Content a com.google.cloud.vertexai.api.Content to send to the generative model |
Returns | |
---|---|
Type | Description |
GenerateContentResponse |
a com.google.cloud.vertexai.api.GenerateContentResponse instance that contains response contents and other metadata |
Exceptions | |
---|---|
Type | Description |
IOException |
if an I/O error occurs while making the API call |
generateContent(Content content, GenerationConfig generationConfig)
public GenerateContentResponse generateContent(Content content, GenerationConfig generationConfig)
Generate content from this model given a single content and generation config.
Parameters | |
---|---|
Name | Description |
content |
Content a com.google.cloud.vertexai.api.Content to send to the generative model |
generationConfig |
GenerationConfig a com.google.cloud.vertexai.api.GenerationConfig instance for generating response. #getGenerationConfig will not be used if this is set |
Returns | |
---|---|
Type | Description |
GenerateContentResponse |
a com.google.cloud.vertexai.api.GenerateContentResponse instance that contains response contents and other metadata |
Exceptions | |
---|---|
Type | Description |
IOException |
if an I/O error occurs while making the API call |
generateContent(Content content, GenerationConfig generationConfig, List<SafetySetting> safetySettings)
public GenerateContentResponse generateContent(Content content, GenerationConfig generationConfig, List<SafetySetting> safetySettings)
Generate content from generative model given a single content, generation config, and safety settings.
Parameters | |
---|---|
Name | Description |
content |
Content a com.google.cloud.vertexai.api.Content to send to the generative model |
generationConfig |
GenerationConfig a com.google.cloud.vertexai.api.GenerationConfig instance for generating response. #getGenerationConfig will not be used if this is set |
safetySettings |
List<SafetySetting> a list of com.google.cloud.vertexai.api.SafetySetting for generating response. #getSafetySettings will not be used if this is set |
Returns | |
---|---|
Type | Description |
GenerateContentResponse |
a com.google.cloud.vertexai.api.GenerateContentResponse instance that contains response contents and other metadata |
Exceptions | |
---|---|
Type | Description |
IOException |
if an I/O error occurs while making the API call |
generateContent(Content content, List<SafetySetting> safetySettings)
public GenerateContentResponse generateContent(Content content, List<SafetySetting> safetySettings)
Generate content from this model given a single content and safety settings.
Parameters | |
---|---|
Name | Description |
content |
Content a com.google.cloud.vertexai.api.Content to send to the generative model |
safetySettings |
List<SafetySetting> a list of com.google.cloud.vertexai.api.SafetySetting for generating response. #getSafetySettings will not be used if this is set |
Returns | |
---|---|
Type | Description |
GenerateContentResponse |
a com.google.cloud.vertexai.api.GenerateContentResponse instance that contains response contents and other metadata |
Exceptions | |
---|---|
Type | Description |
IOException |
if an I/O error occurs while making the API call |
generateContent(String text)
public GenerateContentResponse generateContent(String text)
Generate content from generative model given a text.
Parameter | |
---|---|
Name | Description |
text |
String a text message to send to the generative model |
Returns | |
---|---|
Type | Description |
GenerateContentResponse |
a com.google.cloud.vertexai.api.GenerateContentResponse instance that contains response contents and other metadata |
Exceptions | |
---|---|
Type | Description |
IOException |
if an I/O error occurs while making the API call |
generateContent(String text, GenerationConfig generationConfig)
public GenerateContentResponse generateContent(String text, GenerationConfig generationConfig)
Generate content from generative model given a text and generation config.
Parameters | |
---|---|
Name | Description |
text |
String a text message to send to the generative model |
generationConfig |
GenerationConfig a com.google.cloud.vertexai.api.GenerationConfig instance for generating response. #getGenerationConfig will not be used if this is set |
Returns | |
---|---|
Type | Description |
GenerateContentResponse |
a com.google.cloud.vertexai.api.GenerateContentResponse instance that contains response contents and other metadata |
Exceptions | |
---|---|
Type | Description |
IOException |
if an I/O error occurs while making the API call |
generateContent(String text, GenerationConfig generationConfig, List<SafetySetting> safetySettings)
public GenerateContentResponse generateContent(String text, GenerationConfig generationConfig, List<SafetySetting> safetySettings)
Generate content from generative model given a text, generation config, and safety settings.
Parameters | |
---|---|
Name | Description |
text |
String a text message to send to the generative model |
generationConfig |
GenerationConfig a com.google.cloud.vertexai.api.GenerationConfig instance for generating response. #getGenerationConfig will not be used if this is set |
safetySettings |
List<SafetySetting> a list of com.google.cloud.vertexai.api.SafetySetting for generating response. #getSafetySettings will not be used if this is set |
Returns | |
---|---|
Type | Description |
GenerateContentResponse |
a com.google.cloud.vertexai.api.GenerateContentResponse instance that contains response contents and other metadata |
Exceptions | |
---|---|
Type | Description |
IOException |
if an I/O error occurs while making the API call |
generateContent(String text, List<SafetySetting> safetySettings)
public GenerateContentResponse generateContent(String text, List<SafetySetting> safetySettings)
Generate content from generative model given a text and safety settings.
Parameters | |
---|---|
Name | Description |
text |
String a text message to send to the generative model |
safetySettings |
List<SafetySetting> a list of com.google.cloud.vertexai.api.SafetySetting for generating response. #getSafetySettings will not be used if this is set |
Returns | |
---|---|
Type | Description |
GenerateContentResponse |
a com.google.cloud.vertexai.api.GenerateContentResponse instance that contains response contents and other metadata |
Exceptions | |
---|---|
Type | Description |
IOException |
if an I/O error occurs while making the API call |
generateContent(List<Content> contents)
public GenerateContentResponse generateContent(List<Content> contents)
Generate content from this model given a list of contents.
Parameter | |
---|---|
Name | Description |
contents |
List<Content> a list of com.google.cloud.vertexai.api.Content to send to the generative model |
Returns | |
---|---|
Type | Description |
GenerateContentResponse |
a com.google.cloud.vertexai.api.GenerateContentResponse instance that contains response contents and other metadata |
Exceptions | |
---|---|
Type | Description |
IOException |
if an I/O error occurs while making the API call |
generateContent(List<Content> contents, GenerationConfig generationConfig)
public GenerateContentResponse generateContent(List<Content> contents, GenerationConfig generationConfig)
Generate content from this model given a list of contents and generation config.
Parameters | |
---|---|
Name | Description |
contents |
List<Content> a list of com.google.cloud.vertexai.api.Content to send to the generative model |
generationConfig |
GenerationConfig a com.google.cloud.vertexai.api.GenerationConfig instance for generating response. #getGenerationConfig will not be used if this is set |
Returns | |
---|---|
Type | Description |
GenerateContentResponse |
a com.google.cloud.vertexai.api.GenerateContentResponse instance that contains response contents and other metadata |
Exceptions | |
---|---|
Type | Description |
IOException |
if an I/O error occurs while making the API call |
generateContent(List<Content> contents, GenerationConfig generationConfig, List<SafetySetting> safetySettings)
public GenerateContentResponse generateContent(List<Content> contents, GenerationConfig generationConfig, List<SafetySetting> safetySettings)
Generate content from generative model given a list of contents, generation config, and safety settings.
Parameters | |
---|---|
Name | Description |
contents |
List<Content> a list of com.google.cloud.vertexai.api.Content to send to the generative model |
generationConfig |
GenerationConfig a com.google.cloud.vertexai.api.GenerationConfig instance for generating response. #getGenerationConfig will not be used if this is set |
safetySettings |
List<SafetySetting> a list of com.google.cloud.vertexai.api.SafetySetting for generating response. #getSafetySettings will not be used if this is set |
Returns | |
---|---|
Type | Description |
GenerateContentResponse |
a com.google.cloud.vertexai.api.GenerateContentResponse instance that contains response contents and other metadata |
Exceptions | |
---|---|
Type | Description |
IOException |
if an I/O error occurs while making the API call |
generateContent(List<Content> contents, List<SafetySetting> safetySettings)
public GenerateContentResponse generateContent(List<Content> contents, List<SafetySetting> safetySettings)
Generate content from this model given a list of contents and safety settings.
Parameters | |
---|---|
Name | Description |
contents |
List<Content> a list of com.google.cloud.vertexai.api.Content to send to the generative model |
safetySettings |
List<SafetySetting> a list of com.google.cloud.vertexai.api.SafetySetting for generating response. #getSafetySettings will not be used if this is set |
Returns | |
---|---|
Type | Description |
GenerateContentResponse |
a com.google.cloud.vertexai.api.GenerateContentResponse instance that contains response contents and other metadata |
Exceptions | |
---|---|
Type | Description |
IOException |
if an I/O error occurs while making the API call |
generateContentStream(Content content)
public ResponseStream<GenerateContentResponse> generateContentStream(Content content)
Generate content with streaming support from generative model given a single Content.
Parameter | |
---|---|
Name | Description |
content |
Content a com.google.cloud.vertexai.api.Content to send to the generative model. The role of the content is "user". |
Returns | |
---|---|
Type | Description |
ResponseStream<GenerateContentResponse> |
a ResponseStream that contains a streaming of com.google.cloud.vertexai.api.GenerateContentResponse |
Exceptions | |
---|---|
Type | Description |
IOException |
if an I/O error occurs while making the API call |
generateContentStream(Content content, GenerationConfig generationConfig)
public ResponseStream<GenerateContentResponse> generateContentStream(Content content, GenerationConfig generationConfig)
Generate content with streaming support from generative model given a single Content and generation config.
Parameters | |
---|---|
Name | Description |
content |
Content a com.google.cloud.vertexai.api.Content to send to the generative model |
generationConfig |
GenerationConfig a com.google.cloud.vertexai.api.GenerationConfig instance for generating response. #getGenerationConfig will not be used if this is set |
Returns | |
---|---|
Type | Description |
ResponseStream<GenerateContentResponse> |
a ResponseStream that contains a streaming of com.google.cloud.vertexai.api.GenerateContentResponse |
Exceptions | |
---|---|
Type | Description |
IOException |
if an I/O error occurs while making the API call |
generateContentStream(Content content, GenerationConfig generationConfig, List<SafetySetting> safetySettings)
public ResponseStream<GenerateContentResponse> generateContentStream(Content content, GenerationConfig generationConfig, List<SafetySetting> safetySettings)
Generate content with streaming support from generative model given a single content, generation config, and safety settings.
Parameters | |
---|---|
Name | Description |
content |
Content a com.google.cloud.vertexai.api.Content to send to the generative model |
generationConfig |
GenerationConfig a com.google.cloud.vertexai.api.GenerationConfig instance for generating response. #getGenerationConfig will not be used if this is set |
safetySettings |
List<SafetySetting> a list of com.google.cloud.vertexai.api.SafetySetting for generating response. #getSafetySettings will not be used if this is set |
Returns | |
---|---|
Type | Description |
ResponseStream<GenerateContentResponse> |
a ResponseStream that contains a streaming of com.google.cloud.vertexai.api.GenerateContentResponse |
Exceptions | |
---|---|
Type | Description |
IOException |
if an I/O error occurs while making the API call |
generateContentStream(Content content, List<SafetySetting> safetySettings)
public ResponseStream<GenerateContentResponse> generateContentStream(Content content, List<SafetySetting> safetySettings)
Generate content with streaming support from generative model given a single content and safety settings.
Parameters | |
---|---|
Name | Description |
content |
Content a com.google.cloud.vertexai.api.Content to send to the generative model |
safetySettings |
List<SafetySetting> a list of com.google.cloud.vertexai.api.SafetySetting for generating response. #getSafetySettings will not be used if this is set |
Returns | |
---|---|
Type | Description |
ResponseStream<GenerateContentResponse> |
a ResponseStream that contains a streaming of com.google.cloud.vertexai.api.GenerateContentResponse |
Exceptions | |
---|---|
Type | Description |
IOException |
if an I/O error occurs while making the API call |
generateContentStream(String text)
public ResponseStream<GenerateContentResponse> generateContentStream(String text)
Generate content with streaming support from generative model given a text.
Parameter | |
---|---|
Name | Description |
text |
String a text message to send to the generative model |
Returns | |
---|---|
Type | Description |
ResponseStream<GenerateContentResponse> |
a ResponseStream that contains a streaming of com.google.cloud.vertexai.api.GenerateContentResponse |
Exceptions | |
---|---|
Type | Description |
IOException |
if an I/O error occurs while making the API call |
generateContentStream(String text, GenerationConfig generationConfig)
public ResponseStream<GenerateContentResponse> generateContentStream(String text, GenerationConfig generationConfig)
Generate content with streaming support from generative model given a text and generation config.
Parameters | |
---|---|
Name | Description |
text |
String a text message to send to the generative model |
generationConfig |
GenerationConfig a com.google.cloud.vertexai.api.GenerationConfig instance for generating response. #getGenerationConfig will not be used if this is set |
Returns | |
---|---|
Type | Description |
ResponseStream<GenerateContentResponse> |
a ResponseStream that contains a streaming of com.google.cloud.vertexai.api.GenerateContentResponse |
Exceptions | |
---|---|
Type | Description |
IOException |
if an I/O error occurs while making the API call |
generateContentStream(String text, GenerationConfig generationConfig, List<SafetySetting> safetySettings)
public ResponseStream<GenerateContentResponse> generateContentStream(String text, GenerationConfig generationConfig, List<SafetySetting> safetySettings)
Generate content with streaming support from generative model given a text, generation config, and safety settings.
Parameters | |
---|---|
Name | Description |
text |
String a text message to send to the generative model |
generationConfig |
GenerationConfig a com.google.cloud.vertexai.api.GenerationConfig instance for generating response. #getGenerationConfig will not be used if this is set |
safetySettings |
List<SafetySetting> a list of com.google.cloud.vertexai.api.SafetySetting for generating response. #getSafetySettings will not be used if this is set |
Returns | |
---|---|
Type | Description |
ResponseStream<GenerateContentResponse> |
a ResponseStream that contains a streaming of com.google.cloud.vertexai.api.GenerateContentResponse |
Exceptions | |
---|---|
Type | Description |
IOException |
if an I/O error occurs while making the API call |
generateContentStream(String text, List<SafetySetting> safetySettings)
public ResponseStream<GenerateContentResponse> generateContentStream(String text, List<SafetySetting> safetySettings)
Generate content with streaming support from generative model given a text and safety settings.
Parameters | |
---|---|
Name | Description |
text |
String a text message to send to the generative model |
safetySettings |
List<SafetySetting> a list of com.google.cloud.vertexai.api.SafetySetting for generating response. #getSafetySettings will not be used if this is set |
Returns | |
---|---|
Type | Description |
ResponseStream<GenerateContentResponse> |
a ResponseStream that contains a streaming of com.google.cloud.vertexai.api.GenerateContentResponse |
Exceptions | |
---|---|
Type | Description |
IOException |
if an I/O error occurs while making the API call |
generateContentStream(List<Content> contents)
public ResponseStream<GenerateContentResponse> generateContentStream(List<Content> contents)
Generate content with streaming support from generative model given a list of contents.
Parameter | |
---|---|
Name | Description |
contents |
List<Content> a list of com.google.cloud.vertexai.api.Content to send to the generative model |
Returns | |
---|---|
Type | Description |
ResponseStream<GenerateContentResponse> |
a ResponseStream that contains a streaming of com.google.cloud.vertexai.api.GenerateContentResponse |
Exceptions | |
---|---|
Type | Description |
IOException |
if an I/O error occurs while making the API call |
generateContentStream(List<Content> contents, GenerationConfig generationConfig)
public ResponseStream<GenerateContentResponse> generateContentStream(List<Content> contents, GenerationConfig generationConfig)
Generate content with streaming support from generative model given a list of contents and generation config.
Parameters | |
---|---|
Name | Description |
contents |
List<Content> a list of com.google.cloud.vertexai.api.Content to send to the generative model |
generationConfig |
GenerationConfig a com.google.cloud.vertexai.api.GenerationConfig instance for generating response. #getGenerationConfig will not be used if this is set |
Returns | |
---|---|
Type | Description |
ResponseStream<GenerateContentResponse> |
a ResponseStream that contains a streaming of com.google.cloud.vertexai.api.GenerateContentResponse |
Exceptions | |
---|---|
Type | Description |
IOException |
if an I/O error occurs while making the API call |
generateContentStream(List<Content> contents, GenerationConfig generationConfig, List<SafetySetting> safetySettings)
public ResponseStream<GenerateContentResponse> generateContentStream(List<Content> contents, GenerationConfig generationConfig, List<SafetySetting> safetySettings)
Generate content with streaming support from generative model given a list of contents, generation config, and safety settings.
Parameters | |
---|---|
Name | Description |
contents |
List<Content> a list of com.google.cloud.vertexai.api.Content to send to the generative model |
generationConfig |
GenerationConfig a com.google.cloud.vertexai.api.GenerationConfig instance for generating response. #getGenerationConfig will not be used if this is set |
safetySettings |
List<SafetySetting> a list of com.google.cloud.vertexai.api.SafetySetting for generating response. #getSafetySettings will not be used if this is set |
Returns | |
---|---|
Type | Description |
ResponseStream<GenerateContentResponse> |
a ResponseStream that contains a streaming of com.google.cloud.vertexai.api.GenerateContentResponse |
Exceptions | |
---|---|
Type | Description |
IOException |
if an I/O error occurs while making the API call |
generateContentStream(List<Content> contents, List<SafetySetting> safetySettings)
public ResponseStream<GenerateContentResponse> generateContentStream(List<Content> contents, List<SafetySetting> safetySettings)
Generate content with streaming support from generative model given a list of contents and safety settings.
Parameters | |
---|---|
Name | Description |
contents |
List<Content> a list of com.google.cloud.vertexai.api.Content to send to the generative model |
safetySettings |
List<SafetySetting> a list of com.google.cloud.vertexai.api.SafetySetting for generating response. #getSafetySettings will not be used if this is set |
Returns | |
---|---|
Type | Description |
ResponseStream<GenerateContentResponse> |
a ResponseStream that contains a streaming of com.google.cloud.vertexai.api.GenerateContentResponse |
Exceptions | |
---|---|
Type | Description |
IOException |
if an I/O error occurs while making the API call |
getGenerationConfig()
public GenerationConfig getGenerationConfig()
Returns the com.google.cloud.vertexai.api.GenerationConfig of this generative model.
Returns | |
---|---|
Type | Description |
GenerationConfig |
getModelName()
public String getModelName()
Returns the model name of this generative model.
Returns | |
---|---|
Type | Description |
String |
getSafetySettings()
public List<SafetySetting> getSafetySettings()
Returns a list of com.google.cloud.vertexai.api.SafetySettings of this generative model.
Returns | |
---|---|
Type | Description |
List<SafetySetting> |
getTools()
public List<Tool> getTools()
Returns a list of com.google.cloud.vertexai.api.Tool of this generative model.
Returns | |
---|---|
Type | Description |
List<Tool> |
getTransport()
public Transport getTransport()
Returns the Transport layer for API calls in this generative model.
Returns | |
---|---|
Type | Description |
Transport |
setGenerationConfig(GenerationConfig generationConfig)
public void setGenerationConfig(GenerationConfig generationConfig)
Sets the value for #getGenerationConfig, which will be used by default for generating response.
Parameter | |
---|---|
Name | Description |
generationConfig |
GenerationConfig |
setSafetySettings(List<SafetySetting> safetySettings)
public void setSafetySettings(List<SafetySetting> safetySettings)
Sets the value for #getSafetySettings, which will be used by default for generating response.
Parameter | |
---|---|
Name | Description |
safetySettings |
List<SafetySetting> |
setTools(List<Tool> tools)
public void setTools(List<Tool> tools)
Sets the value for #getTools, which will be used by default for generating response.
Parameter | |
---|---|
Name | Description |
tools |
List<Tool> |
setTransport(Transport transport)
public void setTransport(Transport transport)
Sets the value for #getTransport, which defines the layer for API calls in this generative model.
Parameter | |
---|---|
Name | Description |
transport |
Transport |
startChat()
public ChatSession startChat()
Returns | |
---|---|
Type | Description |
ChatSession |