UGemini 2.0.1
A C# wrapper for the Google Gemini API.
Loading...
Searching...
No Matches
Uralstech.UGemini.Models.Embedding.GeminiEmbedContentRequest Class Reference

Generates an embedding from the model. More...

Inheritance diagram for Uralstech.UGemini.Models.Embedding.GeminiEmbedContentRequest:
Uralstech.UGemini.IGeminiPostRequest Uralstech.UGemini.IGeminiRequest

Public Member Functions

string GetEndpointUri (GeminiRequestMetadata metadata)
 Gets the URI to the API endpoint.
Parameters
metadataThe metadata of the request to be carried out on the URI.
Returns
The URI.

 
 GeminiEmbedContentRequest (GeminiModelId model, bool useBetaApi=false)
 Creates a new GeminiEmbedContentRequest.
 
string GetUtf8EncodedData ()
 Converts the request object to a UTF-8 encoded string.
Returns
The string data.

 

Public Attributes

GeminiContent Content
 The content to embed. Only the GeminiContentPart.Text fields will be counted.
 
GeminiEmbedTaskType TaskType = GeminiEmbedTaskType.Unspecified
 Optional task type for which the embeddings will be used.
 
string Title = null
 An optional title for the text. Only applicable when TaskType is GeminiEmbedTaskType.RetrievalDocument.
 
int OutputDimensionality = -1
 Optional reduced dimension for the output embedding.
 
GeminiModelId Model
 The model to use.
 
string ApiVersion
 The API version to use.
 

Properties

string ContentType [get]
 The MIME type of the request content.
 
- Properties inherited from Uralstech.UGemini.IGeminiPostRequest

Detailed Description

Generates an embedding from the model.

Constructor & Destructor Documentation

◆ GeminiEmbedContentRequest()

Uralstech.UGemini.Models.Embedding.GeminiEmbedContentRequest.GeminiEmbedContentRequest ( GeminiModelId model,
bool useBetaApi = false )

Creates a new GeminiEmbedContentRequest.

Parameters
modelThe model to use.
useBetaApiShould the request use the Beta API?

Member Function Documentation

◆ GetEndpointUri()

string Uralstech.UGemini.Models.Embedding.GeminiEmbedContentRequest.GetEndpointUri ( GeminiRequestMetadata metadata)

Gets the URI to the API endpoint.

Parameters
metadataThe metadata of the request to be carried out on the URI.
Returns
The URI.

Implements Uralstech.UGemini.IGeminiRequest.

◆ GetUtf8EncodedData()

string Uralstech.UGemini.Models.Embedding.GeminiEmbedContentRequest.GetUtf8EncodedData ( )

Converts the request object to a UTF-8 encoded string.

Returns
The string data.

Implements Uralstech.UGemini.IGeminiPostRequest.

Member Data Documentation

◆ OutputDimensionality

int Uralstech.UGemini.Models.Embedding.GeminiEmbedContentRequest.OutputDimensionality = -1

Optional reduced dimension for the output embedding.

If set, excessive values in the output embedding are truncated from the end. Supported by
newer models since 2024, and the earlier model (models/embedding-001) cannot specify this value.

◆ TaskType

GeminiEmbedTaskType Uralstech.UGemini.Models.Embedding.GeminiEmbedContentRequest.TaskType = GeminiEmbedTaskType.Unspecified

Optional task type for which the embeddings will be used.

Can only be set for "models/embedding-001" model.

◆ Title

string Uralstech.UGemini.Models.Embedding.GeminiEmbedContentRequest.Title = null

An optional title for the text. Only applicable when TaskType is GeminiEmbedTaskType.RetrievalDocument.

Specifying a this for GeminiEmbedTaskType.RetrievalDocument provides better quality embeddings for retrieval.

Property Documentation

◆ ContentType

string Uralstech.UGemini.Models.Embedding.GeminiEmbedContentRequest.ContentType
get

The MIME type of the request content.

Implements Uralstech.UGemini.IGeminiPostRequest.


The documentation for this class was generated from the following file: