Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

Add missing json_parser.py and add alternative requirements

Taylor Browndca5b78bfeec
diff --git a/scripts/json_parser.py b/scripts/json_parser.py
new file mode 100644
index 0000000000..87f376c603
--- /dev/null
+++ b/scripts/json_parser.py
@@ -0,0 +1,12 @@
+import dirtyjson
+from ai_functions import fix_json
+
+def fix_and_parse_json(json_str: str, try_to_fix_with_gpt: bool = True):
+ try:
+ return dirtyjson.loads(json_str)
+ except Exception as e:
+ if try_to_fix_with_gpt:
+ # Now try to fix this up using the ai_functions
+ return fix_json(json_str, None, True)
+ else:
+ raise e
\ No newline at end of file
diff --git a/scripts/requirements-alternative.txt b/scripts/requirements-alternative.txt
new file mode 100644
index 0000000000..a65dd4c6d3
--- /dev/null
+++ b/scripts/requirements-alternative.txt
@@ -0,0 +1,16 @@
+# I wasn't having any luck installing the requirements.txt file in Mac or Linux,
+# so I unpinned and installed, and got these versions:
+beautifulsoup4==4.9.3
+colorama==0.4.6
+dirtyjson==1.0.8
+# The biggest difference is docker 5 instead of 6, because of this silliness:
+# The conflict is caused by:
+# The user requested requests>=2.26.0
+# docker 6.0.1 depends on requests>=2.26.0
+# googlesearch-python 1.1.0 depends on requests==2.25.1
+docker==5.0.3
+googlesearch-python==1.1.0
+openai==0.27.2
+playsound==1.3.0
+readability-lxml==0.8.1
+requests==2.25.1
diff --git a/scripts/requirements.txt b/scripts/requirements.txt
index 0e2e52a7e8..302964865e 100644
--- a/scripts/requirements.txt
+++ b/scripts/requirements.txt
@@ -1,8 +1,9 @@
beautifulsoup4==4.9.3
colorama==0.4.6
+dirtyjson==1.0.8
+docker==6.0.1
googlesearch_python==1.1.0
openai==0.27.0
playsound==1.2.2
readability_lxml==0.8.1
requests==2.25.1
-docker==6.0.1