| Crates.io | llm-schema |
| lib.rs | llm-schema |
| version | 0.1.0 |
| created_at | 2025-07-08 07:41:56.228598+00 |
| updated_at | 2025-07-08 07:41:56.228598+00 |
| description | A Rust library for type-safe schema conversion between Rust types and LLM. |
| homepage | |
| repository | https://github.com/zTgx/llm-schema |
| max_upload_size | |
| id | 1742170 |
| size | 13,369 |
Note: This project is under active development and APIs may change.
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"
// }
}
This project is licensed under the MIT License - see the LICENSE file for details.