# Class GenerativeModel (1.48.0)

1.48.0 (latest) 1.47.0 1.45.0 1.43.0 1.42.0 1.40.0 1.38.0 1.36.0 1.35.0 1.34.0 1.33.0 1.32.0 1.30.0 1.28.0 1.27.0 1.24.0 1.23.0 1.22.0 1.20.1 1.19.0 1.18.0 1.17.0 1.16.0 1.15.0 1.14.0 1.13.0 1.12.0 1.11.0 1.9.0 1.8.0 1.7.0 1.6.0 1.5.0 1.4.0 1.3.0 1.2.0 1.1.0 1.0.0 0.8.0 0.6.0 0.5.0 0.4.0 0.3.0 0.2.0 0.1.0

    public final class GenerativeModel

**Deprecated.** *This class and its package are deprecated. See the [migration guide](https://cloud.google.com/vertex-ai/generative-ai/docs/deprecations/genai-vertexai-sdk#java) for more details.*

This class holds a generative model that can complete what you provided. This class is
thread-safe.

Note: The instances of [ChatSession](https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/com.google.cloud.vertexai.generativeai.ChatSession) returned by [GenerativeModel#startChat()](https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/com.google.cloud.vertexai.generativeai.GenerativeModel#com_google_cloud_vertexai_generativeai_GenerativeModel_startChat__) are
NOT thread-safe.

## Inheritance

[java.lang.Object](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \> GenerativeModel

## Inherited Members

[Object.clone()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--) [Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-) [Object.finalize()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--) [Object.getClass()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--) [Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--) [Object.notify()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--) [Object.notifyAll()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--) [Object.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--) [Object.wait()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--) [Object.wait(long)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-) [Object.wait(long,int)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-)

## Constructors

### GenerativeModel(String modelName, VertexAI vertexAi) (deprecated)

    public GenerativeModel(String modelName, VertexAI vertexAi)

Constructs a GenerativeModel instance.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `modelName` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` 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` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/com.google.cloud.vertexai.VertexAI` a [com.google.cloud.vertexai.VertexAI](https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/com.google.cloud.vertexai.VertexAI) that contains the default configs for the generative model |

## Methods

### countTokens(Content content) (deprecated)

    public CountTokensResponse countTokens(Content content)

> [!WARNING]
> **Beta**
>
> This feature is covered by the [Pre-GA Offerings Terms](https://docs.cloud.google.com/terms/service-terms#1) of the Terms of Service. Pre-GA libraries might have limited support, and changes to pre-GA libraries might not be compatible with other pre-GA versions. For more information, see the launch stage descriptions.

Counts tokens in a single content.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `content` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/com.google.cloud.vertexai.api.Content` a [com.google.cloud.vertexai.api.Content](https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/com.google.cloud.vertexai.api.Content) to count tokens |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/com.google.cloud.vertexai.api.CountTokensResponse` | a [com.google.cloud.vertexai.api.CountTokensResponse](https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/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** |
| `https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html` | if an I/O error occurs while making the API call |

### countTokens(String text) (deprecated)

    public CountTokensResponse countTokens(String text)

> [!WARNING]
> **Beta**
>
> This feature is covered by the [Pre-GA Offerings Terms](https://docs.cloud.google.com/terms/service-terms#1) of the Terms of Service. Pre-GA libraries might have limited support, and changes to pre-GA libraries might not be compatible with other pre-GA versions. For more information, see the launch stage descriptions.

Counts tokens in a text message.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `text` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` a text message to count tokens |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/com.google.cloud.vertexai.api.CountTokensResponse` | a [com.google.cloud.vertexai.api.CountTokensResponse](https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/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** |
| `https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html` | if an I/O error occurs while making the API call |

### countTokens(List\<Content\> contents) (deprecated)

    public CountTokensResponse countTokens(List<Content> contents)

> [!WARNING]
> **Beta**
>
> This feature is covered by the [Pre-GA Offerings Terms](https://docs.cloud.google.com/terms/service-terms#1) of the Terms of Service. Pre-GA libraries might have limited support, and changes to pre-GA libraries might not be compatible with other pre-GA versions. For more information, see the launch stage descriptions.

Counts tokens in a list of contents.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `contents` | `https://docs.oracle.com/javase/8/docs/api/java/util/List.html<https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/com.google.cloud.vertexai.api.Content>` a list of [com.google.cloud.vertexai.api.Content](https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/com.google.cloud.vertexai.api.Content) to count tokens |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/com.google.cloud.vertexai.api.CountTokensResponse` | a [com.google.cloud.vertexai.api.CountTokensResponse](https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/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** |
| `https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html` | if an I/O error occurs while making the API call |

### generateContent(Content content) (deprecated)

    public GenerateContentResponse generateContent(Content content)

Generates content from this model given a single content.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `content` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/com.google.cloud.vertexai.api.Content` a [com.google.cloud.vertexai.api.Content](https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/com.google.cloud.vertexai.api.Content) to send to the generative model |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/com.google.cloud.vertexai.api.GenerateContentResponse` | a [com.google.cloud.vertexai.api.GenerateContentResponse](https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/com.google.cloud.vertexai.api.GenerateContentResponse) instance that contains response contents and other metadata |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html` | if an I/O error occurs while making the API call |

### generateContent(String text) (deprecated)

    public GenerateContentResponse generateContent(String text)

Generates content from generative model given a text.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `text` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` a text message to send to the generative model |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/com.google.cloud.vertexai.api.GenerateContentResponse` | a [com.google.cloud.vertexai.api.GenerateContentResponse](https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/com.google.cloud.vertexai.api.GenerateContentResponse) instance that contains response contents and other metadata |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html` | if an I/O error occurs while making the API call |

### generateContent(List\<Content\> contents) (deprecated)

    public GenerateContentResponse generateContent(List<Content> contents)

Generates content from this model given a list of contents.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `contents` | `https://docs.oracle.com/javase/8/docs/api/java/util/List.html<https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/com.google.cloud.vertexai.api.Content>` a list of [com.google.cloud.vertexai.api.Content](https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/com.google.cloud.vertexai.api.Content) to send to the generative model |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/com.google.cloud.vertexai.api.GenerateContentResponse` | a [com.google.cloud.vertexai.api.GenerateContentResponse](https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/com.google.cloud.vertexai.api.GenerateContentResponse) instance that contains response contents and other metadata |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html` | if an I/O error occurs while making the API call |

### generateContentAsync(Content content) (deprecated)

    public ApiFuture<GenerateContentResponse> generateContentAsync(Content content)

Asynchronously generates content from generative model given a single Content.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `content` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/com.google.cloud.vertexai.api.Content` a [com.google.cloud.vertexai.api.Content](https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/com.google.cloud.vertexai.api.Content) to send to the generative model. The role of the content is "user". |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/api-common/latest/com.google.api.core.ApiFuture.html<https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/com.google.cloud.vertexai.api.GenerateContentResponse>` | a [com.google.api.core.ApiFuture](https://docs.cloud.google.com/java/docs/reference/api-common/latest/com.google.api.core.ApiFuture.html) represents the response of an asynchronous generateContent request |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html` | if an I/O error occurs while making the API call |

### generateContentAsync(String text) (deprecated)

    public ApiFuture<GenerateContentResponse> generateContentAsync(String text)

Asynchronously generates content from generative model given a text.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `text` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` a text message to send to the generative model |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/api-common/latest/com.google.api.core.ApiFuture.html<https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/com.google.cloud.vertexai.api.GenerateContentResponse>` | a [com.google.api.core.ApiFuture](https://docs.cloud.google.com/java/docs/reference/api-common/latest/com.google.api.core.ApiFuture.html) represents the response of an asynchronous generateContent request |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html` | if an I/O error occurs while making the API call |

### generateContentAsync(List\<Content\> contents) (deprecated)

    public ApiFuture<GenerateContentResponse> generateContentAsync(List<Content> contents)

Asynchronously generates content from generative model given a list of contents.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `contents` | `https://docs.oracle.com/javase/8/docs/api/java/util/List.html<https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/com.google.cloud.vertexai.api.Content>` a list of [com.google.cloud.vertexai.api.Content](https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/com.google.cloud.vertexai.api.Content) to send to the generative model |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/api-common/latest/com.google.api.core.ApiFuture.html<https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/com.google.cloud.vertexai.api.GenerateContentResponse>` | a [com.google.api.core.ApiFuture](https://docs.cloud.google.com/java/docs/reference/api-common/latest/com.google.api.core.ApiFuture.html) represents the response of an asynchronous generateContent request |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html` | if an I/O error occurs while making the API call |

### generateContentStream(Content content) (deprecated)

    public ResponseStream<GenerateContentResponse> generateContentStream(Content content)

Generates content with streaming support from generative model given a single Content.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `content` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/com.google.cloud.vertexai.api.Content` a [com.google.cloud.vertexai.api.Content](https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/com.google.cloud.vertexai.api.Content) to send to the generative model. The role of the content is "user". |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/com.google.cloud.vertexai.generativeai.ResponseStream<https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/com.google.cloud.vertexai.api.GenerateContentResponse>` | a [ResponseStream](https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/com.google.cloud.vertexai.generativeai.ResponseStream) that contains a streaming of [com.google.cloud.vertexai.api.GenerateContentResponse](https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/com.google.cloud.vertexai.api.GenerateContentResponse) |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html` | if an I/O error occurs while making the API call |

### generateContentStream(String text) (deprecated)

    public ResponseStream<GenerateContentResponse> generateContentStream(String text)

Generates content with streaming support from generative model given a text.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `text` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` a text message to send to the generative model |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/com.google.cloud.vertexai.generativeai.ResponseStream<https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/com.google.cloud.vertexai.api.GenerateContentResponse>` | a [ResponseStream](https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/com.google.cloud.vertexai.generativeai.ResponseStream) that contains a streaming of [com.google.cloud.vertexai.api.GenerateContentResponse](https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/com.google.cloud.vertexai.api.GenerateContentResponse) |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html` | if an I/O error occurs while making the API call |

### generateContentStream(List\<Content\> contents) (deprecated)

    public ResponseStream<GenerateContentResponse> generateContentStream(List<Content> contents)

Generates content with streaming support from generative model given a list of contents.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `contents` | `https://docs.oracle.com/javase/8/docs/api/java/util/List.html<https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/com.google.cloud.vertexai.api.Content>` a list of [com.google.cloud.vertexai.api.Content](https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/com.google.cloud.vertexai.api.Content) to send to the generative model |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/com.google.cloud.vertexai.generativeai.ResponseStream<https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/com.google.cloud.vertexai.api.GenerateContentResponse>` | a [ResponseStream](https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/com.google.cloud.vertexai.generativeai.ResponseStream) that contains a streaming of [com.google.cloud.vertexai.api.GenerateContentResponse](https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/com.google.cloud.vertexai.api.GenerateContentResponse) |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html` | if an I/O error occurs while making the API call |

### getGenerationConfig() (deprecated)

    public GenerationConfig getGenerationConfig()

Returns the [com.google.cloud.vertexai.api.GenerationConfig](https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/com.google.cloud.vertexai.api.GenerationConfig) of this generative model.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/com.google.cloud.vertexai.api.GenerationConfig` |   |

### getModelName() (deprecated)

    public String getModelName()

Returns the model name of this generative model.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |   |

### getSafetySettings() (deprecated)

    public ImmutableList<SafetySetting> getSafetySettings()

Returns a list of [com.google.cloud.vertexai.api.SafetySetting](https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/com.google.cloud.vertexai.api.SafetySetting) of this generative model.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `com.google.common.collect.ImmutableList<https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/com.google.cloud.vertexai.api.SafetySetting>` |   |

### getSystemInstruction() (deprecated)

    public Optional<Content> getSystemInstruction()

Returns the optional system instruction of this generative model.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/util/Optional.html<https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/com.google.cloud.vertexai.api.Content>` |   |

### getToolConfig() (deprecated)

    public Optional<ToolConfig> getToolConfig()

Returns the optional [com.google.cloud.vertexai.api.ToolConfig](https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/com.google.cloud.vertexai.api.ToolConfig) of this generative model.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/util/Optional.html<https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/com.google.cloud.vertexai.api.ToolConfig>` |   |

### getTools() (deprecated)

    public ImmutableList<Tool> getTools()

Returns a list of [com.google.cloud.vertexai.api.Tool](https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/com.google.cloud.vertexai.api.Tool) of this generative model.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `com.google.common.collect.ImmutableList<https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/com.google.cloud.vertexai.api.Tool>` |   |

### startChat() (deprecated)

    public ChatSession startChat()

Returns a new [ChatSession](https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/com.google.cloud.vertexai.generativeai.ChatSession) instance that can be used to start a chat with this model.

Note: the returned [ChatSession](https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/com.google.cloud.vertexai.generativeai.ChatSession) instance is NOT thread-safe.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/com.google.cloud.vertexai.generativeai.ChatSession` |   |

### withGenerationConfig(GenerationConfig generationConfig) (deprecated)

    public GenerativeModel withGenerationConfig(GenerationConfig generationConfig)

Creates a copy of the current model with updated GenerationConfig.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `generationConfig` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/com.google.cloud.vertexai.api.GenerationConfig` a [com.google.cloud.vertexai.api.GenerationConfig](https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/com.google.cloud.vertexai.api.GenerationConfig) that will be used in the new model. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/com.google.cloud.vertexai.generativeai.GenerativeModel` | a new [GenerativeModel](https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/com.google.cloud.vertexai.generativeai.GenerativeModel) instance with the specified GenerationConfig. |

### withSafetySettings(List\<SafetySetting\> safetySettings) (deprecated)

    public GenerativeModel withSafetySettings(List<SafetySetting> safetySettings)

Creates a copy of the current model with updated safetySettings.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `safetySettings` | `https://docs.oracle.com/javase/8/docs/api/java/util/List.html<https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/com.google.cloud.vertexai.api.SafetySetting>` a list of [com.google.cloud.vertexai.api.SafetySetting](https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/com.google.cloud.vertexai.api.SafetySetting) that will be used in the new model. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/com.google.cloud.vertexai.generativeai.GenerativeModel` | a new [GenerativeModel](https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/com.google.cloud.vertexai.generativeai.GenerativeModel) instance with the specified safetySettings. |

### withSystemInstruction(Content systemInstruction) (deprecated)

    public GenerativeModel withSystemInstruction(Content systemInstruction)

Creates a copy of the current model with updated system instructions.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `systemInstruction` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/com.google.cloud.vertexai.api.Content` a [com.google.cloud.vertexai.api.Content](https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/com.google.cloud.vertexai.api.Content) containing system instructions. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/com.google.cloud.vertexai.generativeai.GenerativeModel` | a new [GenerativeModel](https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/com.google.cloud.vertexai.generativeai.GenerativeModel) instance with the specified tools. |

### withToolConfig(ToolConfig toolConfig) (deprecated)

    public GenerativeModel withToolConfig(ToolConfig toolConfig)

Creates a copy of the current model with updated tool config.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `toolConfig` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/com.google.cloud.vertexai.api.ToolConfig` a [com.google.cloud.vertexai.api.ToolConfig](https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/com.google.cloud.vertexai.api.ToolConfig) that will be used in the new model. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/com.google.cloud.vertexai.generativeai.GenerativeModel` | a new [GenerativeModel](https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/com.google.cloud.vertexai.generativeai.GenerativeModel) instance with the specified tool config. |

### withTools(List\<Tool\> tools) (deprecated)

    public GenerativeModel withTools(List<Tool> tools)

Creates a copy of the current model with updated tools.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `tools` | `https://docs.oracle.com/javase/8/docs/api/java/util/List.html<https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/com.google.cloud.vertexai.api.Tool>` a list of [com.google.cloud.vertexai.api.Tool](https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/com.google.cloud.vertexai.api.Tool) that will be used in the new model. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/com.google.cloud.vertexai.generativeai.GenerativeModel` | a new [GenerativeModel](https://docs.cloud.google.com/java/docs/reference/google-cloud-vertexai/latest/com.google.cloud.vertexai.generativeai.GenerativeModel) instance with the specified tools. |