From 6fb15172a1cf7c39f4108216544a075deb592d9b Mon Sep 17 00:00:00 2001 From: Adil Hafeez Date: Wed, 11 Jun 2025 14:30:31 -0700 Subject: [PATCH] fix int tests --- crates/common/src/consts.rs | 3 +-- crates/llm_gateway/src/stream_context.rs | 5 ++--- crates/llm_gateway/tests/integration.rs | 2 -- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/crates/common/src/consts.rs b/crates/common/src/consts.rs index 9eee4693..3ff2ce5e 100644 --- a/crates/common/src/consts.rs +++ b/crates/common/src/consts.rs @@ -11,8 +11,7 @@ pub const MODEL_SERVER_NAME: &str = "model_server"; pub const ARCH_ROUTING_HEADER: &str = "x-arch-llm-provider"; pub const MESSAGES_KEY: &str = "messages"; pub const ARCH_PROVIDER_HINT_HEADER: &str = "x-arch-llm-provider-hint"; -pub const CHAT_COMPLETIONS_PATH: [&str; 2] = - ["/v1/chat/completions", "/openai/v1/chat/completions"]; +pub const CHAT_COMPLETIONS_PATH: &str = "/v1/chat/completions"; pub const HEALTHZ_PATH: &str = "/healthz"; pub const X_ARCH_STATE_HEADER: &str = "x-arch-state"; pub const X_ARCH_API_RESPONSE: &str = "x-arch-api-response-message"; diff --git a/crates/llm_gateway/src/stream_context.rs b/crates/llm_gateway/src/stream_context.rs index 2f1fedf1..050afce9 100644 --- a/crates/llm_gateway/src/stream_context.rs +++ b/crates/llm_gateway/src/stream_context.rs @@ -215,6 +215,8 @@ impl HttpContext for StreamContext { return Action::Continue; } + self.is_chat_completions_request = CHAT_COMPLETIONS_PATH == request_path; + let use_agent_orchestrator = match self.overrides.as_ref() { Some(overrides) => overrides.use_agent_orchestrator.unwrap_or_default(), None => false, @@ -222,9 +224,6 @@ impl HttpContext for StreamContext { let routing_header_value = self.get_http_request_header(ARCH_ROUTING_HEADER); - let request_path = self.get_http_request_header(":path").unwrap_or_default(); - self.is_chat_completions_request = CHAT_COMPLETIONS_PATH.contains(&request_path.as_str()); - if routing_header_value.is_some() && !routing_header_value.as_ref().unwrap().is_empty() { let routing_header_value = routing_header_value.as_ref().unwrap(); info!("routing header already set: {}", routing_header_value); diff --git a/crates/llm_gateway/tests/integration.rs b/crates/llm_gateway/tests/integration.rs index d6cf001f..80c5e5da 100644 --- a/crates/llm_gateway/tests/integration.rs +++ b/crates/llm_gateway/tests/integration.rs @@ -54,8 +54,6 @@ fn request_headers_expectations(module: &mut Tester, http_context: i32) { .returning(Some("selector-key")) .expect_get_header_map_value(Some(MapType::HttpRequestHeaders), Some("selector-key")) .returning(Some("selector-value")) - .expect_get_header_map_value(Some(MapType::HttpRequestHeaders), Some(":path")) - .returning(Some("/v1/chat/completions")) .expect_get_header_map_value(Some(MapType::HttpRequestHeaders), Some("x-request-id")) .returning(None) .expect_get_header_map_value(Some(MapType::HttpRequestHeaders), Some("traceparent"))