Skip to main content

LlmDriver

Trait LlmDriver 

Source
pub trait LlmDriver:
    Send
    + Sync
    + 'static {
    // Required method
    fn complete<'life0, 'async_trait>(
        &'life0 self,
        request: CompletionRequest,
    ) -> Pin<Box<dyn Future<Output = PunchResult<CompletionResponse>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided methods
    fn stream_complete<'life0, 'async_trait>(
        &'life0 self,
        request: CompletionRequest,
    ) -> Pin<Box<dyn Future<Output = PunchResult<CompletionResponse>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn stream_complete_with_callback<'life0, 'async_trait>(
        &'life0 self,
        request: CompletionRequest,
        callback: StreamCallback,
    ) -> Pin<Box<dyn Future<Output = PunchResult<CompletionResponse>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

Abstraction over LLM providers.

Required Methods§

Source

fn complete<'life0, 'async_trait>( &'life0 self, request: CompletionRequest, ) -> Pin<Box<dyn Future<Output = PunchResult<CompletionResponse>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Send a completion request and return the response.

Provided Methods§

Source

fn stream_complete<'life0, 'async_trait>( &'life0 self, request: CompletionRequest, ) -> Pin<Box<dyn Future<Output = PunchResult<CompletionResponse>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Streaming variant. Default implementation falls back to complete.

Source

fn stream_complete_with_callback<'life0, 'async_trait>( &'life0 self, request: CompletionRequest, callback: StreamCallback, ) -> Pin<Box<dyn Future<Output = PunchResult<CompletionResponse>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Streaming completion with per-chunk callback. Returns the final assembled CompletionResponse.

Implementors§