Skip to main content

CompletionClient

Trait CompletionClient 

Source
pub trait CompletionClient {
    // Required methods
    fn complete(
        &mut self,
        messages: &[Value],
        cancel: &dyn Fn() -> bool,
    ) -> Result<Completion, ClientError>;
    fn requests(&self) -> u64;
}
Expand description

Something that answers chat completions (HTTP, or a replay in tests).

Required Methods§

Source

fn complete( &mut self, messages: &[Value], cancel: &dyn Fn() -> bool, ) -> Result<Completion, ClientError>

Send the conversation; cancel is polled while waiting.

Source

fn requests(&self) -> u64

Requests sent so far (retries included).

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§