ai-types-derive

Crates.ioai-types-derive
lib.rsai-types-derive
version0.1.0
created_at2025-07-02 16:47:25.089573+00
updated_at2025-07-02 16:47:25.089573+00
descriptionProcedural macros for ai-types - convert functions into AI tools
homepage
repositoryhttps://github.com/lexoliu/ai-types
max_upload_size
id1735340
size17,817
Lexo Liu (lexoliu)

documentation

https://docs.rs/ai-types-derive

README

ai-types-derive

📖 Documentation: For comprehensive documentation with examples, see the inline code documentation in src/lib.rs and the example file examples/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.

Quick Start

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:

Commit count: 0

cargo fmt