Skip to content
This repository was archived by the owner on Jul 3, 2025. It is now read-only.

Commit 09da69e

Browse files
authored
Merge pull request #23 from lmnr-ai/dev
fix parsing
2 parents aab9e8a + dcbe7d2 commit 09da69e

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

index/agent/agent.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,16 +116,14 @@ async def _generate_action(self, input_messages: list[Message]) -> AgentLLMOutpu
116116
json_str = ""
117117

118118
if not match:
119-
# if we couldn't find the <output> tags, it most likely means the <output> tags are not present in the response
120-
json_str = response.content.replace("<output>", "").replace("</output>", "").strip()
119+
# if we couldn't find the <output> tags, it most likely means the <output*> tag is not present in the response
120+
# remove closing tag just in case
121+
closing_tag_pattern = r"</output(?:[^>]*)>$"
122+
json_str = re.sub(closing_tag_pattern, "", response.content).strip()
121123
else:
122124
# Extract just the content between the tags without any additional replacement
123125
json_str = match.group(1).strip()
124126

125-
# Ensure any trailing closing tags are removed (additional safety check)
126-
closing_tag_pattern = r"</output(?:[^>]*)>$"
127-
json_str = re.sub(closing_tag_pattern, "", json_str).strip()
128-
129127
try:
130128
# First try to parse it directly to catch any obvious JSON issues
131129
try:

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ packages = ["index"]
1010

1111
[project]
1212
name = "lmnr-index"
13-
version = "0.1.3"
13+
version = "0.1.4"
1414
description = "Index - SOTA browser AI agent for autonomous task execution on the web"
1515
readme = "README.md"
1616
requires-python = ">=3.10"

0 commit comments

Comments
 (0)