UNPKG

@plust/datasleuth

Version:

Build LLM-powered research pipelines and output structured data.

67 lines (66 loc) 2.35 kB
import { createStep } from '../utils/steps.js'; import { StepOptions } from '../types/pipeline.js'; import { z } from 'zod'; import { LanguageModel } from 'ai'; /** * Format options for summary output */ export type SummaryFormat = 'paragraph' | 'bullet' | 'structured'; /** * Schema for structured summary output */ declare const structuredSummarySchema: z.ZodObject<{ summary: z.ZodString; keyPoints: z.ZodArray<z.ZodString, "many">; sources: z.ZodOptional<z.ZodArray<z.ZodString, "many">>; sections: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>; }, "strip", z.ZodTypeAny, { summary: string; keyPoints: string[]; sources?: string[] | undefined; sections?: Record<string, string> | undefined; }, { summary: string; keyPoints: string[]; sources?: string[] | undefined; sections?: Record<string, string> | undefined; }>; export type StructuredSummary = z.infer<typeof structuredSummarySchema>; /** * Options for the summarization step */ export interface SummarizeOptions extends StepOptions { /** Maximum length of the generated summary (characters) */ maxLength?: number; /** Model to use for summarization (from the AI SDK) */ llm?: LanguageModel; /** Temperature for the LLM generation (0.0 to 1.0) */ temperature?: number; /** Format for the summary (paragraph, bullet, structured) */ format?: SummaryFormat; /** Focus areas for the summary (aspects to emphasize) */ focus?: string | string[]; /** Whether to include citations in the summary */ includeCitations?: boolean; /** Whether to add the summary to the final results */ includeInResults?: boolean; /** Custom prompt for summary generation */ customPrompt?: string; /** Additional instructions for summary generation */ additionalInstructions?: string; /** Retry configuration for LLM calls */ retry?: { /** Maximum number of retries */ maxRetries?: number; /** Base delay between retries in ms */ baseDelay?: number; }; } /** * Creates a summarization step for the research pipeline * * @param options Configuration options for summarization * @returns A summarization step for the research pipeline */ export declare function summarize(options?: SummarizeOptions): ReturnType<typeof createStep>; export {};