Open-source, secure environment with real-world tools for enterprise-grade agents.
Python agentaiai-agentai-agentscode-interpretercopilotdevelopmentdevtoolsgptgpt-4javascriptllmnextjsopenaipythonreactsoftwaretypescript
Fix newline whitespace escaping when parsing LLM output
Tomas Valentaa1a33495b4ce
diff --git a/api-service/codegen/agent/parsing.py b/api-service/codegen/agent/parsing.pyindex 4d47770c3..1945a3e25 100644--- a/api-service/codegen/agent/parsing.py+++ b/api-service/codegen/agent/parsing.py@@ -5,7 +5,6 @@ from typing import TypedDictfrom typing import Literalfrom lxml import etree-escape_table = str.maketrans({"<": "<",">": ">",@@ -39,7 +38,7 @@ def merge_logs(log: TypedDict, other: TypedDict):action_tag_open = "<action(\\s+tool=\".+?\")?\\s*/?>?"action_tag_close = "</\\s*action\\s*>?"-action_tag_split_pattern = re.compile(f"({action_tag_open}.*?{action_tag_close})|(.+)")+action_tag_split_pattern = re.compile(f"({action_tag_open})|({action_tag_close})|(.+?)")action_tag_check_pattern = re.compile(f"{action_tag_open}|{action_tag_close}")def parse_thoughts_and_actions(text: str):