Skip to content

Commit 9a484d8

Browse files
committed
Merge branch 'main' into tinyra-refactor
2 parents 007eed6 + b270a2e commit 9a484d8

File tree

353 files changed

+25691
-6119
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

353 files changed

+25691
-6119
lines changed

.devcontainer/Dockerfile

+5-1
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,13 @@ RUN apt-get update \
1414
&& apt-get -y install --no-install-recommends build-essential npm \
1515
&& apt-get autoremove -y \
1616
&& apt-get clean -y \
17-
&& rm -rf /var/lib/apt/lists/*
17+
&& wget https://github.com/quarto-dev/quarto-cli/releases/download/v1.4.549/quarto-1.4.549-linux-amd64.deb \
18+
&& dpkg -i quarto-1.4.549-linux-amd64.deb \
19+
&& rm -rf /var/lib/apt/lists/* quarto-1.4.549-linux-amd64.deb
1820
ENV DEBIAN_FRONTEND=dialog
1921

2022
# For docs
2123
RUN npm install --global yarn
2224
RUN pip install pydoc-markdown
25+
RUN pip install pyyaml
26+
RUN pip install colored

samples/dockers/Dockerfiles.md renamed to .devcontainer/README.md

+28-13
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,43 @@
1-
# README for AutoGen Docker Samples
1+
# Dockerfiles and Devcontainer Configurations for AutoGen
22

3-
Welcome to the `autogen/samples/dockers` directory! Here you'll find Dockerfiles that are essential for setting up your AutoGen development environment. Each Dockerfile is tailored for different use cases and requirements. Below is a brief overview of each and how you can utilize them effectively.
3+
Welcome to the `.devcontainer` directory! Here you'll find Dockerfiles and devcontainer configurations that are essential for setting up your AutoGen development environment. Each Dockerfile is tailored for different use cases and requirements. Below is a brief overview of each and how you can utilize them effectively.
4+
5+
These configurations can be used with Codespaces and locally.
46

57
## Dockerfile Descriptions
68

7-
### Dockerfile.base
9+
### base
810

9-
- **Purpose**: This Dockerfile is designed for basic setups. It includes common Python libraries and essential dependencies required for general usage of AutoGen.
11+
- **Purpose**: This Dockerfile, i.e., `./Dockerfile`, is designed for basic setups. It includes common Python libraries and essential dependencies required for general usage of AutoGen.
1012
- **Usage**: Ideal for those just starting with AutoGen or for general-purpose applications.
11-
- **Building the Image**: Run `docker build -f Dockerfile.base -t autogen_base_img .` in this directory.
13+
- **Building the Image**: Run `docker build -f ./Dockerfile -t autogen_base_img .` in this directory.
14+
- **Using with Codespaces**: `Code > Codespaces > Click on +` By default + creates a Codespace on the current branch.
1215

13-
### Dockerfile.full
16+
### full
1417

15-
- **Purpose**: This Dockerfile is for advanced features. It includes additional dependencies and is configured for more complex or feature-rich AutoGen applications.
18+
- **Purpose**: This Dockerfile, i.e., `./full/Dockerfile` is for advanced features. It includes additional dependencies and is configured for more complex or feature-rich AutoGen applications.
1619
- **Usage**: Suited for advanced users who need the full range of AutoGen's capabilities.
17-
- **Building the Image**: Execute `docker build -f Dockerfile.full -t autogen_full_img .`.
20+
- **Building the Image**: Execute `docker build -f full/Dockerfile -t autogen_full_img .`.
21+
- **Using with Codespaces**: `Code > Codespaces > Click on ...> New with options > Choose "full" as devcontainer configuration`. This image may require a Codespace with at least 64GB of disk space.
1822

19-
### Dockerfile.dev
23+
### dev
2024

21-
- **Purpose**: Tailored for AutoGen project developers, this Dockerfile includes tools and configurations aiding in development and contribution.
25+
- **Purpose**: Tailored for AutoGen project developers, this Dockerfile, i.e., `./dev/Dockerfile` includes tools and configurations aiding in development and contribution.
2226
- **Usage**: Recommended for developers who are contributing to the AutoGen project.
23-
- **Building the Image**: Run `docker build -f Dockerfile.dev -t autogen_dev_img .`.
27+
- **Building the Image**: Run `docker build -f dev/Dockerfile -t autogen_dev_img .`.
28+
- **Using with Codespaces**: `Code > Codespaces > Click on ...> New with options > Choose "dev" as devcontainer configuration`. This image may require a Codespace with at least 64GB of disk space.
2429
- **Before using**: We highly encourage all potential contributors to read the [AutoGen Contributing](https://microsoft.github.io/autogen/docs/Contribute) page prior to submitting any pull requests.
2530

31+
32+
### studio
33+
34+
- **Purpose**: Tailored for AutoGen project developers, this Dockerfile, i.e., `./studio/Dockerfile`, includes tools and configurations aiding in development and contribution.
35+
- **Usage**: Recommended for developers who are contributing to the AutoGen project.
36+
- **Building the Image**: Run `docker build -f studio/Dockerfile -t autogen_studio_img .`.
37+
- **Using with Codespaces**: `Code > Codespaces > Click on ...> New with options > Choose "studio" as devcontainer configuration`.
38+
- **Before using**: We highly encourage all potential contributors to read the [AutoGen Contributing](https://microsoft.github.io/autogen/docs/Contribute) page prior to submitting any pull requests.
39+
40+
2641
## Customizing Dockerfiles
2742

2843
Feel free to modify these Dockerfiles for your specific project needs. Here are some common customizations:
@@ -33,9 +48,9 @@ Feel free to modify these Dockerfiles for your specific project needs. Here are
3348
`FROM python:3.11-slim-bookworm` to `FROM python:3.10-slim-bookworm`
3449
- **Setting Environment Variables**: Add environment variables using the `ENV` command for any application-specific configurations. We have prestaged the line needed to inject your OpenAI_key into the docker environment as a environmental variable. Others can be staged in the same way. Just uncomment the line.
3550
`# ENV OPENAI_API_KEY="{OpenAI-API-Key}"` to `ENV OPENAI_API_KEY="{OpenAI-API-Key}"`
36-
- **Need a less "Advanced" Autogen build**: If the Dockerfile.full is to much but you need more than advanced then update this line in the Dockerfile.full file.
51+
- **Need a less "Advanced" Autogen build**: If the `./full/Dockerfile` is to much but you need more than advanced then update this line in the Dockerfile file.
3752
`RUN pip install pyautogen[teachable,lmm,retrievechat,mathchat,blendsearch] autogenra` to install just what you need. `RUN pip install pyautogen[retrievechat,blendsearch] autogenra`
38-
- **Can't Dev without your favorite CLI tool**: if you need particular OS tools to be installed in your Docker container you can add those packages here right after the sudo for the Dockerfile.base and Dockerfile.full files. In the example below we are installing net-tools and vim to the environment.
53+
- **Can't Dev without your favorite CLI tool**: if you need particular OS tools to be installed in your Docker container you can add those packages here right after the sudo for the `./base/Dockerfile` and `./full/Dockerfile` files. In the example below we are installing net-tools and vim to the environment.
3954

4055
```code
4156
RUN apt-get update \

samples/dockers/Dockerfile.dev renamed to .devcontainer/dev/Dockerfile

+9-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ FROM python:3.11-slim-bookworm
44
# Update and install necessary packages
55
RUN apt-get update && apt-get -y update
66
# added vim and nano for convenience
7-
RUN apt-get install -y sudo git npm vim nano curl
7+
RUN apt-get install -y sudo git npm vim nano curl wget
88

99
# Setup a non-root user 'autogen' with sudo access
1010
RUN adduser --disabled-password --gecos '' autogen
@@ -32,6 +32,14 @@ RUN sudo pip install pydoc-markdown
3232
RUN cd website
3333
RUN yarn install --frozen-lockfile --ignore-engines
3434

35+
RUN arch=$(arch | sed s/aarch64/arm64/ | sed s/x86_64/amd64/) && \
36+
wget -q https://github.com/quarto-dev/quarto-cli/releases/download/v1.4.549/quarto-1.4.549-linux-${arch}.tar.gz && \
37+
mkdir -p /home/autogen/quarto/ && \
38+
tar -xzf quarto-1.4.549-linux-${arch}.tar.gz --directory /home/autogen/quarto/ && \
39+
rm quarto-1.4.549-linux-${arch}.tar.gz
40+
41+
ENV PATH="${PATH}:/home/autogen/quarto/quarto-1.4.549/bin/"
42+
3543
# Exposes the Yarn port for Docusaurus
3644
EXPOSE 3000
3745

.devcontainer/dev/devcontainer.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"dockerFile": "Dockerfile"
3+
}

.devcontainer/devcontainer.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"extensions": [
55
"ms-python.python",
66
"ms-toolsai.jupyter",
7-
"visualstudioexptteam.vscodeintellicode"
7+
"visualstudioexptteam.vscodeintellicode",
8+
"GitHub.copilot"
89
],
910
"settings": {
1011
"terminal.integrated.profiles.linux": {
File renamed without changes.

.devcontainer/full/devcontainer.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"dockerFile": "Dockerfile"
3+
}

.devcontainer/studio/Dockerfile

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#-------------------------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See LICENSE file in the project root for license information.
4+
#-------------------------------------------------------------------------------------------------------------
5+
6+
FROM mcr.microsoft.com/vscode/devcontainers/python:3.10
7+
8+
#
9+
# Update the OS and maybe install packages
10+
#
11+
ENV DEBIAN_FRONTEND=noninteractive
12+
RUN apt-get update \
13+
&& apt-get upgrade -y \
14+
&& apt-get -y install --no-install-recommends build-essential npm \
15+
&& apt-get autoremove -y \
16+
&& apt-get clean -y \
17+
&& rm -rf /var/lib/apt/lists/*
18+
ENV DEBIAN_FRONTEND=dialog
19+
20+
# For docs
21+
RUN npm install --global yarn
22+
RUN pip install pydoc-markdown
+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"customizations": {
3+
"vscode": {
4+
"extensions": [
5+
"ms-python.python",
6+
"ms-toolsai.jupyter",
7+
"visualstudioexptteam.vscodeintellicode"
8+
],
9+
"settings": {
10+
"terminal.integrated.profiles.linux": {
11+
"bash": {
12+
"path": "/bin/bash"
13+
}
14+
},
15+
"terminal.integrated.defaultProfile.linux": "bash"
16+
}
17+
}
18+
},
19+
"dockerFile": "Dockerfile",
20+
"updateContentCommand": "cd samples/apps/autogen-studio && pip install -e . && sudo npm install -g gatsby-cli && cd frontend && yarn install && yarn build"
21+
}

.github/workflows/build.yml

+27-14
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,31 @@ name: Build
55

66
on:
77
push:
8-
branches: ['main']
8+
branches: ["main"]
99
paths:
10-
- 'autogen/**'
11-
- 'test/**'
12-
- '.github/workflows/build.yml'
13-
- 'setup.py'
10+
- "autogen/**"
11+
- "test/**"
12+
- ".github/workflows/build.yml"
13+
- "setup.py"
1414
pull_request:
15-
branches: ['main']
15+
branches: ["main"]
1616
merge_group:
1717
types: [checks_requested]
1818

1919
concurrency:
2020
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref }}
2121
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
22-
22+
permissions: {}
2323
jobs:
2424
build:
25-
2625
runs-on: ${{ matrix.os }}
26+
env:
27+
AUTOGEN_USE_DOCKER: ${{ matrix.os != 'ubuntu-latest' && 'False' }}
2728
strategy:
2829
fail-fast: false
2930
matrix:
30-
os: [ubuntu-latest, macos-latest, windows-2019]
31-
python-version: ["3.8", "3.9", "3.10", "3.11"]
31+
os: [ubuntu-latest, macos-latest, windows-latest]
32+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
3233
steps:
3334
- uses: actions/checkout@v3
3435
- name: Set up Python ${{ matrix.python-version }}
@@ -40,15 +41,27 @@ jobs:
4041
python -m pip install --upgrade pip wheel
4142
pip install -e .
4243
python -c "import autogen"
43-
pip install -e. pytest mock
44-
- name: Test with pytest
45-
if: matrix.python-version != '3.10'
44+
pip install pytest mock
45+
pip install jupyter-client ipykernel
46+
python -m ipykernel install --user --name python3
47+
- name: Set AUTOGEN_USE_DOCKER based on OS
48+
shell: bash
49+
run: |
50+
if [[ ${{ matrix.os }} != ubuntu-latest ]]; then
51+
echo "AUTOGEN_USE_DOCKER=False" >> $GITHUB_ENV
52+
fi
53+
- name: Test with pytest skipping openai tests
54+
if: matrix.python-version != '3.10' && matrix.os == 'ubuntu-latest'
4655
run: |
4756
pytest test --skip-openai
57+
- name: Test with pytest skipping openai and docker tests
58+
if: matrix.python-version != '3.10' && matrix.os != 'ubuntu-latest'
59+
run: |
60+
pytest test --skip-openai --skip-docker
4861
- name: Coverage
4962
if: matrix.python-version == '3.10'
5063
run: |
51-
pip install -e .[test]
64+
pip install -e .[test,redis]
5265
coverage run -a -m pytest test --ignore=test/agentchat/contrib --skip-openai
5366
coverage xml
5467
- name: Upload coverage to Codecov

.github/workflows/contrib-openai.yml

+83-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ on:
1111
- 'test/agentchat/contrib/**'
1212
- '.github/workflows/contrib-openai.yml'
1313
- 'setup.py'
14-
14+
permissions: {}
15+
# actions: read
16+
# checks: read
17+
# contents: read
18+
# deployments: read
1519
jobs:
1620
RetrieveChatTest:
1721
strategy:
@@ -217,3 +221,81 @@ jobs:
217221
with:
218222
file: ./coverage.xml
219223
flags: unittests
224+
WebSurfer:
225+
strategy:
226+
matrix:
227+
os: [ubuntu-latest]
228+
python-version: ["3.11"]
229+
runs-on: ${{ matrix.os }}
230+
environment: openai1
231+
steps:
232+
# checkout to pr branch
233+
- name: Checkout
234+
uses: actions/checkout@v3
235+
with:
236+
ref: ${{ github.event.pull_request.head.sha }}
237+
- name: Set up Python ${{ matrix.python-version }}
238+
uses: actions/setup-python@v4
239+
with:
240+
python-version: ${{ matrix.python-version }}
241+
- name: Install packages and dependencies
242+
run: |
243+
docker --version
244+
python -m pip install --upgrade pip wheel
245+
pip install -e .[websurfer]
246+
python -c "import autogen"
247+
pip install coverage pytest
248+
- name: Coverage
249+
env:
250+
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
251+
AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }}
252+
AZURE_OPENAI_API_BASE: ${{ secrets.AZURE_OPENAI_API_BASE }}
253+
OAI_CONFIG_LIST: ${{ secrets.OAI_CONFIG_LIST }}
254+
BING_API_KEY: ${{ secrets.BING_API_KEY }}
255+
run: |
256+
coverage run -a -m pytest test/agentchat/contrib/test_web_surfer.py
257+
coverage xml
258+
- name: Upload coverage to Codecov
259+
uses: codecov/codecov-action@v3
260+
with:
261+
file: ./coverage.xml
262+
flags: unittests
263+
ContextHandling:
264+
strategy:
265+
matrix:
266+
os: [ubuntu-latest]
267+
python-version: ["3.11"]
268+
runs-on: ${{ matrix.os }}
269+
environment: openai1
270+
steps:
271+
# checkout to pr branch
272+
- name: Checkout
273+
uses: actions/checkout@v3
274+
with:
275+
ref: ${{ github.event.pull_request.head.sha }}
276+
- name: Set up Python ${{ matrix.python-version }}
277+
uses: actions/setup-python@v4
278+
with:
279+
python-version: ${{ matrix.python-version }}
280+
- name: Install packages and dependencies
281+
run: |
282+
docker --version
283+
python -m pip install --upgrade pip wheel
284+
pip install -e .
285+
python -c "import autogen"
286+
pip install coverage pytest
287+
- name: Coverage
288+
env:
289+
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
290+
AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }}
291+
AZURE_OPENAI_API_BASE: ${{ secrets.AZURE_OPENAI_API_BASE }}
292+
OAI_CONFIG_LIST: ${{ secrets.OAI_CONFIG_LIST }}
293+
BING_API_KEY: ${{ secrets.BING_API_KEY }}
294+
run: |
295+
coverage run -a -m pytest test/agentchat/contrib/capabilities/test_context_handling.py
296+
coverage xml
297+
- name: Upload coverage to Codecov
298+
uses: codecov/codecov-action@v3
299+
with:
300+
file: ./coverage.xml
301+
flags: unittests

0 commit comments

Comments
 (0)