> For the complete documentation index, see [llms.txt](https://docs.wisej.com/ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.wisej.com/ai/components/api/smartendpoint/wisej.ai.endpoints.googleaiendpoint.md).

# GoogleAIEndpoint

Namespace: **Wisej.AI.Endpoints**

Assembly: **Wisej.AI** (3.5.0.0)

* [SmartEndpoint](/ai/components/api/smartendpoint.md)
  * [SmartHttpEndpoint](/ai/components/api/smartendpoint/wisej.ai.endpoints.smarthttpendpoint.md)
    * [GoogleAIEndpoint](/ai/components/api/smartendpoint/wisej.ai.endpoints.googleaiendpoint.md)

Represents a connection to Google AI endpoints for generating content and embeddings.

{% tabs %}
{% tab title="C#" %}

```csharp
public class GoogleAIEndpoint : SmartHttpEndpoint
```

{% endtab %}

{% tab title="VB.NET" %}

```visual-basic
Public Class GoogleAIEndpoint
    Inherits SmartHttpEndpoint
```

{% endtab %}
{% endtabs %}

This class is used to interact with Google AI services, allowing for content generation and text embeddings. It extends the [SmartHttpEndpoint](/ai/components/api/smartendpoint/wisej.ai.endpoints.smarthttpendpoint.md) to provide specific functionality for Google AI.

## Constructors

### ![](/files/ptrKjmmRoQB76pvrIqh0) GoogleAIEndpoint()

Initializes a new instance of the [GoogleAIEndpoint](/ai/components/api/smartendpoint/wisej.ai.endpoints.googleaiendpoint.md) class with default settings.

## Properties

### ![](/files/ptrKjmmRoQB76pvrIqh0) Authentication

[String](https://docs.microsoft.com/dotnet/api/system.string): Gets or sets the authentication token for accessing the Google AI endpoint. (Default: `null`)

### ![](/files/ptrKjmmRoQB76pvrIqh0) EmbeddingModel

[String](https://docs.microsoft.com/dotnet/api/system.string): Gets or sets the model used for text embeddings. (Default: `"text-embedding-004"`)

### ![](/files/ptrKjmmRoQB76pvrIqh0) Model

[String](https://docs.microsoft.com/dotnet/api/system.string): Gets or sets the model used for content generation. (Default: `"gemini-1.5-pro-latest"`)

### ![](/files/ptrKjmmRoQB76pvrIqh0) URL

[String](https://docs.microsoft.com/dotnet/api/system.string): Gets or sets the base URL for the Google AI endpoint. (Default: `"https://generativelanguage.googleapis.com/v1beta/models"`)

## Methods

### ![](/files/KL0Ik37djZRr8a07Wopd) AddMessages(payload, session, messages)

Adds messages to the payload for processing.

| Parameter    | Type                                                                                        | Description                              |
| ------------ | ------------------------------------------------------------------------------------------- | ---------------------------------------- |
| **payload**  | [Object](https://docs.microsoft.com/dotnet/api/system.object)                               | The payload to which messages are added. |
| **session**  | [SmartSession](/ai/components/api/smartsession.md)                                          | The current session.                     |
| **messages** | [IList\<Message>](https://docs.microsoft.com/dotnet/api/system.collections.generic.ilist-1) | The list of messages to be processed.    |

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception)\
  Thrown when *session* , *payload* , or *messages* is `null`.

### ![](/files/KL0Ik37djZRr8a07Wopd) AddOptions(message, session)

Adds options to the message for content generation.

| Parameter   | Type                                                          | Description                                   |
| ----------- | ------------------------------------------------------------- | --------------------------------------------- |
| **message** | [Object](https://docs.microsoft.com/dotnet/api/system.object) | The message to which options are added.       |
| **session** | [SmartSession](/ai/components/api/smartsession.md)            | The current session containing model options. |

This method configures the generation parameters such as temperature and max output tokens. It also incorporates any additional model options from the session.

### ![](/files/KL0Ik37djZRr8a07Wopd) BuildEmbeddingsPayload(inputs)

Builds the payload for embedding requests.

| Parameter  | Type                                                              | Description                                |
| ---------- | ----------------------------------------------------------------- | ------------------------------------------ |
| **inputs** | [String\[\]](https://docs.microsoft.com/dotnet/api/system.string) | The array of input strings to be embedded. |

**Returns:** [Object](https://docs.microsoft.com/dotnet/api/system.object). The constructed payload object for embedding requests.

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception)\
  Thrown when *inputs* is `null`.

### ![](/files/KL0Ik37djZRr8a07Wopd) GetApiURL()

Constructs the API URL for content generation requests.

**Returns:** [String](https://docs.microsoft.com/dotnet/api/system.string). The constructed API URL as a string.

### ![](/files/KL0Ik37djZRr8a07Wopd) GetEmbeddingsURL()

Constructs the API URL for embedding requests.

**Returns:** [String](https://docs.microsoft.com/dotnet/api/system.string). The constructed embeddings URL as a string.

### ![](/files/KL0Ik37djZRr8a07Wopd) ReadAssistantMessage(response, message)

Reads the assistant's message from the response.

| Parameter    | Type                                                                            | Description                                                   |
| ------------ | ------------------------------------------------------------------------------- | ------------------------------------------------------------- |
| **response** | [Response](/ai/components/api/smartendpoint/wisej.ai.smartendpoint.response.md) | The response containing the assistant's message.              |
| **message**  | [Message](/ai/components/api/smartsession/wisej.ai.smartsession.message.md)     | The message object to populate with the assistant's response. |

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception)\
  Thrown when *response* or *message* is `null`.

### ![](/files/KL0Ik37djZRr8a07Wopd) ReadEmbeddingsResponse(response)

Reads the embeddings response and extracts the embedding vectors.

| Parameter    | Type                                                                            | Description                                  |
| ------------ | ------------------------------------------------------------------------------- | -------------------------------------------- |
| **response** | [Response](/ai/components/api/smartendpoint/wisej.ai.smartendpoint.response.md) | The response containing the embeddings data. |

**Returns:** [Single\[\]\[\]](https://docs.microsoft.com/dotnet/api/system.single). An array of float arrays representing the embedding vectors.

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception)\
  Thrown when *response* is `null`.

### ![](/files/KL0Ik37djZRr8a07Wopd) ReadUsage(message, reply)

Reads the usage data from the reply and updates the message usage.

| Parameter   | Type                                                                        | Description                            |
| ----------- | --------------------------------------------------------------------------- | -------------------------------------- |
| **message** | [Message](/ai/components/api/smartsession/wisej.ai.smartsession.message.md) | The message to update with usage data. |
| **reply**   | [Object](https://docs.microsoft.com/dotnet/api/system.object)               | The reply containing usage metadata.   |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.wisej.com/ai/components/api/smartendpoint/wisej.ai.endpoints.googleaiendpoint.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
