Class PipelinePromptTemplate<PromptTemplateType>

Class that handles a sequence of prompts, each of which may require different input variables. Includes methods for formatting these prompts, extracting required input values, and handling partial prompts.

Type Parameters

Hierarchy

Constructors

Properties

PromptValueReturnType: BasePromptValue
finalPrompt: PromptTemplateType
inputVariables: string[]

A list of variable names the prompt template expects

partialVariables: PartialValues<any>

Partial variables

pipelinePrompts: PipelinePromptParams<PromptTemplateType>[]
outputParser?: BaseOutputParser<unknown>

How to parse the output of calling an LLM on this formatted prompt

lc_runnable: boolean = true

Methods

  • Formats the final prompt value based on the provided input values.

    Parameters

    • values: InputValues

      Input values to format the final prompt value.

    Returns Promise<PromptTemplateType["PromptValueReturnType"]>

    Promise that resolves with the formatted final prompt value.

  • Stream all output from a runnable, as reported to the callback system. This includes all inner runs of LLMs, Retrievers, Tools, etc. Output is streamed as Log objects, which include a list of jsonpatch ops that describe how the state of the run has changed in each step, and the final state of the run. The jsonpatch ops can be applied in order to construct state.

    Parameters

    • input: any
    • Optional options: Partial<BaseCallbackConfig>
    • Optional streamOptions: Omit<LogStreamCallbackHandlerInput, "autoClose">

    Returns AsyncGenerator<RunLogPatch, any, unknown>

  • Helper method to transform an Iterator of Input values into an Iterator of Output values, with callbacks. Use this to implement stream() or transform() in Runnable subclasses.

    Type Parameters

    Parameters

    • inputGenerator: AsyncGenerator<I, any, unknown>
    • transformer: ((generator, runManager?, options?) => AsyncGenerator<O, any, unknown>)
        • (generator, runManager?, options?): AsyncGenerator<O, any, unknown>
        • Parameters

          Returns AsyncGenerator<O, any, unknown>

    • Optional options: BaseCallbackConfig & {
          runType?: string;
      }

    Returns AsyncGenerator<O, any, unknown>

  • Computes the input values required by the pipeline prompts.

    Returns string[]

    Array of input values required by the pipeline prompts.

Generated using TypeDoc