-
Notifications
You must be signed in to change notification settings - Fork 44.7k
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
Fixed Json Error #285
Fixed Json Error #285
Conversation
except Exception as e: | ||
if try_to_fix_with_gpt: | ||
print(f"Warning: Failed to parse AI output, attempting to fix.\n If you see this warning frequently, it's likely that your prompt is confusing the AI. Try changing it up slightly.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why get rid of this message about confusing the AI?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, please add this back in.
return json_str | ||
else: | ||
raise e | ||
return None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not keep the try/except error handling paradigm?
json_str = json_str[:last_brace_index+1] | ||
return json_str | ||
|
||
def attempt_parse(json_str): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not un-nest these functions while you're at it?
What are all these new .idea files? |
.idea/Auto-GPT.iml
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume you added these by mistake?
Please remove them.
@Torantulino Those are IntelliJ IDE files that people keep pushing by mistake. We can add those to |
@ksylvan Add them in a separate PR. Also resolve the conflicts. |
@nponeccop Not my PR, I was just commenting on it, since I'd seen a few different PRs with |
@jetblaise Could you resolve the conflicts? |
This pull request has conflicts with the base branch, please resolve those so we can evaluate the pull request. |
1 similar comment
This pull request has conflicts with the base branch, please resolve those so we can evaluate the pull request. |
This is a mass message from the AutoGPT core team. For more details (and for infor on joining our Discord), please refer to: |
Closing this PR as it has conflicts and long-standing unresolved requests for changes |
Signed-off-by: Merwane Hamadi <merwanehamadi@gmail.com>
Fixed the json_parser.py error by making chatgpt fix itself
def fix_and_parse_json(json_str: str, try_to_fix_with_gpt: bool = True):
json_schema = """
{
"command": {
"name": "command name",
"args":{
"arg name": "value"
}
},
"thoughts":
{
"text": "thought",
"reasoning": "reasoning",
"plan": "- short bulleted\n- list that conveys\n- long-term plan",
"criticism": "constructive self-criticism",
"speak": "thoughts summary to say to user"
}
}
"""