From c039df28a8015820c40c1402ce5d82187a868f7b Mon Sep 17 00:00:00 2001 From: Kalvin C Date: Thu, 10 Apr 2025 13:44:57 -0700 Subject: [PATCH] feat: remove ^$ anchor in recipe regex for json responses (#2140) --- crates/goose/src/agents/agent.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/goose/src/agents/agent.rs b/crates/goose/src/agents/agent.rs index 380eb71c..fe0a4896 100644 --- a/crates/goose/src/agents/agent.rs +++ b/crates/goose/src/agents/agent.rs @@ -822,7 +822,7 @@ impl Agent { let content = result.as_concat_text(); // the response may be contained in ```json ```, strip that before parsing json - let re = Regex::new(r"(?s)^```[^\n]*\n(.*?)\n```$").unwrap(); + let re = Regex::new(r"(?s)```[^\n]*\n(.*?)\n```").unwrap(); let clean_content = re .captures(&content) .and_then(|caps| caps.get(1).map(|m| m.as_str()))