Skip to main content

Crate llm_xml_caster

Crate llm_xml_caster 

Source
Expand description

A robust Rust library for converting structured XML output from Large Language Models (LLMs) back into Rust data structures.

This library provides a procedural macro (#[llm_prompt]) to automatically generate XML schemas and prompts from your Rust structs, ensuring LLMs generate predictable and correct XML output for reliable deserialization.

For more details and usage examples, see the README.

Re-exports§

pub use type::*;

Modules§

type

Traits§

LlmPrompt
Trait implemented by structures annotated with #[llm_prompt].

Functions§

generate_as
Attempts to generate structured data of type T from an LLM response.
generate_as_with_retries
Attempts to generate structured data of type T from an LLM response with a specified number of retries.

Type Aliases§

Error
Result

Attribute Macros§

llm_prompt
Procedural macro used to derive LlmPrompt implementation and integrate custom deserialization logic for LLM-generated XML.