@plust/datasleuth
Version:
Build LLM-powered research pipelines and output structured data.
61 lines (60 loc) • 2.09 kB
TypeScript
import { createStep } from '../utils/steps.js';
import { z } from 'zod';
import { LanguageModel } from 'ai';
/**
* Schema for refined query output
*/
declare const refinedQuerySchema: z.ZodObject<{
originalQuery: z.ZodString;
refinedQuery: z.ZodString;
refinementStrategy: z.ZodString;
targetedAspects: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
reasonForRefinement: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
originalQuery: string;
refinedQuery: string;
refinementStrategy: string;
targetedAspects?: string[] | undefined;
reasonForRefinement?: string | undefined;
}, {
originalQuery: string;
refinedQuery: string;
refinementStrategy: string;
targetedAspects?: string[] | undefined;
reasonForRefinement?: string | undefined;
}>;
export type RefinedQuery = z.infer<typeof refinedQuerySchema>;
/**
* Options for the query refinement step
*/
export interface RefineQueryOptions {
/** What to base the refinement on */
basedOn?: 'findings' | 'gaps' | 'factuality' | 'all';
/** Language Model to use for query refinement */
llm?: LanguageModel;
/** Maximum number of queries to generate */
maxQueries?: number;
/** Whether to include the refined queries in the final results */
includeInResults?: boolean;
/** Custom prompt for query refinement */
customPrompt?: string;
/** Temperature for the LLM (0.0 to 1.0) */
temperature?: number;
/** Retry configuration for LLM calls */
retry?: {
/** Maximum number of retries */
maxRetries?: number;
/** Base delay between retries in ms */
baseDelay?: number;
};
/** Whether to use simulation instead of actual LLM (for development/testing) */
useSimulation?: boolean;
}
/**
* Creates a query refinement step for the research pipeline
*
* @param options Configuration options for query refinement
* @returns A query refinement step for the research pipeline
*/
export declare function refineQuery(options?: RefineQueryOptions): ReturnType<typeof createStep>;
export {};