1use serde::Deserialize;
2use thiserror::Error;
3
4#[derive(Debug, Error)]
5pub enum OllamaError {
6 #[error("request error: {0}")]
8 RequestError(reqwest::Error),
9
10 #[error("decoding error: {0}")]
12 DecodingError(reqwest::Error),
13
14 #[cfg(feature = "stream")]
16 #[error("stream decoding error: {0}")]
17 StreamDecodingError(String),
18
19 #[error("invalid format: {0}")]
21 InvalidFormat(String),
22
23 #[error("ollama error: {0}")]
25 OllamaServerError(String),
26
27 #[cfg(feature = "model")]
29 #[error("model does not exist")]
30 ModelDoesNotExist,
31
32 #[cfg(feature = "model")]
34 #[error("blob does not exist")]
35 BlobDoesNotExist,
36
37 #[cfg(feature = "model")]
39 #[error("unexpected digest")]
40 UnexpectedDigest,
41
42 #[cfg(feature = "model")]
44 #[error("file error: {0}")]
45 FileError(std::io::Error),
46}
47
48#[derive(Debug, Deserialize)]
49pub struct OllamaServerError {
50 pub error: String,
51}