Skip to main content

LlmClient

Trait LlmClient 

Source
pub trait LlmClient: Send + Sync {
    // Required methods
    fn complete(
        &self,
        prompt: &str,
        system: Option<&str>,
    ) -> impl Future<Output = Result<String, LlmError>> + Send;
    fn embed(
        &self,
        text: &str,
    ) -> impl Future<Output = Result<Vec<f32>, LlmError>> + Send;
}
Expand description

Trait for LLM providers (Anthropic, OpenAI, Ollama). Shared between mur-core and mur-commander.

Edition 2024 supports async fn in traits natively.

Required Methods§

Source

fn complete( &self, prompt: &str, system: Option<&str>, ) -> impl Future<Output = Result<String, LlmError>> + Send

Text completion

Source

fn embed( &self, text: &str, ) -> impl Future<Output = Result<Vec<f32>, LlmError>> + Send

Generate embedding vector

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§