#[define_intent]Expand description
A procedural attribute macro that generates prompt-building functions and extractor structs for intent enums.
This macro should be applied to an enum to generate:
- A prompt-building function that incorporates enum documentation
- An extractor struct that implements
IntentExtractor
§Requirements
The enum must have an #[intent(...)] attribute with:
prompt: The prompt template (supports Jinja-style variables)extractor_tag: The tag to use for extraction
§Example
ⓘ
#[define_intent]
#[intent(
prompt = "Analyze the intent: {{ user_input }}",
extractor_tag = "intent"
)]
enum MyIntent {
/// Create a new item
Create,
/// Update an existing item
Update,
/// Delete an item
Delete,
}This will generate:
pub fn build_my_intent_prompt(user_input: &str) -> Stringpub struct MyIntentExtractor;withIntentExtractor<MyIntent>implementation