Constructors

Accessors

  • get readonly(): boolean
  • Indicates whether the context is read-only

    Returns boolean

Methods

  • Add a new message to the context and return it.

    Parameters

    • params: {
          content: string | ChatContent[];
          createdAt?: number;
          id?: string;
          interrupted?: boolean;
          role: ChatRole;
      }
      • content: string | ChatContent[]
      • Optional createdAt?: number
      • Optional id?: string
      • Optional interrupted?: boolean
      • role: ChatRole

    Returns ChatMessage

  • Parameters

    • options: {
          excludeEmptyMessage?: boolean;
          excludeFunctionCall?: boolean;
          excludeInstructions?: boolean;
          toolCtx?: ToolContext<any>;
      } = {}
      • Optional excludeEmptyMessage?: boolean
      • Optional excludeFunctionCall?: boolean
      • Optional excludeInstructions?: boolean
      • Optional toolCtx?: ToolContext<any>

    Returns ChatContext

  • Parameters

    • itemId: string

    Returns undefined | number

  • Insert a single item or multiple items based on their createdAt field so that the array keeps its chronological order.

    Parameters

    Returns void

  • Parameters

    • options: {
          excludeAudio?: boolean;
          excludeFunctionCall?: boolean;
          excludeImage?: boolean;
          excludeTimestamp?: boolean;
      } = {}
      • Optional excludeAudio?: boolean
      • Optional excludeFunctionCall?: boolean
      • Optional excludeImage?: boolean
      • Optional excludeTimestamp?: boolean

    Returns JSONObject

  • Parameters

    Returns Promise<Record<string, any>[] | [Record<string, any>[], GoogleFormatData]>