hugbot
Version:
Chatbot maker for HuggingFace Inference API and other AI API providers and backends.
38 lines • 1.39 kB
TypeScript
/**
* Conversation memory buffer with token counter for managing limited context window lengths.
* @method {push} - Adds entries to memory buffer.
* @method {dump} - Retrieves current memory state including system prompt and response instructions.
* @property {contextWindow} - Buffer length can be adjusted with contextWindow property.
* @property {systemPrompt} {responseAffirmation} {userInstruction} - Stores current system prompt and other AI prompt template elements.
* @property {tokenizer} - Tokenizer function used to calculate ammount of tokens across all memory entries.
*/
export declare class ShortTermMemory {
#private;
tokenizer: (text: string) => number;
contextWindow: number;
systemPrompt: string;
responseAffirmation: string;
userInstruction: string;
constructor(params?: Partial<ShortTermMemoryParams>);
push(entry: MemoryEntry): void;
get dump(): MemoryDump;
}
export type ShortTermMemoryParams = {
tokenizer: (text: string) => number;
contextWindow: number;
systemPrompt: string;
responseAffirmation: string;
userInstruction: string;
};
type MemoryEntry = {
role: "user" | "ai";
input: string;
};
type MemoryDump = {
conversation: MemoryEntry[];
systemPrompt: string;
responseAffirmation: string;
userInstruction: string;
};
export {};
//# sourceMappingURL=ShortTermMemory.d.ts.map