llm_chain_milvus/
errors.rs

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
31
use thiserror::Error;

use llm_chain::traits::{EmbeddingsError, VectorStoreError};

use milvus::error::Error as InnerError;

#[derive(Debug, Error)]
pub enum MilvusError<E>
where
    E: std::fmt::Debug + std::error::Error + EmbeddingsError,
{
    #[error(transparent)]
    Embeddings(#[from] E),
    #[error("Milvus Client Error")]
    Client(InnerError),
    #[error("Milvus payload column doesn't exist")]
    InvalidColumnName,
    #[error("Milvus insertion error")]
    InsertionError,
    #[error("No indexes on collection vector field")]
    EmptyIndexError,
    #[error("Milvus query error")]
    QueryError,
    #[error("Serde Error")]
    Serde(serde_json::Error),
}

impl<E> VectorStoreError for MilvusError<E> where
    E: std::fmt::Debug + std::error::Error + EmbeddingsError
{
}