manx_cli/rag/providers/
mod.rs

1use anyhow::Result;
2
3pub mod custom;
4pub mod hash;
5pub mod huggingface;
6pub mod ollama;
7pub mod onnx;
8pub mod openai;
9
10/// Trait for embedding providers
11#[async_trait::async_trait]
12pub trait EmbeddingProvider {
13    /// Generate embeddings for a single text
14    async fn embed_text(&self, text: &str) -> Result<Vec<f32>>;
15
16    /// Get the dimension of embeddings produced by this provider
17    async fn get_dimension(&self) -> Result<usize>;
18
19    /// Test if the provider is available and working
20    async fn health_check(&self) -> Result<()>;
21
22    /// Get provider-specific information
23    fn get_info(&self) -> ProviderInfo;
24}
25
26/// Information about an embedding provider
27#[derive(Debug, Clone)]
28pub struct ProviderInfo {
29    pub name: String,
30    pub provider_type: String,
31    pub model_name: Option<String>,
32    pub description: String,
33    pub max_input_length: Option<usize>,
34}