| Crates.io | ai-types-derive |
| lib.rs | ai-types-derive |
| version | 0.1.0 |
| created_at | 2025-07-02 16:47:25.089573+00 |
| updated_at | 2025-07-02 16:47:25.089573+00 |
| description | Procedural macros for ai-types - convert functions into AI tools |
| homepage | |
| repository | https://github.com/lexoliu/ai-types |
| max_upload_size | |
| id | 1735340 |
| size | 17,817 |
📖 Documentation: For comprehensive documentation with examples, see the inline code documentation in
src/lib.rsand the example fileexamples/tool_macro.rs.
Procedural macros for converting Rust functions into AI tools that can be called by language models.
This crate provides the #[tool] attribute macro that automatically generates the necessary boilerplate code to make your async functions callable by AI models through the ai-types framework.
Transform any async function into an AI tool by adding the #[tool] attribute:
use ai_types::Result;
use ai_types_derive::tool;
#[tool(description = "Get the current UTC time")]
pub async fn get_time() -> Result<&'static str> {
Ok("2023-10-01T12:00:00Z")
}
That's it! Your function can now be called by AI models as a tool.
For detailed examples and comprehensive documentation, please refer to:
src/lib.rs contains extensive inline documentationexamples/tool_macro.rs shows various patterns