8 releases
| 0.2.6 | Feb 20, 2026 |
|---|---|
| 0.2.5 | Feb 17, 2026 |
| 0.1.5 | Jan 27, 2026 |
#267 in #ai
152 downloads per month
Used in 12 crates
(3 directly)
37KB
740 lines
serdes-ai-macros
Procedural macros for serdes-ai (tool definitions, output schemas)
This crate provides procedural macros for SerdesAI:
#[derive(Output)]- Derive the Output trait with JSON schema generation#[derive(Tool)]- Derive tool implementations from functions- Schema generation utilities
Installation
[dependencies]
serdes-ai-macros = "0.1"
Usage
Output Derive
use serdes_ai_macros::Output;
use serde::{Deserialize, Serialize};
#[derive(Debug, Serialize, Deserialize, Output)]
struct ExtractedData {
/// The person's name
name: String,
/// Their age in years
age: u32,
/// Optional email address
email: Option<String>,
}
Tool Derive
use serdes_ai_macros::tool;
#[tool(description = "Calculate the sum of two numbers")]
async fn add(a: i32, b: i32) -> i32 {
a + b
}
Part of SerdesAI
This crate is part of the SerdesAI workspace.
For most use cases, you should use the main serdes-ai crate which re-exports these macros.
License
MIT License - see LICENSE for details.
Dependencies
~0.5–0.9MB
~19K SLoC