UNPKG

@plust/datasleuth

Version:

Build LLM-powered research pipelines and output structured data.

41 lines (40 loc) 1.49 kB
/** * Transform step for the research pipeline * Ensures output matches the expected schema structure */ import { createStep } from '../utils/steps.js'; import { ResearchState, StepOptions } from '../types/pipeline.js'; import { LanguageModel } from 'ai'; /** * Options for the transform step */ export interface TransformOptions extends StepOptions { /** Custom transformation function */ transformFn?: (state: ResearchState) => Record<string, any>; /** Whether to allow missing fields with defaults */ allowMissingWithDefaults?: boolean; /** Override output validation (use with caution) */ skipValidation?: boolean; /** Use LLM to intelligently format output according to schema */ useLLM?: boolean; /** Custom LLM to use for transformation (falls back to state.defaultLLM) */ llm?: LanguageModel; /** Temperature for LLM generation (0.0 to 1.0) */ temperature?: number; /** Custom system prompt for the LLM */ systemPrompt?: string; /** Retry configuration for LLM calls */ retry?: { /** Maximum number of retries */ maxRetries?: number; /** Base delay between retries in ms */ baseDelay?: number; }; } /** * Creates a transform step for the research pipeline * * @param options Configuration options for transformation * @returns A transform step for the research pipeline */ export declare function transform(options?: TransformOptions): ReturnType<typeof createStep>;