{"version":3,"file":"summary.d.cts","names":["BaseLanguageModelInterface","BaseMessage","BasePromptTemplate","InputValues","MemoryVariables","OutputValues","BaseChatMemory","BaseChatMemoryInput","ConversationSummaryMemoryInput","BaseConversationSummaryMemoryInput","BaseConversationSummaryMemory","Promise","ConversationSummaryMemory"],"sources":["../../src/memory/summary.d.ts"],"sourcesContent":["import type { BaseLanguageModelInterface } from \"@langchain/core/language_models/base\";\nimport { BaseMessage } from \"@langchain/core/messages\";\nimport { BasePromptTemplate } from \"@langchain/core/prompts\";\nimport { InputValues, MemoryVariables, OutputValues } from \"@langchain/core/memory\";\nimport { BaseChatMemory, BaseChatMemoryInput } from \"./chat_memory.js\";\n/**\n * Interface for the input parameters of the ConversationSummaryMemory\n * class.\n */\nexport interface ConversationSummaryMemoryInput extends BaseConversationSummaryMemoryInput {\n}\n/**\n * Interface for the input parameters of the BaseConversationSummaryMemory\n * class.\n */\nexport interface BaseConversationSummaryMemoryInput extends BaseChatMemoryInput {\n    llm: BaseLanguageModelInterface;\n    memoryKey?: string;\n    humanPrefix?: string;\n    aiPrefix?: string;\n    prompt?: BasePromptTemplate;\n    summaryChatMessageClass?: new (content: string) => BaseMessage;\n}\n/**\n * Abstract class that provides a structure for storing and managing the\n * memory of a conversation. It includes methods for predicting a new\n * summary for the conversation given the existing messages and summary.\n */\nexport declare abstract class BaseConversationSummaryMemory extends BaseChatMemory {\n    memoryKey: string;\n    humanPrefix: string;\n    aiPrefix: string;\n    llm: BaseLanguageModelInterface;\n    prompt: BasePromptTemplate;\n    summaryChatMessageClass: new (content: string) => BaseMessage;\n    constructor(fields: BaseConversationSummaryMemoryInput);\n    /**\n     * Predicts a new summary for the conversation given the existing messages\n     * and summary.\n     * @param messages Existing messages in the conversation.\n     * @param existingSummary Current summary of the conversation.\n     * @returns A promise that resolves to a new summary string.\n     */\n    predictNewSummary(messages: BaseMessage[], existingSummary: string): Promise<string>;\n}\n/**\n * Class that provides a concrete implementation of the conversation\n * memory. It includes methods for loading memory variables, saving\n * context, and clearing the memory.\n * @example\n * ```typescript\n * const memory = new ConversationSummaryMemory({\n *   memoryKey: \"chat_history\",\n *   llm: new ChatOpenAI({ model: \"gpt-3.5-turbo\", temperature: 0 }),\n * });\n *\n * const model = new ChatOpenAI({ model: \"gpt-4o-mini\" });\n * const prompt =\n *   PromptTemplate.fromTemplate(`The following is a friendly conversation between a human and an AI. The AI is talkative and provides lots of specific details from its context. If the AI does not know the answer to a question, it truthfully says it does not know.\n *\n * Current conversation:\n * {chat_history}\n * Human: {input}\n * AI:`);\n * const chain = new LLMChain({ llm: model, prompt, memory });\n *\n * const res1 = await chain.call({ input: \"Hi! I'm Jim.\" });\n * console.log({ res1, memory: await memory.loadMemoryVariables({}) });\n *\n * const res2 = await chain.call({ input: \"What's my name?\" });\n * console.log({ res2, memory: await memory.loadMemoryVariables({}) });\n *\n * ```\n */\nexport declare class ConversationSummaryMemory extends BaseConversationSummaryMemory {\n    buffer: string;\n    constructor(fields: ConversationSummaryMemoryInput);\n    get memoryKeys(): string[];\n    /**\n     * Loads the memory variables for the conversation memory.\n     * @returns A promise that resolves to an object containing the memory variables.\n     */\n    loadMemoryVariables(_: InputValues): Promise<MemoryVariables>;\n    /**\n     * Saves the context of the conversation memory.\n     * @param inputValues Input values for the conversation.\n     * @param outputValues Output values from the conversation.\n     * @returns A promise that resolves when the context has been saved.\n     */\n    saveContext(inputValues: InputValues, outputValues: OutputValues): Promise<void>;\n    /**\n     * Clears the conversation memory.\n     * @returns A promise that resolves when the memory has been cleared.\n     */\n    clear(): Promise<void>;\n}\n"],"mappings":";;;;;;;;;;AASA;AAMA;AAAmD,UANlCQ,8BAAAA,SAAuCC,kCAML,CAAA;;;;AAA4B;AAajDC,UAbbD,kCAAAA,SAA2CF,mBAaD,CAAA;EAAA,GAAA,EAZlDP,0BAYkD;EAAA,SAIlDA,CAAAA,EAAAA,MAAAA;EAA0B,WACvBE,CAAAA,EAAAA,MAAAA;EAAkB,QACwBD,CAAAA,EAAAA,MAAAA;EAAW,MACzCQ,CAAAA,EAfXP,kBAeWO;EAAkC,uBAQ1BR,CAAAA,EAAAA,KAAAA,OAAAA,EAAAA,MAAAA,EAAAA,GAtBuBA,WAsBvBA;;;AAfkD;AA8ClF;;;AAQ2BE,uBAtDGO,6BAAAA,SAAsCJ,cAAAA,CAsDzCH;EAAW,SAAWC,EAAAA,MAAAA;EAAe,WAAvBO,EAAAA,MAAAA;EAAO,QAOnBR,EAAAA,MAAAA;EAAW,GAAgBE,EAzD/CL,0BAyD+CK;EAAY,MAAGM,EAxD3DT,kBAwD2DS;EAAO,uBAKjEA,EAAAA,KAAAA,OAAAA,EAAAA,MAAAA,EAAAA,GA5DyCV,WA4DzCU;EAAO,WApBmCD,CAAAA,MAAAA,EAvC/BD,kCAuC+BC;EAA6B;;;;;;;8BA/BpDT,yCAAyCU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA+BpDC,yBAAAA,SAAkCF,6BAAAA;;sBAE/BF;;;;;;yBAMGL,cAAcQ,QAAQP;;;;;;;2BAOpBD,2BAA2BE,eAAeM;;;;;WAK1DA"}