// Common types shared across all protocol implementations use serde::{Deserialize, Serialize}; /// Helper function for serde default value pub fn default_true() -> bool { true } /// Common trait for all generation requests across different APIs pub trait GenerationRequest: Send + Sync { /// Check if the request is for streaming fn is_stream(&self) -> bool; /// Get the model name if specified fn get_model(&self) -> Option<&str>; /// Extract text content for routing decisions fn extract_text_for_routing(&self) -> String; } /// Helper type for string or array of strings #[derive(Debug, Clone, Deserialize, Serialize)] #[serde(untagged)] pub enum StringOrArray { String(String), Array(Vec), } /// LoRA adapter path - can be single path or batch of paths (SGLang extension) #[derive(Debug, Clone, Deserialize, Serialize)] #[serde(untagged)] pub enum LoRAPath { Single(Option), Batch(Vec>), }