From d63b9f53981150c8a2f3c8b25104689662ea5067 Mon Sep 17 00:00:00 2001 From: Adil Hafeez Date: Thu, 10 Jul 2025 15:55:47 -0700 Subject: [PATCH] fix rust tests --- crates/llm_gateway/src/stream_context.rs | 5 ----- crates/llm_gateway/tests/integration.rs | 13 ++++++++----- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/crates/llm_gateway/src/stream_context.rs b/crates/llm_gateway/src/stream_context.rs index d6be1749..b25c0c75 100644 --- a/crates/llm_gateway/src/stream_context.rs +++ b/crates/llm_gateway/src/stream_context.rs @@ -307,11 +307,6 @@ impl HttpContext for StreamContext { } }; - debug!( - "on_http_request_body: deserialized body: {}", - serde_json::to_string(&deserialized_body).unwrap_or_default() - ); - self.user_message = deserialized_body .messages .iter() diff --git a/crates/llm_gateway/tests/integration.rs b/crates/llm_gateway/tests/integration.rs index 80c5e5da..f97d87d3 100644 --- a/crates/llm_gateway/tests/integration.rs +++ b/crates/llm_gateway/tests/integration.rs @@ -30,7 +30,10 @@ fn request_headers_expectations(module: &mut Tester, http_context: i32) { Some("x-arch-llm-provider-hint"), ) .returning(None) - .expect_log(Some(LogLevel::Debug), Some("request received: llm provider hint: default, selected llm: open-ai-gpt-4, model: gpt-4")) + .expect_log( + Some(LogLevel::Debug), + Some("request received: llm provider hint: default, selected provider: open-ai-gpt-4"), + ) .expect_add_header_map_value( Some(MapType::HttpRequestHeaders), Some("x-arch-llm-provider"), @@ -263,7 +266,7 @@ fn llm_gateway_bad_request_to_open_ai_chat_completions() { .expect_get_buffer_bytes(Some(BufferType::HttpRequestBody)) .returning(Some(incomplete_chat_completions_request_body)) .expect_log(Some(LogLevel::Debug), None) - .expect_log(Some(LogLevel::Info), Some("on_http_request_body: provider: open-ai-gpt-4, model requested: gpt-1, model selected: gpt-4")) + .expect_log(Some(LogLevel::Info), Some("on_http_request_body: provider: openai, model requested (in body): gpt-1, model selected: gpt-4")) .expect_send_local_response( Some(StatusCode::BAD_REQUEST.as_u16().into()), None, @@ -429,7 +432,7 @@ fn llm_gateway_override_model_name() { .returning(Some(chat_completions_request_body)) // The actual call is not important in this test, we just need to grab the token_id .expect_log(Some(LogLevel::Debug), None) - .expect_log(Some(LogLevel::Info), Some("on_http_request_body: provider: open-ai-gpt-4, model requested: gpt-1, model selected: gpt-4")) + .expect_log(Some(LogLevel::Info), Some("on_http_request_body: provider: openai, model requested (in body): gpt-1, model selected: gpt-4")) .expect_log(Some(LogLevel::Debug), None) .expect_log(Some(LogLevel::Debug), None) .expect_metric_record("input_sequence_length", 29) @@ -478,7 +481,7 @@ fn llm_gateway_override_use_default_model() { // The actual call is not important in this test, we just need to grab the token_id .expect_log( Some(LogLevel::Info), - Some("on_http_request_body: provider: open-ai-gpt-4, model requested: gpt-1, model selected: gpt-4"), + Some("on_http_request_body: provider: openai, model requested (in body): gpt-1, model selected: gpt-4"), ) .expect_log(Some(LogLevel::Debug), None) .expect_log(Some(LogLevel::Debug), None) @@ -526,7 +529,7 @@ fn llm_gateway_override_use_model_name_none() { .returning(Some(chat_completions_request_body)) // The actual call is not important in this test, we just need to grab the token_id .expect_log(Some(LogLevel::Debug), None) - .expect_log(Some(LogLevel::Info), Some("on_http_request_body: provider: open-ai-gpt-4, model requested: none, model selected: gpt-4")) + .expect_log(Some(LogLevel::Info), Some("on_http_request_body: provider: openai, model requested (in body): none, model selected: gpt-4")) .expect_log(Some(LogLevel::Debug), None) .expect_log(Some(LogLevel::Debug), None) .expect_metric_record("input_sequence_length", 29)