/**
 * @file BatchEvaluator - Supports batch evaluation of multiple responses.
 * Enables parallel evaluation with configurable concurrency and error handling.
 */
import type { LanguageModelV3CallOptions } from "@ai-sdk/provider";
import type { GenerateResult } from "../types/generateTypes.js";
import type { EvaluationConfig } from "../types/evaluationTypes.js";
import type { EvaluationData } from "../types/evaluation.js";
import type { AutoEvaluationConfig } from "../types/middlewareTypes.js";
/**
 * Configuration for batch evaluation.
 */
export interface BatchEvaluationConfig extends EvaluationConfig {
    /** Maximum number of concurrent evaluations (default: 5) */
    concurrency?: number;
    /** Whether to continue on individual failures (default: true) */
    continueOnError?: boolean;
    /** Maximum retries for retryable errors (default: 2) */
    maxRetries?: number;
    /** Delay between retries in milliseconds (default: 1000) */
    retryDelay?: number;
    /** Callback for progress updates */
    onProgress?: (progress: BatchProgress) => void;
    /** Callback for individual evaluation completion */
    onItemComplete?: (result: BatchEvaluationItemResult) => void;
}
/**
 * Progress information for batch evaluation.
 */
export interface BatchProgress {
    /** Total items to evaluate */
    total: number;
    /** Items completed (success + failed) */
    completed: number;
    /** Items that succeeded */
    succeeded: number;
    /** Items that failed */
    failed: number;
    /** Items still pending */
    pending: number;
    /** Percentage complete */
    percentComplete: number;
}
/**
 * Input item for batch evaluation.
 */
export interface BatchEvaluationItem {
    /** Unique identifier for this item */
    id: string;
    /** The generation options */
    options: LanguageModelV3CallOptions;
    /** The generation result to evaluate */
    result: GenerateResult;
    /** Optional item-specific threshold override */
    threshold?: number;
}
/**
 * Result for a single item in batch evaluation.
 */
export interface BatchEvaluationItemResult {
    /** The item ID */
    id: string;
    /** Whether the evaluation succeeded */
    success: boolean;
    /** The evaluation data (if successful) */
    data?: EvaluationData;
    /** Error information (if failed) */
    error?: {
        message: string;
        code?: string;
        retryable?: boolean;
    };
    /** Time taken for this evaluation in milliseconds */
    duration: number;
    /** Number of retry attempts (if any) */
    retryCount: number;
}
/**
 * Result of a batch evaluation operation.
 */
export interface BatchEvaluationResult {
    /** All item results */
    results: BatchEvaluationItemResult[];
    /** Summary statistics */
    summary: {
        /** Total items evaluated */
        total: number;
        /** Number of successful evaluations */
        succeeded: number;
        /** Number of failed evaluations */
        failed: number;
        /** Average evaluation score (for successful items) */
        averageScore: number;
        /** Average evaluation time in milliseconds */
        averageDuration: number;
        /** Total time for batch evaluation */
        totalDuration: number;
        /** Passing rate (percentage of items meeting threshold) */
        passingRate: number;
    };
    /** Whether all evaluations succeeded */
    allSucceeded: boolean;
}
/**
 * BatchEvaluator - Performs evaluation on multiple items in parallel.
 * Supports configurable concurrency, retry logic, and progress tracking.
 *
 * @example
 * ```typescript
 * const batchEvaluator = new BatchEvaluator({
 *   concurrency: 3,
 *   continueOnError: true,
 *   onProgress: (progress) => console.log(`${progress.percentComplete}% complete`)
 * });
 *
 * const items = [
 *   { id: '1', options: opts1, result: result1 },
 *   { id: '2', options: opts2, result: result2 },
 * ];
 *
 * const batchResult = await batchEvaluator.evaluateBatch(items);
 * console.log(`Passing rate: ${batchResult.summary.passingRate}%`);
 * ```
 */
export declare class BatchEvaluator {
    private config;
    constructor(config?: BatchEvaluationConfig);
    /**
     * Create a fresh Evaluator instance for each evaluation to avoid leaking state.
     */
    private _createEvaluator;
    /**
     * Evaluates a batch of items in parallel with controlled concurrency.
     *
     * @param items - Array of items to evaluate
     * @param autoEvalConfig - Auto-evaluation configuration for thresholds
     * @returns Batch evaluation results with summary statistics
     */
    evaluateBatch(items: BatchEvaluationItem[], autoEvalConfig?: AutoEvaluationConfig): Promise<BatchEvaluationResult>;
    /**
     * Evaluates items sequentially (one at a time).
     * Useful for debugging or when order matters.
     *
     * @param items - Array of items to evaluate
     * @param autoEvalConfig - Auto-evaluation configuration
     * @returns Batch evaluation results
     */
    evaluateSequential(items: BatchEvaluationItem[], autoEvalConfig?: AutoEvaluationConfig): Promise<BatchEvaluationResult>;
    /**
     * Gets the current configuration.
     */
    getConfig(): BatchEvaluationConfig;
    /**
     * Updates the configuration.
     *
     * @param config - New configuration values
     */
    updateConfig(config: Partial<BatchEvaluationConfig>): void;
    /**
     * Helper to delay execution.
     */
    private delay;
}
