diff --git a/src/promptflow-core/promptflow/core/_prompty_utils.py b/src/promptflow-core/promptflow/core/_prompty_utils.py index 47ef499ce1e..49dc1108adf 100644 --- a/src/promptflow-core/promptflow/core/_prompty_utils.py +++ b/src/promptflow-core/promptflow/core/_prompty_utils.py @@ -654,7 +654,7 @@ def try_parse_tool_call_id_and_content(role_prompt): def try_parse_tool_calls(role_prompt): # customer can add ## in front of tool_calls for markdown highlight. # and we still support tool_calls without ## prefix for backward compatibility. - pattern = r"\n*#{0,2}\s*tool_calls\s*:\s*\n+\s*(\[.*?\])" + pattern = r"\n*#{0,2}\s*tool_calls\s*:\s*\n+\s*(\[.*?\])\s*$" match = re.search(pattern, role_prompt, re.DOTALL) if match: try: