Repository navigation
Python: Prevents LLMs from stripping complex function names - #4366
Merged
Alex Chao (alexchaomander) merged 3 commits intoDec 20, 2023
Conversation
Julio Carlos Menendez (juliomenendez)
force-pushed
the
issue-3237-stepwiseplan-recall-context-not-used
branch
from
December 18, 2023 22:39
6baa890 to
040120f
Compare
Julio Carlos Menendez (juliomenendez)
force-pushed
the
issue-3237-stepwiseplan-recall-context-not-used
branch
from
December 18, 2023 22:41
040120f to
473797a
Compare
Julio Carlos Menendez (juliomenendez)
marked this pull request as ready for review
December 18, 2023 22:45
Julio Carlos Menendez (juliomenendez)
requested a review
from a team
as a code owner
December 18, 2023 22:45
Huijing Huang (rewrlution)
left a comment
Contributor
There was a problem hiding this comment.
LGTM, just have a high level question.
Huijing Huang (rewrlution)
left a comment
Contributor
There was a problem hiding this comment.
Left another comment on the prompt itself.
Huijing Huang (rewrlution)
approved these changes
Dec 18, 2023
Eduard van Valkenburg (eavanvalkenburg)
approved these changes
Dec 19, 2023
Eduard van Valkenburg (eavanvalkenburg)
left a comment
Member
There was a problem hiding this comment.
Looks good, adding testing would be good, but can be a separate PR.
Evan Mattson (moonbox3)
approved these changes
Dec 19, 2023
Evan Mattson (moonbox3)
left a comment
Collaborator
There was a problem hiding this comment.
Thanks so much for working on this!
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Dec 19, 2023
Evan Mattson (moonbox3)
approved these changes
Dec 19, 2023
Evan Mattson (moonbox3)
enabled auto-merge
December 19, 2023 17:54
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Dec 19, 2023
Julio Carlos Menendez (juliomenendez)
deleted the
issue-3237-stepwiseplan-recall-context-not-used
branch
December 20, 2023 14:46
Bryan (Bryan-Roe)
pushed a commit
to Bryan-Roe-ai/semantic-kernel
that referenced
this pull request
Oct 6, 2024
…t#4366) ### Motivation and Context When using the `StepwisePlanner` planner along with core skills, for example `TextMemorySkill`, the LLMs tend to plans with function names stripped down to the name without the skill name. This makes the plan fail with an exception like: `Error invoking action recall: (<ErrorCodes.UnknownError: -1>, "The function 'recall' was not found.", None)` This error is because the completion returned by the planner prompt does not include the fully structured skill function name. Ex.: instead of returning `_GLOBAL_FUNCTIONS_.recall` it returns `recall` or `GLOBAL_FUNCTIONS.recall`. This is somehow relates microsoft#3237 ### Description This change instructs the LLM to keep the skill function name unchanged in its response by adding an example that includes `_` in the name. This approach mimics how the `SequentialPlanner` solves this same issue. ### Contribution Checklist - [X] The code builds clean without any errors or warnings - [X] The PR follows the [SK Contribution Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md) and the [pre-submission formatting script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts) raises no violations - [X] All unit tests pass, and I have added new tests where possible - [X] I didn't break anyone 😄
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation and Context
When using the
StepwisePlannerplanner along with core skills, for exampleTextMemorySkill, the LLMs tend to plans with function names stripped down to the name without the skill name. This makes the plan fail with an exception like:Error invoking action recall: (<ErrorCodes.UnknownError: -1>, "The function 'recall' was not found.", None)This error is because the completion returned by the planner prompt does not include the fully structured skill function name. Ex.: instead of returning
_GLOBAL_FUNCTIONS_.recallit returnsrecallorGLOBAL_FUNCTIONS.recall.This is somehow relates #3237
Description
This change instructs the LLM to keep the skill function name unchanged in its response by adding an example that includes
_in the name. This approach mimics how theSequentialPlannersolves this same issue.Contribution Checklist