functai for TypeScript - v0.1.0
    Preparing search index...

    Class TurnStream

    A turn, watched while it is made: a stream (its answer's text as it is written, its events, its result) with turn (known once it is recorded, before the model is asked), and approve/deny for tool calls it waits for in this process. When its call ends, the turn's ended (or waiting) record is written before its result is given.

    Implements

    • AsyncIterable<string>
    • PromiseLike<unknown>
    Index
    conversation: Conversation
    passive: boolean

    Read for its result only: its replies are not streamed from the provider.

    prediction: Promise<unknown>

    An AI function's turn: every output, the lmcc turn, the replies (p.callId is the turn's id).

    result: Promise<unknown>

    The answer (the same as calling the program); rejects with its error, Waiting when it waits for a person.

    turn: Promise<Turn>

    The turn, once recorded (before the model is asked).

    • get text(): string

      The answer so far (its text since its latest request).

      Returns string

    • The answer's text, piece by piece.

      Returns AsyncGenerator<string>

    • Say yes to a tool call this turn waits for here (on a stream with no conversation store to wait in).

      Parameters

      • Optionalapproval: number | Approval | null
      • opts: { by?: string | null } = {}

      Returns Promise<void>

    • Parameters

      • Optionalapproval: number | Approval | null
      • Optionalreason: string | null
      • opts: { by?: string | null } = {}

      Returns Promise<void>

    • Attaches callbacks for the resolution and/or rejection of the Promise.

      Type Parameters

      • T1 = unknown
      • T2 = never

      Parameters

      • Optionalok: ((value: unknown) => T1 | PromiseLike<T1>) | null
      • Optionalfail: ((reason: unknown) => T2 | PromiseLike<T2>) | null

      Returns Promise<T1 | T2>

      A Promise for the completion of which ever callback is executed.