Class representing metadata for a chat segment.

ChatMetadataImpl {ChatMetadata}

Implements

Constructors

Properties

keywords: string[]

The keywords associated with the chat segment

length: number

The length of the chat segment

participants: string[]

The participants in the chat segment

position: number

The position of the speaker in the chat segment

speaker: string

The speaker in the chat segment

timestamp?: string

The timestamp of the chat segment

Constructor: Initializes a new ChatMetadataImpl instance with the given options, validating the participants and length. fromParser: Creates a new ChatMetadataImpl instance from parser results, allowing empty participants. setLength: Creates a new metadata instance with an updated length. addParticipants: Creates a new metadata instance with additional participants. addKeywords: Creates a new metadata instance with additional keywords. merge: Merges this metadata with another metadata instance, creating a new instance with merged data. validateOptions: Validates the options passed to the constructor, throwing errors for invalid participants or length. fromContent: Creates metadata from a chat segment content, extracting the speaker, keywords, and timestamp. extractSpeaker: Extracts the speaker from a chat segment content. extractKeywords: Extracts keywords from a chat segment content. extractTimestamp: Extracts the timestamp from a chat segment content.

Methods

  • Creates a new metadata instance with additional keywords

    Parameters

    • newKeywords: string[]

      {string[]} The new keywords to add

    Returns ChatMetadataImpl

    A new metadata instance with additional keywords

  • Creates a new metadata instance with additional participants

    Parameters

    • newParticipants: string[]

      {string[]} The new participants to add

    Returns ChatMetadataImpl

    A new metadata instance with additional participants

  • Creates a new metadata instance with updated length

    Parameters

    • length: number

      {number} The new length to set

    Returns ChatMetadataImpl

    A new metadata instance with updated length

  • Creates metadata from a chat segment content

    Parameters

    • content: string

      {string} The content to create metadata from

    • position: number

      {number} The position of the segment in the chat

    Returns ChatMetadataImpl

    A new metadata instance created from the content