@@ -525,6 +525,54 @@ func TestRenderStep_GenerateFormat_MultipleImages(t *testing.T) {
525525 }
526526}
527527
528+ func TestRenderStep_GenerateFormat_MalformedFeatures (t * testing.T ) {
529+ for _ , tc := range []struct {
530+ name string
531+ features any
532+ }{
533+ {"string" , "not-an-object" },
534+ {"array" , []any {"a" , "b" }},
535+ {"number" , float64 (42 )},
536+ } {
537+ t .Run (tc .name , func (t * testing.T ) {
538+ step , _ := NewRenderStep (nil , map [string ]any {})
539+ reqCtx := & pipeline.RequestContext {
540+ OriginalPath : gateway .DefaultGeneratePath ,
541+ Body : map [string ]any {
542+ "model" : "test-model" ,
543+ "token_ids" : []any {float64 (1 ), float64 (2 ), float64 (3 )},
544+ "features" : tc .features ,
545+ },
546+ }
547+ err := step .Execute (context .Background (), reqCtx )
548+ if err == nil {
549+ t .Fatal ("expected error for malformed features" )
550+ }
551+ if ! errors .Is (err , pipeline .ErrBadRequest ) {
552+ t .Errorf ("expected ErrBadRequest, got %v" , err )
553+ }
554+ })
555+ }
556+ }
557+
558+ func TestRenderStep_GenerateFormat_NullFeatures (t * testing.T ) {
559+ step , _ := NewRenderStep (nil , map [string ]any {})
560+ reqCtx := & pipeline.RequestContext {
561+ OriginalPath : gateway .DefaultGeneratePath ,
562+ Body : map [string ]any {
563+ "model" : "test-model" ,
564+ "token_ids" : []any {float64 (1 ), float64 (2 ), float64 (3 )},
565+ "features" : nil ,
566+ },
567+ }
568+ if err := step .Execute (context .Background (), reqCtx ); err != nil {
569+ t .Fatalf ("unexpected error for null features: %v" , err )
570+ }
571+ if len (reqCtx .MultimodalEntries ) != 0 {
572+ t .Fatalf ("expected no multimodal entries, got %d" , len (reqCtx .MultimodalEntries ))
573+ }
574+ }
575+
528576func TestRenderStep_GenerateFormat_MissingTokenIDs (t * testing.T ) {
529577 step , _ := NewRenderStep (nil , map [string ]any {})
530578 reqCtx := & pipeline.RequestContext {
0 commit comments