pub trait ModelSource {
// Required method
fn resolve<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId<str>,
) -> Pin<Box<dyn Future<Output = Result<ResolvedModel, Box<dyn Error + Send + Sync>>> + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}Expand description
Chooses the model for each completion round of each thread.
Resolution happens at the start of every round, which is what makes mid-session model switching safe: persist the new selection wherever your implementation reads it from, and the next round picks it up. An in-flight completion always finishes on the model it started with.
Required Methods§
fn resolve<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId<str>,
) -> Pin<Box<dyn Future<Output = Result<ResolvedModel, Box<dyn Error + Send + Sync>>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".