import { BaseMemory } from "@langchain/core/memory"; import { ChainValues } from "@langchain/core/utils/types"; import { CallbackManagerForChainRun, CallbackManager, Callbacks } from "@langchain/core/callbacks/manager"; import { type RunnableConfig } from "@langchain/core/runnables"; import { BaseLangChain, BaseLangChainParams } from "@langchain/core/language_models/base"; import { SerializedBaseChain } from "./serde.js"; export type LoadValues = Record; export interface ChainInputs extends BaseLangChainParams { memory?: BaseMemory; /** * @deprecated Use `callbacks` instead */ callbackManager?: CallbackManager; } /** * Base interface that all chains must implement. */ export declare abstract class BaseChain extends BaseLangChain implements ChainInputs { memory?: BaseMemory; get lc_namespace(): string[]; constructor(fields?: BaseMemory | ChainInputs, /** @deprecated */ verbose?: boolean, /** @deprecated */ callbacks?: Callbacks); /** @ignore */ _selectMemoryInputs(values: ChainValues): ChainValues; /** * Invoke the chain with the provided input and returns the output. * @param input Input values for the chain run. * @param config Optional configuration for the Runnable. * @returns Promise that resolves with the output of the chain run. */ invoke(input: RunInput, options?: RunnableConfig): Promise; private _validateOutputs; prepOutputs(inputs: Record, outputs: Record, returnOnlyOutputs?: boolean): Promise>; /** * Run the core logic of this chain and return the output */ abstract _call(values: RunInput, runManager?: CallbackManagerForChainRun, config?: RunnableConfig): Promise; /** * Return the string type key uniquely identifying this class of chain. */ abstract _chainType(): string; /** * Return a json-like object representing this chain. */ serialize(): SerializedBaseChain; abstract get inputKeys(): string[]; abstract get outputKeys(): string[]; /** @deprecated Use .invoke() instead. Will be removed in 0.2.0. */ run(input: any, config?: Callbacks | RunnableConfig): Promise; protected _formatValues(values: ChainValues & { signal?: AbortSignal; timeout?: number; }): Promise; /** * @deprecated Use .invoke() instead. Will be removed in 0.2.0. * * Run the core logic of this chain and add to output if desired. * * Wraps _call and handles memory. */ call(values: ChainValues & { signal?: AbortSignal; timeout?: number; }, config?: Callbacks | RunnableConfig, /** @deprecated */ tags?: string[]): Promise; /** * @deprecated Use .batch() instead. Will be removed in 0.2.0. * * Call the chain on all inputs in the list */ apply(inputs: RunInput[], config?: (Callbacks | RunnableConfig)[]): Promise; /** * Load a chain from a json-like object describing it. */ static deserialize(data: SerializedBaseChain, values?: LoadValues): Promise; }