Skip to content

Commit ee377de

Browse files
committed
test fix
1 parent 69b218a commit ee377de

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

src/agentlab/agents/dynamic_prompting.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,12 @@
1010

1111
import bgym
1212
from browsergym.core.action.base import AbstractActionSet
13-
from browsergym.utils.obs import flatten_axtree_to_str, flatten_dom_to_str, overlay_som, prune_html
13+
from browsergym.utils.obs import (
14+
flatten_axtree_to_str,
15+
flatten_dom_to_str,
16+
overlay_som,
17+
prune_html,
18+
)
1419

1520
from agentlab.llm.llm_utils import (
1621
BaseMessage,

src/agentlab/llm/llm_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ def extract_code_blocks(text) -> list[tuple[str, str]]:
250250
pattern = re.compile(r"```(\w*\n)?(.*?)```", re.DOTALL)
251251

252252
matches = pattern.findall(text)
253-
return [(match[0], match[1].strip()) for match in matches]
253+
return [(match[0].strip(), match[1].strip()) for match in matches]
254254

255255

256256
def parse_html_tags_raise(text, keys=(), optional_keys=(), merge_multiple=False):

tests/llm/test_llm_utils.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,12 +231,14 @@ def hello_world():
231231
```javascript
232232
console.log("Hello, world!");
233233
```
234+
An inline code block ```click()```
234235
"""
235236

236237
expected_output = [
237238
("python", 'def hello_world():\n print("Hello, world!")'),
238239
("", "More code without a language."),
239240
("javascript", 'console.log("Hello, world!");'),
241+
("", "click()"),
240242
]
241243

242244
assert llm_utils.extract_code_blocks(text) == expected_output

0 commit comments

Comments
 (0)