UNPKG

@promptbook/vercel

Version:

Promptbook: Turn your company's scattered knowledge into AI ready books

54 lines (53 loc) 2.37 kB
import type { PartialDeep, Promisable, ReadonlyDeep } from 'type-fest'; import type { PipelineJson } from '../../pipeline/PipelineJson/PipelineJson'; import type { InputParameters } from '../../types/typeAliases'; import type { PipelineExecutorResult } from '../PipelineExecutorResult'; import type { LlmCall } from '../../types/LlmCall'; import type { CreatePipelineExecutorOptions } from './00-CreatePipelineExecutorOptions'; /** * Options for executing an entire pipeline, including input parameters, pipeline context, and progress callbacks. * * @private internal type of `executePipeline` */ type ExecutePipelineOptions = Required<CreatePipelineExecutorOptions> & { /** * The input parameters provided by the user for pipeline execution. */ readonly inputParameters: Readonly<InputParameters>; /** * Optional callback invoked with partial results as the pipeline execution progresses. */ onProgress?(newOngoingResult: PartialDeep<PipelineExecutorResult>): Promisable<void>; /** * Optional callback invoked with each LLM call. */ logLlmCall?(llmCall: LlmCall): Promisable<void>; /** * The pipeline definition to execute. */ readonly pipeline: PipelineJson; /** * The prepared and validated pipeline, ready for execution. */ readonly preparedPipeline: ReadonlyDeep<PipelineJson>; /** * Callback to update the prepared pipeline reference after preparation. */ setPreparedPipeline(preparedPipeline: ReadonlyDeep<PipelineJson>): void; /** * String identifier for the pipeline, used in error messages and reporting. */ readonly pipelineIdentification: string; }; /** * Executes an entire pipeline, resolving tasks in dependency order, handling errors, and reporting progress. * * Note: This is not a `PipelineExecutor` (which is bound to a single pipeline), but a utility function used by `createPipelineExecutor` to create a `PipelineExecutor`. * * @param options - Options for execution, including input parameters, pipeline, and callbacks. * @returns The result of the pipeline execution, including output parameters, errors, and usage statistics. * * @private internal utility of `createPipelineExecutor` */ export declare function executePipeline(options: ExecutePipelineOptions): Promise<PipelineExecutorResult>; export {};