mirror of
https://github.com/microsoft/autogen.git
synced 2026-04-20 03:02:16 -04:00
* Add new capability to handle long context * Make print conditional * Remove superfluous comment * Fix msg order * Allow user to specify max_tokens * Add ability to specify max_tokens per message; improve name * Improve doc and readability * Add tests * Improve documentation and add tests per Erik and Chi's feedback * Update notebook * Update doc string of add to agents * Improve doc string * improve notebook * Update github workflows for context handling * Update docstring * update notebook to use raw config list. * Update contrib-openai.yml remove _target * Fix code formatting * Fix workflow file * Update .github/workflows/contrib-openai.yml --------- Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com> Co-authored-by: Chi Wang <wang.chi@microsoft.com>
302 lines
10 KiB
YAML
302 lines
10 KiB
YAML
# This workflow will install Python dependencies and run tests
|
|
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
|
|
|
|
name: OpenAI4ContribTests
|
|
|
|
on:
|
|
pull_request_target:
|
|
branches: ['main']
|
|
paths:
|
|
- 'autogen/**'
|
|
- 'test/agentchat/contrib/**'
|
|
- '.github/workflows/contrib-openai.yml'
|
|
- 'setup.py'
|
|
permissions: {}
|
|
# actions: read
|
|
# checks: read
|
|
# contents: read
|
|
# deployments: read
|
|
jobs:
|
|
RetrieveChatTest:
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-latest]
|
|
python-version: ["3.10"]
|
|
runs-on: ${{ matrix.os }}
|
|
environment: openai1
|
|
steps:
|
|
# checkout to pr branch
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
with:
|
|
ref: ${{ github.event.pull_request.head.sha }}
|
|
- name: Set up Python ${{ matrix.python-version }}
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
- name: Install packages and dependencies
|
|
run: |
|
|
docker --version
|
|
python -m pip install --upgrade pip wheel
|
|
pip install -e .
|
|
python -c "import autogen"
|
|
pip install coverage pytest-asyncio
|
|
- name: Install packages for test when needed
|
|
run: |
|
|
pip install docker
|
|
pip install qdrant_client[fastembed]
|
|
pip install -e .[retrievechat]
|
|
- name: Coverage
|
|
env:
|
|
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
|
AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }}
|
|
AZURE_OPENAI_API_BASE: ${{ secrets.AZURE_OPENAI_API_BASE }}
|
|
OAI_CONFIG_LIST: ${{ secrets.OAI_CONFIG_LIST }}
|
|
run: |
|
|
coverage run -a -m pytest test/agentchat/contrib/test_retrievechat.py test/agentchat/contrib/test_qdrant_retrievechat.py
|
|
coverage xml
|
|
- name: Upload coverage to Codecov
|
|
uses: codecov/codecov-action@v3
|
|
with:
|
|
file: ./coverage.xml
|
|
flags: unittests
|
|
CompressionTest:
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-latest]
|
|
python-version: ["3.9"]
|
|
runs-on: ${{ matrix.os }}
|
|
environment: openai1
|
|
steps:
|
|
# checkout to pr branch
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
with:
|
|
ref: ${{ github.event.pull_request.head.sha }}
|
|
- name: Set up Python ${{ matrix.python-version }}
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
- name: Install packages and dependencies
|
|
run: |
|
|
docker --version
|
|
python -m pip install --upgrade pip wheel
|
|
pip install -e .
|
|
python -c "import autogen"
|
|
pip install coverage pytest-asyncio
|
|
- name: Install packages for test when needed
|
|
run: |
|
|
pip install docker
|
|
- name: Coverage
|
|
env:
|
|
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
|
AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }}
|
|
AZURE_OPENAI_API_BASE: ${{ secrets.AZURE_OPENAI_API_BASE }}
|
|
OAI_CONFIG_LIST: ${{ secrets.OAI_CONFIG_LIST }}
|
|
run: |
|
|
coverage run -a -m pytest test/agentchat/contrib/test_compressible_agent.py
|
|
coverage xml
|
|
- name: Upload coverage to Codecov
|
|
uses: codecov/codecov-action@v3
|
|
with:
|
|
file: ./coverage.xml
|
|
flags: unittests
|
|
GPTAssistantAgent:
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-latest]
|
|
python-version: ["3.11"]
|
|
runs-on: ${{ matrix.os }}
|
|
environment: openai1
|
|
steps:
|
|
# checkout to pr branch
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
with:
|
|
ref: ${{ github.event.pull_request.head.sha }}
|
|
- name: Set up Python ${{ matrix.python-version }}
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
- name: Install packages and dependencies
|
|
run: |
|
|
docker --version
|
|
python -m pip install --upgrade pip wheel
|
|
pip install -e .
|
|
python -c "import autogen"
|
|
pip install coverage pytest-asyncio
|
|
- name: Install packages for test when needed
|
|
run: |
|
|
pip install docker
|
|
- name: Coverage
|
|
env:
|
|
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
|
AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }}
|
|
AZURE_OPENAI_API_BASE: ${{ secrets.AZURE_OPENAI_API_BASE }}
|
|
OAI_CONFIG_LIST: ${{ secrets.OAI_CONFIG_LIST }}
|
|
run: |
|
|
coverage run -a -m pytest test/agentchat/contrib/test_gpt_assistant.py
|
|
coverage xml
|
|
- name: Upload coverage to Codecov
|
|
uses: codecov/codecov-action@v3
|
|
with:
|
|
file: ./coverage.xml
|
|
flags: unittests
|
|
TeachableAgent:
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-latest]
|
|
python-version: ["3.11"]
|
|
runs-on: ${{ matrix.os }}
|
|
environment: openai1
|
|
steps:
|
|
# checkout to pr branch
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
with:
|
|
ref: ${{ github.event.pull_request.head.sha }}
|
|
- name: Set up Python ${{ matrix.python-version }}
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
- name: Install packages and dependencies
|
|
run: |
|
|
docker --version
|
|
python -m pip install --upgrade pip wheel
|
|
pip install -e .[teachable]
|
|
python -c "import autogen"
|
|
pip install coverage pytest
|
|
- name: Coverage
|
|
env:
|
|
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
|
AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }}
|
|
AZURE_OPENAI_API_BASE: ${{ secrets.AZURE_OPENAI_API_BASE }}
|
|
OAI_CONFIG_LIST: ${{ secrets.OAI_CONFIG_LIST }}
|
|
run: |
|
|
coverage run -a -m pytest test/agentchat/contrib/test_teachable_agent.py
|
|
coverage xml
|
|
- name: Upload coverage to Codecov
|
|
uses: codecov/codecov-action@v3
|
|
with:
|
|
file: ./coverage.xml
|
|
flags: unittests
|
|
AgentBuilder:
|
|
strategy:
|
|
matrix:
|
|
os: [ ubuntu-latest ]
|
|
python-version: [ "3.11" ]
|
|
runs-on: ${{ matrix.os }}
|
|
environment: openai1
|
|
steps:
|
|
# checkout to pr branch
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
with:
|
|
ref: ${{ github.event.pull_request.head.sha }}
|
|
- name: Set up Python ${{ matrix.python-version }}
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
- name: Install packages and dependencies
|
|
run: |
|
|
docker --version
|
|
python -m pip install --upgrade pip wheel
|
|
pip install -e .
|
|
python -c "import autogen"
|
|
pip install coverage pytest-asyncio
|
|
- name: Install packages for test when needed
|
|
run: |
|
|
pip install -e .[autobuild]
|
|
- name: Coverage
|
|
env:
|
|
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
|
AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }}
|
|
AZURE_OPENAI_API_BASE: ${{ secrets.AZURE_OPENAI_API_BASE }}
|
|
OAI_CONFIG_LIST: ${{ secrets.OAI_CONFIG_LIST }}
|
|
run: |
|
|
coverage run -a -m pytest test/agentchat/contrib/test_agent_builder.py
|
|
coverage xml
|
|
- name: Upload coverage to Codecov
|
|
uses: codecov/codecov-action@v3
|
|
with:
|
|
file: ./coverage.xml
|
|
flags: unittests
|
|
WebSurfer:
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-latest]
|
|
python-version: ["3.11"]
|
|
runs-on: ${{ matrix.os }}
|
|
environment: openai1
|
|
steps:
|
|
# checkout to pr branch
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
with:
|
|
ref: ${{ github.event.pull_request.head.sha }}
|
|
- name: Set up Python ${{ matrix.python-version }}
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
- name: Install packages and dependencies
|
|
run: |
|
|
docker --version
|
|
python -m pip install --upgrade pip wheel
|
|
pip install -e .[websurfer]
|
|
python -c "import autogen"
|
|
pip install coverage pytest
|
|
- name: Coverage
|
|
env:
|
|
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
|
AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }}
|
|
AZURE_OPENAI_API_BASE: ${{ secrets.AZURE_OPENAI_API_BASE }}
|
|
OAI_CONFIG_LIST: ${{ secrets.OAI_CONFIG_LIST }}
|
|
BING_API_KEY: ${{ secrets.BING_API_KEY }}
|
|
run: |
|
|
coverage run -a -m pytest test/agentchat/contrib/test_web_surfer.py
|
|
coverage xml
|
|
- name: Upload coverage to Codecov
|
|
uses: codecov/codecov-action@v3
|
|
with:
|
|
file: ./coverage.xml
|
|
flags: unittests
|
|
ContextHandling:
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-latest]
|
|
python-version: ["3.11"]
|
|
runs-on: ${{ matrix.os }}
|
|
environment: openai1
|
|
steps:
|
|
# checkout to pr branch
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
with:
|
|
ref: ${{ github.event.pull_request.head.sha }}
|
|
- name: Set up Python ${{ matrix.python-version }}
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
- name: Install packages and dependencies
|
|
run: |
|
|
docker --version
|
|
python -m pip install --upgrade pip wheel
|
|
pip install -e .
|
|
python -c "import autogen"
|
|
pip install coverage pytest
|
|
- name: Coverage
|
|
env:
|
|
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
|
AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }}
|
|
AZURE_OPENAI_API_BASE: ${{ secrets.AZURE_OPENAI_API_BASE }}
|
|
OAI_CONFIG_LIST: ${{ secrets.OAI_CONFIG_LIST }}
|
|
BING_API_KEY: ${{ secrets.BING_API_KEY }}
|
|
run: |
|
|
coverage run -a -m pytest test/agentchat/contrib/capabilities/test_context_handling.py
|
|
coverage xml
|
|
- name: Upload coverage to Codecov
|
|
uses: codecov/codecov-action@v3
|
|
with:
|
|
file: ./coverage.xml
|
|
flags: unittests
|