pub struct ConfigToolRoutingTable { /* private fields */ }Expand description
Configuration-driven tool routing table.
Routes incoming tool names to concrete provider targets using two strategies:
- Direct routing:
"provider:tool_id"routes directly to the named provider. - Tool lookup: Names are looked up in the
toolsmap, which supports prioritised failover and round-robin load balancing.
Unlike model routing, there is no default-provider fallback for tools.
Implementations§
Source§impl ConfigToolRoutingTable
impl ConfigToolRoutingTable
pub fn new( providers: HashMap<String, ProviderConfig>, tools: HashMap<String, ToolConfig>, ) -> Self
Sourcepub fn providers(&self) -> &HashMap<String, ProviderConfig>
pub fn providers(&self) -> &HashMap<String, ProviderConfig>
Returns a reference to the resolved provider configurations.
Sourcepub fn tools(&self) -> &HashMap<String, ToolConfig>
pub fn tools(&self) -> &HashMap<String, ToolConfig>
Returns a reference to the tool configurations.
Sourcepub fn providers_by_protocol(
&self,
) -> HashMap<ApiProtocol, Vec<(String, ProviderConfig)>>
pub fn providers_by_protocol( &self, ) -> HashMap<ApiProtocol, Vec<(String, ProviderConfig)>>
Groups providers by their ApiProtocol, considering only providers
that are actually referenced by at least one tool endpoint.
Providers without a resolvable api_protocol are skipped with a
warning log.
Sourcepub fn tool_pricing(&self, tool_name: &str) -> Option<&FlatPricing>
pub fn tool_pricing(&self, tool_name: &str) -> Option<&FlatPricing>
Returns the pricing configuration for a tool, if any.
Sourcepub fn resolve(&self, incoming: &str) -> Result<ResolvedTarget>
pub fn resolve(&self, incoming: &str) -> Result<ResolvedTarget>
Resolves an incoming tool name to a full target with any per-endpoint overrides.
Trait Implementations§
Source§impl RoutingTable for ConfigToolRoutingTable
impl RoutingTable for ConfigToolRoutingTable
Source§async fn route(
&self,
incoming_name: &str,
_context: &RouteContext,
) -> Result<RoutingTarget>
async fn route( &self, incoming_name: &str, _context: &RouteContext, ) -> Result<RoutingTarget>
Routes an incoming name to a routing target. Read more
Source§fn list_routes(&self) -> Vec<RouteEntry>
fn list_routes(&self) -> Vec<RouteEntry>
Lists all configured routes.
Source§impl ToolRegistry for ConfigToolRoutingTable
impl ToolRegistry for ConfigToolRoutingTable
Source§async fn list_tools(&self) -> Vec<ToolEntry>
async fn list_tools(&self) -> Vec<ToolEntry>
Lists all tools available through the router.
Auto Trait Implementations§
impl Freeze for ConfigToolRoutingTable
impl RefUnwindSafe for ConfigToolRoutingTable
impl Send for ConfigToolRoutingTable
impl Sync for ConfigToolRoutingTable
impl Unpin for ConfigToolRoutingTable
impl UnsafeUnpin for ConfigToolRoutingTable
impl UnwindSafe for ConfigToolRoutingTable
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more