{"version":3,"file":"history_aware_retriever.d.cts","names":["LanguageModelLike","Runnable","RunnableInterface","BasePromptTemplate","DocumentInterface","BaseMessage","CreateHistoryAwareRetrieverParams","createHistoryAwareRetriever","llm","retriever","rephrasePrompt","Promise"],"sources":["../../src/chains/history_aware_retriever.d.ts"],"sourcesContent":["import type { LanguageModelLike } from \"@langchain/core/language_models/base\";\nimport { type Runnable, type RunnableInterface } from \"@langchain/core/runnables\";\nimport { type BasePromptTemplate } from \"@langchain/core/prompts\";\nimport type { DocumentInterface } from \"@langchain/core/documents\";\nimport type { BaseMessage } from \"@langchain/core/messages\";\n/**\n * Params for the createHistoryAwareRetriever method.\n */\nexport type CreateHistoryAwareRetrieverParams = {\n    /**\n     * Language model to use for generating a search term given chat history.\n     */\n    llm: LanguageModelLike;\n    /**\n     * RetrieverLike object that takes a string as input and outputs a list of Documents.\n     */\n    retriever: RunnableInterface<string, DocumentInterface[]>;\n    /**\n     * The prompt used to generate the search query for the retriever.\n     */\n    rephrasePrompt: BasePromptTemplate;\n};\n/**\n * Create a chain that takes conversation history and returns documents.\n * If there is no `chat_history`, then the `input` is just passed directly to the\n * retriever. If there is `chat_history`, then the prompt and LLM will be used\n * to generate a search query. That search query is then passed to the retriever.\n * @param {CreateHistoryAwareRetriever} params\n * @returns An LCEL Runnable. The runnable input must take in `input`, and if there\n * is chat history should take it in the form of `chat_history`.\n * The Runnable output is a list of Documents\n * @example\n * ```typescript\n * // pnpm add langchain @langchain/openai\n *\n * import { ChatOpenAI } from \"@langchain/openai\";\n * import { pull } from \"langchain/hub\";\n * import { createHistoryAwareRetriever } from \"langchain/chains/history_aware_retriever\";\n *\n * const rephrasePrompt = await pull(\"langchain-ai/chat-langchain-rephrase\");\n * const llm = new ChatOpenAI({ model: \"gpt-4o-mini\" });\n * const retriever = ...\n * const chain = await createHistoryAwareRetriever({\n *   llm,\n *   retriever,\n *   rephrasePrompt,\n * });\n * const result = await chain.invoke({\"input\": \"...\", \"chat_history\": [] })\n * ```\n */\nexport declare function createHistoryAwareRetriever({ llm, retriever, rephrasePrompt }: CreateHistoryAwareRetrieverParams): Promise<Runnable<{\n    input: string;\n    chat_history: string | BaseMessage[];\n}, DocumentInterface[]>>;\n"],"mappings":";;;;;;;;;;AAQA;AAA6C,KAAjCM,iCAAAA,GAAiC;EAAA;;;EAQb,GAIZH,EARXH,iBAQWG;EAAkB;AA8BtC;;EAAmD,SAAGK,EAlCvCN,iBAkCuCM,CAAAA,MAAAA,EAlCbJ,iBAkCaI,EAAAA,CAAAA;EAAG;;;EAAgE,cAE9FH,EAhCPF,kBAgCOE;CAAW;;;AAF6F;;;;;;;;;;;;;;;;;;;;;;;;;;iBAA3GE,2BAAAA;;;;GAAgED,oCAAoCK,QAAQV;;yBAEzGI;GACxBD"}