pub struct ModelProviderParser { /* private fields */ }Expand description
Parser that turns a provider:model string (e.g. anthropic:claude-sonnet-4.5) into
a StreamingLlmProvider
Implementations§
Source§impl ModelProviderParser
impl ModelProviderParser
Sourcepub fn new(factories: HashMap<String, CreateProviderFn>) -> Self
pub fn new(factories: HashMap<String, CreateProviderFn>) -> Self
Create a new parser with custom provider factories
Source§impl ModelProviderParser
impl ModelProviderParser
pub fn with_provider<P: ProviderFactory + StreamingModelProvider + 'static>( self, name: impl Into<String>, ) -> Self
pub fn with_openai_provider( self, name: impl Into<String>, config: &'static ProviderConfig, ) -> Self
Sourcepub fn create_provider(
&self,
model: &LlmModel,
) -> Result<Box<dyn StreamingModelProvider>>
pub fn create_provider( &self, model: &LlmModel, ) -> Result<Box<dyn StreamingModelProvider>>
Create a provider from a typed LlmModel
Sourcepub fn parse(
&self,
models_str: &str,
) -> Result<(Box<dyn StreamingModelProvider>, LlmModel)>
pub fn parse( &self, models_str: &str, ) -> Result<(Box<dyn StreamingModelProvider>, LlmModel)>
Parse a model specification string and create a provider instance.
Returns both the provider and an LlmModel describing the identity
of the first (or only) provider in the spec.
§Format
"provider:model"- Single provider (e.g., “anthropic:claude-3.5-sonnet”)"provider1:model1,provider2:model2"- Multiple providers create anAlloyedModelProvider
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ModelProviderParser
impl !RefUnwindSafe for ModelProviderParser
impl Send for ModelProviderParser
impl Sync for ModelProviderParser
impl Unpin for ModelProviderParser
impl UnsafeUnpin for ModelProviderParser
impl !UnwindSafe for ModelProviderParser
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 moreCreates a shared type from an unshared type.