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

Extracting plan json from ActionPlanner result #1802

Merged
merged 14 commits into from
Jul 7, 2023

Conversation

teresaqhoang
Copy link
Contributor

Motivation and Context

LLM can return additional texts (i.e., preambles, explanations) around the proposed plan, so this PR extracts a well-formed JSON from the result of the planner using a RegEx and balanced group concepts.

In response to: #1726

Description

Also, updates any use of Plan State to Plan Parameters due to previous Planner refactor.

Contribution Checklist

@teresaqhoang teresaqhoang added planner Anything related to planner or plans kernel Issues or pull requests impacting the core kernel sk team issue A tag to denote issues that where created by the Semantic Kernel team (i.e., not the community) labels Jun 30, 2023
@teresaqhoang teresaqhoang self-assigned this Jun 30, 2023
@teresaqhoang teresaqhoang requested review from a team as code owners June 30, 2023 23:05
@github-actions github-actions bot added .NET Issue or Pull requests regarding .NET code samples labels Jun 30, 2023
Copy link
Member

@dmytrostruk dmytrostruk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @teresaqhoang !
It would be great to add unit test under Extensions.UnitTests\Planning to verify and showcase how new regex resolves an issue.

@dmytrostruk dmytrostruk added the PR: feedback to address Waiting for PR owner to address comments/questions label Jul 3, 2023
@teresaqhoang teresaqhoang added PR: ready to merge PR has been approved by all reviewers, and is ready to merge. and removed PR: feedback to address Waiting for PR owner to address comments/questions labels Jul 6, 2023
Copy link
Member

@dmytrostruk dmytrostruk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @teresaqhoang ! I pushed some minor improvements for tests and XML documentation. Looks good to me!

@gitri-ms gitri-ms added this pull request to the merge queue Jul 7, 2023
Merged via the queue into microsoft:main with commit 6b3e46d Jul 7, 2023
17 checks passed
golden-aries pushed a commit to golden-aries/semantic-kernel that referenced this pull request Oct 10, 2023
### Motivation and Context
<!-- Thank you for your contribution to the semantic-kernel repo!
Please help reviewers and future users, providing the following
information:
  1. Why is this change required?
  2. What problem does it solve?
  3. What scenario does it contribute to?
  4. If it fixes an open issue, please link to the issue here.
-->
LLM can return additional texts (i.e., preambles, explanations) around
the proposed plan, so this PR extracts a well-formed JSON from the
result of the planner using a RegEx and balanced group concepts.

In response to: microsoft#1726

### Description
<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->
Also, updates any use of Plan State to Plan Parameters due to previous
Planner refactor.

### Contribution Checklist
<!-- Before submitting this PR, please make sure: -->
- [x] The code builds clean without any errors or warnings
- [x] The PR follows SK Contribution Guidelines
(https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
- [x] The code follows the .NET coding conventions
(https://learn.microsoft.com/dotnet/csharp/fundamentals/coding-style/coding-conventions)
verified with `dotnet format`
- [x] All unit tests pass, and I have added new tests where possible
- [x] I didn't break anyone 😄

---------

Co-authored-by: Dmytro Struk <13853051+dmytrostruk@users.noreply.github.com>
@teresaqhoang teresaqhoang deleted the action-planner-json-parser branch December 13, 2023 22:41
@kanchanpathak06
Copy link

Which version of semantic kernel is this issue resolved in, using 0.5.1.dev0 I am still seeing error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kernel Issues or pull requests impacting the core kernel .NET Issue or Pull requests regarding .NET code planner Anything related to planner or plans PR: ready to merge PR has been approved by all reviewers, and is ready to merge. sk team issue A tag to denote issues that where created by the Semantic Kernel team (i.e., not the community)
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

ActionPlanner should be more forgiving when parsing out plan results.
4 participants