import type { ActorContext, ActorData, ActorKnowledge, ActorMemory, ActorPersona, Message } from "../types.js"; import { Conversation } from "./Conversation.js"; /** * The type of an actor. The type is used to categorize the actor. */ export declare enum PersonaType { /** A habit is a routine of behavior that is repeated regularly and tends to * occur subconsciously. */ Habit = "habit", /** A trait is a distinguishing quality or characteristic, typically one * belonging to a person. */ Trait = "trait", /** An interest is something that arouses curiosity or concern. */ Interest = "interest", /** A goal is the object of a person's ambition or effort; an aim or desired * result. */ Goal = "goal", /** A fear is an unpleasant emotion caused by the belief that someone or * something is dangerous, likely to cause pain, or a threat. */ Fear = "fear", /** A desire is a strong feeling of wanting to have something or wishing for * something to happen. */ Desire = "desire", /** A need is a physiological or psychological requirement for the well-being * of an organism. */ Need = "need", /** A value is a person's principles or standards of behavior; one's * judgment of what is important in life. */ Value = "value", /** A belief is an acceptance that a statement is true or that something * exists. */ Belief = "belief", /** An identity is the fact of being who or what a person or thing is. */ Identity = "identity", /** A role is an actor's role in the context of a conversation. */ Role = "role", /** A relationship is the way in which two or more people or organizations * regard and behave toward each other. */ Relationship = "relationship" } /** * The type of knowledge. The type is used to categorize the knowledge. */ export declare enum KnowledgeType { /** A fact is a thing that is known or proved to be true. */ Fact = "fact", /** A skill is the ability to do something well; expertise. */ Skill = "skill", /** An experience is practical contact with and observation of facts or * events. */ Experience = "experience", /** An opinion is a view or judgment formed about something, not necessarily * based on fact or knowledge. */ Opinion = "opinion", /** A belief is an acceptance that a statement is true or that something * exists. */ Belief = "belief" } /** * The type of memory. The type is used to categorize the memory. */ export declare enum MemoryType { /** An event is a thing that happens, especially one of importance. */ Event = "event", /** An experience is practical contact with and observation of facts or * events. */ Experience = "experience", /** A conversation is a talk, especially an informal one, between two or more * people, in which news and ideas are exchanged. */ Conversation = "conversation", /** A relationship is the way in which two or more people or organizations * regard and behave toward each other. */ Relationship = "relationship" } /** * An actor is a person or other entity that performs a role in a conversation. * The actor is used to store information about the person or entity. The * information is used to determine the behavior of the actor. */ export declare class Actor { /** * Render the actor's prompt. The prompt is generated from the actor's * template. The prompt is generated using the actor's context, persona, * knowledge, memory, and messages. * * This method is a static method that can be used to render the prompt of an * actor without creating an instance of the actor. * * @param name The name of the actor. * @param template The template to render with. * @param participants The perticipants in the conversation. * @param context The context of the actor. * @param persona The persona of the actor. * @param knowledge The knowledge of the actor. * @param memory The memory of the actor. * @param messages The messages to render with. */ static render({ name, conversation, actor, template, participants, context, persona, knowledge, memory, messages, }: { name: string; conversation: { id: string; name: string; }; actor: Actor; template: string; participants?: Actor[]; context: ActorData[]; persona: ActorData[]; knowledge: ActorData[]; memory: ActorData[]; messages: Message[]; }): string; /** The unique identifier of the actor. */ readonly id: string; /** The name of the actor. */ readonly name: string; /** The prompt template for the actor. This template is used to generate the * prompt for the actor. */ readonly template: string; /** The context of the actor. The context is used to store information about * the actor. */ readonly context: ActorContext; /** The persona of the actor. The persona is used to store information about * the actor. */ readonly persona: ActorPersona; /** The knowledge of the actor. The knowledge is used to store information * about the actor. */ readonly knowledge: ActorKnowledge; /** The memory of the actor. The memory is used to store information about the * actor. */ readonly memory: ActorMemory; /** * Creates a new actor. The actor is used to store information about the * person or entity. The information is used to determine the behavior of the * actor. * * @param name The name of the actor. * @param template The prompt template for the actor. If not provided, the * default template is used. * @param context The context of the actor. * @param persona The persona of the actor. * @param knowledge The knowledge of the actor. * @param memory The memory of the actor. */ constructor(name: string, { id, template, context, persona, knowledge, memory, }?: { id?: string; template?: string; context?: Record; persona?: Partial>; knowledge?: Partial>; memory?: Partial>; }); /** * Render the actor's prompt. The prompt is generated from the actor's * template. The prompt is generated using the actor's context, persona, * knowledge, memory, and the message history of the conversation. * @param conversation The conversation to render with. * @returns The rendered prompt. */ render(conversation: Conversation): string; /** * Transform the actor into a JSON-seralizable object. */ toJSON(): { id: string; name: string; template: string; context: Record[]>; persona: Record[]>; knowledge: Record[]>; memory: Record[]>; }; }