@juspay/neurolink
Version:
The pipe layer of an AI nervous system: one interface connecting provider neurons to your application, across three inference types — generate, stream and decide. `decide` returns typed, calibrated judgements from a non-generative model (~400ms, ~$0.00002
89 lines (88 loc) • 2.22 kB
TypeScript
/**
* @file Metrics Collector
* Collect and aggregate evaluation metrics
*/
import type { AggregatedMetrics, PipelineMetrics, PipelineResult, ScoreResult, ScorerMetrics } from "../../types/index.js";
/**
* Metrics collector for evaluation data
*/
export declare class MetricsCollector {
private _pipelineMetrics;
private _scorerMetrics;
private _collectionStartTime;
private _lastUpdateTime;
private _totalEvaluations;
private _scoreDistribution;
/**
* Record a scorer execution
*/
recordScorer(scorerId: string, scorerName: string, result: ScoreResult): void;
/**
* Record a pipeline execution
*/
recordPipeline(result: PipelineResult): void;
/**
* Get aggregated metrics
*/
getMetrics(): AggregatedMetrics;
/**
* Get metrics for a specific scorer
*/
getScorerMetrics(scorerId: string): ScorerMetrics | undefined;
/**
* Get metrics for a specific pipeline
*/
getPipelineMetrics(pipelineName: string): PipelineMetrics | undefined;
/**
* Get summary statistics
*/
getSummary(): {
totalEvaluations: number;
passRate: number;
averageScore: number;
topScorers: Array<{
id: string;
passRate: number;
}>;
bottomScorers: Array<{
id: string;
passRate: number;
}>;
};
/**
* Export metrics as JSON
*/
exportJson(): string;
/**
* Reset all metrics
*/
reset(): void;
/**
* Create empty scorer metrics
*/
private _createEmptyScorerMetrics;
/**
* Create empty pipeline metrics
*/
private _createEmptyPipelineMetrics;
/**
* Update scorer metrics with new result
*/
private _updateScorerMetrics;
/**
* Update pipeline metrics with new result
*/
private _updatePipelineMetrics;
/**
* Update score distribution
*/
private _updateScoreDistribution;
}
/**
* Create a metrics collector
*/
export declare function createMetricsCollector(): MetricsCollector;
/**
* Global metrics collector instance
*/
export declare const globalMetricsCollector: MetricsCollector;