Skip to main content

DaemonClient

Trait DaemonClient 

Source
pub trait DaemonClient: Send + Sync {
    // Required methods
    fn id(&self) -> &str;
    fn is_available(&self) -> bool;
    fn embed(
        &self,
        text: &str,
        request_id: &str,
    ) -> Result<Vec<f32>, DaemonError>;
    fn embed_batch(
        &self,
        texts: &[&str],
        request_id: &str,
    ) -> Result<Vec<Vec<f32>>, DaemonError>;
    fn rerank(
        &self,
        query: &str,
        documents: &[&str],
        request_id: &str,
    ) -> Result<Vec<f32>, DaemonError>;
}
Expand description

Abstract daemon client.

Concrete transports (e.g. UDS/HTTP) are implemented by host applications.

Required Methods§

Source

fn id(&self) -> &str

Source

fn is_available(&self) -> bool

Source

fn embed(&self, text: &str, request_id: &str) -> Result<Vec<f32>, DaemonError>

Source

fn embed_batch( &self, texts: &[&str], request_id: &str, ) -> Result<Vec<Vec<f32>>, DaemonError>

Source

fn rerank( &self, query: &str, documents: &[&str], request_id: &str, ) -> Result<Vec<f32>, DaemonError>

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§