Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the ReasoningAgent to CI #294

Merged
merged 7 commits into from
Jan 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions .github/workflows/contrib-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -772,3 +772,54 @@ jobs:
with:
file: ./coverage.xml
flags: unittests

ReasoningTest:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
exclude:
- os: macos-latest
python-version: "3.9"
steps:
- uses: actions/checkout@v4
with:
lfs: true
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install packages and dependencies for all tests
run: |
python -m pip install --upgrade pip wheel
pip install pytest-cov>=5
- name: Install packages and dependencies for Reasoning
run: |
pip install -e .
- name: Install Graphviz based on OS
run: |
if [[ ${{ matrix.os }} == 'ubuntu-latest' ]]; then
sudo apt-get update
sudo apt-get install -y graphviz
elif [[ ${{ matrix.os }} == 'macos-latest' ]]; then
brew install graphviz
elif [[ ${{ matrix.os }} == 'windows-latest' ]]; then
choco install graphviz
fi
shell: bash
- name: Set AUTOGEN_USE_DOCKER based on OS
shell: bash
run: |
if [[ ${{ matrix.os }} != ubuntu-latest ]]; then
echo "AUTOGEN_USE_DOCKER=False" >> $GITHUB_ENV
fi
- name: Coverage
run: |
pytest test/agentchat/contrib/test_reasoning_agent.py --skip-openai
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
flags: unittests
13 changes: 13 additions & 0 deletions test/agentchat/contrib/test_reasoning_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,17 @@
sys.path.append(os.path.join(os.path.dirname(__file__), "../.."))
from conftest import reason, skip_openai # noqa: E402

skip_reasons = [reason]
try:
from graphviz import Digraph

skip_for_dependencies = False
skip_reason = ""
except ImportError as e:
skip_for_dependencies = True
skip_reason = f"dependency not installed: {e.msg}"
pass

here = os.path.abspath(os.path.dirname(__file__))

# Test data
Expand Down Expand Up @@ -212,6 +223,7 @@ def mock_response(*args, **kwargs):
assert max_depth_found <= agent._max_depth


@pytest.mark.skipif(skip_for_dependencies, reason=skip_reason)
@patch("graphviz.Digraph")
def test_visualize_tree_successful_case(mock_digraph):
"""Test successful tree visualization"""
Expand Down Expand Up @@ -260,6 +272,7 @@ def test_visualize_tree_successful_case(mock_digraph):
mock_graph.render.assert_called_once_with("tree_of_thoughts", view=False, format="png", cleanup=True)


@pytest.mark.skipif(skip_for_dependencies, reason=skip_reason)
@patch("graphviz.Digraph")
def test_visualize_tree_render_failure(mock_digraph):
"""Test visualization when rendering fails"""
Expand Down
Loading