import { Generation, GenerationChunk, LLMResult } from "../outputs.js"; import { BaseCache } from "../caches/index.js"; import { BaseCallbackConfig, CallbackManagerForLLMRun, Callbacks } from "../callbacks/manager.js"; import { RunnableConfig } from "../runnables/types.js"; import { BasePromptValueInterface } from "../prompt_values.js"; import { BaseLanguageModel, BaseLanguageModelCallOptions, BaseLanguageModelInput, BaseLanguageModelParams } from "./base.js"; //#region src/language_models/llms.d.ts type SerializedLLM = { _model: string; _type: string; } & Record; interface BaseLLMParams extends BaseLanguageModelParams {} interface BaseLLMCallOptions extends BaseLanguageModelCallOptions {} /** * LLM Wrapper. Takes in a prompt (or prompts) and returns a string. */ declare abstract class BaseLLM extends BaseLanguageModel { ParsedCallOptions: Omit>; lc_namespace: string[]; /** * This method takes an input and options, and returns a string. It * converts the input to a prompt value and generates a result based on * the prompt. * @param input Input for the LLM. * @param options Options for the LLM call. * @returns A string result based on the prompt. */ invoke(input: BaseLanguageModelInput, options?: Partial): Promise; _streamResponseChunks(_input: string, _options: this["ParsedCallOptions"], _runManager?: CallbackManagerForLLMRun): AsyncGenerator; protected _separateRunnableConfigFromCallOptionsCompat(options?: Partial): [RunnableConfig, this["ParsedCallOptions"]]; _streamIterator(input: BaseLanguageModelInput, options?: Partial): AsyncGenerator; /** * This method takes prompt values, options, and callbacks, and generates * a result based on the prompts. * @param promptValues Prompt values for the LLM. * @param options Options for the LLM call. * @param callbacks Callbacks for the LLM call. * @returns An LLMResult based on the prompts. */ generatePrompt(promptValues: BasePromptValueInterface[], options?: string[] | Partial, callbacks?: Callbacks): Promise; /** * Run the LLM on the given prompts and input. */ abstract _generate(prompts: string[], options: this["ParsedCallOptions"], runManager?: CallbackManagerForLLMRun): Promise; /** * Get the parameters used to invoke the model */ invocationParams(_options?: this["ParsedCallOptions"]): any; _flattenLLMResult(llmResult: LLMResult): LLMResult[]; /** @ignore */ _generateUncached(prompts: string[], parsedOptions: this["ParsedCallOptions"], handledOptions: BaseCallbackConfig, startedRunManagers?: CallbackManagerForLLMRun[]): Promise; _generateCached({ prompts, cache, llmStringKey, parsedOptions, handledOptions, runId }: { prompts: string[]; cache: BaseCache; llmStringKey: string; parsedOptions: any; handledOptions: RunnableConfig; runId?: string; }): Promise; /** * Run the LLM on the given prompts and input, handling caching. */ generate(prompts: string[], options?: string[] | Partial, callbacks?: Callbacks): Promise; /** * Get the identifying parameters of the LLM. */ _identifyingParams(): Record; /** * Return the string type key uniquely identifying this class of LLM. */ abstract _llmType(): string; _modelType(): string; } /** * LLM class that provides a simpler interface to subclass than {@link BaseLLM}. * * Requires only implementing a simpler {@link _call} method instead of {@link _generate}. * * @augments BaseLLM */ declare abstract class LLM extends BaseLLM { /** * Run the LLM on the given prompt and input. */ abstract _call(prompt: string, options: this["ParsedCallOptions"], runManager?: CallbackManagerForLLMRun): Promise; _generate(prompts: string[], options: this["ParsedCallOptions"], runManager?: CallbackManagerForLLMRun): Promise; } //#endregion export { BaseLLM, BaseLLMCallOptions, BaseLLMParams, LLM, SerializedLLM }; //# sourceMappingURL=llms.d.ts.map