semantic-kernel icon indicating copy to clipboard operation
semantic-kernel copied to clipboard

Hitting InvalidPlan from time to time

Open LittleLittleCloud opened this issue 1 year ago • 1 comments

Describe the bug When using planner skill, I sometimes hit InvalidPlan exception and planner string seems to be missing either a <if> or <else> tag. The error appears from time to time and even with the same plan prompt can sometimes producing a different planning string.

Invalid plan string example (missing a if)

<goal>
1:Check if you can answer the given quesiton with existing knowledge. If yes return answer, otherwise do the following steps until you get the answer:
 - explain why you can't answer the question
 - generating query from explanation
 - use query to lookup or search information, and append the lookup or search result to $knowledge
2:Answer to $ANSWER.
3:Summarize and set to Summary variable.
</goal><plan>
  <else><function._GLOBAL_FUNCTIONS_.Explain knowledge="$knowledge" question="$question" setContextVariable="EXPLANATION" /><function._GLOBAL_FUNCTIONS_.GenerateQuery explanation="$EXPLANATION" setContextVariable="QUERY" /><function._GLOBAL_FUNCTIONS_.Lookup input="$QUERY" setContextVariable="LOOKUP_RESULT" /><function._GLOBAL_FUNCTIONS_.Search input="$QUERY" setContextVariable="SEARCH_RESULT" /><function._GLOBAL_FUNCTIONS_.BucketOutputs input="$LOOKUP_RESULT;$SEARCH_RESULT" bucketCount="2" bucketLabelPrefix="RESULT" /><function._GLOBAL_FUNCTIONS_.UpdateKnowledgeVariable input="$RESULT_1;$RESULT_2" knowledge="$knowledge" /><function._GLOBAL_FUNCTIONS_.Answer knowledge="$knowledge" question="$question" setContextVariable="ANSWER" /></else>
  <function._GLOBAL_FUNCTIONS_.Summarize question="$question" query="$QUERY" knowledge="$knowledge" answer="$ANSWER" setContextVariable="SUMMARY" />
</plan>

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. Windows]
  • IDE: [e.g. Visual Studio, VS Code]
  • NuGet Package Version [e.g. 0.1.0]

Additional context Add any other context about the problem here.

LittleLittleCloud avatar Apr 17 '23 21:04 LittleLittleCloud

@LittleLittleCloud ,thanks for the idea. We will take a look.

evchaki avatar Apr 18 '23 20:04 evchaki

The planner has changed quite a bit. Please open a new issue if you are still seeing issues with 0.15 or greater.

lemillermicrosoft avatar Jun 15 '23 21:06 lemillermicrosoft