Python: Trouble understanding how to control the prompt that is executing the plan created by the planner in function_calling_stepwise_planner #6104
-
I see that I could change the prompt that is behind the actual planner of the function_calling_stepwise_planner by providing the get_initial_plan argument to FunctionCallingStepwisePlannerOptions and passing that to the FunctionCallingStepwisePlanner. However, the default prompt works well for my purposes, and I'm instead interested in how I can alter the prompt being used to return the final answer to the user. Please correct me if I'm wrong but from my understanding there are essentially 3 prompts at play by default.
My end goal would be to edit the prompt behind this function in order to return the output in a standard format. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Update: After finding a discussion about a similar issue posted a couple weeks ago (Sadly I could not find the discussion again to link here) there was a recent reply from @moonbox3 suggesting the user use the callbacks I had initially mentioned in my question. I created a new version of generate_plan.yaml and added that to the FunctionCallingStepwisePlannerOptions and got the result I was looking for. Though I got the desired result, it still feels wrong to me as I don't fully understand how the UserInteraction plugin is working. To me, it feels like this is where the edits should be made to any prompting since this is the formatting of the final result. Could someone explain how UserInteraction-SendFinalAnswer is actually being used? I'm confused by the fact that it just contains |
Beta Was this translation helpful? Give feedback.
-
Hi @ColtonBehannon, the UserInteraction-SendFinalAnswer plugin is a more concrete way for us to handle the final answer, if/when it is created by the LLM. The It sounds like what you're doing is perfectly fine, which is the more advanced way of providing your own callbacks for the initial plan prompt and step prompt template. |
Beta Was this translation helpful? Give feedback.
Hi @ColtonBehannon, the UserInteraction-SendFinalAnswer plugin is a more concrete way for us to handle the final answer, if/when it is created by the LLM. The
answer
parameter to the function is an indication to the LLM and is not intended to be used. You can see here that we're doing a check if the FunctionResult contains a plugin with the nameUserInteraction-SendFinalAnswer
, otherwise other text returned from the LLM could be part of the planned process and not something we want to actually stop on.https://github.com/microsoft/semantic-kernel/blob/8f15f3a81c3bbbfa2f3fe65f4a9034e76425e693/python/semantic_kernel/planners/function_calling_stepwise_planner/function_calling_stepwise_planne…