From 4160a7006e475e20ea598e4b82d9a9094f6e2b7b Mon Sep 17 00:00:00 2001 From: Adil Hafeez Date: Fri, 16 May 2025 17:39:57 -0700 Subject: [PATCH] fix model handling --- crates/llm_gateway/src/stream_context.rs | 30 +++++++++++------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/crates/llm_gateway/src/stream_context.rs b/crates/llm_gateway/src/stream_context.rs index 8fc92787..c5cdfe32 100644 --- a/crates/llm_gateway/src/stream_context.rs +++ b/crates/llm_gateway/src/stream_context.rs @@ -339,24 +339,22 @@ impl HttpContext for StreamContext { }; let model_requested = deserialized_body.model.clone(); - if deserialized_body.model.is_empty() || deserialized_body.model.to_lowercase() == "none" { - deserialized_body.model = match model_name { - Some(model_name) => model_name.clone(), - None => { - if use_agent_orchestrator { - "agent_orchestrator".to_string() - } else { - self.send_server_error( - ServerError::BadRequest { - why: format!("No model specified in request and couldn't determine model name from arch_config. Model name in req: {}, arch_config, provider: {}, model: {:?}", deserialized_body.model, self.llm_provider().name, self.llm_provider().model).to_string(), - }, - Some(StatusCode::BAD_REQUEST), - ); - return Action::Continue; - } + deserialized_body.model = match model_name { + Some(model_name) => model_name.clone(), + None => { + if use_agent_orchestrator { + "agent_orchestrator".to_string() + } else { + self.send_server_error( + ServerError::BadRequest { + why: format!("No model specified in request and couldn't determine model name from arch_config. Model name in req: {}, arch_config, provider: {}, model: {:?}", deserialized_body.model, self.llm_provider().name, self.llm_provider().model).to_string(), + }, + Some(StatusCode::BAD_REQUEST), + ); + return Action::Continue; } } - } + }; info!( "on_http_request_body: provider: {}, model requested: {}, model selected: {}",