From 1e073736963d1789774ee2f532dfd3eeeec03fe5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CPhilip?= Date: Mon, 3 Apr 2023 14:58:27 +0100 Subject: [PATCH 1/5] Fix JSON string escaping issue Fixes an issue where double quotes were not being escaped in JSON strings, causing parse errors. --- scripts/json_parser.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/json_parser.py b/scripts/json_parser.py index 11ff9ed2..c36b2c14 100644 --- a/scripts/json_parser.py +++ b/scripts/json_parser.py @@ -52,7 +52,7 @@ def fix_json(json_str: str, schema: str, debug=False) -> str: # Try to fix the JSON using gpt: function_string = "def fix_json(json_str: str, schema:str=None) -> str:" args = [json_str, schema] - description_string = """Fixes the provided JSON string to make it parseable and fully complient with the provided schema.\n If an object or field specifed in the schema isn't contained within the correct JSON, it is ommited.\n This function is brilliant at guessing when the format is incorrect.""" + description_string = """This function takes a JSON string and ensures that it is parseable and fully compliant with the provided schema. If an object or field specified in the schema isn't contained within the correct JSON, it is omitted. The function also escapes any double quotes in the JSON string to ensure that it is valid.""" # If it doesn't already start with a "`", add one: if not json_str.startswith("`"): From f20d6f3fdb731c43910ba49916a7c8e2e1fd9eb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CPhilip?= Date: Mon, 3 Apr 2023 15:07:47 +0100 Subject: [PATCH 2/5] Breaking on None and NaN values returned fix by converting to valid null value for JSON --- scripts/json_parser.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/json_parser.py b/scripts/json_parser.py index c36b2c14..90bf83db 100644 --- a/scripts/json_parser.py +++ b/scripts/json_parser.py @@ -52,7 +52,7 @@ def fix_json(json_str: str, schema: str, debug=False) -> str: # Try to fix the JSON using gpt: function_string = "def fix_json(json_str: str, schema:str=None) -> str:" args = [json_str, schema] - description_string = """This function takes a JSON string and ensures that it is parseable and fully compliant with the provided schema. If an object or field specified in the schema isn't contained within the correct JSON, it is omitted. The function also escapes any double quotes in the JSON string to ensure that it is valid.""" + description_string = """This function takes a JSON string and ensures that it is parseable and fully compliant with the provided schema. If an object or field specified in the schema isn't contained within the correct JSON, it is omitted. The function also escapes any double quotes in the JSON string to ensure that it is valid. If the JSON string contains any None or NaN values, they are replaced with null before being parsed.""" # If it doesn't already start with a "`", add one: if not json_str.startswith("`"): From 6003d98f3ae62b40f5c0ebdaf995e5749d2b4c5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CPhilip?= Date: Mon, 3 Apr 2023 20:35:12 +0100 Subject: [PATCH 3/5] More specific wording consistent escaping --- scripts/json_parser.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/json_parser.py b/scripts/json_parser.py index 90bf83db..91e4e80f 100644 --- a/scripts/json_parser.py +++ b/scripts/json_parser.py @@ -52,7 +52,7 @@ def fix_json(json_str: str, schema: str, debug=False) -> str: # Try to fix the JSON using gpt: function_string = "def fix_json(json_str: str, schema:str=None) -> str:" args = [json_str, schema] - description_string = """This function takes a JSON string and ensures that it is parseable and fully compliant with the provided schema. If an object or field specified in the schema isn't contained within the correct JSON, it is omitted. The function also escapes any double quotes in the JSON string to ensure that it is valid. If the JSON string contains any None or NaN values, they are replaced with null before being parsed.""" + description_string = """This function takes a JSON string and ensures that it is parseable and fully compliant with the provided schema. If an object or field specified in the schema isn't contained within the correct JSON, it is omitted. The function also escapes any double quotes within JSON string values to ensure that they are valid. If the JSON string contains any None or NaN values, they are replaced with null before being parsed.""" # If it doesn't already start with a "`", add one: if not json_str.startswith("`"): From a791d7a2449684b2435956c3c08158a5c04ce81f Mon Sep 17 00:00:00 2001 From: Edgar Barrantes Date: Sat, 15 Apr 2023 12:06:40 +0300 Subject: [PATCH 4/5] Update docs: Data ingestion script location --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 55c3d833..7da3172a 100644 --- a/README.md +++ b/README.md @@ -297,7 +297,7 @@ To switch to either, change the `MEMORY_BACKEND` env variable to the value that ## 🧠 Memory pre-seeding ``` -# python scripts/data_ingestion.py -h +# python autogpt/data_ingestion.py -h usage: data_ingestion.py [-h] (--file FILE | --dir DIR) [--init] [--overlap OVERLAP] [--max_length MAX_LENGTH] Ingest a file or a directory with multiple files into memory. Make sure to set your .env before running this script. @@ -310,10 +310,10 @@ options: --overlap OVERLAP The overlap size between chunks when ingesting files (default: 200) --max_length MAX_LENGTH The max_length of each chunk when ingesting files (default: 4000 -# python scripts/data_ingestion.py --dir seed_data --init --overlap 200 --max_length 1000 +# python autogpt/data_ingestion.py --dir seed_data --init --overlap 200 --max_length 1000 ``` -This script located at scripts/data_ingestion.py, allows you to ingest files into memory and pre-seed it before running Auto-GPT. +This script located at autogpt/data_ingestion.py, allows you to ingest files into memory and pre-seed it before running Auto-GPT. Memory pre-seeding is a technique that involves ingesting relevant documents or data into the AI's memory so that it can use this information to generate more informed and accurate responses. From 9607ae0c1e126adffb0f0e44cf9497a4db93e945 Mon Sep 17 00:00:00 2001 From: Mansy Date: Sat, 15 Apr 2023 22:26:00 +0200 Subject: [PATCH 5/5] Update README.md Use correct var name "ELEVENLABS_API_KEY" --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ae487ceb..91dc487b 100644 --- a/README.md +++ b/README.md @@ -115,7 +115,7 @@ cd Auto-GPT pip install -r requirements.txt ``` -5. Rename `.env.template` to `.env` and fill in your `OPENAI_API_KEY`. If you plan to use Speech Mode, fill in your `ELEVEN_LABS_API_KEY` as well. +5. Rename `.env.template` to `.env` and fill in your `OPENAI_API_KEY`. If you plan to use Speech Mode, fill in your `ELEVENLABS_API_KEY` as well. - See [OpenAI API Keys Configuration](#openai-api-keys-configuration) to obtain your OpenAI API key. - Obtain your ElevenLabs API key from: https://elevenlabs.io. You can view your xi-api-key using the "Profile" tab on the website. - If you want to use GPT on an Azure instance, set `USE_AZURE` to `True` and then follow these steps: