pub struct GatewayConfig {
pub enabled: bool,
pub routes: Vec<GatewayRoute>,
pub default_provider: Option<ProviderId>,
pub allow_unlisted_models: bool,
pub auth_scheme: String,
pub inference_path_prefix: String,
}Expand description
Runtime gateway configuration: the post-resolution shape every non-loader caller sees.
Not Deserialize: the only legal construction paths are
GatewayConfigSpec::resolve for the production loader and direct
struct-literal construction in tests.
Fields§
§enabled: bool§routes: Vec<GatewayRoute>§default_provider: Option<ProviderId>§allow_unlisted_models: bool§auth_scheme: String§inference_path_prefix: StringImplementations§
Source§impl GatewayConfig
impl GatewayConfig
pub fn find_route(&self, model: &str) -> Option<&GatewayRoute>
pub fn candidate_routes<'a>( &'a self, registry: &ProviderRegistry, ) -> impl Iterator<Item = Cow<'a, GatewayRoute>>
pub fn resolve_route<'a>( &'a self, registry: &ProviderRegistry, model: &str, ) -> Option<Cow<'a, GatewayRoute>>
pub fn dispatchable_route_ids( &self, registry: &ProviderRegistry, ) -> Vec<RouteId>
Sourcepub fn is_model_exposed(&self, registry: &ProviderRegistry, model: &str) -> bool
pub fn is_model_exposed(&self, registry: &ProviderRegistry, model: &str) -> bool
Closed-allowlist posture: a model matching no explicit route and not a
registered provider model is dispatchable only when default_provider
is set and Self::allow_unlisted_models opts in. Otherwise it
is denied before dispatch rather than silently billed.
pub fn validate(&self, registry: &ProviderRegistry) -> GatewayResult<()>
pub fn to_spec(&self) -> GatewayConfigSpec
Trait Implementations§
Source§impl Clone for GatewayConfig
impl Clone for GatewayConfig
Source§fn clone(&self) -> GatewayConfig
fn clone(&self) -> GatewayConfig
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for GatewayConfig
impl Debug for GatewayConfig
Auto Trait Implementations§
impl Freeze for GatewayConfig
impl RefUnwindSafe for GatewayConfig
impl Send for GatewayConfig
impl Sync for GatewayConfig
impl Unpin for GatewayConfig
impl UnsafeUnpin for GatewayConfig
impl UnwindSafe for GatewayConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more