Skip to main content

Module parse

Module parse 

Source
Expand description

Parse-back helper — Phase 3 of action-grain unification (2026-04-20).

Inverse of the Phase 2 adapters: takes raw LLM output in one of 5 text/JSON formats and extracts structured tool-call records.

Provider coverage:

  • hermes: <tool_call>{...}</tool_call>
  • llama31: <|python_tag|>{...}<|eom_id|>
  • anthropic-tools: <function_calls>…<invoke name="…"><parameter name="…">…</parameter>…</invoke></function_calls>
  • openai-tools: assistant message JSON with tool_calls: [...]
  • markdown-tools: ```json {...} ```

All regexes are compiled via regex::RegexBuilder::size_limit(1 MB) to defend against ReDoS / oversized-pattern attacks, following the Phase-1 validator precedent.

Structs§

ParseError
A non-fatal parse error — a malformed tool call that was skipped. Multiple may appear alongside successfully-parsed calls.
ParsedToolCall
A successfully parsed tool call.

Functions§

parse
Parse the LLM’s raw output for the given provider.