A programming framework for agentic AI
Change `contrib-tests.yml` tests to use `--skip-openai` (#1132)
Maxim Saplin083ba32a73ce
diff --git a/.github/workflows/contrib-tests.yml b/.github/workflows/contrib-tests.ymlindex 25bcef05b..27a616b77 100644--- a/.github/workflows/contrib-tests.yml+++ b/.github/workflows/contrib-tests.yml@@ -45,15 +45,14 @@ jobs:- name: Install packages and dependencies for RetrieveChatrun: |pip install -e .[retrievechat]- pip uninstall -y openai- name: Test RetrieveChatrun: |- pytest test/test_retrieve_utils.py test/agentchat/contrib/test_retrievechat.py test/agentchat/contrib/test_qdrant_retrievechat.py+ pytest test/test_retrieve_utils.py test/agentchat/contrib/test_retrievechat.py test/agentchat/contrib/test_qdrant_retrievechat.py --skip-openai- name: Coverageif: matrix.python-version == '3.10'run: |pip install coverage>=5.3- coverage run -a -m pytest test/test_retrieve_utils.py test/agentchat/contrib+ coverage run -a -m pytest test/test_retrieve_utils.py test/agentchat/contrib/test_retrievechat.py test/agentchat/contrib/test_qdrant_retrievechat.py --skip-openaicoverage xml- name: Upload coverage to Codecovif: matrix.python-version == '3.10'@@ -82,16 +81,15 @@ jobs:- name: Install packages and dependencies for Compressionrun: |pip install -e .- pip uninstall -y openai- name: Test Compressionif: matrix.python-version != '3.10' # diversify the python versionsrun: |- pytest test/agentchat/contrib/test_compressible_agent.py+ pytest test/agentchat/contrib/test_compressible_agent.py --skip-openai- name: Coverageif: matrix.python-version == '3.10'run: |pip install coverage>=5.3- coverage run -a -m pytest test/agentchat/contrib/test_compressible_agent.py+ coverage run -a -m pytest test/agentchat/contrib/test_compressible_agent.py --skip-openaicoverage xml- name: Upload coverage to Codecovif: matrix.python-version == '3.10'@@ -120,16 +118,15 @@ jobs:- name: Install packages and dependencies for GPTAssistantAgentrun: |pip install -e .- pip uninstall -y openai- name: Test GPTAssistantAgentif: matrix.python-version != '3.11' # diversify the python versionsrun: |- pytest test/agentchat/contrib/test_gpt_assistant.py+ pytest test/agentchat/contrib/test_gpt_assistant.py --skip-openai- name: Coverageif: matrix.python-version == '3.11'run: |pip install coverage>=5.3- coverage run -a -m pytest test/agentchat/contrib/test_gpt_assistant.py+ coverage run -a -m pytest test/agentchat/contrib/test_gpt_assistant.py --skip-openaicoverage xml- name: Upload coverage to Codecovif: matrix.python-version == '3.11'@@ -158,16 +155,15 @@ jobs:- name: Install packages and dependencies for Teachabilityrun: |pip install -e .[teachable]- pip uninstall -y openai- - name: Test Teachability+ - name: Test TeachableAgentif: matrix.python-version != '3.9' # diversify the python versionsrun: |- pytest test/agentchat/contrib/test_teachable_agent.py+ pytest test/agentchat/contrib/test_teachable_agent.py --skip-openai- name: Coverageif: matrix.python-version == '3.9'run: |pip install coverage>=5.3- coverage run -a -m pytest test/agentchat/contrib/test_teachable_agent.py+ coverage run -a -m pytest test/agentchat/contrib/test_teachable_agent.py --skip-openaicoverage xml- name: Upload coverage to Codecovif: matrix.python-version == '3.9'@@ -196,15 +192,14 @@ jobs:- name: Install packages and dependencies for LMMrun: |pip install -e .[lmm]- pip uninstall -y openai- name: Test LMM and LLaVArun: |- pytest test/agentchat/contrib/test_img_utils.py test/agentchat/contrib/test_lmm.py test/agentchat/contrib/test_llava.py+ pytest test/agentchat/contrib/test_img_utils.py test/agentchat/contrib/test_lmm.py test/agentchat/contrib/test_llava.py --skip-openai- name: Coverageif: matrix.python-version == '3.10'run: |pip install coverage>=5.3- coverage run -a -m pytest test/agentchat/contrib/test_img_utils.py test/agentchat/contrib/test_lmm.py test/agentchat/contrib/test_llava.py+ coverage run -a -m pytest test/agentchat/contrib/test_img_utils.py test/agentchat/contrib/test_lmm.py test/agentchat/contrib/test_llava.py --skip-openaicoverage xml- name: Upload coverage to Codecovif: matrix.python-version == '3.10'diff --git a/test/agentchat/contrib/test_qdrant_retrievechat.py b/test/agentchat/contrib/test_qdrant_retrievechat.pyindex 1d3c5afd6..1a18e78a4 100644--- a/test/agentchat/contrib/test_qdrant_retrievechat.py+++ b/test/agentchat/contrib/test_qdrant_retrievechat.py@@ -4,6 +4,9 @@ import pytestfrom autogen.agentchat.contrib.retrieve_assistant_agent import RetrieveAssistantAgentfrom autogen import config_list_from_json+sys.path.append(os.path.join(os.path.dirname(__file__), "../.."))+from conftest import skip_openai # noqa: E402+sys.path.append(os.path.join(os.path.dirname(__file__), ".."))from test_assistant_agent import KEY_LOC, OAI_CONFIG_LIST # noqa: E402@@ -22,17 +25,17 @@ except ImportError:try:import openai-- OPENAI_INSTALLED = Trueexcept ImportError:- OPENAI_INSTALLED = False+ skip = True+else:+ skip = False or skip_openaitest_dir = os.path.join(os.path.dirname(__file__), "../..", "test_files")@pytest.mark.skipif(- sys.platform in ["darwin", "win32"] or not QDRANT_INSTALLED or not OPENAI_INSTALLED,- reason="do not run on MacOS or windows or dependency is not installed",+ sys.platform in ["darwin", "win32"] or not QDRANT_INSTALLED or skip,+ reason="do not run on MacOS or windows OR dependency is not installed OR requested to skip",)def test_retrievechat():conversations = {}diff --git a/test/agentchat/contrib/test_retrievechat.py b/test/agentchat/contrib/test_retrievechat.pyindex 574e3571b..eeda1dc48 100644--- a/test/agentchat/contrib/test_retrievechat.py+++ b/test/agentchat/contrib/test_retrievechat.py@@ -3,6 +3,9 @@ import osimport sysimport autogen+sys.path.append(os.path.join(os.path.dirname(__file__), "../.."))+from conftest import skip_openai # noqa: E402+sys.path.append(os.path.join(os.path.dirname(__file__), ".."))from test_assistant_agent import KEY_LOC, OAI_CONFIG_LIST # noqa: E402@@ -16,15 +19,15 @@ try:)import chromadbfrom chromadb.utils import embedding_functions as ef-- skip_test = Falseexcept ImportError:- skip_test = True+ skip = True+else:+ skip = False or skip_openai@pytest.mark.skipif(- sys.platform in ["darwin", "win32"] or skip_test,- reason="do not run on MacOS or windows or dependency is not installed",+ sys.platform in ["darwin", "win32"] or skip,+ reason="do not run on MacOS or windows OR dependency is not installed OR requested to skip",)def test_retrievechat():conversations = {}@@ -69,8 +72,8 @@ def test_retrievechat():@pytest.mark.skipif(- sys.platform in ["darwin", "win32"] or skip_test,- reason="do not run on MacOS or windows or dependency is not installed",+ sys.platform in ["darwin", "win32"] or skip,+ reason="do not run on MacOS or windows OR dependency is not installed OR requested to skip",)def test_retrieve_config(caplog):# test warning message when no docs_path is provided