1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#[macro_use]
extern crate anyhow;

use anyhow::Result;
use async_trait::async_trait;
use serde::{Deserialize, Serialize};

mod document;
mod metrics;
mod naive;

pub use document::*;
pub use metrics::*;
pub use naive::*;

mod import;

pub type Embeddings = Vec<f64>;

#[async_trait]
pub trait Embedder: Send + Sync {
    async fn embed(&self, text: &str) -> Result<Embeddings>;
}

#[derive(Clone, Debug, Default, Serialize, Deserialize)]
pub struct Configuration {
    pub source_path: String,
    pub data_path: String,
    pub chunk_size: Option<usize>,
}