UNPKG

@plust/datasleuth

Version:

Build LLM-powered research pipelines and output structured data.

38 lines (37 loc) 1.57 kB
/** * Utilities for creating and working with pipeline steps */ import { ResearchStep, ResearchState, StepOptions } from '../types/pipeline.js'; /** * Step creation options with error handling configuration */ export interface StepCreationOptions { /** Whether the step can be retried on failure */ retryable?: boolean; /** Whether the step can be skipped without breaking the pipeline */ optional?: boolean; /** Maximum number of retry attempts */ maxRetries?: number; /** Initial delay between retries in milliseconds */ retryDelay?: number; /** Factor by which to increase the delay on each retry */ backoffFactor?: number; } /** * Creates a new step with consistent structure and error handling * * @param name Name of the step * @param executor Function that executes the step logic * @param options Step options * @param creationOptions Error handling and retry configuration * @returns A research step with standardized error handling */ export declare function createStep<T extends StepOptions = StepOptions>(name: string, executor: (state: ResearchState, options: T) => Promise<ResearchState>, options?: T, creationOptions?: StepCreationOptions): ResearchStep; /** * Wrap an existing step with enhanced error handling * * @param step The original step to wrap * @param creationOptions Error handling and retry configuration * @returns A wrapped step with enhanced error handling */ export declare function wrapStepWithErrorHandling(step: ResearchStep, creationOptions?: StepCreationOptions): ResearchStep;