Skip to main content

extract_variables

Function extract_variables 

Source
pub fn extract_variables(content: &str) -> Vec<ExtractedVariable>
Expand description

Extracts variables from prompt content.

Variables are identified by the pattern {{variable_name}} where variable_name consists of alphanumeric characters and underscores.

Important: Variables inside fenced code blocks ( ) are automatically excluded to avoid capturing example/documentation patterns.

ยงReturns

A list of extracted variables in order of first appearance, deduplicated.