Function toolLearningContextFor

  • A turn's tool context (sessionData.learning) and the turn its recorded writes belong to, from a learner session and what it prepared for the turn. The GMI builds each turn's with it, and a product that runs its own turn loop puts the same on its tool calls. The recorder and the freeze read are bound to the turn and called on the session, each only where the session has it; the turn's conversation goes to the session row, so forgetUser deletes the conversation's thread.

    Parameters

    • session: ILearnerSession

      The learner session the turn was prepared by.

    • turn: {
          learner: "none" | "bound";
          mode: LearningMode;
          scopes?: TurnScopes;
          turnUserId?: string;
          conversationId?: string;
          threadIds?: readonly string[];
      }

      The turn's learner and mode, its scope ids where the session gives them, the explicit id of a second user on a turn with no learner, the turn's conversation id, and the ids its own thread is filed under where its memory names a session of its own (threadIds; the conversation id is then the first of them).

      • learner: "none" | "bound"
      • mode: LearningMode
      • Optional scopes?: TurnScopes
      • Optional turnUserId?: string
      • Optional conversationId?: string
      • Optional threadIds?: readonly string[]

    Returns {
        tools: ToolLearningContext;
        writeTurn: SelfChangeTurn | undefined;
    }

    tools, what each tool call of the turn is told; writeTurn, what the session's recorder and guard are told about the turn, undefined when the turn has no scope ids.