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
pub mod tests {
    use rag_toolchain::loaders::{LoadSource, SingleFileSource};

    #[test]
    fn test_when_file_exists() {
        let sut: SingleFileSource = SingleFileSource::new("tests/single_file_loader/test.txt");
        let result = sut.load().unwrap();
        assert_eq!(result, vec!["Hello World !\n"]);
    }

    #[test]
    fn test_when_file_doesnt_exist() {
        let sut: SingleFileSource = SingleFileSource::new("fake_file.txt");
        let err: std::io::Error = sut.load().unwrap_err();
        assert_eq!(err.kind(), std::io::ErrorKind::NotFound)
    }
}