diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ea8b5a94f..9269365f2 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -92,6 +92,7 @@ jobs: topic: - document_stores - nodes + - agents runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 @@ -399,9 +400,37 @@ jobs: channel: '#haystack' if: failure() && github.repository_owner == 'deepset-ai' && github.ref == 'refs/heads/main' + integration-tests-agents: + name: Integration / Agents / ${{ matrix.os }} + needs: + - unit-tests + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest,windows-latest] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v3 + + - name: Setup Python + uses: ./.github/actions/python_cache/ + + - name: Install Haystack + run: pip install -U . + + - name: Run tests + run: | + pytest --maxfail=5 -m "integration" test/agents + + - uses: act10ns/slack@v2 + with: + status: ${{ job.status }} + channel: '#haystack' + if: failure() && github.repository_owner == 'deepset-ai' && github.ref == 'refs/heads/main' + # -# TODO: the following steps need to be revisited +# IMPORTANT: the following steps need to be revisited PLEASE DO NOT ADD ANYTHING TO THE JOBS BELOW! # @@ -413,7 +442,6 @@ jobs: folder: - "nodes" - "pipelines" - - "agents" - "modeling" - "others" @@ -459,9 +487,7 @@ jobs: folder: - "nodes" - "pipelines" - - "agents" - "modeling" - #- "others" runs-on: windows-latest if: contains(github.event.pull_request.labels.*.name, 'topic:windows') || !github.event.pull_request.draft @@ -510,7 +536,6 @@ jobs: folder: - "nodes" - "pipelines" - - "agents" - "modeling" - "others" @@ -606,7 +631,6 @@ jobs: folder: - "nodes" - "pipelines" - - "agents" - "modeling" - "others" diff --git a/test/agents/test_agent.py b/test/agents/test_agent.py index 878d29acf..1191a547f 100644 --- a/test/agents/test_agent.py +++ b/test/agents/test_agent.py @@ -13,6 +13,7 @@ from haystack.pipelines import ExtractiveQAPipeline, DocumentSearchPipeline, Bas from test.conftest import MockRetriever, MockPromptNode +@pytest.mark.unit def test_add_and_overwrite_tool(): # Add a Node as a Tool to an Agent agent = Agent(prompt_node=MockPromptNode()) @@ -52,6 +53,7 @@ def test_add_and_overwrite_tool(): assert isinstance(agent.tools["Retriever"].pipeline_or_node, BaseStandardPipeline) +@pytest.mark.unit def test_agent_chooses_no_action(): agent = Agent(prompt_node=MockPromptNode()) retriever = MockRetriever() @@ -66,6 +68,7 @@ def test_agent_chooses_no_action(): agent.run("How many letters does the name of the town where Christelle lives have?") +@pytest.mark.unit def test_max_iterations(caplog, monkeypatch): # Run an Agent and stop because max_iterations is reached agent = Agent(prompt_node=MockPromptNode(), max_iterations=3) @@ -97,6 +100,7 @@ def test_max_iterations(caplog, monkeypatch): assert "Maximum number of iterations (2) reached" in caplog.text +@pytest.mark.unit def test_run_tool(): agent = Agent(prompt_node=MockPromptNode()) retriever = MockRetriever() @@ -111,6 +115,7 @@ def test_run_tool(): assert result[0]["documents"] == [] +@pytest.mark.unit def test_extract_observation(): agent = Agent(prompt_node=MockPromptNode()) observation = agent._extract_observation( @@ -124,6 +129,7 @@ def test_extract_observation(): assert observation == "first answer" +@pytest.mark.unit def test_extract_tool_name_and_tool_input(): agent = Agent(prompt_node=MockPromptNode()) @@ -132,6 +138,7 @@ def test_extract_tool_name_and_tool_input(): assert tool_name == "Search" and tool_input == "Where was Jeremy McKinnon born" +@pytest.mark.unit def test_extract_final_answer(): agent = Agent(prompt_node=MockPromptNode()) @@ -140,6 +147,7 @@ def test_extract_final_answer(): assert final_answer == "Florida" +@pytest.mark.unit def test_format_answer(): agent = Agent(prompt_node=MockPromptNode()) formatted_answer = agent._format_answer(query="query", answer="answer", transcript="transcript")