Open-source, secure environment with real-world tools for enterprise-grade agents.
Python agentaiai-agentai-agentscode-interpretercopilotdevelopmentdevtoolsgptgpt-4javascriptllmnextjsopenaipythonreactsoftwaretypescript
Adapt parsing xml string for parsing incomplete string while wrappign the string in root tag
Tomas Valentaa4b149997029
diff --git a/api-service/codegen/agent/base.py b/api-service/codegen/agent/base.pyindex 1b6ad6d69..dc8a1a3ba 100644--- a/api-service/codegen/agent/base.py+++ b/api-service/codegen/agent/base.py@@ -36,7 +36,8 @@ def actions_from_xml_string(xml_string: str):# Parse the escaped string as an XML tree.root = ET.fromstring(- f"<root>{xml_string}</root>",+ # Wrapping the XML in a fully formed root tag while some inner tags can be incomplete seems to be causing some small parsing errors ("</" added as a tag content)+ f"<root>{xml_string}",# Use Parser with C binding for libxml2+libxslt, with recovery mode that allows to parse incomplete XML.etree.XMLParser(recover=True),)