Bluestep JS Documentation
    Preparing search index...

    Class AiTranscript

    The exact message list a B.ai call sent to the model, tool calls and results included. Returned as AiCallResult.transcript, accepted back as AiClientOptions.transcript (or AiAgent.setTranscript) to continue that conversation losslessly, and carried between executions as the string toJson() returns. Opaque: read it through entries(); build one only from a previous call or from B.ai.transcript(json).

    const result = B.ai.call({ message: B.net.request.parameter("q"), tools: [lookup] });

    B.out = result.transcript.entries() .map(entry => entry.role + ": " + entry.text).join("\n");

    // Carry it to a later execution, then continue exactly where it stopped. const json = result.transcript.toJson(); B.ai.call({ transcript: B.ai.transcript(json), message: "And the dose?" });

      
    @category
    Index
    length: number

    How many messages the transcript holds. Zero before any call, and for realtime audio turns, which keep no message list.

    • A shorter transcript with the same shape: the first turn, the last keepLastTurns turns, and a model's summary of everything between them.

      This makes a metered model call. Compacting means asking a model to summarize the middle, so it costs tokens and goes through the usage gate like any other call. A summary that cannot be produced — the budget is gone, the provider is down — leaves the transcript untouched rather than returning something no shorter.

      Cuts only at turn boundaries, so an assistant's tool calls and the results answering them always travel together — a transcript with one half of that pair is rejected by the provider outright.

      const shorter = agent.getTranscript().compact({keepLastTurns: 3});
      agent.setTranscript(shorter);

      The original is unchanged. A transcript with nothing between its kept turns is returned as-is, without spending a call, so calling this unconditionally is safe.

      Parameters

      • Optionaloptions: AiCompactOptions

        How much to keep, and which model to summarize with. Omit for the defaults.

      Returns AiTranscript

    • A read-only view of the messages, oldest first. Each entry carries role and text; an assistant entry that requested tools also carries toolCalls, and a tool entry carries toolResult. Mutating the returned array does not affect the transcript.

      Returns readonly AiTranscriptEntry[]

    • The transcript as a string that AiClientOptions.transcript, AiAgent.setTranscript and B.ai.transcript accept back. Store this to continue the conversation in a later execution; the format is versioned, and a string that does not decode is refused with a message naming the entry at fault.

      Returns string