Segment

class Segment


Represents a specific segment within a Content object, often used to pinpoint the exact location of text or data that grounding information refers to.

Summary

Public constructors

Segment(startIndex: Int, endIndex: Int, partIndex: Int, text: String)

Public properties

Int

The zero-based end index of the segment within the specified Part, measured in UTF-16 characters.

Int

The zero-based index of the Part object within the parts array of its parent Content object.

Int

The zero-based start index of the segment within the specified Part, measured in UTF-16 characters.

String

The text corresponding to the segment from the response.

Public constructors

Segment

Segment(startIndex: Int, endIndex: Int, partIndex: Int, text: String)

Public properties

endIndex

val endIndex: Int

The zero-based end index of the segment within the specified Part, measured in UTF-16 characters. This offset is exclusive, meaning the character at this index is not included in the segment.

partIndex

val partIndex: Int

The zero-based index of the Part object within the parts array of its parent Content object. This identifies which part of the content the segment belongs to.

startIndex

val startIndex: Int

The zero-based start index of the segment within the specified Part, measured in UTF-16 characters. This offset is inclusive, starting from 0 at the beginning of the part's content.

text

val text: String

The text corresponding to the segment from the response.