llm 1.3.8

A Rust library unifying multiple LLM backends.
Documentation
1
2
3
4
5
6
7
8
9
10
11
use crate::error::LLMError;

pub(super) fn decrement_attempts(remaining: usize, err: &str) -> Result<usize, LLMError> {
    let remaining = remaining.saturating_sub(1);
    if remaining == 0 {
        return Err(LLMError::InvalidRequest(format!(
            "Validation error after max attempts: {err}"
        )));
    }
    Ok(remaining)
}