objectiveai-sdk 2.0.6

ObjectiveAI SDK, definitions, and utilities
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! Description length validation for remote functions.

/// Maximum byte length for function descriptions (maps to GitHub repo description limit of 350 chars).
const MAX_DESCRIPTION_BYTES: usize = 350;

pub fn check_description(description: &str) -> Result<(), String> {
    if description.trim().is_empty() {
        return Err("QD01: Description must not be empty".to_string());
    }
    if description.len() > MAX_DESCRIPTION_BYTES {
        return Err(format!(
            "QD02: Description is {} bytes, exceeds maximum of {} bytes",
            description.len(),
            MAX_DESCRIPTION_BYTES
        ));
    }
    Ok(())
}