Skip to main content

ConstructCompletionModel

Trait ConstructCompletionModel 

Source
pub trait ConstructCompletionModel<C>: Sized {
    // Required method
    fn construct(client: &C, model: String) -> Self;
}
Expand description

Construction hook for the blanket CompletionClient implementation over crate::client::Client.

That blanket implementation is generic over whichever model type a provider extension declares, so it needs some way to build that model. Coherence rules out one blanket implementation per provider family — they would all overlap on Client<Ext, H> — and the alternative of a public bound such as From<(Client<Ext, H>, String)> would push a synthetic conversion into every provider model’s public API.

This trait is public because it is the extension point for out-of-tree provider extensions built on the generic crate::client::Client: such a crate cannot implement CompletionClient for rig’s foreign Client<Ext, H> type directly (orphan rule), so it implements this trait on its own model type instead, and the blanket implementation supplies completion_model for it. Providers with their own client type simply implement CompletionClient directly and never need this trait.

Required Methods§

Source

fn construct(client: &C, model: String) -> Self

Build this model from its provider client and a model identifier.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<Ext, H> ConstructCompletionModel<Client<Ext, H>> for GenericCompletionModel<Ext, H>
where Client<Ext, H>: Debug + Clone + 'static, Ext: Provider + Clone + 'static,

Source§

impl<H> ConstructCompletionModel<Client<ChatGPTExt, H>> for ResponsesCompletionModel<H>
where Client<ChatGPTExt, H>: HttpClientExt + Clone + Debug + 'static, H: Clone + Default + Debug + WasmCompatSend + WasmCompatSync + 'static,

Source§

impl<H> ConstructCompletionModel<Client<CopilotExt, H>> for rig_agent::core::providers::copilot::CompletionModel<H>
where Client<CopilotExt, H>: HttpClientExt + Clone + Debug + 'static, H: Clone + Default + Debug + WasmCompatSend + WasmCompatSync + 'static,

Source§

impl<T> ConstructCompletionModel<Client<CohereExt, T>> for rig_agent::core::providers::cohere::CompletionModel<T>

Source§

impl<T> ConstructCompletionModel<Client<GeminiExt, T>> for rig_agent::core::providers::gemini::CompletionModel<T>
where Client<GeminiExt, T>: Clone,

Source§

impl<T> ConstructCompletionModel<Client<GeminiInteractionsExt, T>> for InteractionsCompletionModel<T>

Source§

impl<T> ConstructCompletionModel<Client<OllamaExt, T>> for rig_agent::core::providers::ollama::CompletionModel<T>
where Client<OllamaExt, T>: Clone,