Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tool calls parsing for definitions containing arrays #3389

Closed

Conversation

bwilliams2
Copy link
Contributor

Description

Makes a small change to the parsing for tool_calls within Jinja templates. Previously square bracket pairs defined matching group which caused incomplete matching when square brackets were used within the tool_calls definition (e.g., arguments with arrays for function calls). This PR changes the matching logic to match the tool_call preamble definitions and removes then removes the matching preamble from the prompt. This avoids the need for more complex recursive bracket matching.

The bug was fixed in the two identical functions defined in promptflow-tools/promptflow/tools/common.py and promptflow-core/core/_prompty_utils.py. Test case added to promptflow-tools but I did not find existing test cases for the relevant code in promptflow-core. If directed to the right location, I can added additional test cases there.

Fixes #3388

All Promptflow Contribution checklist:

  • The pull request does not introduce [breaking changes].
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.
  • Create an issue and link to the pull request to get dedicated review from promptflow team. Learn more: suggested workflow.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

@bwilliams2 bwilliams2 requested review from a team as code owners June 7, 2024 16:28
@github-actions github-actions bot added promptflow-tools promptflow tools code promptflow-core labels Jun 7, 2024
@bwilliams2 bwilliams2 closed this Jun 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Parsing of tool calls does not support arrays in the "arguments"
3 participants