From 401ccad316e80ba84f074490bb2e1c19dd251974 Mon Sep 17 00:00:00 2001 From: Adrian Panella Date: Fri, 18 Oct 2024 20:46:09 -0600 Subject: [PATCH] prompty: fix parsing of tool_calls when array in arguments --- src/promptflow-core/promptflow/core/_prompty_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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: