Skip to main content

langchain_rust/agent/
error.rs

1use thiserror::Error;
2
3use crate::{
4    chain::ChainError, language_models::LLMError, prompt::PromptError, schemas::memory::MemoryError,
5};
6
7#[derive(Error, Debug)]
8#[non_exhaustive]
9pub enum AgentError {
10    #[error("LLM error: {0}")]
11    LLMError(#[from] LLMError),
12
13    #[error("Chain error: {0}")]
14    ChainError(#[from] ChainError),
15
16    #[error("Prompt error: {0}")]
17    PromptError(#[from] PromptError),
18
19    #[error("Tool error: {0}")]
20    ToolError(String),
21
22    #[error("Missing Object On Builder: {0}")]
23    MissingObject(String),
24
25    #[error("Missing input variable: {0}")]
26    MissingInputVariable(String),
27
28    #[error("Serde json error: {0}")]
29    SerdeJsonError(#[from] serde_json::Error),
30
31    #[error("Error: {0}")]
32    OtherError(String),
33
34    #[error("Memory error: {0}")]
35    MemoryError(#[from] MemoryError),
36}