Skip to main content

Provider

Trait Provider 

Source
pub trait Provider:
    Send
    + Sync
    + Debug {
    // Required methods
    fn kind(&self) -> &'static str;
    fn options(&self) -> ProviderOptions;
    fn set_options(&mut self, options: ProviderOptions);
    fn serialize_config(&self) -> Value;
    fn complete<'life0, 'async_trait>(
        &'life0 mut self,
        request: LlmRequest,
    ) -> Pin<Box<dyn Future<Output = Result<LlmResponse, LlmTransportError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn clone_boxed(&self) -> Box<dyn Provider>;

    // Provided method
    fn requires_streaming(&self) -> bool { ... }
}
Expand description

A configured LLM backend: its identity, host-config serialization, its generation options, and the request transport.

Required Methods§

Source

fn kind(&self) -> &'static str

Source

fn options(&self) -> ProviderOptions

Source

fn set_options(&mut self, options: ProviderOptions)

Source

fn serialize_config(&self) -> Value

Emit the provider-specific JSON body used by ProviderSpec. The object must NOT contain a type field — [ProviderSpec::Serialize] layers that on top.

Source

fn complete<'life0, 'async_trait>( &'life0 mut self, request: LlmRequest, ) -> Pin<Box<dyn Future<Output = Result<LlmResponse, LlmTransportError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn clone_boxed(&self) -> Box<dyn Provider>

Provided Methods§

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§