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)]
8pub enum AgentError {
9    #[error("LLM error: {0}")]
10    LLMError(#[from] LLMError),
11
12    #[error("Chain error: {0}")]
13    ChainError(#[from] ChainError),
14
15    #[error("Prompt error: {0}")]
16    PromptError(#[from] PromptError),
17
18    #[error("Tool error: {0}")]
19    ToolError(String),
20
21    #[error("Missing Object On Builder: {0}")]
22    MissingObject(String),
23
24    #[error("Missing input variable: {0}")]
25    MissingInputVariable(String),
26
27    #[error("Serde json error: {0}")]
28    SerdeJsonError(#[from] serde_json::Error),
29
30    #[error("Error: {0}")]
31    OtherError(String),
32
33    #[error("Memory error: {0}")]
34    MemoryError(#[from] MemoryError),
35}