Table of Contents

Class RagChunk

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

A RagChunk includes the content of a chunk of a RagFile, and associated metadata. This data type is not supported in Gemini API.

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

Properties

ChunkId

The ID of the chunk.

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

Property Value

string

FileId

The ID of the file that the chunk belongs to.

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

Property Value

string

PageSpan

If populated, represents where the chunk starts and ends in the document.

[JsonPropertyName("pageSpan")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public RagChunkPageSpan? PageSpan { get; set; }

Property Value

RagChunkPageSpan

Text

The content of the chunk.

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

Property Value

string

Methods

FromJson(string, JsonSerializerOptions?)

Deserializes a JSON string to a RagChunk object.

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

Parameters

jsonString string

The JSON string to deserialize.

options JsonSerializerOptions

Optional JsonSerializerOptions.

Returns

RagChunk

The deserialized RagChunk object, or null if deserialization fails.