Skip to content

Commit ee25953

Browse files
fix: Rename stale entries
Signed-off-by: Alberto Perdomo <aperdomo@redhat.com>
1 parent 1d3ab27 commit ee25953

1 file changed

Lines changed: 19 additions & 19 deletions

File tree

pkg/epp/framework/plugins/requestcontrol/dataproducer/tokenizer/estimate_test.go

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -235,10 +235,10 @@ func chatVideoBody(url string) *fwkrh.InferenceRequestBody {
235235
func TestVideoEstimator_Default(t *testing.T) {
236236
tp, err := estimateBackend{}.produce(context.Background(), chatVideoBody("https://example.com/clip.mp4"))
237237
require.NoError(t, err)
238-
require.Len(t, tp.MultiModalFeatures, 1)
238+
require.Len(t, tp.Prompts[0].MultiModalFeatures, 1)
239239
frames := defaultVideoDuration * defaultVideoSampleFPS
240240
tpf := (defaultVideoWidth * defaultVideoHeight) / videoTokenFactor
241-
assert.Equal(t, frames*tpf, tp.MultiModalFeatures[0].Length, "default video length")
241+
assert.Equal(t, frames*tpf, tp.Prompts[0].MultiModalFeatures[0].Length, "default video length")
242242
}
243243

244244
// TestVideoEstimator_StaticTokensPerFrame asserts static mode emits a constant
@@ -250,7 +250,7 @@ func TestVideoEstimator_StaticTokensPerFrame(t *testing.T) {
250250
tp, err := b.produce(context.Background(), chatVideoBody("https://example.com/clip.mp4"))
251251
require.NoError(t, err)
252252
frames := defaultVideoDuration * defaultVideoSampleFPS
253-
assert.Equal(t, frames*100, tp.MultiModalFeatures[0].Length, "static tokens-per-frame video length")
253+
assert.Equal(t, frames*100, tp.Prompts[0].MultiModalFeatures[0].Length, "static tokens-per-frame video length")
254254
}
255255

256256
// TestVideoEstimator_DynamicFactor asserts the dynamic factor knob changes the
@@ -263,7 +263,7 @@ func TestVideoEstimator_DynamicFactor(t *testing.T) {
263263
require.NoError(t, err)
264264
frames := defaultVideoDuration * defaultVideoSampleFPS
265265
tpf := (defaultVideoWidth * defaultVideoHeight) / 2048
266-
assert.Equal(t, frames*tpf, tp.MultiModalFeatures[0].Length, "custom-factor video length")
266+
assert.Equal(t, frames*tpf, tp.Prompts[0].MultiModalFeatures[0].Length, "custom-factor video length")
267267
}
268268

269269
// TestVideoEstimator_SampledFrames asserts sampled frames scale with sampleFPS
@@ -276,7 +276,7 @@ func TestVideoEstimator_SampledFrames(t *testing.T) {
276276
}})}
277277
tp, err := b.produce(context.Background(), chatVideoBody("https://example.com/clip.mp4"))
278278
require.NoError(t, err)
279-
assert.Equal(t, 8*2*10, tp.MultiModalFeatures[0].Length, "sampled-frames video length")
279+
assert.Equal(t, 8*2*10, tp.Prompts[0].MultiModalFeatures[0].Length, "sampled-frames video length")
280280
}
281281

282282
// TestVideoEstimator_StridedFramesCapped asserts strided frames apply the
@@ -290,7 +290,7 @@ func TestVideoEstimator_StridedFramesCapped(t *testing.T) {
290290
tp, err := b.produce(context.Background(), chatVideoBody("https://example.com/clip.mp4"))
291291
require.NoError(t, err)
292292
// duration*sourceFPS/stride = 10*24/4 = 60, capped to 16; 16*100 tokens.
293-
assert.Equal(t, 16*100, tp.MultiModalFeatures[0].Length, "strided-frames video length")
293+
assert.Equal(t, 16*100, tp.Prompts[0].MultiModalFeatures[0].Length, "strided-frames video length")
294294
}
295295

296296
// TestVideoEstimator_StridedFramesFloored asserts strided frames apply the
@@ -304,7 +304,7 @@ func TestVideoEstimator_StridedFramesFloored(t *testing.T) {
304304
tp, err := b.produce(context.Background(), chatVideoBody("https://example.com/clip.mp4"))
305305
require.NoError(t, err)
306306
// duration*sourceFPS/stride = 1*24/4 = 6, floored to 8; 8*100 tokens.
307-
assert.Equal(t, 8*100, tp.MultiModalFeatures[0].Length, "strided-frames floored video length")
307+
assert.Equal(t, 8*100, tp.Prompts[0].MultiModalFeatures[0].Length, "strided-frames floored video length")
308308
}
309309

310310
// TestVideoEstimator_MaxVideoTokens asserts the overall cap bounds the total
@@ -316,7 +316,7 @@ func TestVideoEstimator_MaxVideoTokens(t *testing.T) {
316316
tp, err := b.produce(context.Background(), chatVideoBody("https://example.com/clip.mp4"))
317317
require.NoError(t, err)
318318
// Default frames*tpf = 10*225 = 2250, capped to 500.
319-
assert.Equal(t, 500, tp.MultiModalFeatures[0].Length, "max-video-tokens cap")
319+
assert.Equal(t, 500, tp.Prompts[0].MultiModalFeatures[0].Length, "max-video-tokens cap")
320320
}
321321

322322
// TestVideoEstimator_Qwen3AndGemma4 asserts the two documented model shapes
@@ -332,7 +332,7 @@ func TestVideoEstimator_Qwen3AndGemma4(t *testing.T) {
332332
tp, err := qwen3.produce(context.Background(), chatVideoBody("https://example.com/clip.mp4"))
333333
require.NoError(t, err)
334334
// frames = 10*2 = 20, tpf = 640*480/1024 = 300, tokens = 6000.
335-
assert.Equal(t, 20*((640*480)/1024), tp.MultiModalFeatures[0].Length, "qwen3-shaped video length")
335+
assert.Equal(t, 20*((640*480)/1024), tp.Prompts[0].MultiModalFeatures[0].Length, "qwen3-shaped video length")
336336

337337
gemma4 := estimateBackend{vid: newVideoEstimator(&estimateConfig{Video: &videoEstimateConfig{
338338
DefaultDuration: 10,
@@ -342,7 +342,7 @@ func TestVideoEstimator_Qwen3AndGemma4(t *testing.T) {
342342
tp, err = gemma4.produce(context.Background(), chatVideoBody("https://example.com/clip.mp4"))
343343
require.NoError(t, err)
344344
// frames = min(10*24/4, 16) = 16, tokens = 16*256.
345-
assert.Equal(t, 16*256, tp.MultiModalFeatures[0].Length, "gemma4-shaped video length")
345+
assert.Equal(t, 16*256, tp.Prompts[0].MultiModalFeatures[0].Length, "gemma4-shaped video length")
346346
}
347347

348348
// TestParseVideoMetadataHeaders covers full, partial, missing, and malformed
@@ -433,11 +433,11 @@ func TestVideoEstimator_HeaderMetadataOverridesDefaults(t *testing.T) {
433433
withMeta, err := estimateBackend{}.produce(ctx, chatVideoBody("https://example.com/clip.mp4"))
434434
require.NoError(t, err)
435435
// sampled frames = duration(3)*sampleFPS(2) = 6; dynamic tpf = 320*240/1024 = 75.
436-
assert.Equal(t, 6*((320*240)/videoTokenFactor), withMeta.MultiModalFeatures[0].Length)
436+
assert.Equal(t, 6*((320*240)/videoTokenFactor), withMeta.Prompts[0].MultiModalFeatures[0].Length)
437437

438438
def, err := estimateBackend{}.produce(context.Background(), chatVideoBody("https://example.com/clip.mp4"))
439439
require.NoError(t, err)
440-
assert.NotEqual(t, def.MultiModalFeatures[0].Length, withMeta.MultiModalFeatures[0].Length, "header metadata must change the count")
440+
assert.NotEqual(t, def.Prompts[0].MultiModalFeatures[0].Length, withMeta.Prompts[0].MultiModalFeatures[0].Length, "header metadata must change the count")
441441
}
442442

443443
// TestVideoEstimator_HeaderFPSStridedMode asserts header source FPS and duration
@@ -450,7 +450,7 @@ func TestVideoEstimator_HeaderFPSStridedMode(t *testing.T) {
450450
// strided frames = int(duration(3)*fps(30))/2 = 45.
451451
tp, err := b.produce(videoCtx(videoMetadata{duration: 3, fps: 30}), chatVideoBody("https://cdn.example.com/movie.mp4"))
452452
require.NoError(t, err)
453-
assert.Equal(t, 45, tp.MultiModalFeatures[0].Length)
453+
assert.Equal(t, 45, tp.Prompts[0].MultiModalFeatures[0].Length)
454454
}
455455

456456
// TestVideoEstimator_SampledIgnoresHeaderFPS asserts sampled mode honors the
@@ -465,8 +465,8 @@ func TestVideoEstimator_SampledIgnoresHeaderFPS(t *testing.T) {
465465
require.NoError(t, err)
466466
fps60, err := b.produce(videoCtx(videoMetadata{duration: 3, fps: 60}), chatVideoBody("https://example.com/clip.mp4"))
467467
require.NoError(t, err)
468-
assert.Equal(t, 6, fps30.MultiModalFeatures[0].Length)
469-
assert.Equal(t, fps30.MultiModalFeatures[0].Length, fps60.MultiModalFeatures[0].Length, "sampled mode must ignore header source fps")
468+
assert.Equal(t, 6, fps30.Prompts[0].MultiModalFeatures[0].Length)
469+
assert.Equal(t, fps30.Prompts[0].MultiModalFeatures[0].Length, fps60.Prompts[0].MultiModalFeatures[0].Length, "sampled mode must ignore header source fps")
470470
}
471471

472472
// TestVideoEstimator_NoHeadersUseDefaults asserts that without header metadata the
@@ -476,7 +476,7 @@ func TestVideoEstimator_NoHeadersUseDefaults(t *testing.T) {
476476
require.NoError(t, err)
477477
frames := defaultVideoDuration * defaultVideoSampleFPS
478478
tpf := (defaultVideoWidth * defaultVideoHeight) / videoTokenFactor
479-
assert.Equal(t, frames*tpf, tp.MultiModalFeatures[0].Length, "default video length")
479+
assert.Equal(t, frames*tpf, tp.Prompts[0].MultiModalFeatures[0].Length, "default video length")
480480
}
481481

482482
// TestVideoEstimator_TemporalMergeAndMinFrames asserts sampled frames are floored
@@ -490,11 +490,11 @@ func TestVideoEstimator_TemporalMergeAndMinFrames(t *testing.T) {
490490
// 10s: 10*2 = 20 sampled frames, /2 temporal merge = 10 groups.
491491
long, err := b.produce(videoCtx(videoMetadata{duration: 10}), chatVideoBody("https://example.com/clip.mp4"))
492492
require.NoError(t, err)
493-
assert.Equal(t, 10, long.MultiModalFeatures[0].Length)
493+
assert.Equal(t, 10, long.Prompts[0].MultiModalFeatures[0].Length)
494494
// 1s: 2 sampled frames floored to minFrames 4, /2 merge = 2 groups.
495495
short, err := b.produce(videoCtx(videoMetadata{duration: 1}), chatVideoBody("https://example.com/clip.mp4"))
496496
require.NoError(t, err)
497-
assert.Equal(t, 2, short.MultiModalFeatures[0].Length)
497+
assert.Equal(t, 2, short.Prompts[0].MultiModalFeatures[0].Length)
498498
}
499499

500500
// TestVideoEstimator_HeaderRespectsMaxVideoTokens asserts the overall cap still
@@ -504,7 +504,7 @@ func TestVideoEstimator_HeaderRespectsMaxVideoTokens(t *testing.T) {
504504
// Uncapped would be 6*75 = 450; capped to 100.
505505
tp, err := b.produce(videoCtx(videoMetadata{width: 320, height: 240, duration: 3}), chatVideoBody("https://example.com/clip.mp4"))
506506
require.NoError(t, err)
507-
assert.Equal(t, 100, tp.MultiModalFeatures[0].Length)
507+
assert.Equal(t, 100, tp.Prompts[0].MultiModalFeatures[0].Length)
508508
}
509509

510510
// TestEstimateBackend_MessagesImageFeature asserts an Anthropic messages image

0 commit comments

Comments
 (0)