Closed Chris-hughes10 closed 1 year ago
Wow
It looks like there's a bug in the code. The
Plan
class is trying to access an attributeself.plan
, which has been renamed toself.generated_plan
. You need to update the code in theBasicPlanner
class to use the correct attribute name. This should fix the AttributeError you're encountering. class Plan: def init(self, prompt, goal, generated_plan): self.prompt = prompt self.goal = goal self.generated_plan = generated_plandef __str__(self): return f"Prompt: {self.prompt}\nGoal: {self.goal}\nPlan: {self.plan}"
To fix the bug, you'll need to modify the str method in the Plan class of the BasicPlanner module. Instead of using self.plan, you should use self.generated_plan. Here's how you can do it:
Open the file located at /anaconda/envs/azureml_py310_sdkv2/lib/python3.10/site-packages/semantic_kernel/planning/basic_planner.py. Find the Plan class definition. It should look something like this: python Copy code class Plan: def init(self, prompt, goal, generated_plan): self.prompt = prompt self.goal = goal self.generated_plan = generated_plan
def __str__(self): return f"Prompt: {self.prompt}\nGoal: {self.goal}\nPlan: {self.plan}"
Modify the str method to use self.generated_plan instead of self.plan: python Copy code class Plan: def init(self, prompt, goal, generated_plan): self.prompt = prompt self.goal = goal self.generated_plan = generated_plan
def __str__(self): return f"Prompt: {self.prompt}\nGoal: {self.goal}\nPlan: {self.generated_plan}"
Save the file. This should resolve the AttributeError issue you're facing. Once you've made this change, you can rerun your code, and it should now print the plan correctly using the self.generated_plan attribute.
Understood, but I'd rather it's fixed in the repo ;)
Additionally, when both a text completion service and a chat completion service are registered, the output isn't as intended. After fixing the bug, and using the prompt write a poem based on an image
the output I get is:
I assume that this is using the text completion service (GPT3.5-turbo) that I have registered, rather than the chat service (also GPT3.5-turbo), so is treating the task as an autocomplete rather than an instruction.
Should the class default to using chat services rather than text completion?
@lemillermicrosoft - please confirm the bug and provide any suggestions on next steps.
Describe the bug When trying to use the basic planner, it seems to be unable to generate any sort of plan, raising an attribute error.
To Reproduce
Stacktrace
Expected behavior A plan is printed. If it is unable to generate a plan, it should either return an empty dict or raise an error.
The issue seems to be in this line in the
Plan
classit appears that
self.plan
has been renamed toself.generated_plan
Platform
Additional context Add any other context about the problem here.