import type { RagTurn } from "./rag-chain.js"; /** * One row in the shape commonly used with Databricks / MLflow GenAI evaluation * tables (request / response / retrieved_context). This is an **export** for * Mosaic Agent Evaluation and notebooks — not a reimplementation of judges. * * @see https://docs.databricks.com/aws/en/agents/agent-evaluation/ */ export interface LegacyAgentEvaluationRecord { request: string; response: string; retrieved_context: Array<{ doc_uri?: string; content: string; }>; /** Optional expected answer for offline scoring. */ expected_response?: string; /** Free-form tags for filtering in MLflow / notebooks. */ tags?: Record; /** Latency and model metadata for cost/latency analysis. */ metrics?: { retrieve_ms?: number; generate_ms?: number; total_ms?: number; input_tokens?: number; output_tokens?: number; }; } /** MLflow 3 evaluation-dataset row with structured inputs, outputs, and expectations. */ export interface Mlflow3RagEvaluationRecord { inputs: { question: string; }; outputs: { answer: string; retrieved_context: Array<{ doc_uri?: string; content: string; }>; }; expectations?: { expected_response?: string; expected_retrieved_context?: Array<{ doc_uri?: string; content: string; }>; }; tags?: Record; metadata: { model?: string; index?: string; retrieve_ms: number; generate_ms: number; total_ms: number; input_tokens?: number; output_tokens?: number; trace_id?: string; submission_id?: string; }; } export interface RagEvalExpected { /** Substrings that should appear in the answer. */ mustContain?: string[]; /** Retrieved chunk ids that should appear among results. */ mustRetrieveIds?: string[]; /** Require at least one citation id on the turn. */ requireCitations?: boolean; /** Full expected answer (exact or for Agent Evaluation expected_response). */ expectedAnswer?: string; } /** * Convert a {@link RagTurn} into a Databricks-friendly evaluation record. * Upload JSONL of these rows to MLflow / Agent Evaluation rather than building * a parallel judge stack in Fabric. */ export declare function toAgentEvaluationRecord(turn: RagTurn, options?: { expectedAnswer?: string; tags?: Record; }): LegacyAgentEvaluationRecord; /** Serialize evaluation records as JSONL for MLflow / Agent Evaluation import. */ export declare function exportAgentEvaluationJsonl(records: LegacyAgentEvaluationRecord[]): string; /** Convert a RAG turn into the structured MLflow 3 evaluation-dataset shape. */ export declare function toMlflow3EvaluationRecord(turn: RagTurn, options?: { expectedAnswer?: string; expectedRetrievedContext?: Array<{ doc_uri?: string; content: string; }>; tags?: Record; traceId?: string; submissionId?: string; }): Mlflow3RagEvaluationRecord; /** Serialize structured MLflow 3 evaluation rows as newline-delimited JSON. */ export declare function exportMlflow3EvaluationJsonl(records: Mlflow3RagEvaluationRecord[]): string; export interface RagTurnScore { name: string; score: number; passed: boolean; reason: string; } /** Lightweight local checks before/alongside Databricks Agent Evaluation. */ export declare function scoreRagTurn(turn: RagTurn, expected?: RagEvalExpected): RagTurnScore[]; /** * Adapter for `@fabric-harness/evals` scorers when the suite output is a {@link RagTurn}. * Keep heavy quality judges in Databricks Agent Evaluation; use these for CI smoke. */ export declare function ragTurnContainsScorer(name?: string): (input: { case: { expected?: RagEvalExpected | string; }; output: RagTurn; }) => RagTurnScore; export declare function ragTurnCitationsScorer(name?: string): (input: { output: RagTurn; }) => RagTurnScore; //# sourceMappingURL=rag-eval.d.ts.map