UNPKG

@promptbook/vercel

Version:

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

57 lines (56 loc) 2.3 kB
import type { PartialDeep, Promisable, ReadonlyDeep, WritableDeep } from 'type-fest'; import type { PipelineJson } from '../../pipeline/PipelineJson/PipelineJson'; import type { TaskJson } from '../../pipeline/PipelineJson/TaskJson'; import type { Parameters } from '../../types/typeAliases'; import type { LlmCall } from '../../types/LlmCall'; import type { ExecutionReportJson } from '../execution-report/ExecutionReportJson'; import type { PipelineExecutorResult } from '../PipelineExecutorResult'; import type { CreatePipelineExecutorOptions } from './00-CreatePipelineExecutorOptions'; /** * Options for executing a single pipeline task, including task details, pipeline context, parameters, and callbacks. * * @private internal type of `executeTask` */ type executeSingleTaskOptions = Required<CreatePipelineExecutorOptions> & { /** * The task to be executed. */ readonly currentTask: ReadonlyDeep<TaskJson>; /** * The pipeline in which the task resides, fully prepared and validated. */ readonly preparedPipeline: ReadonlyDeep<PipelineJson>; /** * The parameters to pass to the task execution. */ readonly parametersToPass: Readonly<Parameters>; /** * Callback invoked with partial results as the execution progresses. */ onProgress(newOngoingResult: PartialDeep<PipelineExecutorResult>): Promisable<void>; /** * Optional callback invoked with each LLM call. */ logLlmCall?(llmCall: LlmCall): Promisable<void>; /** * Mutable execution report object for tracking execution details. */ readonly $executionReport: WritableDeep<ExecutionReportJson>; /** * String identifier for the pipeline, used in error messages and reporting. */ readonly pipelineIdentification: string; }; /** * Executes a single task within a pipeline, handling parameter validation, error checking, and progress reporting. * * @param options - Options for execution, including the task, pipeline, parameters, and callbacks. * @returns The output parameters produced by the task. * * @private internal utility of `createPipelineExecutor` */ export declare function executeTask(options: executeSingleTaskOptions): Promise<Readonly<Parameters>>; export {}; /** * TODO: [🤹‍♂️] */