The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
test(ai-gateway): cover the blank session id and model fallbacks
mateo-berri70dc0a69a4bb
diff --git a/litellm-rust/crates/ai-gateway/src/realtime/streaming.rs b/litellm-rust/crates/ai-gateway/src/realtime/streaming.rsindex edd9338b4f2..c0d72e90b77 100644--- a/litellm-rust/crates/ai-gateway/src/realtime/streaming.rs+++ b/litellm-rust/crates/ai-gateway/src/realtime/streaming.rs@@ -323,6 +323,32 @@ mod tests {assert_eq!(streaming.dropped(), 0);}+ #[test]+ fn blank_session_id_and_model_keep_the_gateway_fallbacks() {+ let mut streaming = RealTimeStreaming::new(+ Vec::new(),+ "call_fallback".to_string(),+ "gpt-realtime".to_string(),+ RequestMetadata::default(),+ );++ streaming.observe(&event(+ r#"{"type":"session.created","session":{"id":"","model":""}}"#,+ ));+ let payload = streaming.build_payload();+ assert_eq!(payload.id, "call_fallback");+ assert_eq!(payload.litellm_call_id, "call_fallback");+ assert_eq!(payload.model, "gpt-realtime");++ streaming.observe(&event(+ r#"{"type":"session.updated","session":{"id":"sess_002","model":""}}"#,+ ));+ let payload = streaming.build_payload();+ assert_eq!(payload.id, "sess_002");+ assert_eq!(payload.litellm_call_id, "sess_002");+ assert_eq!(payload.model, "gpt-realtime");+ }+#[test]fn payload_serializes_with_camelcase_times_and_realtime_call_type() {let mut streaming = RealTimeStreaming::new(