pub struct ModelPortfolio { /* private fields */ }Expand description
Several concurrently live provider handles, keyed by entry id.
Implementations§
Source§impl ModelPortfolio
impl ModelPortfolio
Sourcepub fn from_config(config: &Config) -> Result<Self>
pub fn from_config(config: &Config) -> Result<Self>
Build a portfolio from the [providers] table.
A configuration without a [providers] table yields a one-entry
portfolio from the flat provider fields, so single-provider setups
keep working unchanged. Credentials resolve per entry:
api_key_env > literal api_key; Vertex entries fall through to the
existing ADC token resolver rather than snapshotting a short-lived
token at startup.
Sourcepub fn resolve(&self, provider: &str) -> Result<&ProviderHandle>
pub fn resolve(&self, provider: &str) -> Result<&ProviderHandle>
Resolve a provider handle by entry id.
Sourcepub fn provider_ids(&self) -> Vec<String>
pub fn provider_ids(&self) -> Vec<String>
All configured provider ids, sorted.
Sourcepub fn handles(&self) -> impl Iterator<Item = &ProviderHandle>
pub fn handles(&self) -> impl Iterator<Item = &ProviderHandle>
Iterate over the handles, sorted by id.
Trait Implementations§
Source§impl Debug for ModelPortfolio
impl Debug for ModelPortfolio
Source§impl Default for ModelPortfolio
impl Default for ModelPortfolio
Source§fn default() -> ModelPortfolio
fn default() -> ModelPortfolio
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ModelPortfolio
impl !RefUnwindSafe for ModelPortfolio
impl Send for ModelPortfolio
impl Sync for ModelPortfolio
impl Unpin for ModelPortfolio
impl UnsafeUnpin for ModelPortfolio
impl !UnwindSafe for ModelPortfolio
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.