All files / api/src/connectors/evaluations/latency latency.ts

100% Statements 14/14
100% Branches 1/1
100% Functions 1/1
100% Lines 14/14

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 221x   1x       1x   1x 1x 1x 1x 1x 1x   1x 1x 1x 1x   1x  
import { LatencyEvaluationParameters } from '@api/connectors/evaluations/latency/types';
import type { EvaluationMethodConnector } from '@api/types/connector';
import {
  type EvaluationMethodDetails,
  EvaluationMethodName,
} from '@shared/types/evaluations';
import { evaluateLog } from './service/evaluate';
 
const methodConfig: EvaluationMethodDetails = {
  method: EvaluationMethodName.LATENCY,
  name: 'Latency',
  description:
    'Evaluates time-to-first-token (TTFT) for streaming responses or total duration for non-streaming',
} as const;
 
export const latencyEvaluationConnector: EvaluationMethodConnector = {
  getDetails: () => methodConfig,
  evaluateLog,
  getParameterSchema: LatencyEvaluationParameters,
  // Latency evaluation doesn't use AI for parameter generation, so we omit getAIParameterSchema
};