From b766af75f2b573a0a07cef54741849b91d9c5f4a Mon Sep 17 00:00:00 2001 From: Arthur Chien Date: Fri, 21 Mar 2025 03:44:44 +0800 Subject: [PATCH] fix the _extract_thought (#2398) * fix the _extract_thought the regex string should be same with prompt in en.json:129 ...\nThought: I now know the final answer\nFinal Answer: the... * fix Action match --------- Co-authored-by: Brandon Hancock (bhancock_ai) <109994880+bhancockio@users.noreply.github.com> --- src/crewai/agents/parser.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/crewai/agents/parser.py b/src/crewai/agents/parser.py index 1bda4df5c..05c5bc003 100644 --- a/src/crewai/agents/parser.py +++ b/src/crewai/agents/parser.py @@ -124,9 +124,9 @@ class CrewAgentParser: ) def _extract_thought(self, text: str) -> str: - thought_index = text.find("\n\nAction") + thought_index = text.find("\nAction") if thought_index == -1: - thought_index = text.find("\n\nFinal Answer") + thought_index = text.find("\nFinal Answer") if thought_index == -1: return "" thought = text[:thought_index].strip()