Skip to main content

LlmBackend

Trait LlmBackend 

Source
pub trait LlmBackend: Send + Sync {
    // Required methods
    fn complete<'life0, 'life1, 'async_trait>(
        &'life0 self,
        request: &'life1 Value,
    ) -> Pin<Box<dyn Future<Output = Result<Value, LlmError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn id(&self) -> &str;
}
Expand description

Pluggable LLM backend for replay.

Required Methods§

Source

fn complete<'life0, 'life1, 'async_trait>( &'life0 self, request: &'life1 Value, ) -> Pin<Box<dyn Future<Output = Result<Value, LlmError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Given a chat_request payload, return the corresponding chat_response payload.

Source

fn id(&self) -> &str

Stable identifier for this backend (e.g. "mock", "anthropic"). Propagated into replay summaries.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§