Skip to main content

AnthropicClient

Trait AnthropicClient 

Source
pub trait AnthropicClient: Send + Sync {
    // Required method
    fn create<'life0, 'async_trait>(
        &'life0 self,
        params: Value,
    ) -> Pin<Box<dyn Future<Output = Result<Value, DraftError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Tiny adapter over the Anthropic messages API. Used so tests can supply a fake.

params is a JSON object with the same keys the SDK accepts: model, max_tokens, temperature, system, messages. Implementations must return a value with content: [{type:"text", text:"..."}, ...].

Required Methods§

Source

fn create<'life0, 'async_trait>( &'life0 self, params: Value, ) -> Pin<Box<dyn Future<Output = Result<Value, DraftError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Implementors§