Splits model output into conversational text and the raw blocks between a format's tags.
iex> A2UIAgent.BlockLexer.tokenize("Hi <a2ui>root = Text(\"</a2ui>\")</a2ui> bye")
[{:text, "Hi"}, {:a2ui_raw, ~s|root = Text("</a2ui>")|, true}, {:text, "bye"}]Inside a block, a closing tag counts only outside string literals and
single-line comments: the scanner follows strings (with backslash
escapes and triple-quoted forms) and comments until their end. The
opening tag may carry attributes, and both tags ignore case. A block
whose closing tag never comes is returned with final? false.
Text and blocks are trimmed, and a Markdown code fence around either is dropped; text that is empty after that is left out.
Summary
Types
A part of an unwrapped response: text or an uncompiled block.
Functions
Trims text and drops a Markdown code fence around it.
Tokenizes content. Options: :tag (the tag name, default "a2ui"),
:string_delimiters (default " and ') and :comments (the markers
that start a single-line comment, default #).
Types
Functions
Trims text and drops a Markdown code fence around it.
iex> A2UIAgent.BlockLexer.clean("```express\nroot = Text(\"x\")\n```")
~s|root = Text("x")|
Tokenizes content. Options: :tag (the tag name, default "a2ui"),
:string_delimiters (default " and ') and :comments (the markers
that start a single-line comment, default #).