agentvet 0.1.0

Validate LLM-generated tool args before execution. Throws a structured ToolArgError with LLM-friendly retry hints when the model hallucinates wrong types or missing fields.
Documentation
//! Validate LLM-generated tool args before execution.
//!
//! When an LLM emits a tool call, the arguments may have wrong types,
//! missing required fields, or extra fields. `agentvet` validates them
//! against the same JSON Schema you sent the model and returns a
//! [`ToolArgError`] whose [`for_llm`](ToolArgError::for_llm) renders a
//! short human-readable hint you can feed back to the model on the next
//! turn so it can self-correct.
//!
//! # Quick start
//!
//! ```
//! use agentvet::{ToolArgError, Validator};
//! use serde_json::json;
//!
//! // The same JSON Schema you advertised in your tool definition.
//! let schema = json!({
//!     "type": "object",
//!     "properties": {
//!         "city": {"type": "string"},
//!         "units": {"type": "string", "enum": ["c", "f"]}
//!     },
//!     "required": ["city"],
//!     "additionalProperties": false
//! });
//! let v = Validator::from_schema(&schema).unwrap();
//!
//! // Good args: validation passes.
//! v.validate(&json!({"city": "SFO", "units": "c"})).unwrap();
//!
//! // Bad args: structured error with an LLM-friendly retry hint.
//! let err = v.validate(&json!({"units": "c"})).unwrap_err();
//! assert!(err.for_llm().contains("city"));
//! ```
#![forbid(unsafe_code)]
#![warn(missing_docs)]
#![warn(rust_2018_idioms)]

mod error;
mod validator;

pub use crate::error::{ToolArgError, ToolArgIssue};
pub use crate::validator::Validator;