Table of Contents

Class EmbedContentConfig

Namespace
Google.GenAI.Types
Assembly
Google.GenAI.dll

Optional parameters for the embed_content method.

public record EmbedContentConfig : IEquatable<EmbedContentConfig>
Inheritance
EmbedContentConfig
Implements
Inherited Members

Properties

AudioTrackExtraction

Gemini Enterprise Agent Platform only. Whether to extract audio from video content. Only applicable to Gemini Embedding 2 models.

[JsonPropertyName("audioTrackExtraction")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public bool? AudioTrackExtraction { get; set; }

Property Value

bool?

AutoTruncate

Gemini Enterprise Agent Platform only. Whether to silently truncate inputs longer than the max sequence length. If this option is set to false, oversized inputs will lead to an INVALID_ARGUMENT error, similar to other text APIs.

[JsonPropertyName("autoTruncate")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public bool? AutoTruncate { get; set; }

Property Value

bool?

DocumentOcr

Gemini Enterprise Agent Platform only. Whether to enable OCR for document content. Only applicable to Gemini Embedding 2 models.

[JsonPropertyName("documentOcr")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public bool? DocumentOcr { get; set; }

Property Value

bool?

HttpOptions

Used to override HTTP request options.

[JsonPropertyName("httpOptions")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public HttpOptions? HttpOptions { get; set; }

Property Value

HttpOptions

MimeType

Gemini Enterprise Agent Platform only. The MIME type of the input.

[JsonPropertyName("mimeType")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? MimeType { get; set; }

Property Value

string

OutputDimensionality

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. You cannot set this value if using the earlier model (models/embedding-001).

[JsonPropertyName("outputDimensionality")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public int? OutputDimensionality { get; set; }

Property Value

int?

TaskType

Type of task for which the embedding will be used.

[JsonPropertyName("taskType")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? TaskType { get; set; }

Property Value

string

Title

Title for the text. Only applicable when TaskType is RETRIEVAL_DOCUMENT.

[JsonPropertyName("title")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? Title { get; set; }

Property Value

string

Methods

FromJson(string, JsonSerializerOptions?)

Deserializes a JSON string to a EmbedContentConfig object.

public static EmbedContentConfig? FromJson(string jsonString, JsonSerializerOptions? options = null)

Parameters

jsonString string

The JSON string to deserialize.

options JsonSerializerOptions

Optional JsonSerializerOptions.

Returns

EmbedContentConfig

The deserialized EmbedContentConfig object, or null if deserialization fails.