Interface RagRetrievalDiagnostics

Diagnostics emitted by retrieval operations.

interface RagRetrievalDiagnostics {
    embeddingTimeMs?: number;
    retrievalTimeMs?: number;
    rerankingTimeMs?: number;
    totalTokensInContext?: number;
    strategyUsed?: "hybrid" | "similarity" | "mmr";
    dataSourceHits?: Record<string, number>;
    effectiveDataSourceIds?: string[];
    messages?: string[];
    hyde?: {
        hypothesis: string;
        hypothesisLatencyMs: number;
        effectiveThreshold: number;
        thresholdSteps: number;
    };
}

Properties

embeddingTimeMs?: number
retrievalTimeMs?: number
rerankingTimeMs?: number
totalTokensInContext?: number
strategyUsed?: "hybrid" | "similarity" | "mmr"
dataSourceHits?: Record<string, number>
effectiveDataSourceIds?: string[]
messages?: string[]
hyde?: {
    hypothesis: string;
    hypothesisLatencyMs: number;
    effectiveThreshold: number;
    thresholdSteps: number;
}

HyDE-specific diagnostics, populated when HyDE retrieval is active.

  • hypothesis: The generated (or pre-supplied) hypothetical answer.
  • hypothesisLatencyMs: Time spent generating the hypothesis via LLM.
  • effectiveThreshold: Final similarity threshold after adaptive stepping.
  • thresholdSteps: Number of times the threshold was lowered before results were found (0 means the initial threshold succeeded).

Type declaration

  • hypothesis: string
  • hypothesisLatencyMs: number
  • effectiveThreshold: number
  • thresholdSteps: number