# Class GenerativeServiceConnection (2.30.0-rc)

The [`GenerativeServiceConnection`](https://docs.cloud.google.com/cpp/docs/reference/generativelanguage/latest/classgoogle_1_1cloud_1_1generativelanguage__v1_1_1GenerativeServiceConnection) object for [`GenerativeServiceClient`](https://docs.cloud.google.com/cpp/docs/reference/generativelanguage/latest/classgoogle_1_1cloud_1_1generativelanguage__v1_1_1GenerativeServiceClient).
This interface defines virtual methods for each of the user-facing overload sets in [`GenerativeServiceClient`](https://docs.cloud.google.com/cpp/docs/reference/generativelanguage/latest/classgoogle_1_1cloud_1_1generativelanguage__v1_1_1GenerativeServiceClient). This allows users to inject custom behavior (e.g., with a Google Mock object) when writing tests that use objects of type [`GenerativeServiceClient`](https://docs.cloud.google.com/cpp/docs/reference/generativelanguage/latest/classgoogle_1_1cloud_1_1generativelanguage__v1_1_1GenerativeServiceClient).

To create a concrete instance, see [`MakeGenerativeServiceConnection()`](https://docs.cloud.google.com/cpp/docs/reference/generativelanguage/latest/namespacegoogle_1_1cloud_1_1generativelanguage__v1).

For mocking, see [`generativelanguage_v1_mocks::MockGenerativeServiceConnection`](https://docs.cloud.google.com/cpp/docs/reference/generativelanguage/latest/classgoogle_1_1cloud_1_1generativelanguage__v1__mocks_1_1MockGenerativeServiceConnection).

## Functions

### virtual options()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Options` |   |

### virtual GenerateContent(google::ai::generativelanguage::v1::GenerateContentRequest const \&)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `request` | `google::ai::generativelanguage::v1::GenerateContentRequest const &` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `StatusOr< google::ai::generativelanguage::v1::GenerateContentResponse >` |   |

### virtual StreamGenerateContent(google::ai::generativelanguage::v1::GenerateContentRequest const \&)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `request` | `google::ai::generativelanguage::v1::GenerateContentRequest const &` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `StreamRange< google::ai::generativelanguage::v1::GenerateContentResponse >` |   |

### virtual EmbedContent(google::ai::generativelanguage::v1::EmbedContentRequest const \&)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `request` | `google::ai::generativelanguage::v1::EmbedContentRequest const &` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `StatusOr< google::ai::generativelanguage::v1::EmbedContentResponse >` |   |

### virtual BatchEmbedContents(google::ai::generativelanguage::v1::BatchEmbedContentsRequest const \&)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `request` | `google::ai::generativelanguage::v1::BatchEmbedContentsRequest const &` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `StatusOr< google::ai::generativelanguage::v1::BatchEmbedContentsResponse >` |   |

### virtual CountTokens(google::ai::generativelanguage::v1::CountTokensRequest const \&)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `request` | `google::ai::generativelanguage::v1::CountTokensRequest const &` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `StatusOr< google::ai::generativelanguage::v1::CountTokensResponse >` |   |