StructuredOutput

Derive Macro StructuredOutput 

Source
#[derive(StructuredOutput)]
{
    // Attributes available to this derive:
    #[structured_output]
}
Expand description

Derive macro for StructuredOutput trait.

§Attributes

  • name: Tool name (required) - e.g., name = "final_answer"
  • description: Tool description (required) - e.g., description = "Returns the final answer"

§Example

#[derive(Serialize, Deserialize, StructuredOutput)]
#[structured_output(
    name = "create_npc",
    description = "Creates an NPC character"
)]
struct NPCData {
    name: String,
    age: u32,
    backstory: String,
}