@@ -20,6 +20,7 @@ import (
2020
2121 "github.com/envoyproxy/ai-gateway/internal/extproc/translator"
2222 "github.com/envoyproxy/ai-gateway/internal/filterapi"
23+ "github.com/envoyproxy/ai-gateway/internal/internalapi"
2324 "github.com/envoyproxy/ai-gateway/internal/llmcostcel"
2425 tracing "github.com/envoyproxy/ai-gateway/internal/tracing/api"
2526)
@@ -110,7 +111,7 @@ func Test_imageGenerationProcessorRouterFilter_ProcessRequestBody(t *testing.T)
110111 headers := map [string ]string {":path" : "/v1/images/generations" }
111112 const modelKey = "x-ai-gateway-model-key"
112113 p := & imageGenerationProcessorRouterFilter {
113- config : & processorConfig {modelNameHeaderKey : modelKey },
114+ config : & processorConfig {},
114115 requestHeaders : headers ,
115116 logger : slog .Default (),
116117 tracer : tracing.NoopTracing {}.ImageGenerationTracer (),
@@ -133,12 +134,11 @@ func Test_imageGenerationProcessorRouterFilter_ProcessRequestBody(t *testing.T)
133134
134135 t .Run ("span creation" , func (t * testing.T ) {
135136 headers := map [string ]string {":path" : "/v1/images/generations" }
136- const modelKey = "x-ai-gateway-model-key"
137137 span := & mockImageGenerationSpan {}
138138 mockTracerInstance := & mockImageGenerationTracer {returnedSpan : span }
139139
140140 p := & imageGenerationProcessorRouterFilter {
141- config : & processorConfig {modelNameHeaderKey : modelKey },
141+ config : & processorConfig {},
142142 requestHeaders : headers ,
143143 logger : slog .Default (),
144144 tracer : mockTracerInstance ,
@@ -233,8 +233,6 @@ func Test_imageGenerationProcessorUpstreamFilter_ProcessResponseBody(t *testing.
233233 logger : slog .New (slog .NewTextHandler (io .Discard , & slog.HandlerOptions {})),
234234 metrics : mm ,
235235 config : & processorConfig {
236- metadataNamespace : "ai_gateway_llm_ns" ,
237- modelNameHeaderKey : "x-aigw-model" ,
238236 requestCosts : []processorConfigRequestCost {
239237 {LLMRequestCost : & filterapi.LLMRequestCost {Type : filterapi .LLMRequestCostTypeOutputToken , MetadataKey : "output_token_usage" }},
240238 {LLMRequestCost : & filterapi.LLMRequestCost {Type : filterapi .LLMRequestCostTypeInputToken , MetadataKey : "input_token_usage" }},
@@ -299,12 +297,12 @@ func Test_imageGenerationProcessorUpstreamFilter_ProcessResponseBody(t *testing.
299297
300298func Test_imageGenerationProcessorUpstreamFilter_ProcessRequestHeaders (t * testing.T ) {
301299 t .Run ("ok with auth handler and header mutator" , func (t * testing.T ) {
302- headers := map [string ]string {":path" : "/v1/images/generations" , "x-model" : "dall-e-3" }
300+ headers := map [string ]string {":path" : "/v1/images/generations" , internalapi . ModelNameHeaderKeyDefault : "dall-e-3" }
303301 mm := & mockImageGenerationMetrics {}
304302 body := & openaisdk.ImageGenerateParams {Model : openaisdk .ImageModel ("dall-e-3" ), Prompt : "a cat" }
305303 mt := & mockImageGenerationTranslator {t : t , expRequestBody : body }
306304 p := & imageGenerationProcessorUpstreamFilter {
307- config : & processorConfig {modelNameHeaderKey : "x-model" },
305+ config : & processorConfig {},
308306 requestHeaders : headers ,
309307 logger : slog .Default (),
310308 metrics : mm ,
@@ -344,8 +342,8 @@ func Test_imageGenerationProcessorUpstreamFilter_SetBackend(t *testing.T) {
344342 // Supported OpenAI schema.
345343 rp := & imageGenerationProcessorRouterFilter {originalRequestBody : & openaisdk.ImageGenerateParams {}}
346344 p2 := & imageGenerationProcessorUpstreamFilter {
347- config : & processorConfig {modelNameHeaderKey : "x-model-name" },
348- requestHeaders : map [string ]string {"x-model-name" : "dall-e-2" },
345+ config : & processorConfig {},
346+ requestHeaders : map [string ]string {internalapi . ModelNameHeaderKeyDefault : "dall-e-2" },
349347 logger : slog .Default (),
350348 metrics : & mockImageGenerationMetrics {},
351349 }
@@ -355,7 +353,7 @@ func Test_imageGenerationProcessorUpstreamFilter_SetBackend(t *testing.T) {
355353 ModelNameOverride : "gpt-image-1" ,
356354 }, nil , rp )
357355 require .NoError (t , err )
358- require .Equal (t , "gpt-image-1" , p2 .requestHeaders ["x-model-name" ])
356+ require .Equal (t , "gpt-image-1" , p2 .requestHeaders [internalapi . ModelNameHeaderKeyDefault ])
359357}
360358
361359func TestImageGeneration_ParseBody (t * testing.T ) {
0 commit comments