mirror of
https://github.com/katanemo/plano.git
synced 2026-06-02 14:35:14 +02:00
restructure model_metrics_sources to use type + provider pattern
This commit is contained in:
parent
e5751d6b13
commit
ba701264be
7 changed files with 142 additions and 299 deletions
|
|
@ -127,32 +127,39 @@ pub struct TopLevelRoutingPreference {
|
|||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct MetricsAuth {
|
||||
#[serde(rename = "type")]
|
||||
pub auth_type: String, // only "bearer" supported
|
||||
pub token: String,
|
||||
#[serde(tag = "type", rename_all = "snake_case")]
|
||||
pub enum MetricsSource {
|
||||
Cost(CostMetricsConfig),
|
||||
Latency(LatencyMetricsConfig),
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(tag = "type", rename_all = "snake_case")]
|
||||
pub enum MetricsSource {
|
||||
CostMetrics {
|
||||
url: String,
|
||||
refresh_interval: Option<u64>,
|
||||
auth: Option<MetricsAuth>,
|
||||
},
|
||||
PrometheusMetrics {
|
||||
url: String,
|
||||
query: String,
|
||||
refresh_interval: Option<u64>,
|
||||
},
|
||||
#[serde(rename = "digitalocean_pricing")]
|
||||
DigitalOceanPricing {
|
||||
refresh_interval: Option<u64>,
|
||||
/// Map DO catalog keys (`lowercase(creator)/model_id`) to Plano model names.
|
||||
/// Example: `openai/openai-gpt-oss-120b: openai/gpt-4o`
|
||||
model_aliases: Option<HashMap<String, String>>,
|
||||
},
|
||||
pub struct CostMetricsConfig {
|
||||
pub provider: CostProvider,
|
||||
pub refresh_interval: Option<u64>,
|
||||
/// Map DO catalog keys (`lowercase(creator)/model_id`) to Plano model names.
|
||||
/// Example: `openai/openai-gpt-oss-120b: openai/gpt-4o`
|
||||
pub model_aliases: Option<HashMap<String, String>>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum CostProvider {
|
||||
Digitalocean,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct LatencyMetricsConfig {
|
||||
pub provider: LatencyProvider,
|
||||
pub url: String,
|
||||
pub query: String,
|
||||
pub refresh_interval: Option<u64>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum LatencyProvider {
|
||||
Prometheus,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue