Skip to main content

ProviderRegistry

Struct ProviderRegistry 

Source
pub struct ProviderRegistry { /* private fields */ }
Expand description

A “provider directory” that is materialized at assembly time. The session holds an Arc<ProviderRegistry>.

Implementations§

Source§

impl ProviderRegistry

Source

pub fn single( provider: Arc<dyn LlmProvider>, default_model: ModelInfo, ) -> Arc<Self>

A convenience constructor for a single provider with a single model. Used by tests, EchoProvider, and the provider() builder entry point. This is the minimal form that satisfies the invariants checked by ProviderRegistry::new (non-empty + default_model must belong to an entry).

Source

pub fn new( entries: Vec<ProviderEntry>, default_provider: &str, default_model: &str, ) -> Result<Self, ProviderRegistryError>

Constructs a registry from a list of entries and a default (provider vendor, model id) pair. The pair must appear in the (vendor, models) list of some entry.

The same model id may be declared by multiple entries with different vendors (multiple gateways sharing a model) — the selection key is (vendor, model). Only a duplicate (vendor, model) pair is a configuration error.

§Errors
Source

pub fn default_entry(&self) -> &ProviderEntry

The default entry used to initialize the current provider/model when a session starts.

Source

pub fn default_model(&self) -> &str

The default model ID.

Source

pub fn entry_for(&self, vendor: &str, model_id: &str) -> Option<&ProviderEntry>

Look up the entry for a given (vendor, model id) pair. Returns None if the registry does not declare this pair.

Source

pub fn first_entry_for_model(&self, model_id: &str) -> Option<&ProviderEntry>

Look up the first entry that declares the given bare model ID (in assembly order). Used by legacy paths that lack a vendor dimension, such as the model field in prompt hooks — when there are multiple matches, the first one is returned.

Source

pub fn entries(&self) -> &[ProviderEntry]

Returns all entries in assembly order.

Source

pub fn list_candidates(&self) -> Vec<ModelCandidate>

Flatten all (provider_info, model) pairs. ACP list_models uses this to build SessionModelState::available_models.

Source

pub fn candidate_for( &self, vendor: &str, model_id: &str, ) -> Option<ModelCandidate>

Look up a candidate by model ID; used by the ACP layer to render the description.

Trait Implementations§

Source§

impl Debug for ProviderRegistry

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoMaybeUndefined<T> for T

Source§

impl<T> IntoOption<T> for T

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more