GoogleAIEndpoint
Wisej.AI.Endpoints.GoogleAIEndpoint
Namespace: Wisej.AI.Endpoints
Assembly: Wisej.AI (3.5.0.0)
Represents a connection to Google AI endpoints for generating content and embeddings.
public class GoogleAIEndpoint : SmartHttpEndpoint
This class is used to interact with Google AI services, allowing for content generation and text embeddings. It extends the SmartHttpEndpoint to provide specific functionality for Google AI.
Constructors
GoogleAIEndpoint()

Initializes a new instance of the GoogleAIEndpoint class with default settings.
Properties
Authentication

String: Gets or sets the authentication token for accessing the Google AI endpoint. (Default: null
)
EmbeddingModel

String: Gets or sets the model used for text embeddings. (Default: "text-embedding-004"
)
Model

String: Gets or sets the model used for content generation. (Default: "gemini-1.5-pro-latest"
)
URL

String: Gets or sets the base URL for the Google AI endpoint. (Default: "https://generativelanguage.googleapis.com/v1beta/models"
)
Methods
AddMessages(payload, session, messages)

Adds messages to the payload for processing.
Throws:
ArgumentNullException Thrown when session , payload , or messages is
null
.
AddOptions(message, session)

Adds options to the message for content generation.
This method configures the generation parameters such as temperature and max output tokens. It also incorporates any additional model options from the session.
BuildEmbeddingsPayload(inputs)

Builds the payload for embedding requests.
Returns: Object. The constructed payload object for embedding requests.
Throws:
ArgumentNullException Thrown when inputs is
null
.
GetApiURL()

Constructs the API URL for content generation requests.
Returns: String. The constructed API URL as a string.
GetEmbeddingsURL()

Constructs the API URL for embedding requests.
Returns: String. The constructed embeddings URL as a string.
ReadAssistantMessage(response, message)

Reads the assistant's message from the response.
Throws:
ArgumentNullException Thrown when response or message is
null
.
ReadEmbeddingsResponse(response)

Reads the embeddings response and extracts the embedding vectors.
Returns: Single[][]. An array of float arrays representing the embedding vectors.
Throws:
ArgumentNullException Thrown when response is
null
.
ReadUsage(message, reply)

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