mirror of
https://github.com/katanemo/plano.git
synced 2026-05-03 12:52:56 +02:00
Add Ratelimit config (#32)
Signed-off-by: José Ulises Niño Rivera <junr03@users.noreply.github.com>
This commit is contained in:
parent
445b1ea210
commit
2a4cde950d
1 changed files with 34 additions and 2 deletions
|
|
@ -9,6 +9,32 @@ pub struct Configuration {
|
|||
pub llm_providers: Vec<LlmProvider>,
|
||||
pub system_prompt: Option<String>,
|
||||
pub prompt_targets: Vec<PromptTarget>,
|
||||
pub ratelimits: Option<Vec<Ratelimit>>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct Ratelimit {
|
||||
provider: String,
|
||||
selectors: Vec<Header>,
|
||||
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<String>,
|
||||
}
|
||||
|
||||
#[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]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue