pub struct ProviderRegistry { /* private fields */ }Expand description
Resolves model ids of the form <provider><separator><model>.
Implementations§
Source§impl ProviderRegistry
impl ProviderRegistry
Sourcepub fn builder() -> ProviderRegistryBuilder
pub fn builder() -> ProviderRegistryBuilder
Starts building a registry.
Sourcepub fn provider_ids(&self) -> impl Iterator<Item = &str> + '_
pub fn provider_ids(&self) -> impl Iterator<Item = &str> + '_
The registered provider ids.
Sourcepub fn provider(&self, id: &str) -> Option<&ProviderRef>
pub fn provider(&self, id: &str) -> Option<&ProviderRef>
Looks up a provider by id.
Sourcepub fn language_model(&self, id: &str) -> Result<LanguageModelRef, Error>
pub fn language_model(&self, id: &str) -> Result<LanguageModelRef, Error>
Resolves a language model, applying the registry middleware.
§Errors
Error::NoSuchProvider for unknown providers or malformed ids,
Error::Provider (NoSuchModel) from the provider.
Sourcepub fn embedding_model(&self, id: &str) -> Result<EmbeddingModelRef, Error>
pub fn embedding_model(&self, id: &str) -> Result<EmbeddingModelRef, Error>
Resolves an embedding model, applying the registry middleware.
§Errors
Sourcepub fn image_model(&self, id: &str) -> Result<ImageModelRef, Error>
pub fn image_model(&self, id: &str) -> Result<ImageModelRef, Error>
Resolves an image model, applying the registry middleware.
§Errors
Sourcepub fn transcription_model(
&self,
id: &str,
) -> Result<TranscriptionModelRef, Error>
pub fn transcription_model( &self, id: &str, ) -> Result<TranscriptionModelRef, Error>
Sourcepub fn speech_model(&self, id: &str) -> Result<SpeechModelRef, Error>
pub fn speech_model(&self, id: &str) -> Result<SpeechModelRef, Error>
Sourcepub fn reranking_model(&self, id: &str) -> Result<RerankingModelRef, Error>
pub fn reranking_model(&self, id: &str) -> Result<RerankingModelRef, Error>
Sourcepub fn video_model(&self, id: &str) -> Result<VideoModelRef, Error>
pub fn video_model(&self, id: &str) -> Result<VideoModelRef, Error>
Sourcepub fn speech_translation_model(
&self,
id: &str,
) -> Result<SpeechTranslationModelRef, Error>
pub fn speech_translation_model( &self, id: &str, ) -> Result<SpeechTranslationModelRef, Error>
Sourcepub fn realtime_model(&self, id: &str) -> Result<RealtimeModelRef, Error>
pub fn realtime_model(&self, id: &str) -> Result<RealtimeModelRef, Error>
Resolves a realtime model through the provider’s realtime factory.
§Errors
See ProviderRegistry::language_model; providers without realtime
support yield a NoSuchModel error.
Trait Implementations§
Source§impl Clone for ProviderRegistry
impl Clone for ProviderRegistry
Source§fn clone(&self) -> ProviderRegistry
fn clone(&self) -> ProviderRegistry
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 ProviderRegistry
impl Debug for ProviderRegistry
Source§impl Provider for ProviderRegistry
impl Provider for ProviderRegistry
Source§fn provider_id(&self) -> &ProviderId
fn provider_id(&self) -> &ProviderId
Provider identifier, for example
openai.Source§fn language_model(
&self,
model_id: &str,
) -> Result<LanguageModelRef, NoSuchModelError>
fn language_model( &self, model_id: &str, ) -> Result<LanguageModelRef, NoSuchModelError>
Returns the language model with
model_id. Read moreSource§fn embedding_model(
&self,
model_id: &str,
) -> Result<EmbeddingModelRef, NoSuchModelError>
fn embedding_model( &self, model_id: &str, ) -> Result<EmbeddingModelRef, NoSuchModelError>
Returns the embedding model with
model_id. Read moreSource§fn image_model(&self, model_id: &str) -> Result<ImageModelRef, NoSuchModelError>
fn image_model(&self, model_id: &str) -> Result<ImageModelRef, NoSuchModelError>
Returns the image model with
model_id. Read moreSource§fn transcription_model(
&self,
model_id: &str,
) -> Result<TranscriptionModelRef, NoSuchModelError>
fn transcription_model( &self, model_id: &str, ) -> Result<TranscriptionModelRef, NoSuchModelError>
Returns the transcription model with
model_id. Read moreSource§fn speech_model(
&self,
model_id: &str,
) -> Result<SpeechModelRef, NoSuchModelError>
fn speech_model( &self, model_id: &str, ) -> Result<SpeechModelRef, NoSuchModelError>
Returns the speech model with
model_id. Read moreSource§fn reranking_model(
&self,
model_id: &str,
) -> Result<RerankingModelRef, NoSuchModelError>
fn reranking_model( &self, model_id: &str, ) -> Result<RerankingModelRef, NoSuchModelError>
Returns the reranking model with
model_id. Read moreSource§fn video_model(&self, model_id: &str) -> Result<VideoModelRef, NoSuchModelError>
fn video_model(&self, model_id: &str) -> Result<VideoModelRef, NoSuchModelError>
Returns the video model with
model_id. Read moreSource§fn speech_translation_model(
&self,
model_id: &str,
) -> Result<SpeechTranslationModelRef, NoSuchModelError>
fn speech_translation_model( &self, model_id: &str, ) -> Result<SpeechTranslationModelRef, NoSuchModelError>
Returns the speech translation model with
model_id. Read moreSource§fn realtime(&self) -> Option<ServiceRef<dyn DynRealtimeFactory>>
fn realtime(&self) -> Option<ServiceRef<dyn DynRealtimeFactory>>
Returns the realtime factory, if the provider supports realtime sessions.
Source§fn files(&self) -> Option<ServiceRef<dyn DynFiles>>
fn files(&self) -> Option<ServiceRef<dyn DynFiles>>
Returns the files service, if the provider supports file storage.
Auto Trait Implementations§
impl !RefUnwindSafe for ProviderRegistry
impl !UnwindSafe for ProviderRegistry
impl Freeze for ProviderRegistry
impl Send for ProviderRegistry
impl Sync for ProviderRegistry
impl Unpin for ProviderRegistry
impl UnsafeUnpin for ProviderRegistry
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