From aa786e1b41841604e00a451d7304cdcfc6795e2c Mon Sep 17 00:00:00 2001 From: Chris Cheney Date: Sat, 8 Apr 2023 21:30:36 -0500 Subject: [PATCH 01/19] command_name null check before calling .lower() fixes #534 `AttributeError: 'NoneType' object has no attribute 'lower'` --- scripts/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/main.py b/scripts/main.py index 17385bf339..4d68b4506d 100644 --- a/scripts/main.py +++ b/scripts/main.py @@ -358,7 +358,7 @@ while True: f"COMMAND = {Fore.CYAN}{command_name}{Style.RESET_ALL} ARGUMENTS = {Fore.CYAN}{arguments}{Style.RESET_ALL}") # Execute command - if command_name.lower() == "error": + if command_name is not None and command_name.lower() == "error": result = f"Command {command_name} threw the following error: " + arguments elif command_name == "human_feedback": result = f"Human feedback: {user_input}" From 334a1d2632da5fbc4c2a66c4171e361e94b07227 Mon Sep 17 00:00:00 2001 From: keenborder786 <21110290@lums.edu.pk> Date: Tue, 11 Apr 2023 01:23:59 +0500 Subject: [PATCH 02/19] [feat]: Added a argument which allows gpt4 only mode and configure the fast_llm_model accordingly --- scripts/main.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/main.py b/scripts/main.py index 3dfcaa157e..6fc6a03011 100644 --- a/scripts/main.py +++ b/scripts/main.py @@ -265,6 +265,7 @@ def parse_arguments(): parser.add_argument('--speak', action='store_true', help='Enable Speak Mode') parser.add_argument('--debug', action='store_true', help='Enable Debug Mode') parser.add_argument('--gpt3only', action='store_true', help='Enable GPT3.5 Only Mode') + parser.add_argument('--gpt4only', action='store_true', help='Enable GPT4 Only Mode') args = parser.parse_args() if args.continuous: @@ -286,6 +287,10 @@ def parse_arguments(): if args.gpt3only: print_to_console("GPT3.5 Only Mode: ", Fore.GREEN, "ENABLED") cfg.set_smart_llm_model(cfg.fast_llm_model) + + if args.gpt4only: + print_to_console("GPT4 Only Mode: ", Fore.GREEN, "ENABLED") + cfg.set_fast_llm_model(cfg.smart_llm_model) if args.debug: print_to_console("Debug Mode: ", Fore.GREEN, "ENABLED") From c0d2df6acc6d6663ed4935f57b7bf63819c1a44f Mon Sep 17 00:00:00 2001 From: blankster Date: Tue, 11 Apr 2023 01:59:43 +0200 Subject: [PATCH 03/19] Update .gitignore Ignoring IntelliJ Project Settings (e.g, Pycharm) --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 0edd3047d3..854b1401d1 100644 --- a/.gitignore +++ b/.gitignore @@ -11,4 +11,5 @@ venv/* outputs/* ai_settings.yaml .vscode +.idea/* auto-gpt.json From d4bb3de91bab4a6bb4a2c7e8124016f31645c20e Mon Sep 17 00:00:00 2001 From: Joseph Bisaillon Date: Mon, 10 Apr 2023 21:02:13 -0400 Subject: [PATCH 04/19] Add OpenAPI Key Link to README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 749c879151..70ee85e1cd 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ Your support is greatly appreciated ## 📋 Requirements - [Python 3.8 or later](https://www.tutorialspoint.com/how-to-install-python-in-windows) -- OpenAI API key +- [OpenAI API key](https://platform.openai.com/account/api-keys) - [PINECONE API key](https://www.pinecone.io/) Optional: From 66d316a19cb540cb3a310bea2ab3aa306b34304e Mon Sep 17 00:00:00 2001 From: BillSchumacher <34168009+BillSchumacher@users.noreply.github.com> Date: Mon, 10 Apr 2023 21:55:35 -0500 Subject: [PATCH 05/19] Fix case where index throws value error. --- 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 1fd6824408..a7b6127f79 100644 --- a/scripts/json_parser.py +++ b/scripts/json_parser.py @@ -53,7 +53,7 @@ def fix_and_parse_json( last_brace_index = json_str.rindex("}") json_str = json_str[:last_brace_index+1] return json.loads(json_str) - except json.JSONDecodeError as e: # noqa: F841 + except (json.JSONDecodeError, ValueError) as e: # noqa: F841 if try_to_fix_with_gpt: print("Warning: Failed to parse AI output, attempting to fix." "\n If you see this warning frequently, it's likely that" From 2b67ede6b36668a7b22cd9f35ce8b9e5c710bc49 Mon Sep 17 00:00:00 2001 From: honeykjoule Date: Tue, 11 Apr 2023 04:31:38 +0000 Subject: [PATCH 06/19] update gitignore venv/* to *venv/* --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 2d60380168..287c937fa7 100644 --- a/.gitignore +++ b/.gitignore @@ -7,7 +7,7 @@ package-lock.json auto_gpt_workspace/* *.mpeg .env -venv/* +*venv/* outputs/* ai_settings.yaml .vscode From e0cb648858427dfa2dc3b31b7485791707e981cd Mon Sep 17 00:00:00 2001 From: kinance Date: Tue, 11 Apr 2023 23:01:49 +0900 Subject: [PATCH 07/19] Make the cfg.debug to cfg.debug_mode consistent across files --- scripts/chat.py | 6 +++--- scripts/json_parser.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/chat.py b/scripts/chat.py index 23e5b50149..30f7603c76 100644 --- a/scripts/chat.py +++ b/scripts/chat.py @@ -64,14 +64,14 @@ def chat_with_ai( model = cfg.fast_llm_model # TODO: Change model from hardcode to argument # Reserve 1000 tokens for the response - if cfg.debug: + if cfg.debug_mode: print(f"Token limit: {token_limit}") send_token_limit = token_limit - 1000 relevant_memory = permanent_memory.get_relevant(str(full_message_history[-5:]), 10) - if cfg.debug: + if cfg.debug_mode: print('Memory Stats: ', permanent_memory.get_stats()) next_message_to_add_index, current_tokens_used, insertion_index, current_context = generate_context( @@ -110,7 +110,7 @@ def chat_with_ai( # assert tokens_remaining >= 0, "Tokens remaining is negative. This should never happen, please submit a bug report at https://www.github.com/Torantulino/Auto-GPT" # Debug print the current context - if cfg.debug: + if cfg.debug_mode: print(f"Token limit: {token_limit}") print(f"Send Token Count: {current_tokens_used}") print(f"Tokens remaining for response: {tokens_remaining}") diff --git a/scripts/json_parser.py b/scripts/json_parser.py index 8c17dfa252..1d93b10926 100644 --- a/scripts/json_parser.py +++ b/scripts/json_parser.py @@ -91,7 +91,7 @@ def fix_json(json_str: str, schema: str) -> str: result_string = call_ai_function( function_string, args, description_string, model=cfg.fast_llm_model ) - if cfg.debug: + if cfg.debug_mode: print("------------ JSON FIX ATTEMPT ---------------") print(f"Original JSON: {json_str}") print("-----------") From 9725c727da05c1a2a402216013d0564d100c48ec Mon Sep 17 00:00:00 2001 From: JZ Date: Tue, 11 Apr 2023 16:22:26 -0700 Subject: [PATCH 08/19] Changed spelling from "GTP" to "GPT". Also removed the 3 as this can run on GPT4. --- scripts/agent_manager.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/agent_manager.py b/scripts/agent_manager.py index e6bf3b8632..a0e5f16482 100644 --- a/scripts/agent_manager.py +++ b/scripts/agent_manager.py @@ -13,7 +13,7 @@ def create_agent(task, prompt, model): messages = [{"role": "user", "content": prompt}, ] - # Start GTP3 instance + # Start GPT instance agent_reply = create_chat_completion( model=model, messages=messages, @@ -41,7 +41,7 @@ def message_agent(key, message): # Add user message to message history before sending to agent messages.append({"role": "user", "content": message}) - # Start GTP3 instance + # Start GPT instance agent_reply = create_chat_completion( model=model, messages=messages, From 8d7e0153f056fe274bcd0d951d7c7d40a11132a9 Mon Sep 17 00:00:00 2001 From: Robin Richtsfeld Date: Wed, 12 Apr 2023 02:26:30 +0200 Subject: [PATCH 09/19] Fix Spinner --- scripts/spinner.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/spinner.py b/scripts/spinner.py index df39dbbd22..df1f4ddf93 100644 --- a/scripts/spinner.py +++ b/scripts/spinner.py @@ -20,7 +20,7 @@ class Spinner: sys.stdout.write(next(self.spinner) + " " + self.message + "\r") sys.stdout.flush() time.sleep(self.delay) - sys.stdout.write('\b' * (len(self.message) + 2)) + sys.stdout.write('\r' + ' ' * (len(self.message) + 2) + '\r') def __enter__(self): """Start the spinner""" From bbe6b1f626847e9b323edc6e0747e93e6656dd91 Mon Sep 17 00:00:00 2001 From: Dill <4053467+dillweed@users.noreply.github.com> Date: Tue, 11 Apr 2023 17:27:37 -0700 Subject: [PATCH 10/19] 'Config' object has no attribute 'debug' --- scripts/chat.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/chat.py b/scripts/chat.py index 23e5b50149..30f7603c76 100644 --- a/scripts/chat.py +++ b/scripts/chat.py @@ -64,14 +64,14 @@ def chat_with_ai( model = cfg.fast_llm_model # TODO: Change model from hardcode to argument # Reserve 1000 tokens for the response - if cfg.debug: + if cfg.debug_mode: print(f"Token limit: {token_limit}") send_token_limit = token_limit - 1000 relevant_memory = permanent_memory.get_relevant(str(full_message_history[-5:]), 10) - if cfg.debug: + if cfg.debug_mode: print('Memory Stats: ', permanent_memory.get_stats()) next_message_to_add_index, current_tokens_used, insertion_index, current_context = generate_context( @@ -110,7 +110,7 @@ def chat_with_ai( # assert tokens_remaining >= 0, "Tokens remaining is negative. This should never happen, please submit a bug report at https://www.github.com/Torantulino/Auto-GPT" # Debug print the current context - if cfg.debug: + if cfg.debug_mode: print(f"Token limit: {token_limit}") print(f"Send Token Count: {current_tokens_used}") print(f"Tokens remaining for response: {tokens_remaining}") From 4621df02c7d8ab7ed11b0f853b62f4222ecceb0e Mon Sep 17 00:00:00 2001 From: Toran Bruce Richards Date: Wed, 12 Apr 2023 12:31:58 +1200 Subject: [PATCH 11/19] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 749c879151..24e2aeba92 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ ![Twitter Follow](https://img.shields.io/twitter/follow/siggravitas?style=social) [![](https://dcbadge.vercel.app/api/server/PQ7VX6TY4t?style=flat)](https://discord.gg/PQ7VX6TY4t) -Auto-GPT is an experimental open-source application showcasing the capabilities of the GPT-4 language model. This program, driven by GPT-4, autonomously develops and manages businesses to increase net worth. As one of the first examples of GPT-4 running fully autonomously, Auto-GPT pushes the boundaries of what is possible with AI. +Auto-GPT is an experimental open-source application showcasing the capabilities of the GPT-4 language model. This program, driven by GPT-4, chains together LLM "thoughts", to autonomously achieve whatever goal you set. As one of the first examples of GPT-4 running fully autonomously, Auto-GPT pushes the boundaries of what is possible with AI. ### Demo (30/03/2023): https://user-images.githubusercontent.com/22963551/228855501-2f5777cf-755b-4407-a643-c7299e5b6419.mp4 From d25c016154ce519c1f3d50220ad45e35ab085f86 Mon Sep 17 00:00:00 2001 From: Robin Richtsfeld Date: Wed, 12 Apr 2023 02:56:37 +0200 Subject: [PATCH 12/19] Fixed typos --- .github/PULL_REQUEST_TEMPLATE.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 1ac8f8642d..9fa5659360 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -23,10 +23,10 @@ By following these guidelines, your PRs are more likely to be merged quickly aft ### PR Quality Checklist - [ ] My pull request is atomic and focuses on a single change. -- [ ] I have thouroughly tested my changes with multiple different prompts. +- [ ] I have thoroughly tested my changes with multiple different prompts. - [ ] I have considered potential risks and mitigations for my changes. - [ ] I have documented my changes clearly and comprehensively. -- [ ] I have not snuck in any "extra" small tweaks changes +- [ ] I have not snuck in any "extra" small tweaks changes From cf8b06f11ff2ec007b8eb7cae7e1741982d4b1ee Mon Sep 17 00:00:00 2001 From: endolith Date: Tue, 11 Apr 2023 22:10:37 -0400 Subject: [PATCH 13/19] Fix some typos --- scripts/ai_config.py | 4 ++-- scripts/chat.py | 2 +- scripts/commands.py | 2 +- scripts/config.py | 2 +- scripts/json_parser.py | 10 +++++----- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/scripts/ai_config.py b/scripts/ai_config.py index 2a4854cb97..bd373944fc 100644 --- a/scripts/ai_config.py +++ b/scripts/ai_config.py @@ -42,7 +42,7 @@ class AIConfig: config_file (int): The path to the config yaml file. DEFAULT: "../ai_settings.yaml" Returns: - cls (object): A instance of given cls object + cls (object): An instance of given cls object """ try: @@ -80,7 +80,7 @@ class AIConfig: None Returns: - full_prompt (str): A string containing the intitial prompt for the user including the ai_name, ai_role and ai_goals. + full_prompt (str): A string containing the initial prompt for the user including the ai_name, ai_role and ai_goals. """ prompt_start = """Your decisions must always be made independently without seeking user assistance. Play to your strengths as an LLM and pursue simple strategies with no legal complications.""" diff --git a/scripts/chat.py b/scripts/chat.py index 30f7603c76..c64be3b84b 100644 --- a/scripts/chat.py +++ b/scripts/chat.py @@ -141,6 +141,6 @@ def chat_with_ai( return assistant_reply except openai.error.RateLimitError: - # TODO: WHen we switch to langchain, this is built in + # TODO: When we switch to langchain, this is built in print("Error: ", "API Rate Limit Reached. Waiting 10 seconds...") time.sleep(10) diff --git a/scripts/commands.py b/scripts/commands.py index ce5d04ff48..92d46ae18a 100644 --- a/scripts/commands.py +++ b/scripts/commands.py @@ -110,7 +110,7 @@ def execute_command(command_name, arguments): elif command_name == "task_complete": shutdown() else: - return f"Unknown command '{command_name}'. Please refer to the 'COMMANDS' list for availabe commands and only respond in the specified JSON format." + return f"Unknown command '{command_name}'. Please refer to the 'COMMANDS' list for available commands and only respond in the specified JSON format." # All errors, return "Error: + error message" except Exception as e: return "Error: " + str(e) diff --git a/scripts/config.py b/scripts/config.py index 24911bce93..4dcfe4c527 100644 --- a/scripts/config.py +++ b/scripts/config.py @@ -75,7 +75,7 @@ class Config(metaclass=Singleton): self.redis_password = os.getenv("REDIS_PASSWORD", "") self.wipe_redis_on_start = os.getenv("WIPE_REDIS_ON_START", "True") == 'True' self.memory_index = os.getenv("MEMORY_INDEX", 'auto-gpt') - # Note that indexes must be created on db 0 in redis, this is not configureable. + # Note that indexes must be created on db 0 in redis, this is not configurable. self.memory_backend = os.getenv("MEMORY_BACKEND", 'local') # Initialize the OpenAI API client diff --git a/scripts/json_parser.py b/scripts/json_parser.py index 1d93b10926..34c3254bae 100644 --- a/scripts/json_parser.py +++ b/scripts/json_parser.py @@ -67,22 +67,22 @@ def fix_and_parse_json( else: # This allows the AI to react to the error message, # which usually results in it correcting its ways. - print("Failed to fix ai output, telling the AI.") + print("Failed to fix AI output, telling the AI.") return json_str else: raise e def fix_json(json_str: str, schema: str) -> str: - """Fix the given JSON string to make it parseable and fully complient with the provided schema.""" + """Fix the given JSON string to make it parseable and fully compliant with the provided schema.""" - # Try to fix the JSON using gpt: + # Try to fix the JSON using GPT: function_string = "def fix_json(json_str: str, schema:str=None) -> str:" args = [f"'''{json_str}'''", f"'''{schema}'''"] description_string = "Fixes the provided JSON string to make it parseable"\ - " and fully complient with the provided schema.\n If an object or"\ + " and fully compliant with the provided schema.\n If an object or"\ " field specified in the schema isn't contained within the correct"\ - " JSON, it is ommited.\n This function is brilliant at guessing"\ + " JSON, it is omitted.\n This function is brilliant at guessing"\ " when the format is incorrect." # If it doesn't already start with a "`", add one: From f8438aabc2122f6774b1f5a7d7b9ed17f36ae4ca Mon Sep 17 00:00:00 2001 From: Dill <4053467+dillweed@users.noreply.github.com> Date: Tue, 11 Apr 2023 21:37:03 -0700 Subject: [PATCH 14/19] Added option for custom elevenlabs voice IDs. --- .env.template | 4 +++- scripts/config.py | 10 ++++++++++ scripts/speak.py | 16 ++++++++++++++-- 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/.env.template b/.env.template index 01735615ca..b4cde93896 100644 --- a/.env.template +++ b/.env.template @@ -2,6 +2,8 @@ PINECONE_API_KEY=your-pinecone-api-key PINECONE_ENV=your-pinecone-region OPENAI_API_KEY=your-openai-api-key ELEVENLABS_API_KEY=your-elevenlabs-api-key +ELEVENLABS_VOICE_1_ID=your-voice-id +ELEVENLABS_VOICE_2_ID=your-voice-id SMART_LLM_MODEL=gpt-4 FAST_LLM_MODEL=gpt-3.5-turbo GOOGLE_API_KEY= @@ -12,4 +14,4 @@ OPENAI_AZURE_API_VERSION=api-version-for-azure OPENAI_AZURE_DEPLOYMENT_ID=deployment-id-for-azure IMAGE_PROVIDER=dalle HUGGINGFACE_API_TOKEN= -USE_MAC_OS_TTS=False +USE_MAC_OS_TTS=False \ No newline at end of file diff --git a/scripts/config.py b/scripts/config.py index 24911bce93..1dd9c8808d 100644 --- a/scripts/config.py +++ b/scripts/config.py @@ -54,6 +54,8 @@ class Config(metaclass=Singleton): openai.api_version = self.openai_api_version self.elevenlabs_api_key = os.getenv("ELEVENLABS_API_KEY") + self.elevenlabs_voice_1_id = os.getenv("ELEVENLABS_VOICE_1_ID") + self.elevenlabs_voice_2_id = os.getenv("ELEVENLABS_VOICE_2_ID") self.use_mac_os_tts = False self.use_mac_os_tts = os.getenv("USE_MAC_OS_TTS") @@ -113,6 +115,14 @@ class Config(metaclass=Singleton): """Set the ElevenLabs API key value.""" self.elevenlabs_api_key = value + def set_elevenlabs_voice_1_id(self, value: str): + """Set the ElevenLabs Voice 1 ID value.""" + self.elevenlabs_voice_1_id = value + + def set_elevenlabs_voice_2_id(self, value: str): + """Set the ElevenLabs Voice 2 ID value.""" + self.elevenlabs_voice_2_id = value + def set_google_api_key(self, value: str): """Set the Google API key value.""" self.google_api_key = value diff --git a/scripts/speak.py b/scripts/speak.py index 08b0c1c98e..5eed28d438 100644 --- a/scripts/speak.py +++ b/scripts/speak.py @@ -7,9 +7,21 @@ import gtts import threading from threading import Lock, Semaphore +# Default voice IDs +default_voices = ["ErXwobaYiN019PkySvjV", "EXAVITQu4vr4xnSDxMaL"] -# TODO: Nicer names for these ids -voices = ["ErXwobaYiN019PkySvjV", "EXAVITQu4vr4xnSDxMaL"] +# Retrieve custom voice IDs from the Config class +custom_voice_1 = cfg.elevenlabs_voice_1_id +custom_voice_2 = cfg.elevenlabs_voice_2_id + +# Placeholder values that should be treated as empty +placeholders = {"your-voice-id"} + +# Use custom voice IDs if provided and not placeholders, otherwise use default voice IDs +voices = [ + custom_voice_1 if custom_voice_1 and custom_voice_1 not in placeholders else default_voices[0], + custom_voice_2 if custom_voice_2 and custom_voice_2 not in placeholders else default_voices[1] +] tts_headers = { "Content-Type": "application/json", From 15ee80e87d5b4a28c9a5390a23156c975b8544c5 Mon Sep 17 00:00:00 2001 From: Dill <4053467+dillweed@users.noreply.github.com> Date: Tue, 11 Apr 2023 22:05:07 -0700 Subject: [PATCH 15/19] Newline at end of file --- .env.template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env.template b/.env.template index b4cde93896..6fbc84243b 100644 --- a/.env.template +++ b/.env.template @@ -14,4 +14,4 @@ OPENAI_AZURE_API_VERSION=api-version-for-azure OPENAI_AZURE_DEPLOYMENT_ID=deployment-id-for-azure IMAGE_PROVIDER=dalle HUGGINGFACE_API_TOKEN= -USE_MAC_OS_TTS=False \ No newline at end of file +USE_MAC_OS_TTS=False From bc6f34d7dc70771273992e2377d890bfe91c6c71 Mon Sep 17 00:00:00 2001 From: vadi Date: Wed, 12 Apr 2023 16:32:13 +1000 Subject: [PATCH 16/19] Fixes #803 - Brings back debug mode - Replaces all calls from cfg.debug to cfg.debug_mode that was updated on 5b2d6010dc59bab1026d13bfcd75b37618e573b9 - Remove unnecessary config instance at main.py --- scripts/chat.py | 6 +++--- scripts/json_parser.py | 2 +- scripts/main.py | 4 ++++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/scripts/chat.py b/scripts/chat.py index 23e5b50149..30f7603c76 100644 --- a/scripts/chat.py +++ b/scripts/chat.py @@ -64,14 +64,14 @@ def chat_with_ai( model = cfg.fast_llm_model # TODO: Change model from hardcode to argument # Reserve 1000 tokens for the response - if cfg.debug: + if cfg.debug_mode: print(f"Token limit: {token_limit}") send_token_limit = token_limit - 1000 relevant_memory = permanent_memory.get_relevant(str(full_message_history[-5:]), 10) - if cfg.debug: + if cfg.debug_mode: print('Memory Stats: ', permanent_memory.get_stats()) next_message_to_add_index, current_tokens_used, insertion_index, current_context = generate_context( @@ -110,7 +110,7 @@ def chat_with_ai( # assert tokens_remaining >= 0, "Tokens remaining is negative. This should never happen, please submit a bug report at https://www.github.com/Torantulino/Auto-GPT" # Debug print the current context - if cfg.debug: + if cfg.debug_mode: print(f"Token limit: {token_limit}") print(f"Send Token Count: {current_tokens_used}") print(f"Tokens remaining for response: {tokens_remaining}") diff --git a/scripts/json_parser.py b/scripts/json_parser.py index 8c17dfa252..1d93b10926 100644 --- a/scripts/json_parser.py +++ b/scripts/json_parser.py @@ -91,7 +91,7 @@ def fix_json(json_str: str, schema: str) -> str: result_string = call_ai_function( function_string, args, description_string, model=cfg.fast_llm_model ) - if cfg.debug: + if cfg.debug_mode: print("------------ JSON FIX ATTEMPT ---------------") print(f"Original JSON: {json_str}") print("-----------") diff --git a/scripts/main.py b/scripts/main.py index d84e150850..40cad2b839 100644 --- a/scripts/main.py +++ b/scripts/main.py @@ -266,6 +266,7 @@ def prompt_user(): def parse_arguments(): """Parses the arguments passed to the script""" global cfg + cfg.set_debug_mode(False) cfg.set_continuous_mode(False) cfg.set_speak_mode(False) @@ -292,6 +293,9 @@ def parse_arguments(): print_to_console("GPT3.5 Only Mode: ", Fore.GREEN, "ENABLED") cfg.set_smart_llm_model(cfg.fast_llm_model) + if args.debug: + print_to_console("Debug Mode: ", Fore.GREEN, "ENABLED") + cfg.set_debug_mode(True) # TODO: fill in llm values here From 3d5dba2e57d311c9892b1e838e9a58d47dfad8f9 Mon Sep 17 00:00:00 2001 From: Toran Bruce Richards Date: Wed, 12 Apr 2023 20:05:16 +1200 Subject: [PATCH 17/19] Adds live star history chart to README --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 24e2aeba92..49ab47291e 100644 --- a/README.md +++ b/README.md @@ -267,3 +267,8 @@ Stay up-to-date with the latest news, updates, and insights about Auto-GPT by fo We look forward to connecting with you and hearing your thoughts, ideas, and experiences with Auto-GPT. Join us on Twitter and let's explore the future of AI together! +

+ + Star History Chart + +

From 94441ee63bc55390f670483b965d01bbe712a961 Mon Sep 17 00:00:00 2001 From: Manal Arora <42407286+manalarora@users.noreply.github.com> Date: Wed, 12 Apr 2023 14:37:50 +0530 Subject: [PATCH 18/19] correcting the clone command in contributing.md (#927) * correcting the clone command in contributing.md * removing extra newlines added in previous commit removing extra newlines added in previous commit --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 09a604eba9..0529cbd949 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -6,7 +6,7 @@ To contribute to this GitHub project, you can follow these steps: 2. Clone the repository to your local machine using the following command: ``` -git clone https://github.com/Torantulino/Auto-GPT +git clone https://github.com//Auto-GPT ``` 3. Create a new branch for your changes using the following command: From 16b37fff1d65a7d998c39aeab9764973d76ea731 Mon Sep 17 00:00:00 2001 From: sarango Date: Mon, 10 Apr 2023 08:07:03 -0500 Subject: [PATCH 19/19] Fix to LocalCache add method, created integration test for it --- scripts/memory/local.py | 2 +- tests/integration/memory_tests.py | 49 +++++++++++++++++++++++++++++++ tests/{ => unit}/json_tests.py | 0 3 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 tests/integration/memory_tests.py rename tests/{ => unit}/json_tests.py (100%) diff --git a/scripts/memory/local.py b/scripts/memory/local.py index 8dc90021ff..372b59c442 100644 --- a/scripts/memory/local.py +++ b/scripts/memory/local.py @@ -54,8 +54,8 @@ class LocalCache(MemoryProviderSingleton): vector = vector[np.newaxis, :] self.data.embeddings = np.concatenate( [ - vector, self.data.embeddings, + vector, ], axis=0, ) diff --git a/tests/integration/memory_tests.py b/tests/integration/memory_tests.py new file mode 100644 index 0000000000..ed444d9196 --- /dev/null +++ b/tests/integration/memory_tests.py @@ -0,0 +1,49 @@ +import unittest +import random +import string +import sys +from pathlib import Path +# Add the parent directory of the 'scripts' folder to the Python path +sys.path.append(str(Path(__file__).resolve().parent.parent.parent / 'scripts')) +from config import Config +from memory.local import LocalCache + +class TestLocalCache(unittest.TestCase): + + def random_string(self, length): + return ''.join(random.choice(string.ascii_letters) for _ in range(length)) + + def setUp(self): + cfg = cfg = Config() + self.cache = LocalCache(cfg) + self.cache.clear() + + # Add example texts to the cache + self.example_texts = [ + 'The quick brown fox jumps over the lazy dog', + 'I love machine learning and natural language processing', + 'The cake is a lie, but the pie is always true', + 'ChatGPT is an advanced AI model for conversation' + ] + + for text in self.example_texts: + self.cache.add(text) + + # Add some random strings to test noise + for _ in range(5): + self.cache.add(self.random_string(10)) + + def test_get_relevant(self): + query = "I'm interested in artificial intelligence and NLP" + k = 3 + relevant_texts = self.cache.get_relevant(query, k) + + print(f"Top {k} relevant texts for the query '{query}':") + for i, text in enumerate(relevant_texts, start=1): + print(f"{i}. {text}") + + self.assertEqual(len(relevant_texts), k) + self.assertIn(self.example_texts[1], relevant_texts) + +if __name__ == '__main__': + unittest.main() diff --git a/tests/json_tests.py b/tests/unit/json_tests.py similarity index 100% rename from tests/json_tests.py rename to tests/unit/json_tests.py