From 5318535d0d26bbd819c135a5f1b8022133c79fcb Mon Sep 17 00:00:00 2001 From: James Date: Tue, 4 Jul 2023 21:28:02 +0800 Subject: [PATCH 1/4] Fix summarize_text recursion calls (#4876) `summarize_text` is currently broken, because it calls itself with the wrong args (missing `config`) --- autogpt/processing/text.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/autogpt/processing/text.py b/autogpt/processing/text.py index 24851b1c..cf81fa71 100644 --- a/autogpt/processing/text.py +++ b/autogpt/processing/text.py @@ -131,13 +131,12 @@ def summarize_text( logger.info( f"Summarizing chunk {i + 1} / {len(chunks)} of length {chunk_length} tokens" ) - summary, _ = summarize_text(chunk, instruction) + summary, _ = summarize_text(chunk, config, instruction) summaries.append(summary) logger.info(f"Summarized {len(chunks)} chunks") - summary, _ = summarize_text("\n\n".join(summaries)) - + summary, _ = summarize_text("\n\n".join(summaries), config, instruction) return summary.strip(), [ (summaries[i], chunks[i][0]) for i in range(0, len(chunks)) ] From 9adcad8b8aefd20ae62d0826f5c17394b352d09c Mon Sep 17 00:00:00 2001 From: James Collins Date: Sun, 9 Jul 2023 19:32:04 -0700 Subject: [PATCH 2/4] Fix regression: restore api_base and organization configurability (#4933) --- autogpt/config/config.py | 13 ++++++++++++- autogpt/llm/utils/__init__.py | 18 ++++-------------- autogpt/memory/vector/utils.py | 7 ++----- tests/unit/test_config.py | 26 ++++++++++++++++++++------ 4 files changed, 38 insertions(+), 26 deletions(-) diff --git a/autogpt/config/config.py b/autogpt/config/config.py index 05590eb6..b1ff0a0a 100644 --- a/autogpt/config/config.py +++ b/autogpt/config/config.py @@ -86,7 +86,18 @@ class Config(SystemSettings): plugins: list[str] authorise_key: str - def get_azure_kwargs(self, model: str) -> dict[str, str]: + def get_openai_credentials(self, model: str) -> dict[str, str]: + credentials = { + "api_key": self.openai_api_key, + "api_base": self.openai_api_base, + "organization": self.openai_organization, + } + if self.use_azure: + azure_credentials = self.get_azure_credentials(model) + credentials.update(azure_credentials) + return credentials + + def get_azure_credentials(self, model: str) -> dict[str, str]: """Get the kwargs for the Azure API.""" # Fix --gpt3only and --gpt4only in combination with Azure diff --git a/autogpt/llm/utils/__init__.py b/autogpt/llm/utils/__init__.py index 3c2835b7..e0ff1473 100644 --- a/autogpt/llm/utils/__init__.py +++ b/autogpt/llm/utils/__init__.py @@ -71,17 +71,14 @@ def create_text_completion( if temperature is None: temperature = config.temperature - if config.use_azure: - kwargs = config.get_azure_kwargs(model) - else: - kwargs = {"model": model} + kwargs = {"model": model} + kwargs.update(config.get_openai_credentials(model)) response = iopenai.create_text_completion( prompt=prompt, **kwargs, temperature=temperature, max_tokens=max_output_tokens, - api_key=config.openai_api_key, ) logger.debug(f"Response: {response}") @@ -137,9 +134,7 @@ def create_chat_completion( if message is not None: return message - chat_completion_kwargs["api_key"] = config.openai_api_key - if config.use_azure: - chat_completion_kwargs.update(config.get_azure_kwargs(model)) + chat_completion_kwargs.update(config.get_openai_credentials(model)) if functions: chat_completion_kwargs["functions"] = [ @@ -179,12 +174,7 @@ def check_model( config: Config, ) -> str: """Check if model is available for use. If not, return gpt-3.5-turbo.""" - openai_credentials = { - "api_key": config.openai_api_key, - } - if config.use_azure: - openai_credentials.update(config.get_azure_kwargs(model_name)) - + openai_credentials = config.get_openai_credentials(model_name) api_manager = ApiManager() models = api_manager.get_models(**openai_credentials) diff --git a/autogpt/memory/vector/utils.py b/autogpt/memory/vector/utils.py index 74438f28..eb691256 100644 --- a/autogpt/memory/vector/utils.py +++ b/autogpt/memory/vector/utils.py @@ -41,10 +41,8 @@ def get_embedding( input = [text.replace("\n", " ") for text in input] model = config.embedding_model - if config.use_azure: - kwargs = config.get_azure_kwargs(model) - else: - kwargs = {"model": model} + kwargs = {"model": model} + kwargs.update(config.get_openai_credentials(model)) logger.debug( f"Getting embedding{f's for {len(input)} inputs' if multiple else ''}" @@ -57,7 +55,6 @@ def get_embedding( embeddings = iopenai.create_embedding( input, **kwargs, - api_key=config.openai_api_key, ).data if not multiple: diff --git a/tests/unit/test_config.py b/tests/unit/test_config.py index b441aa94..7abbfcd5 100644 --- a/tests/unit/test_config.py +++ b/tests/unit/test_config.py @@ -174,18 +174,32 @@ azure_model_map: fast_llm = config.fast_llm smart_llm = config.smart_llm - assert config.get_azure_kwargs(config.fast_llm)["deployment_id"] == "FAST-LLM_ID" - assert config.get_azure_kwargs(config.smart_llm)["deployment_id"] == "SMART-LLM_ID" + assert ( + config.get_azure_credentials(config.fast_llm)["deployment_id"] == "FAST-LLM_ID" + ) + assert ( + config.get_azure_credentials(config.smart_llm)["deployment_id"] + == "SMART-LLM_ID" + ) # Emulate --gpt4only config.fast_llm = smart_llm - assert config.get_azure_kwargs(config.fast_llm)["deployment_id"] == "SMART-LLM_ID" - assert config.get_azure_kwargs(config.smart_llm)["deployment_id"] == "SMART-LLM_ID" + assert ( + config.get_azure_credentials(config.fast_llm)["deployment_id"] == "SMART-LLM_ID" + ) + assert ( + config.get_azure_credentials(config.smart_llm)["deployment_id"] + == "SMART-LLM_ID" + ) # Emulate --gpt3only config.fast_llm = config.smart_llm = fast_llm - assert config.get_azure_kwargs(config.fast_llm)["deployment_id"] == "FAST-LLM_ID" - assert config.get_azure_kwargs(config.smart_llm)["deployment_id"] == "FAST-LLM_ID" + assert ( + config.get_azure_credentials(config.fast_llm)["deployment_id"] == "FAST-LLM_ID" + ) + assert ( + config.get_azure_credentials(config.smart_llm)["deployment_id"] == "FAST-LLM_ID" + ) del os.environ["USE_AZURE"] del os.environ["AZURE_CONFIG_FILE"] From 4d514694738eb1a9a581136e85cb6aeb0ba27d63 Mon Sep 17 00:00:00 2001 From: Reinier van der Leer Date: Mon, 10 Jul 2023 18:13:59 +0200 Subject: [PATCH 3/4] Fix CI cassette checkout --- .github/workflows/ci.yml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3e21d1d7..dde98cf9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -108,22 +108,27 @@ jobs: if: ${{ startsWith(github.event_name, 'pull_request') }} run: | cassette_branch="${{ github.event.pull_request.user.login }}-${{ github.event.pull_request.head.ref }}" + cassette_base_branch="${{ github.event.pull_request.base.ref }}" cd tests/Auto-GPT-test-cassettes + if ! git ls-remote --exit-code --heads origin $cassette_base_branch ; then + cassette_base_branch="master" + fi + if git ls-remote --exit-code --heads origin $cassette_branch ; then git fetch origin $cassette_branch - git fetch origin ${{ github.event.pull_request.base.ref }} + git fetch origin $cassette_base_branch git checkout $cassette_branch # Pick non-conflicting cassette updates from the base branch - git merge --no-commit --strategy-option=ours origin/${{ github.event.pull_request.base.ref }} + git merge --no-commit --strategy-option=ours origin/$cassette_base_branch echo "Using cassettes from mirror branch '$cassette_branch'," \ - "synced to upstream branch '${{ github.event.pull_request.base.ref }}'." + "synced to upstream branch '$cassette_base_branch'." else git checkout -b $cassette_branch echo "Branch '$cassette_branch' does not exist in cassette submodule." \ - "Using cassettes from '${{ github.event.pull_request.base.ref }}'." + "Using cassettes from '$cassette_base_branch'." fi - name: Set up Python ${{ matrix.python-version }} From 46f31cb643a4803c04f0a1cb5af8bde6afd0a90e Mon Sep 17 00:00:00 2001 From: Luke <2609441+lc0rp@users.noreply.github.com> Date: Tue, 11 Jul 2023 07:40:33 -0400 Subject: [PATCH 4/4] Bulletin & version update for 0.4.4 (#4937) Co-authored-by: Reinier van der Leer Co-authored-by: lc0rp <2609411+lc0rp@users.noreply.github.com> --- BULLETIN.md | 43 +++++++++++++++++++++++++------------------ pyproject.toml | 2 +- 2 files changed, 26 insertions(+), 19 deletions(-) diff --git a/BULLETIN.md b/BULLETIN.md index 0b8afeba..117a436a 100644 --- a/BULLETIN.md +++ b/BULLETIN.md @@ -1,22 +1,29 @@ -# Website and Documentation Site 📰📖 -Check out *https://agpt.co*, the official news & updates site for Auto-GPT! -The documentation also has a place here, at *https://docs.agpt.co* +# QUICK LINKS 🔗 +# -------------- +🌎 *Official Website*: https://agpt.co. +📖 *User Guide*: https://docs.agpt.co. +👩 *Contributors Wiki*: https://github.com/Significant-Gravitas/Auto-GPT/wiki/Contributing. -# For contributors 👷🏼 -Since releasing v0.3.0, whave been working on re-architecting the Auto-GPT core to make it more extensible and make room for structural performance-oriented R&D. +# v0.4.4 RELEASE HIGHLIGHTS! 🚀 +# ----------------------------- +## GPT-4 is back! +Following OpenAI's recent GPT-4 GA announcement, the SMART_LLM .env setting +now defaults to GPT-4, and Auto-GPT will use GPT-4 by default in its main loop. -Check out the contribution guide on our wiki: -https://github.com/Significant-Gravitas/Auto-GPT/wiki/Contributing +### !! High Costs Warning !! 💰💀🚨 +GPT-4 costs ~20x more than GPT-3.5-turbo. +Please take note of this before using SMART_LLM. You can use `--gpt3only` +or `--gpt4only` to force the use of GPT-3.5-turbo or GPT-4, respectively, +at runtime. -# 🚀 v0.4.3 Release 🚀 -We're happy to announce the 0.4.3 maintenance release, which primarily focuses on refining the LLM command execution, -extending support for OpenAI's latest models (including the powerful GPT-3 16k model), and laying the groundwork -for future compatibility with OpenAI's function calling feature. +## Re-arch v1 preview release! +We've released a preview version of the re-arch code, under `autogpt/core`. +This is a major milestone for us, and we're excited to continue working on it. +We look forward to your feedback. Follow the process here: +https://github.com/Significant-Gravitas/Auto-GPT/issues/4770. -Key Highlights: -- OpenAI API Key Prompt: Auto-GPT will now courteously prompt users for their OpenAI API key, if it's not already provided. -- Summarization Enhancements: We've optimized Auto-GPT's use of the LLM context window even further. -- JSON Memory Reading: Support for reading memories from JSON files has been improved, resulting in enhanced task execution. -- Deprecated commands, removed for a leaner, more performant LLM: analyze_code, write_tests, improve_code, audio_text, web_playwright, web_requests -## Take a look at the Release Notes on Github for the full changelog! -https://github.com/Significant-Gravitas/Auto-GPT/releases +## Other highlights +Other fixes include plugins regressions, Azure config and security patches. + +Take a look at the Release Notes on Github for the full changelog! +https://github.com/Significant-Gravitas/Auto-GPT/releases. diff --git a/pyproject.toml b/pyproject.toml index b0aea625..06b2f87f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "agpt" -version = "0.4.3" +version = "0.4.4" authors = [ { name="Torantulino", email="support@agpt.co" }, ]