UNPKG

@plust/datasleuth

Version:

Build LLM-powered research pipelines and output structured data.

88 lines (87 loc) 2.78 kB
/** * Research track implementation for parallel research paths * A track represents a distinct research path that can run in parallel with others */ import { createStep } from '../utils/steps.js'; import { ResearchStep } from '../types/pipeline.js'; import { z } from 'zod'; /** * Options for creating a research track */ export interface TrackOptions { /** The name of this research track (used for identification in results) */ name: string; /** Steps to execute in this track */ steps: ResearchStep[]; /** Whether to keep the track's data isolated from other tracks */ isolate?: boolean; /** Whether to include this track's results in the final results object */ includeInResults?: boolean; /** Optional description of this track's purpose */ description?: string; /** Optional metadata to associate with this track */ metadata?: Record<string, any>; /** Whether to continue execution if a step fails */ continueOnError?: boolean; /** Retry configuration for the entire track */ retry?: { /** Maximum number of retries */ maxRetries?: number; /** Base delay between retries in ms */ baseDelay?: number; }; } /** * Schema for track result */ declare const trackResultSchema: z.ZodObject<{ name: z.ZodString; results: z.ZodArray<z.ZodAny, "many">; data: z.ZodRecord<z.ZodString, z.ZodAny>; metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>; errors: z.ZodArray<z.ZodObject<{ message: z.ZodString; step: z.ZodOptional<z.ZodString>; code: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { message: string; code?: string | undefined; step?: string | undefined; }, { message: string; code?: string | undefined; step?: string | undefined; }>, "many">; completed: z.ZodBoolean; }, "strip", z.ZodTypeAny, { data: Record<string, any>; results: any[]; errors: { message: string; code?: string | undefined; step?: string | undefined; }[]; name: string; completed: boolean; metadata?: Record<string, any> | undefined; }, { data: Record<string, any>; results: any[]; errors: { message: string; code?: string | undefined; step?: string | undefined; }[]; name: string; completed: boolean; metadata?: Record<string, any> | undefined; }>; export type TrackResult = z.infer<typeof trackResultSchema>; /** * Creates a track step for the research pipeline * * @param options Options for the research track * @returns A track step for the research pipeline */ export declare function track(options: TrackOptions): ReturnType<typeof createStep>; export {};