pub struct RoutedProvider { /* private fields */ }Expand description
A ModelProvider that routes requests to different models based on
ModelHint.
Providers are pre-created at construction time — one per unique model name in the config. Provider selection is a simple HashMap lookup with no allocation on the hot path.
Implementations§
Source§impl RoutedProvider
impl RoutedProvider
pub fn new(config: RoutedModelConfig) -> Self
Trait Implementations§
Source§impl ModelProvider for RoutedProvider
impl ModelProvider for RoutedProvider
Source§fn complete<'life0, 'async_trait>(
&'life0 self,
request: CompletionRequest,
) -> Pin<Box<dyn Future<Output = Result<CompletionResponse, AgentError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn complete<'life0, 'async_trait>(
&'life0 self,
request: CompletionRequest,
) -> Pin<Box<dyn Future<Output = Result<CompletionResponse, AgentError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Issue a single non-streaming completion request.
Source§fn stream_complete<'a>(
&'a self,
request: CompletionRequest,
) -> Pin<Box<dyn Stream<Item = Result<ProviderEvent, AgentError>> + Send + 'a>>
fn stream_complete<'a>( &'a self, request: CompletionRequest, ) -> Pin<Box<dyn Stream<Item = Result<ProviderEvent, AgentError>> + Send + 'a>>
Stream a completion as a sequence of
ProviderEvents. Read moreSource§fn estimate_tokens(&self, text: &str) -> usize
fn estimate_tokens(&self, text: &str) -> usize
Estimate the number of tokens for the given text. Read more
Source§fn max_tokens(&self) -> u32
fn max_tokens(&self) -> u32
Return the maximum number of tokens that can be requested from this provider. Read more
Auto Trait Implementations§
impl Freeze for RoutedProvider
impl !RefUnwindSafe for RoutedProvider
impl Send for RoutedProvider
impl Sync for RoutedProvider
impl Unpin for RoutedProvider
impl UnsafeUnpin for RoutedProvider
impl !UnwindSafe for RoutedProvider
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