Table of Contents

Class Segment

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

Segment of the content this support belongs to.

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

Properties

EndIndex

Output only. End index in the given Part, measured in bytes. Offset from the start of the Part, exclusive, starting at zero.

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

Property Value

int?

PartIndex

Output only. The index of a Part object within its parent Content object.

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

Property Value

int?

StartIndex

Output only. Start index in the given Part, measured in bytes. Offset from the start of the Part, inclusive, starting at zero.

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

Property Value

int?

Text

Output only. The text corresponding to the segment from the response.

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

Property Value

string

Methods

FromJson(string, JsonSerializerOptions?)

Deserializes a JSON string to a Segment object.

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

Parameters

jsonString string

The JSON string to deserialize.

options JsonSerializerOptions

Optional JsonSerializerOptions.

Returns

Segment

The deserialized Segment object, or null if deserialization fails.