pub struct ModelCatalog { /* private fields */ }Expand description
Shared, refreshable view of the fixed models.dev["opencode"] catalog.
Implementations§
Source§impl ModelCatalog
impl ModelCatalog
Sourcepub async fn initialize() -> Result<Self, ModelCatalogError>
pub async fn initialize() -> Result<Self, ModelCatalogError>
Load the disk cache and refresh it when needed. A fresh cache returns immediately. A stale cache remains usable while one background refresh runs; with no usable cache, the network fetch is awaited and required.
Sourcepub async fn refresh(&self) -> Result<(), ModelCatalogError>
pub async fn refresh(&self) -> Result<(), ModelCatalogError>
Force a refresh. Concurrent callers share a single in-flight fetch.
Sourcepub async fn resolve(
&self,
request: ModelRequestConfig,
wire_protocol: WireProtocol,
) -> Result<ResolvedModelConfig, ModelCatalogError>
pub async fn resolve( &self, request: ModelRequestConfig, wire_protocol: WireProtocol, ) -> Result<ResolvedModelConfig, ModelCatalogError>
Resolve and validate a short model id for one of the three wire protocols. Exact id match wins; a path-like id may also match by a unique basename. Contains/fuzzy matches are suggestions only.
pub async fn model_count(&self) -> usize
Trait Implementations§
Source§impl Clone for ModelCatalog
impl Clone for ModelCatalog
Source§fn clone(&self) -> ModelCatalog
fn clone(&self) -> ModelCatalog
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 moreAuto Trait Implementations§
impl !RefUnwindSafe for ModelCatalog
impl !UnwindSafe for ModelCatalog
impl Freeze for ModelCatalog
impl Send for ModelCatalog
impl Sync for ModelCatalog
impl Unpin for ModelCatalog
impl UnsafeUnpin for ModelCatalog
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