• Create a chain that passes a list of documents to a model.

    Parameters

    • llm: LanguageModelLike

      Language model to use for responding.

    • prompt: BasePromptTemplate<any, BasePromptValueInterface, any>

      Prompt template. Must contain input variable "context", which will be used for passing in the formatted documents.

    • outputParser: BaseOutputParser<unknown> = ...

      Output parser. Defaults to StringOutputParser.

    • documentPrompt: BasePromptTemplate<any, BasePromptValueInterface, any> = DEFAULT_DOCUMENT_PROMPT

      Prompt used for formatting each document into a string. Input variables can be "page_content" or any metadata keys that are in all documents. "page_content" will automatically retrieve the Document.page_content, and all other inputs variables will be automatically retrieved from the Document.metadata dictionary. Default to a prompt that only contains Document.page_content.

    • documentSeparator: string = DEFAULT_DOCUMENT_SEPARATOR

      String separator to use between formatted document strings.

    Returns Promise<RunnableSequence<Record<string, unknown>, unknown>>

    An LCEL Runnable chain. Expects a dictionary as input with a list of Documents being passed under the "context" key. Return type depends on the output_parser used.

Generated using TypeDoc