FirebaseAILogic Framework Reference

Segment

@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
public struct Segment : Sendable, Equatable, Hashable
extension Segment: Decodable

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

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

    Declaration

    Swift

    public let partIndex: Int
  • The zero-based start index of the segment within the specified Part, measured in UTF-8 bytes. This offset is inclusive, starting from 0 at the beginning of the part’s content.

    Declaration

    Swift

    public let startIndex: Int
  • The zero-based end index of the segment within the specified Part, measured in UTF-8 bytes. This offset is exclusive, meaning the character at this index is not included in the segment.

    Declaration

    Swift

    public let endIndex: Int
  • The text corresponding to the segment from the response.

    Declaration

    Swift

    public let text: String
  • Declaration

    Swift

    public init(from decoder: Decoder) throws