Entropic 2.11.1
Local-first agentic inference engine
Loading...
Searching...
No Matches
xml_parameter_parser.cpp File Reference

Shared XML <parameter=...>value</parameter> extractor. More...

#include "xml_parameter_parser.h"
#include <regex>
#include <string>
#include <utility>
Include dependency graph for xml_parameter_parser.cpp:

Go to the source code of this file.

Namespaces

namespace  entropic
 Activate model on GPU (WARM → ACTIVE).
 

Functions

std::unordered_map< std::string, std::string > entropic::inference::adapters::parse_xml_parameters (const std::string &func_body, const std::shared_ptr< spdlog::logger > &logger)
 Extract <parameter=NAME>value</parameter> pairs from a function body.
 

Detailed Description

Shared XML <parameter=...>value</parameter> extractor.

Version
2.4.1 (gh#79)

Definition in file xml_parameter_parser.cpp.

Function Documentation

◆ parse_xml_parameters()

std::unordered_map< std::string, std::string > entropic::inference::adapters::parse_xml_parameters ( const std::string &  func_body,
const std::shared_ptr< spdlog::logger > &  logger 
)

Extract <parameter=NAME>value</parameter> pairs from a function body.

gh#79 fix: tolerates </NAME> close tags in addition to the literal </parameter>. See the helper definitions above and the header for full contract.

The hand-rolled multi-parameter parser the autoparser families (Qwen, Nemotron) keep, because common_chat's PEG autoparser drops parameters past the first. An unterminated parameter is dropped without aborting the scan, and the body is truncated at a nested <function= tag.

Parameters
func_bodyFunction body between <function=name> and </function>.
loggerAdapter-owned logger; may be null (parser stays silent).
Returns
Map of trimmed parameter key to trimmed value — every well-formed parameter in the body, not just the first. @req REQ-INFER-012
Version
2.4.1

Returns a map keyed by parameter name. Empty keys / values (after trim) are skipped with a warning. The </NAME> close-tag tolerance is the gh#79 fix.

Parameters
func_bodyFunction body text (between <function=name> and the matching </function>).
loggerAdapter-owned logger for warn messages. May be null — the parser is silent in that case.
Returns
Map of trimmed parameter key to trimmed parameter value. @utility
Version
2.4.1

Definition at line 125 of file xml_parameter_parser.cpp.