Skip to main content

extract_references

Function extract_references 

Source
pub fn extract_references(
    text: &str,
) -> Result<(String, HashMap<String, String>)>
Expand description

Extract XML-style references from LLM response

Extracts content from tags like <script001>content</script001> or <script001>content<script001> and returns the cleaned response (with tags removed) plus a map of tag_name -> content.

§Arguments

  • text - The full LLM response text

§Returns

  • Tuple of (cleaned_text, references_map)
    • cleaned_text: Response with all XML blocks removed (leaving just JSON)
    • references_map: HashMap mapping tag names to their content