/**
 * Generic input for a Distil pipeline.
 * - modelName: Name of the model to use
 * - systemPrompt & userPrompt: Template strings for the prompt
 * - parameters: Input parameters that fill placeholders in the prompt
 * - extraData: Optional extra information
 * - pipelineName: Name of the pipeline (used as ES index)
 * - templateHash: Computed hash for version tracking
 * - originalInput: Raw input before preprocessing
 */
export interface LLMInput {
    modelName: string;
    systemPrompt: string;
    userPrompt: string;
    parameters?: Record<string, any>;
    extraData?: any;
    pipelineName: string;
    templateHash?: string;
    originalInput?: any;
    startTime?: number;
    preprocessFn?: (input: LLMInput) => Promise<LLMInput> | LLMInput;
    postprocessFn?: (rawOutput: string, extraData?: any) => Promise<string> | string;
}
export interface InferenceResult {
    detail: string;
    rawInput: LLMInput;
    preprocessedInput: LLMInput;
    rawOutput: string;
    processedOutput: string;
    cost: number;
    retryCount?: number;
}
export interface GenerationResult {
    processedOutput: string;
    metadata: {
        generationCost: number;
        timeTaken: number;
        rawInput: LLMInput;
        preprocessedInput: LLMInput;
        rawOutput: string;
        templateHash: string;
        pipelineName: string;
        generationId: string;
    };
}
export interface PipelineExecutionResult {
    processedOutput: string;
    rawOutput: string;
    rawInput: LLMInput;
    preprocessedInput: LLMInput;
    executionStats?: {
        averageTime: number;
        totalRuns: number;
        successRate: number;
    };
}
export interface PipelineVersionRecord {
    id: string;
    pipelineName: string;
    template: {
        systemPrompt: string;
        userPrompt: string;
        parameterKeys: string[];
    };
    tags: string[];
    rating?: number;
    isFinetuned?: boolean;
    createdAt: string;
    generations?: Array<{
        id: string;
        rawInput: any;
        preprocessedInput: any;
        rawOutput: string;
        output: string;
        timestamp: string;
        metadata?: any;
    }>;
}
export interface ESSearchResponse<T> {
    hits: {
        total: {
            value: number;
            relation: string;
        };
        hits: Array<{
            _index: string;
            _id: string;
            _score: number;
            _source: T;
        }>;
    };
    aggregations?: {
        [key: string]: {
            buckets: Array<{
                key: string;
                doc_count: number;
                latest_doc: {
                    hits: {
                        hits: Array<{
                            _source: T;
                        }>;
                    };
                };
            }>;
        };
    };
}
