1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
//! # Toolkits Module
//!
//! A comprehensive tool calling and execution framework for AI applications.
//! This module was merged from the former `zai-tools` crate and provides
//! a robust foundation for integrating external tools and functions with AI
//! models.
//!
//! ## Overview
//!
//! The toolkits module enables AI models to invoke external functions, APIs,
//! and tools in a type-safe and extensible manner. It supports both static tool
//! definitions and dynamic tool registration at runtime.
//!
//! ## Core Components
//!
//! - [`core`] - Core traits and types for tool definitions
//! - [`error`] - Comprehensive error handling and reporting
//! - [`executor`] - Tool execution engine with registration and management
//! - [`llm`] - LLM-specific parsing and interaction utilities
//!
//! ## Key Features
//!
//! ### Flexibility
//! - Dynamic tool registration and discovery
//! - JSON schema generation for tool descriptions
//!
//! ### Error Handling
//! - Comprehensive error types with context information
//! - Graceful error recovery and reporting
//! - Validation errors with detailed messages
//!
//! ## Usage Example
//! ```rust,ignore
//! let tool = FunctionTool::builder("get_weather", "Get current weather")
//! .property("location", json!({"type": "string"}))
//! .required("location")
//! .handler(|input| async move {
//! // Function implementation
//! Ok(json!({"temperature": 22.5}))
//! })
//! .build()?;
//! ```
// RMCP bridge (feature-gated)
/// Prelude module for convenient imports
///
/// This module re-exports commonly used types and traits from the toolkits
/// module, making it easier to import everything needed for tool development
/// with a single `use` statement.
///
/// ## Usage
///
/// ```rust,ignore
/// use zai_rs::toolkits::prelude::*;
/// ```
// Re-export commonly used types at crate root for convenience via toolkits::
pub use crate;