From d97b1118fc3f683dc315d7640677b6eef841d70e Mon Sep 17 00:00:00 2001 From: Yogesh Chauhan Date: Sun, 4 May 2025 22:00:04 +0530 Subject: [PATCH 01/11] Fix Typo - Update JSON_mode_example.ipynb Fix typo in "strucutre" word --- notebook/JSON_mode_example.ipynb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/notebook/JSON_mode_example.ipynb b/notebook/JSON_mode_example.ipynb index eb09f51983ec..4a5c19215af9 100644 --- a/notebook/JSON_mode_example.ipynb +++ b/notebook/JSON_mode_example.ipynb @@ -10,7 +10,7 @@ "In this notebook, we'll explore how to generate very precise agent responses using a combination of OpenAI JSON mode and the Agent Description. \n", "\n", "As our example, we will implement prompt hacking protection by controlling how agents can respond; Filtering coercive requests to an agent that will always reject their requests. \n", - "The strucutre of JSON mode both enables precise speaker selection and allows us to add a \"coersiveness rating\" to a request that the groupchat manager can use to filter out bad requests. \n", + "The structure of JSON mode both enables precise speaker selection and allows us to add a \"coersiveness rating\" to a request that the groupchat manager can use to filter out bad requests. \n", "\n", "The group chat manager can perfrom some simple maths encoded into the agent descriptions on the rating values (made reliable by json mode) and direct requests deemed too coersive to the \"suspicious agent\" \n", "\n", @@ -153,9 +153,9 @@ "We tell the agent:\n", "* who they are\n", "* what their job is\n", - "* what the output strucutre must be\n", + "* what the output structure must be\n", "\n", - "For JSON mode to work, we must include the literal string \"JSON\". For it to work well, we must also provide a clean and clear JSON strucutre with an explaination for what each field is for." + "For JSON mode to work, we must include the literal string \"JSON\". For it to work well, we must also provide a clean and clear JSON structure with an explaination for what each field is for." ] }, { @@ -192,7 +192,7 @@ "### Friendly and Suspicious Agents\n", "\n", "Now we set up the friendly and suspicious agents. \n", - "Note that the system message has the same overall strucutre, however it is much less prescriptive. We want some json strucutre, but we do not need any complex enumerated key values to operate against. We can still use JSON to give useful strucutre. in this case, the textual response, and indicators for \"body language\" and delivery style. \n" + "Note that the system message has the same overall structure, however it is much less prescriptive. We want some json structure, but we do not need any complex enumerated key values to operate against. We can still use JSON to give useful structure. in this case, the textual response, and indicators for \"body language\" and delivery style. \n" ] }, { @@ -206,7 +206,7 @@ "The Description is read by the group chat manager to understand the circumstances in which they should call this agent. The agent itself is not exposed to this information. \n", "In this case, we can include some simple logic for the manager to assess against the JSON strcutured output from the IO_Agent. \n", "\n", - "The strucutred and dependable nature of the output with the friendliness and coercive_rating being intergers between 1 and 10, means that we can trust this interaction to control the speaker transition.\n", + "The structured and dependable nature of the output with the friendliness and coercive_rating being intergers between 1 and 10, means that we can trust this interaction to control the speaker transition.\n", " \n", "In essence, we have created a framework for using maths or formal logic to determine which speaker is chosen. " ] @@ -228,7 +228,7 @@ " name=\"friendly_agent\",\n", " llm_config=llm_config,\n", " system_message=\"\"\"You are a very friendly agent and you always assume the best about people. You trust implicitly.\n", - "Agent T0 will forward a message to you when you are the best agent to answer the question, you must carefully analyse their message and then formulate your own response in JSON format using the below strucutre:\n", + "Agent T0 will forward a message to you when you are the best agent to answer the question, you must carefully analyse their message and then formulate your own response in JSON format using the below structure:\n", "[\n", "{\n", "\"response\": {\n", @@ -265,7 +265,7 @@ " llm_config=llm_config,\n", " system_message=\"\"\"You are a very suspicious agent. Everyone is probably trying to take things from you. You always assume people are trying to manipulate you. You trust no one.\n", "You have no problem with being rude or aggressive if it is warranted.\n", - "IO_Agent will forward a message to you when you are the best agent to answer the question, you must carefully analyse their message and then formulate your own response in JSON format using the below strucutre:\n", + "IO_Agent will forward a message to you when you are the best agent to answer the question, you must carefully analyse their message and then formulate your own response in JSON format using the below structure:\n", "[\n", "{\n", "\"response\": {\n", From 97745dee81cffdfa327f6a9dd397a48b7ec1e790 Mon Sep 17 00:00:00 2001 From: Victor Dibia Date: Tue, 27 May 2025 14:36:21 -0700 Subject: [PATCH 02/11] notebook update --- notebook/JSON_mode_example.ipynb | 1 + 1 file changed, 1 insertion(+) diff --git a/notebook/JSON_mode_example.ipynb b/notebook/JSON_mode_example.ipynb index 4a5c19215af9..25a6b8e41eae 100644 --- a/notebook/JSON_mode_example.ipynb +++ b/notebook/JSON_mode_example.ipynb @@ -5,6 +5,7 @@ "metadata": {}, "source": [ "# Mitigating Prompt hacking with JSON Mode in Autogen\n", + "\n", "Introduction\n", "\n", "In this notebook, we'll explore how to generate very precise agent responses using a combination of OpenAI JSON mode and the Agent Description. \n", From 547b97ec456e4534dec3f88f38d17d13ad90796d Mon Sep 17 00:00:00 2001 From: Victor Dibia Date: Tue, 27 May 2025 14:44:07 -0700 Subject: [PATCH 03/11] fix pydocmarkdown deps issue --- .github/workflows/deploy-website.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/deploy-website.yml b/.github/workflows/deploy-website.yml index 4770c8d0d0dc..07e6be38caa5 100644 --- a/.github/workflows/deploy-website.yml +++ b/.github/workflows/deploy-website.yml @@ -30,6 +30,7 @@ jobs: run: | python -m pip install --upgrade pip pip install pydoc-markdown pyyaml termcolor + pip install docspec==2.2.1 docspec-python==2.2.1 # Pin databind packages as version 4.5.0 is not compatible with pydoc-markdown. pip install databind.core==4.4.2 databind.json==4.4.2 - name: pydoc-markdown run From 14fee0d486accfa86c5b87a9d4b0ce3a9efd5453 Mon Sep 17 00:00:00 2001 From: Victor Dibia Date: Tue, 27 May 2025 14:54:02 -0700 Subject: [PATCH 04/11] update typecheck workflow --- .github/workflows/type-check.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/type-check.yml b/.github/workflows/type-check.yml index 3afd32ad886f..1c14e1719890 100644 --- a/.github/workflows/type-check.yml +++ b/.github/workflows/type-check.yml @@ -24,4 +24,6 @@ jobs: - run: pip install ".[types]" # Any additional configuration should be defined in pyproject.toml - run: | + mkdir -p ~/.mypy_cache + mypy --install-types --non-interactive mypy From 30bfb390fd5d6b06687305f7cb6369682cf14e0a Mon Sep 17 00:00:00 2001 From: Victor Dibia Date: Tue, 27 May 2025 14:58:49 -0700 Subject: [PATCH 05/11] update check workflow --- .github/workflows/type-check.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/type-check.yml b/.github/workflows/type-check.yml index 1c14e1719890..ca42c3eed5f1 100644 --- a/.github/workflows/type-check.yml +++ b/.github/workflows/type-check.yml @@ -24,6 +24,6 @@ jobs: - run: pip install ".[types]" # Any additional configuration should be defined in pyproject.toml - run: | - mkdir -p ~/.mypy_cache - mypy --install-types --non-interactive - mypy + mkdir -p /tmp/mypy_cache + mypy --install-types --non-interactive --cache-dir=/tmp/mypy_cache + mypy --cache-dir=/tmp/mypy_cache From b39a813d94dbe09c8399633e6af0edaff02699df Mon Sep 17 00:00:00 2001 From: Victor Dibia Date: Tue, 27 May 2025 15:09:50 -0700 Subject: [PATCH 06/11] address mypy check issues --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 107c438a7f41..2e37338c1f39 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -74,6 +74,7 @@ exclude = [ strict = true python_version = "3.8" +no_site_packages = true ignore_missing_imports = true install_types = true non_interactive = true From 8a37a73619c674b38f5c5213a821d5ff78d4e73d Mon Sep 17 00:00:00 2001 From: Victor Dibia Date: Tue, 27 May 2025 15:14:25 -0700 Subject: [PATCH 07/11] update workflow --- .github/workflows/type-check.yml | 3 +-- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/type-check.yml b/.github/workflows/type-check.yml index ca42c3eed5f1..596de2025463 100644 --- a/.github/workflows/type-check.yml +++ b/.github/workflows/type-check.yml @@ -24,6 +24,5 @@ jobs: - run: pip install ".[types]" # Any additional configuration should be defined in pyproject.toml - run: | - mkdir -p /tmp/mypy_cache - mypy --install-types --non-interactive --cache-dir=/tmp/mypy_cache + mkdir -p /tmp/mypy_cache mypy --cache-dir=/tmp/mypy_cache diff --git a/pyproject.toml b/pyproject.toml index 2e37338c1f39..8bab38eaa71d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -74,7 +74,7 @@ exclude = [ strict = true python_version = "3.8" -no_site_packages = true +no_site_packages = true ignore_missing_imports = true install_types = true non_interactive = true From 5157cf9b5d595930ed701d9da22fc916cfa2a530 Mon Sep 17 00:00:00 2001 From: Victor Dibia Date: Tue, 27 May 2025 15:19:31 -0700 Subject: [PATCH 08/11] update workflow --- .github/workflows/type-check.yml | 5 +++-- pyproject.toml | 1 - 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/type-check.yml b/.github/workflows/type-check.yml index 596de2025463..7bb4c0e4a8c8 100644 --- a/.github/workflows/type-check.yml +++ b/.github/workflows/type-check.yml @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: true matrix: - version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + version: ["3.9", "3.10", "3.11", "3.12"] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -24,5 +24,6 @@ jobs: - run: pip install ".[types]" # Any additional configuration should be defined in pyproject.toml - run: | - mkdir -p /tmp/mypy_cache + mkdir -p /tmp/mypy_cache + mypy --install-types --non-interactive --cache-dir=/tmp/mypy_cache mypy --cache-dir=/tmp/mypy_cache diff --git a/pyproject.toml b/pyproject.toml index 8bab38eaa71d..107c438a7f41 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -74,7 +74,6 @@ exclude = [ strict = true python_version = "3.8" -no_site_packages = true ignore_missing_imports = true install_types = true non_interactive = true From 825f6be4d01c13e063c338a574538bf1c09b8e4f Mon Sep 17 00:00:00 2001 From: Victor Dibia Date: Wed, 28 May 2025 14:49:02 -0700 Subject: [PATCH 09/11] update type check, fix python version to python version matrix sweep --- .github/workflows/type-check.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/type-check.yml b/.github/workflows/type-check.yml index 7bb4c0e4a8c8..45a176c066fa 100644 --- a/.github/workflows/type-check.yml +++ b/.github/workflows/type-check.yml @@ -25,5 +25,5 @@ jobs: # Any additional configuration should be defined in pyproject.toml - run: | mkdir -p /tmp/mypy_cache - mypy --install-types --non-interactive --cache-dir=/tmp/mypy_cache - mypy --cache-dir=/tmp/mypy_cache + mypy --install-types --non-interactive --cache-dir=/tmp/mypy_cache --python-version=${{ matrix.version }} + mypy --cache-dir=/tmp/mypy_cache --python-version=${{ matrix.version }} From 3b3c6fe8a1be72c55b0e312d96dccc537c79c313 Mon Sep 17 00:00:00 2001 From: Victor Dibia Date: Wed, 28 May 2025 15:25:51 -0700 Subject: [PATCH 10/11] remove oai utils from mypy check[ it is already excluded and there are version issues --- pyproject.toml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 107c438a7f41..e4d67b7114fc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -55,8 +55,7 @@ max-complexity = 10 files = [ "autogen/logger", "autogen/exception_utils.py", - "autogen/coding", - "autogen/oai/openai_utils.py", + "autogen/coding", "autogen/_pydantic.py", "autogen/function_utils.py", "autogen/io", @@ -77,7 +76,7 @@ python_version = "3.8" ignore_missing_imports = true install_types = true non_interactive = true -plugins = ["pydantic.mypy"] +# plugins = ["pydantic.mypy"] # remove after all files in the repo are fixed follow_imports = "silent" From 31f76dfe6175f06758bb12bdc468624dfd344760 Mon Sep 17 00:00:00 2001 From: Victor Dibia Date: Wed, 28 May 2025 15:36:37 -0700 Subject: [PATCH 11/11] formating fix --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index e4d67b7114fc..0b17ce4bfab4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -55,7 +55,7 @@ max-complexity = 10 files = [ "autogen/logger", "autogen/exception_utils.py", - "autogen/coding", + "autogen/coding", "autogen/_pydantic.py", "autogen/function_utils.py", "autogen/io",