assafelovic / gpt-researcher

GPT based autonomous agent that does online comprehensive research on any given topic
https://gptr.dev
MIT License
12.98k stars 1.61k forks source link

Implement more graceful JSON handling on choose_agent in master/actions.py #616

Closed AADaoud closed 1 week ago

AADaoud commented 1 week ago

Reason: When I was testing the limits of this project I noticed that passing off any instructions through the agent as a query broke the choose_agent function as the response contained non-JSON formatted text.

Suggestion: I have added two new async functions to handle different JSON errors using the already imported json_repair library and regex as a last resort.

Importance: This contribution is important because it makes the user experience remain relevant to the research task even when the user (who might not be technically adept) decides to pass instructions in the prompt.

assafelovic commented 1 week ago

Thank you for this improvement!

assafelovic commented 1 week ago

Thank you for this improvement!

AADaoud commented 1 week ago

🙌