llm listener split (#155)

This commit is contained in:
Adil Hafeez 2024-10-09 15:47:32 -07:00 committed by GitHub
parent 8b5db45507
commit e81ca8d5cf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 305 additions and 54 deletions

View file

@ -13,6 +13,20 @@ pub struct Tracing {
pub sampling_rate: Option<f64>,
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Hash)]
pub enum GatewayMode {
#[serde(rename = "llm")]
Llm,
#[serde(rename = "prompt")]
Prompt,
}
impl Default for GatewayMode {
fn default() -> Self {
GatewayMode::Prompt
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Configuration {
pub version: String,
@ -26,6 +40,7 @@ pub struct Configuration {
pub error_target: Option<ErrorTargetDetail>,
pub ratelimits: Option<Vec<Ratelimit>>,
pub tracing: Option<Tracing>,
pub mode: Option<GatewayMode>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
@ -283,5 +298,11 @@ mod test {
let tracing = config.tracing.as_ref().unwrap();
assert_eq!(tracing.sampling_rate.unwrap(), 0.1);
let mode = config
.mode
.as_ref()
.unwrap_or(&super::GatewayMode::Prompt);
assert_eq!(*mode, super::GatewayMode::Prompt);
}
}