use std::path::PathBuf;
#[derive(thiserror::Error, Debug)]
pub enum LoadError {
#[error("model path not found: {0}")]
NotFound(PathBuf),
#[error("mistralrs build failed: {0}")]
Build(String),
}
#[derive(thiserror::Error, Debug)]
pub enum Error {
#[error("at least one image required")]
NoImages,
#[error("invalid RequestOptions: {0}")]
InvalidRequest(&'static str),
#[error("inference timed out after {0:?}")]
InferenceTimeout(std::time::Duration),
#[error("vision message build failed: {0}")]
BuildMessage(String),
#[error("inference failed: {0}")]
Inference(String),
#[error("model returned empty content")]
Empty,
#[error(
"generation truncated by max_tokens (finish_reason={finish_reason:?}); raw output {raw_len} bytes"
)]
Truncated {
finish_reason: String,
raw_len: usize,
},
#[error("parse failed: {0}")]
Parse(Box<dyn core::error::Error + Send + Sync + 'static>),
#[error("{0}")]
UnsupportedGrammar(#[from] llmtask::UnsupportedGrammar),
}