Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error for replace() when self.plan is a list #4

Closed
maxi-w opened this issue Feb 16, 2024 · 4 comments
Closed

Error for replace() when self.plan is a list #4

maxi-w opened this issue Feb 16, 2024 · 4 comments

Comments

@maxi-w
Copy link

maxi-w commented Feb 16, 2024

At string formatting in flows.py for self.plan there is a .replace() operation called.
Sometimes the model returns self.plan as a list. In such cases an error is thrown because replace cannot be called on a list. Most of the time self.plan is a string so it's only happening sometimes and hard to reproduce.

@devilkadabra69
Copy link

devilkadabra69 commented Feb 19, 2024

i guess i can work on it
a small fix to handle self.plan as a list should be

               s=""
                  if isinstance(response_json["Plan"],list):
                      for i in response_json["Plan"]:
                          i=i.strip()
                          s+=i+"\n"
                       self.plan = s.strip()
                   else:
                       self.plan=response_json["Plan"].strip()

can you tell that should i end every word with \n or not ?

@vyokky
Copy link
Contributor

vyokky commented Feb 19, 2024

i guess i can work on it a small fix to handle self.plan as a list should be

               s=""
                  if isinstance(response_json["Plan"],list):
                      for i in response_json["Plan"]:
                          i=i.strip()
                          s+=i+"\n"
                       self.plan = s.strip()
                   else:
                       self.plan=response_json["Plan"].strip()

can you tell that should i end every word with \n or not ?

Great to see you solve it. It does not have to be with a \n.

@vyokky
Copy link
Contributor

vyokky commented Feb 19, 2024

At string formatting in flows.py for self.plan there is a .replace() operation called. Sometimes the model returns self.plan as a list. In such cases an error is thrown because replace cannot be called on a list. Most of the time self.plan is a string so it's only happening sometimes and hard to reproduce.

It is probably because GPT sometimes does not follow our instruction to output string. I see @devilkadabra69 have an soluton. Would you mind having a try? If this work we and intergrate it in the code.

@devilkadabra69
Copy link

i hope it works thank you @vyokky for the response!

@vyokky vyokky closed this as completed Feb 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants