@@ -18,47 +18,6 @@ import {
1818import { extractGenAISpans , skipIf } from "../utils.js" ;
1919import { CheckError } from "../../validator.js" ;
2020
21- /**
22- * Check that input tokens increase with each turn (more conversation history)
23- */
24- const checkTokenProgression : Check = {
25- name : "checkTokenProgression" ,
26- fn : ( spans ) => {
27- const aiSpans = extractGenAISpans ( spans ) ;
28- skipIf (
29- aiSpans . length < 3 ,
30- `Expected 3 spans for multi-turn test, got ${ aiSpans . length } ` ,
31- ) ;
32-
33- // Extract input token counts for each turn
34- const inputTokens = aiSpans . map (
35- ( span ) => span . data ?. [ "gen_ai.usage.input_tokens" ] as number ,
36- ) ;
37-
38- // Input tokens should increase with each turn (more conversation history)
39- const errors : ErrorLocation [ ] = [ ] ;
40- if ( ! ( inputTokens [ 1 ] > inputTokens [ 0 ] ) ) {
41- errors . push ( {
42- spanId : aiSpans [ 1 ] . span_id ,
43- attribute : "gen_ai.usage.input_tokens" ,
44- message : `Turn 2 input tokens (${ inputTokens [ 1 ] } ) should be greater than turn 1 (${ inputTokens [ 0 ] } )` ,
45- } ) ;
46- }
47- if ( ! ( inputTokens [ 2 ] > inputTokens [ 1 ] ) ) {
48- errors . push ( {
49- spanId : aiSpans [ 2 ] . span_id ,
50- attribute : "gen_ai.usage.input_tokens" ,
51- message : `Turn 3 input tokens (${ inputTokens [ 2 ] } ) should be greater than turn 2 (${ inputTokens [ 1 ] } )` ,
52- } ) ;
53- }
54- if ( errors . length > 0 ) {
55- throw new CheckError (
56- `Input token progression failed: tokens should increase with each turn` ,
57- errors ,
58- ) ;
59- }
60- } ,
61- } ;
6221
6322export const multiTurnLLMTest : TestDefinition = {
6423 name : "Multi-Turn LLM Test" ,
@@ -109,7 +68,6 @@ export const multiTurnLLMTest: TestDefinition = {
10968
11069 checks : [
11170 checkValidTokenUsage ,
112- checkTokenProgression ,
11371 checkInputMessagesSchema ,
11472 ] ,
11573
0 commit comments