1 unstable release
Uses new Rust 2024
| 0.1.0 | Jul 8, 2025 |
|---|
#851 in Procedural macros
8KB
99 lines
Note: This project is under active development and APIs may change.
Quick start
use llm_schema::LlmSchema;
#[derive(LlmSchema)]
struct Example {
name: String,
age: i32,
#[llmschem(require)]
email: String,
nickname: Option<String>,
}
fn main() {
let schema = Example::llm_schema();
println!("{}", serde_json::to_string_pretty(&schema).unwrap());
// {
// "properties": {
// "age": {
// "type": "number"
// },
// "email": {
// "type": "string"
// },
// "name": {
// "type": "string"
// },
// "nickname": {
// "type": "null"
// }
// },
// "required": [
// "email"
// ],
// "type": "object"
// }
}
Star History
License
This project is licensed under the MIT License - see the LICENSE file for details.
Dependencies
~0.6–1.6MB
~34K SLoC