Table of Contents

Class EmbedContentRequest

Namespace
GenerativeAI.Types
Assembly
GenerativeAI.dll

Represents a request containing the content for the model to embed.

public class EmbedContentRequest
Inheritance
EmbedContentRequest
Inherited Members
Extension Methods

Properties

AudioTrackExtraction

Whether to extract and embed the audio track of video input. Vertex AI only, Gemini embedding models.

[JsonIgnore]
public bool? AudioTrackExtraction { get; set; }

Property Value

bool?

Remarks

Not part of the Gemini API request body; the SDK places it where Vertex AI expects it.

AutoTruncate

Whether to truncate input that exceeds the model's maximum length instead of failing. Vertex AI only.

[JsonIgnore]
public bool? AutoTruncate { get; set; }

Property Value

bool?

Remarks

Not part of the Gemini API request body; the SDK places it where Vertex AI expects it.

Content

Gets or sets the content to embed. Only the Parts.Text fields will be counted.

[JsonPropertyName("content")]
public Content? Content { get; set; }

Property Value

Content

DocumentOcr

Whether to run OCR on documents (for example PDFs) before embedding. Vertex AI only, Gemini embedding models.

[JsonIgnore]
public bool? DocumentOcr { get; set; }

Property Value

bool?

Remarks

Not part of the Gemini API request body; the SDK places it where Vertex AI expects it.

MimeType

MIME type of the content. Vertex AI only, text embedding models that use the predict method (for example text-embedding-005).

[JsonIgnore]
public string? MimeType { get; set; }

Property Value

string

Remarks

Not part of the Gemini API request body; the SDK places it where Vertex AI expects it.

Model

Gets or sets the model's resource name. This serves as an ID for the model to use. Format: models/{model}.

[JsonPropertyName("model")]
public string? Model { get; set; }

Property Value

string

OutputDimensionality

Gets or sets an 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 only. Cannot be set when using models/embedding-001.

[JsonPropertyName("outputDimensionality")]
public int? OutputDimensionality { get; set; }

Property Value

int?

TaskType

Gets or sets the optional task type for which the embeddings will be used. Can only be set for models/embedding-001.

[JsonPropertyName("taskType")]
public TaskType? TaskType { get; set; }

Property Value

TaskType?

Title

Gets or sets an optional title for the text when the task type is RETRIEVAL_DOCUMENT. Specifying a title provides better quality embeddings for retrieval.

[JsonPropertyName("title")]
public string? Title { get; set; }

Property Value

string

See Also