Skip to main content

Module reference_parser

Module reference_parser 

Source
Expand description

XML Reference Parser for Large Content Blocks

Allows LLMs to write large text blocks (scripts, configs, etc.) outside JSON using simple XML-style tags, avoiding JSON string escaping issues.

§Format

{"actions": [{"code": "<script001>"}]}

<script001>
import json
# No escaping needed!
</script001>

Supports both standard XML (</tag>) and simplified (<tag>) closing tags. Tags can appear before, after, or mixed with JSON.

Functions§

contains_references
Check if a string contains XML reference placeholders Only matches tags containing at least one digit (like , )
extract_references
Extract XML-style references from LLM response
resolve_references
Resolve XML reference placeholders in JSON string