Repository navigation
Commit 49eab94
Python: Prevents LLMs from stripping complex function names (microsoft#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 😄1 parent 774c6af commit 49eab94
1 file changed
Lines changed: 14 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
27 | 41 | | |
28 | 42 | | |
29 | 43 | | |
| |||
0 commit comments