GoogleAIEndpoint
Wisej.AI.Endpoints.GoogleAIEndpoint
Last updated
Wisej.AI.Endpoints.GoogleAIEndpoint
Last updated
Namespace: Wisej.AI.Endpoints
Assembly: Wisej.AI (3.5.0.0)
Represents a connection to Google AI endpoints for generating content and embeddings.
This class is used to interact with Google AI services, allowing for content generation and text embeddings. It extends the to provide specific functionality for Google AI.
Initializes a new instance of the class with default settings.
: Gets or sets the authentication token for accessing the Google AI endpoint. (Default: null
)
Adds messages to the payload for processing.
payload
The payload to which messages are added.
session
The current session.
messages
The list of messages to be processed.
Throws:
Adds options to the message for content generation.
message
The message to which options are added.
session
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.
Builds the payload for embedding requests.
inputs
The array of input strings to be embedded.
Throws:
Constructs the API URL for content generation requests.
Constructs the API URL for embedding requests.
Reads the assistant's message from the response.
response
The response containing the assistant's message.
message
The message object to populate with the assistant's response.
Throws:
Reads the embeddings response and extracts the embedding vectors.
response
The response containing the embeddings data.
Throws:
Reads the usage data from the reply and updates the message usage.
message
The message to update with usage data.
reply
The reply containing usage metadata.
: Gets or sets the model used for text embeddings. (Default: "text-embedding-004"
)
: Gets or sets the model used for content generation. (Default: "gemini-1.5-pro-latest"
)
: Gets or sets the base URL for the Google AI endpoint. (Default: "https://generativelanguage.googleapis.com/v1beta/models"
)
Thrown when session , payload , or messages is null
.
Returns: . The constructed payload object for embedding requests.
Thrown when inputs is null
.
Returns: . The constructed API URL as a string.
Returns: . The constructed embeddings URL as a string.
Thrown when response or message is null
.
Returns: . An array of float arrays representing the embedding vectors.
Thrown when response is null
.