Skip to main content

grate_limiter/
capability.rs

1use serde::{Deserialize, Serialize};
2
3/// Configuration for a capability (e.g., "chat-completion", "image-generation").
4#[derive(Debug, Clone, Serialize, Deserialize)]
5pub struct CapabilityConfig {
6    /// Unique capability name.
7    pub name: String,
8    /// Providers that can fulfill this capability, with per-capability priority.
9    pub providers: Vec<CapabilityProvider>,
10}
11
12/// A provider registered under a capability with its priority for that capability.
13#[derive(Debug, Clone, Serialize, Deserialize)]
14pub struct CapabilityProvider {
15    /// Provider name (must be registered via `upsert_provider`).
16    pub provider: String,
17    /// Priority for this capability (higher = preferred). Overrides provider-level priority.
18    pub priority: u16,
19}