Skip to content

Commit

Permalink
Add comment to tools code
Browse files Browse the repository at this point in the history
  • Loading branch information
bwilliams2 committed Jun 11, 2024
1 parent 343f3e8 commit 9f0d391
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/promptflow-tools/promptflow/tools/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,11 @@ 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.

# Previously used pattern (commented) cannot parse tool_calls with internal square brackets
# common with function call arguments. Updated pattern matches content before tool_calls array
# and removes it before parsing the array.
# pattern = r"\n*#{0,2}\s*tool_calls\s*:\s*\n+\s*(\[.*?\])"
pattern = r"(\n*#{0,2}\s*tool_calls\s*:\s*\n+\s*)\["
match = re.search(pattern, role_prompt, re.DOTALL)
if match:
Expand Down

0 comments on commit 9f0d391

Please sign in to comment.