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 files(&self, provider_id: &str) -> Result<FilesRef, Error>
pub fn files(&self, provider_id: &str) -> Result<FilesRef, Error>
Resolves a file service by provider ID.
§Errors
Returns Error::NoSuchProvider for an unknown provider or a provider
ProviderError::UnsupportedFunctionality when file uploads are unavailable.
Sourcepub fn skills(&self, provider_id: &str) -> Result<SkillsRef, Error>
pub fn skills(&self, provider_id: &str) -> Result<SkillsRef, Error>
Resolves a skill service by provider ID.
§Errors
Returns Error::NoSuchProvider for an unknown provider or a provider
ProviderError::UnsupportedFunctionality when skills are unavailable.
Sourcepub fn register_provider(
&mut self,
id: impl Into<String>,
provider: ProviderRef,
)
pub fn register_provider( &mut self, id: impl Into<String>, provider: ProviderRef, )
Registers or replaces a provider for subsequent model resolutions.
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,
Error::Provider (NoSuchModel) for malformed ids or unknown models.
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
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
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
openai.Source§fn language_model(
&self,
model_id: &str,
) -> Result<LanguageModelRef, NoSuchModelError>
fn language_model( &self, model_id: &str, ) -> Result<LanguageModelRef, NoSuchModelError>
model_id. Read moreSource§fn embedding_model(
&self,
model_id: &str,
) -> Result<EmbeddingModelRef, NoSuchModelError>
fn embedding_model( &self, model_id: &str, ) -> Result<EmbeddingModelRef, NoSuchModelError>
model_id. Read moreSource§fn image_model(&self, model_id: &str) -> Result<ImageModelRef, NoSuchModelError>
fn image_model(&self, model_id: &str) -> Result<ImageModelRef, NoSuchModelError>
model_id. Read moreSource§fn transcription_model(
&self,
model_id: &str,
) -> Result<TranscriptionModelRef, NoSuchModelError>
fn transcription_model( &self, model_id: &str, ) -> Result<TranscriptionModelRef, NoSuchModelError>
model_id. Read moreSource§fn speech_model(
&self,
model_id: &str,
) -> Result<SpeechModelRef, NoSuchModelError>
fn speech_model( &self, model_id: &str, ) -> Result<SpeechModelRef, NoSuchModelError>
model_id. Read moreSource§fn reranking_model(
&self,
model_id: &str,
) -> Result<RerankingModelRef, NoSuchModelError>
fn reranking_model( &self, model_id: &str, ) -> Result<RerankingModelRef, NoSuchModelError>
model_id. Read moreSource§fn video_model(&self, model_id: &str) -> Result<VideoModelRef, NoSuchModelError>
fn video_model(&self, model_id: &str) -> Result<VideoModelRef, NoSuchModelError>
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>
model_id. Read more