diff --git a/envoyfilter/src/configuration.rs b/envoyfilter/src/configuration.rs index 4819e370..03df69f9 100644 --- a/envoyfilter/src/configuration.rs +++ b/envoyfilter/src/configuration.rs @@ -9,6 +9,32 @@ pub struct Configuration { pub llm_providers: Vec, pub system_prompt: Option, pub prompt_targets: Vec, + pub ratelimits: Option>, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct Ratelimit { + provider: String, + selectors: Vec
, + limit: Limit, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct Limit { + tokens: u32, + unit: TimeUnit, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub enum TimeUnit { + #[serde(rename = "minute")] + Minute, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct Header { + key: String, + value: Option, } #[derive(Debug, Clone, Serialize, Deserialize)] @@ -79,7 +105,6 @@ embedding_provider: model: "all-MiniLM-L6-v2" llm_providers: - - name: "open-ai-gpt-4" api_key: "$OPEN_AI_API_KEY" model: gpt-4 @@ -90,7 +115,6 @@ system_prompt: | - Use miles per hour for wind speed prompt_targets: - - type: context_resolver name: weather_forecast few_shot_examples: @@ -112,6 +136,14 @@ prompt_targets: path: /weather entities: - name: city + +ratelimits: + - provider: open-ai-gpt-4 + selectors: + - key: x-katanemo-openai-limit-id + limit: + tokens: 100 + unit: minute "#; #[test]