rag-toolchain 0.1.9

is a Rust native library designed to empower developers with seamless access to common Gen AI workflows.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use std::error::Error;
use std::future::Future;

/// # [`LoadSource`]
/// Trait that allows reading the raw text for an external source
pub trait LoadSource {
    type ErrorType: Error;
    /// Called an returns a vector of raw text to generate embeddings for
    fn load(&self) -> Result<Vec<String>, Self::ErrorType>;
}

/// # [`AsyncLoadSource`]
/// Async version of [`LoadSource`] to support loading raw text from an external source
pub trait AsyncLoadSource {
    type ErrorType: Error;
    /// Called an returns a vector of raw text to generate embeddings for
    fn load(&self) -> impl Future<Output = Result<Vec<String>, Self::ErrorType>> + Send;
}