ai-json-template

Crates.ioai-json-template
lib.rsai-json-template
version0.1.2
created_at2025-03-31 04:43:19.93572+00
updated_at2025-07-13 10:18:09.316736+00
descriptionContains code we use for ai-assisted struct generation. Please also see the ai-json-template-derive crate for more information.
homepage
repositoryhttps://github.com/klebs6/klebs-general
max_upload_size
id1613011
size68,194
(klebs6)

documentation

README

ai-json-template

contains the following code:

/// The derived code implements `AiJsonTemplate` for each struct, letting you
/// call `MyStruct::to_template()` to get a JSON “schema” describing how the
/// AI should produce data that matches this layout.
///
pub trait AiJsonTemplate: serde::Serialize + for<'a> serde::Deserialize<'a> {
    /// Return a JSON template describing how the AI’s output should be structured.
    /// This might include doc comments or other instructions for each field.
    fn to_template() -> serde_json::Value;
}

We use it during AI assisted struct generation. We want to have the AI intelligently generate values for an arbitrary struct's fields. With this in mind, we need to provide it with a template or a sort of "schema" which contains the information about what it needs to generate and how it should do it.

We use this trate to enable this functionality.

See ai-json-template-derive for the full usage and utility of this functionality.

Happy programming!

Commit count: 634

cargo fmt