From 03bdcfdeca9b795cc8500ec1348cd4ef13380b82 Mon Sep 17 00:00:00 2001 From: Kumaran Rajendhiran Date: Thu, 9 Jan 2025 07:54:24 +0000 Subject: [PATCH 01/37] Add a basic python 3.10 based devcontainer --- .devcontainer/devcontainer.env | 8 +++ .devcontainer/devcontainer.json | 89 ++++++++++++++++++++++++++------ .devcontainer/docker-compose.yml | 17 ++++++ .devcontainer/setup.sh | 8 +++ .pre-commit-config.yaml | 6 ++- 5 files changed, 112 insertions(+), 16 deletions(-) create mode 100644 .devcontainer/devcontainer.env create mode 100644 .devcontainer/docker-compose.yml create mode 100755 .devcontainer/setup.sh diff --git a/.devcontainer/devcontainer.env b/.devcontainer/devcontainer.env new file mode 100644 index 0000000000..815a038625 --- /dev/null +++ b/.devcontainer/devcontainer.env @@ -0,0 +1,8 @@ +AZURE_API_ENDPOINT=${AZURE_API_ENDPOINT} +AZURE_API_VERSION=${AZURE_API_VERSION} + +# LLM keys +ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY} +AZURE_OPENAI_API_KEY=${AZURE_OPENAI_API_KEY} +OPENAI_API_KEY=${OPENAI_API_KEY} +TOGETHER_API_KEY=${TOGETHER_API_KEY} diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 8ca4604d85..2b4bdc731c 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,22 +1,81 @@ { - "customizations": { + "name": "python-3.10", + // "image": "mcr.microsoft.com/devcontainers/python:3.10", + "dockerComposeFile": [ + "./docker-compose.yml" + ], + "service": "python-3.10-ag2", + "secrets": { + "OPENAI_API_KEY": { + "description": "This key is optional and only needed if you are working on OpenAI-related code. Leave it blank if not required. You can always set it later as an environment variable in the codespace terminal." + }, + "TOGETHER_API_KEY": { + "description": "This key is optional and only needed if you are working with Together API-related code. Leave it blank if not required. You can always set it later as an environment variable in the codespace terminal." + }, + "ANTHROPIC_API_KEY": { + "description": "This key is optional and only needed if you are working with Anthropic API-related code. Leave it blank if not required. You can always set it later as an environment variable in the codespace terminal." + }, + "AZURE_OPENAI_API_KEY": { + "description": "This key is optional and only needed if you are using Azure's OpenAI services. For it to work, you must also set the related environment variables: AZURE_API_ENDPOINT, AZURE_API_VERSION. Leave it blank if not required. You can always set these variables later in the codespace terminal." + }, + "AZURE_API_ENDPOINT": { + "description": "This key is required if you are using Azure's OpenAI services. It must be used in conjunction with AZURE_OPENAI_API_KEY, AZURE_API_VERSION to ensure proper configuration. You can always set these variables later as environment variables in the codespace terminal." + }, + "AZURE_API_VERSION": { + "description": "This key is required to specify the version of the Azure API you are using. Set this along with AZURE_OPENAI_API_KEY, AZURE_API_ENDPOINT for Azure OpenAI services. These variables can be configured later as environment variables in the codespace terminal." + }, + }, + "shutdownAction": "stopCompose", + "workspaceFolder": "/workspaces/ag2", + // "runArgs": [], + "remoteEnv": {}, + "features": { + "ghcr.io/devcontainers/features/common-utils:2": { + "installZsh": true, + "installOhMyZsh": true, + "configureZshAsDefaultShell": true, + "username": "vscode", + "userUid": "1000", + "userGid": "1000" + // "upgradePackages": "true" + }, + // "ghcr.io/devcontainers/features/python:1": {}, + "ghcr.io/devcontainers/features/node:1": {}, + // The below configuration with "version" set to "latest" fails in codespace + // "ghcr.io/devcontainers/features/git:1": { + // "version": "latest", + // "ppa": true + // }, + "ghcr.io/devcontainers/features/git:1": {}, + "ghcr.io/devcontainers/features/git-lfs:1": {}, + "ghcr.io/robbert229/devcontainer-features/postgresql-client:1": {} + }, + "updateContentCommand": "bash .devcontainer/setup.sh", + "customizations": { "vscode": { + "settings": { + "python.linting.enabled": true, + "python.testing.pytestEnabled": true, + "editor.formatOnSave": true, + "editor.codeActionsOnSave": { + "source.organizeImports": "always" + }, + "[python]": { + "editor.defaultFormatter": "ms-python.vscode-pylance" + }, + "editor.rulers": [ + 80 + ] + }, "extensions": [ "ms-python.python", "ms-toolsai.jupyter", - "visualstudioexptteam.vscodeintellicode", - "GitHub.copilot" - ], - "settings": { - "terminal.integrated.profiles.linux": { - "bash": { - "path": "/bin/bash" - } - }, - "terminal.integrated.defaultProfile.linux": "bash" - } + "ms-toolsai.vscode-jupyter-cell-tags", + "ms-toolsai.jupyter-keymap", + "ms-toolsai.jupyter-renderers", + "ms-toolsai.vscode-jupyter-slideshow", + "ms-python.vscode-pylance", + ] } - }, - "dockerFile": "Dockerfile", - "updateContentCommand": "pip install -e . pre-commit && pre-commit install" + } } diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml new file mode 100644 index 0000000000..6f66201481 --- /dev/null +++ b/.devcontainer/docker-compose.yml @@ -0,0 +1,17 @@ +version: '3' + +services: + python-3.10-ag2: # nosemgrep + image: mcr.microsoft.com/devcontainers/python:3.10 + container_name: ag2-${USER}-python-3.10 + volumes: + - ../:/workspaces/ag2:cached + command: sleep infinity + env_file: + - ./devcontainer.env + networks: + - ag2-network + +networks: + ag2-network: + name: ag2-${USER}-network diff --git a/.devcontainer/setup.sh b/.devcontainer/setup.sh new file mode 100755 index 0000000000..0b137d3858 --- /dev/null +++ b/.devcontainer/setup.sh @@ -0,0 +1,8 @@ +# update pip +pip install --upgrade pip + +# install dev packages +pip install -e ".[test,teachable,lmm,retrievechat,mathchat,blendsearch]" + +# install pre-commit hook if not installed already +pre-commit install diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1fceab925a..f691dcd097 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -15,7 +15,11 @@ repos: - id: check-yaml - id: check-toml - id: check-json - exclude: ^notebook/agentchat_pdf_rag/(parsed_elements|processed_elements)\.json$ + exclude: | + (?x)^( + .devcontainer/devcontainer.json | + ^notebook/agentchat_pdf_rag/(parsed_elements|processed_elements)\.json$ + )$ - id: check-byte-order-marker exclude: .gitignore - id: check-merge-conflict From 683f5be580a3497b2332d87900ae88ad9a7128e8 Mon Sep 17 00:00:00 2001 From: Kumaran Rajendhiran Date: Thu, 9 Jan 2025 09:49:03 +0000 Subject: [PATCH 02/37] Add scripts to generate devcontainer files for different python versions --- .devcontainer/devcontainer.json | 5 +- .devcontainer/docker-compose.yml | 4 + .devcontainer/python-3.11/devcontainer.json | 84 +++++++++++++++++++ .devcontainer/python-3.11/docker-compose.yml | 21 +++++ .devcontainer/python-3.12/devcontainer.json | 84 +++++++++++++++++++ .devcontainer/python-3.12/docker-compose.yml | 21 +++++ .devcontainer/python-3.13/devcontainer.json | 84 +++++++++++++++++++ .devcontainer/python-3.13/docker-compose.yml | 21 +++++ .devcontainer/python-3.9/devcontainer.json | 84 +++++++++++++++++++ .devcontainer/python-3.9/docker-compose.yml | 21 +++++ .pre-commit-config.yaml | 2 +- .../devcontainer.json.jinja | 84 +++++++++++++++++++ .../docker-compose.yml.jinja | 21 +++++ scripts/generate-devcontainers.py | 74 ++++++++++++++++ scripts/generate-devcontainers.sh | 3 + 15 files changed, 611 insertions(+), 2 deletions(-) create mode 100644 .devcontainer/python-3.11/devcontainer.json create mode 100644 .devcontainer/python-3.11/docker-compose.yml create mode 100644 .devcontainer/python-3.12/devcontainer.json create mode 100644 .devcontainer/python-3.12/docker-compose.yml create mode 100644 .devcontainer/python-3.13/devcontainer.json create mode 100644 .devcontainer/python-3.13/docker-compose.yml create mode 100644 .devcontainer/python-3.9/devcontainer.json create mode 100644 .devcontainer/python-3.9/docker-compose.yml create mode 100644 scripts/devcontainer_templates/devcontainer.json.jinja create mode 100644 scripts/devcontainer_templates/docker-compose.yml.jinja create mode 100644 scripts/generate-devcontainers.py create mode 100755 scripts/generate-devcontainers.sh diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 2b4bdc731c..f3461e8596 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,3 +1,6 @@ +// Do not edit this file directly. +// This file is auto generated from the template file `scripts/devcontainer_templates/docker-compose.yml.jinja`. +// If you need to make changes, please update the template file and regenerate this file by running `./scripts/generate_devcontainer.sh`. { "name": "python-3.10", // "image": "mcr.microsoft.com/devcontainers/python:3.10", @@ -74,7 +77,7 @@ "ms-toolsai.jupyter-keymap", "ms-toolsai.jupyter-renderers", "ms-toolsai.vscode-jupyter-slideshow", - "ms-python.vscode-pylance", + "ms-python.vscode-pylance" ] } } diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml index 6f66201481..080a6c9957 100644 --- a/.devcontainer/docker-compose.yml +++ b/.devcontainer/docker-compose.yml @@ -1,3 +1,7 @@ +# Do not edit this file directly. +# This file is auto generated from the template file `scripts/devcontainer_templates/docker-compose.yml.jinja`. +# If you need to make changes, please update the template file and regenerate this file by running `./scripts/generate_devcontainer.sh`. + version: '3' services: diff --git a/.devcontainer/python-3.11/devcontainer.json b/.devcontainer/python-3.11/devcontainer.json new file mode 100644 index 0000000000..9d096fa7c8 --- /dev/null +++ b/.devcontainer/python-3.11/devcontainer.json @@ -0,0 +1,84 @@ +// Do not edit this file directly. +// This file is auto generated from the template file `scripts/devcontainer_templates/docker-compose.yml.jinja`. +// If you need to make changes, please update the template file and regenerate this file by running `./scripts/generate_devcontainer.sh`. +{ + "name": "python-3.11", + // "image": "mcr.microsoft.com/devcontainers/python:3.11", + "dockerComposeFile": [ + "./docker-compose.yml" + ], + "service": "python-3.11-ag2", + "secrets": { + "OPENAI_API_KEY": { + "description": "This key is optional and only needed if you are working on OpenAI-related code. Leave it blank if not required. You can always set it later as an environment variable in the codespace terminal." + }, + "TOGETHER_API_KEY": { + "description": "This key is optional and only needed if you are working with Together API-related code. Leave it blank if not required. You can always set it later as an environment variable in the codespace terminal." + }, + "ANTHROPIC_API_KEY": { + "description": "This key is optional and only needed if you are working with Anthropic API-related code. Leave it blank if not required. You can always set it later as an environment variable in the codespace terminal." + }, + "AZURE_OPENAI_API_KEY": { + "description": "This key is optional and only needed if you are using Azure's OpenAI services. For it to work, you must also set the related environment variables: AZURE_API_ENDPOINT, AZURE_API_VERSION. Leave it blank if not required. You can always set these variables later in the codespace terminal." + }, + "AZURE_API_ENDPOINT": { + "description": "This key is required if you are using Azure's OpenAI services. It must be used in conjunction with AZURE_OPENAI_API_KEY, AZURE_API_VERSION to ensure proper configuration. You can always set these variables later as environment variables in the codespace terminal." + }, + "AZURE_API_VERSION": { + "description": "This key is required to specify the version of the Azure API you are using. Set this along with AZURE_OPENAI_API_KEY, AZURE_API_ENDPOINT for Azure OpenAI services. These variables can be configured later as environment variables in the codespace terminal." + }, + }, + "shutdownAction": "stopCompose", + "workspaceFolder": "/workspaces/ag2", + // "runArgs": [], + "remoteEnv": {}, + "features": { + "ghcr.io/devcontainers/features/common-utils:2": { + "installZsh": true, + "installOhMyZsh": true, + "configureZshAsDefaultShell": true, + "username": "vscode", + "userUid": "1000", + "userGid": "1000" + // "upgradePackages": "true" + }, + // "ghcr.io/devcontainers/features/python:1": {}, + "ghcr.io/devcontainers/features/node:1": {}, + // The below configuration with "version" set to "latest" fails in codespace + // "ghcr.io/devcontainers/features/git:1": { + // "version": "latest", + // "ppa": true + // }, + "ghcr.io/devcontainers/features/git:1": {}, + "ghcr.io/devcontainers/features/git-lfs:1": {}, + "ghcr.io/robbert229/devcontainer-features/postgresql-client:1": {} + }, + "updateContentCommand": "bash .devcontainer/setup.sh", + "customizations": { + "vscode": { + "settings": { + "python.linting.enabled": true, + "python.testing.pytestEnabled": true, + "editor.formatOnSave": true, + "editor.codeActionsOnSave": { + "source.organizeImports": "always" + }, + "[python]": { + "editor.defaultFormatter": "ms-python.vscode-pylance" + }, + "editor.rulers": [ + 80 + ] + }, + "extensions": [ + "ms-python.python", + "ms-toolsai.jupyter", + "ms-toolsai.vscode-jupyter-cell-tags", + "ms-toolsai.jupyter-keymap", + "ms-toolsai.jupyter-renderers", + "ms-toolsai.vscode-jupyter-slideshow", + "ms-python.vscode-pylance" + ] + } + } +} diff --git a/.devcontainer/python-3.11/docker-compose.yml b/.devcontainer/python-3.11/docker-compose.yml new file mode 100644 index 0000000000..671413ff78 --- /dev/null +++ b/.devcontainer/python-3.11/docker-compose.yml @@ -0,0 +1,21 @@ +# Do not edit this file directly. +# This file is auto generated from the template file `scripts/devcontainer_templates/docker-compose.yml.jinja`. +# If you need to make changes, please update the template file and regenerate this file by running `./scripts/generate_devcontainer.sh`. + +version: '3' + +services: + python-3.11-ag2: # nosemgrep + image: mcr.microsoft.com/devcontainers/python:3.11 + container_name: ag2-${USER}-python-3.11 + volumes: + - ../../:/workspaces/ag2:cached + command: sleep infinity + env_file: + - ../../devcontainer.env + networks: + - ag2-network + +networks: + ag2-network: + name: ag2-${USER}-network diff --git a/.devcontainer/python-3.12/devcontainer.json b/.devcontainer/python-3.12/devcontainer.json new file mode 100644 index 0000000000..88767c77ff --- /dev/null +++ b/.devcontainer/python-3.12/devcontainer.json @@ -0,0 +1,84 @@ +// Do not edit this file directly. +// This file is auto generated from the template file `scripts/devcontainer_templates/docker-compose.yml.jinja`. +// If you need to make changes, please update the template file and regenerate this file by running `./scripts/generate_devcontainer.sh`. +{ + "name": "python-3.12", + // "image": "mcr.microsoft.com/devcontainers/python:3.12", + "dockerComposeFile": [ + "./docker-compose.yml" + ], + "service": "python-3.12-ag2", + "secrets": { + "OPENAI_API_KEY": { + "description": "This key is optional and only needed if you are working on OpenAI-related code. Leave it blank if not required. You can always set it later as an environment variable in the codespace terminal." + }, + "TOGETHER_API_KEY": { + "description": "This key is optional and only needed if you are working with Together API-related code. Leave it blank if not required. You can always set it later as an environment variable in the codespace terminal." + }, + "ANTHROPIC_API_KEY": { + "description": "This key is optional and only needed if you are working with Anthropic API-related code. Leave it blank if not required. You can always set it later as an environment variable in the codespace terminal." + }, + "AZURE_OPENAI_API_KEY": { + "description": "This key is optional and only needed if you are using Azure's OpenAI services. For it to work, you must also set the related environment variables: AZURE_API_ENDPOINT, AZURE_API_VERSION. Leave it blank if not required. You can always set these variables later in the codespace terminal." + }, + "AZURE_API_ENDPOINT": { + "description": "This key is required if you are using Azure's OpenAI services. It must be used in conjunction with AZURE_OPENAI_API_KEY, AZURE_API_VERSION to ensure proper configuration. You can always set these variables later as environment variables in the codespace terminal." + }, + "AZURE_API_VERSION": { + "description": "This key is required to specify the version of the Azure API you are using. Set this along with AZURE_OPENAI_API_KEY, AZURE_API_ENDPOINT for Azure OpenAI services. These variables can be configured later as environment variables in the codespace terminal." + }, + }, + "shutdownAction": "stopCompose", + "workspaceFolder": "/workspaces/ag2", + // "runArgs": [], + "remoteEnv": {}, + "features": { + "ghcr.io/devcontainers/features/common-utils:2": { + "installZsh": true, + "installOhMyZsh": true, + "configureZshAsDefaultShell": true, + "username": "vscode", + "userUid": "1000", + "userGid": "1000" + // "upgradePackages": "true" + }, + // "ghcr.io/devcontainers/features/python:1": {}, + "ghcr.io/devcontainers/features/node:1": {}, + // The below configuration with "version" set to "latest" fails in codespace + // "ghcr.io/devcontainers/features/git:1": { + // "version": "latest", + // "ppa": true + // }, + "ghcr.io/devcontainers/features/git:1": {}, + "ghcr.io/devcontainers/features/git-lfs:1": {}, + "ghcr.io/robbert229/devcontainer-features/postgresql-client:1": {} + }, + "updateContentCommand": "bash .devcontainer/setup.sh", + "customizations": { + "vscode": { + "settings": { + "python.linting.enabled": true, + "python.testing.pytestEnabled": true, + "editor.formatOnSave": true, + "editor.codeActionsOnSave": { + "source.organizeImports": "always" + }, + "[python]": { + "editor.defaultFormatter": "ms-python.vscode-pylance" + }, + "editor.rulers": [ + 80 + ] + }, + "extensions": [ + "ms-python.python", + "ms-toolsai.jupyter", + "ms-toolsai.vscode-jupyter-cell-tags", + "ms-toolsai.jupyter-keymap", + "ms-toolsai.jupyter-renderers", + "ms-toolsai.vscode-jupyter-slideshow", + "ms-python.vscode-pylance" + ] + } + } +} diff --git a/.devcontainer/python-3.12/docker-compose.yml b/.devcontainer/python-3.12/docker-compose.yml new file mode 100644 index 0000000000..912fad82b4 --- /dev/null +++ b/.devcontainer/python-3.12/docker-compose.yml @@ -0,0 +1,21 @@ +# Do not edit this file directly. +# This file is auto generated from the template file `scripts/devcontainer_templates/docker-compose.yml.jinja`. +# If you need to make changes, please update the template file and regenerate this file by running `./scripts/generate_devcontainer.sh`. + +version: '3' + +services: + python-3.12-ag2: # nosemgrep + image: mcr.microsoft.com/devcontainers/python:3.12 + container_name: ag2-${USER}-python-3.12 + volumes: + - ../../:/workspaces/ag2:cached + command: sleep infinity + env_file: + - ../../devcontainer.env + networks: + - ag2-network + +networks: + ag2-network: + name: ag2-${USER}-network diff --git a/.devcontainer/python-3.13/devcontainer.json b/.devcontainer/python-3.13/devcontainer.json new file mode 100644 index 0000000000..057299448f --- /dev/null +++ b/.devcontainer/python-3.13/devcontainer.json @@ -0,0 +1,84 @@ +// Do not edit this file directly. +// This file is auto generated from the template file `scripts/devcontainer_templates/docker-compose.yml.jinja`. +// If you need to make changes, please update the template file and regenerate this file by running `./scripts/generate_devcontainer.sh`. +{ + "name": "python-3.13", + // "image": "mcr.microsoft.com/devcontainers/python:3.13", + "dockerComposeFile": [ + "./docker-compose.yml" + ], + "service": "python-3.13-ag2", + "secrets": { + "OPENAI_API_KEY": { + "description": "This key is optional and only needed if you are working on OpenAI-related code. Leave it blank if not required. You can always set it later as an environment variable in the codespace terminal." + }, + "TOGETHER_API_KEY": { + "description": "This key is optional and only needed if you are working with Together API-related code. Leave it blank if not required. You can always set it later as an environment variable in the codespace terminal." + }, + "ANTHROPIC_API_KEY": { + "description": "This key is optional and only needed if you are working with Anthropic API-related code. Leave it blank if not required. You can always set it later as an environment variable in the codespace terminal." + }, + "AZURE_OPENAI_API_KEY": { + "description": "This key is optional and only needed if you are using Azure's OpenAI services. For it to work, you must also set the related environment variables: AZURE_API_ENDPOINT, AZURE_API_VERSION. Leave it blank if not required. You can always set these variables later in the codespace terminal." + }, + "AZURE_API_ENDPOINT": { + "description": "This key is required if you are using Azure's OpenAI services. It must be used in conjunction with AZURE_OPENAI_API_KEY, AZURE_API_VERSION to ensure proper configuration. You can always set these variables later as environment variables in the codespace terminal." + }, + "AZURE_API_VERSION": { + "description": "This key is required to specify the version of the Azure API you are using. Set this along with AZURE_OPENAI_API_KEY, AZURE_API_ENDPOINT for Azure OpenAI services. These variables can be configured later as environment variables in the codespace terminal." + }, + }, + "shutdownAction": "stopCompose", + "workspaceFolder": "/workspaces/ag2", + // "runArgs": [], + "remoteEnv": {}, + "features": { + "ghcr.io/devcontainers/features/common-utils:2": { + "installZsh": true, + "installOhMyZsh": true, + "configureZshAsDefaultShell": true, + "username": "vscode", + "userUid": "1000", + "userGid": "1000" + // "upgradePackages": "true" + }, + // "ghcr.io/devcontainers/features/python:1": {}, + "ghcr.io/devcontainers/features/node:1": {}, + // The below configuration with "version" set to "latest" fails in codespace + // "ghcr.io/devcontainers/features/git:1": { + // "version": "latest", + // "ppa": true + // }, + "ghcr.io/devcontainers/features/git:1": {}, + "ghcr.io/devcontainers/features/git-lfs:1": {}, + "ghcr.io/robbert229/devcontainer-features/postgresql-client:1": {} + }, + "updateContentCommand": "bash .devcontainer/setup.sh", + "customizations": { + "vscode": { + "settings": { + "python.linting.enabled": true, + "python.testing.pytestEnabled": true, + "editor.formatOnSave": true, + "editor.codeActionsOnSave": { + "source.organizeImports": "always" + }, + "[python]": { + "editor.defaultFormatter": "ms-python.vscode-pylance" + }, + "editor.rulers": [ + 80 + ] + }, + "extensions": [ + "ms-python.python", + "ms-toolsai.jupyter", + "ms-toolsai.vscode-jupyter-cell-tags", + "ms-toolsai.jupyter-keymap", + "ms-toolsai.jupyter-renderers", + "ms-toolsai.vscode-jupyter-slideshow", + "ms-python.vscode-pylance" + ] + } + } +} diff --git a/.devcontainer/python-3.13/docker-compose.yml b/.devcontainer/python-3.13/docker-compose.yml new file mode 100644 index 0000000000..a8482481a3 --- /dev/null +++ b/.devcontainer/python-3.13/docker-compose.yml @@ -0,0 +1,21 @@ +# Do not edit this file directly. +# This file is auto generated from the template file `scripts/devcontainer_templates/docker-compose.yml.jinja`. +# If you need to make changes, please update the template file and regenerate this file by running `./scripts/generate_devcontainer.sh`. + +version: '3' + +services: + python-3.13-ag2: # nosemgrep + image: mcr.microsoft.com/devcontainers/python:3.13 + container_name: ag2-${USER}-python-3.13 + volumes: + - ../../:/workspaces/ag2:cached + command: sleep infinity + env_file: + - ../../devcontainer.env + networks: + - ag2-network + +networks: + ag2-network: + name: ag2-${USER}-network diff --git a/.devcontainer/python-3.9/devcontainer.json b/.devcontainer/python-3.9/devcontainer.json new file mode 100644 index 0000000000..b5e727b2f6 --- /dev/null +++ b/.devcontainer/python-3.9/devcontainer.json @@ -0,0 +1,84 @@ +// Do not edit this file directly. +// This file is auto generated from the template file `scripts/devcontainer_templates/docker-compose.yml.jinja`. +// If you need to make changes, please update the template file and regenerate this file by running `./scripts/generate_devcontainer.sh`. +{ + "name": "python-3.9", + // "image": "mcr.microsoft.com/devcontainers/python:3.9", + "dockerComposeFile": [ + "./docker-compose.yml" + ], + "service": "python-3.9-ag2", + "secrets": { + "OPENAI_API_KEY": { + "description": "This key is optional and only needed if you are working on OpenAI-related code. Leave it blank if not required. You can always set it later as an environment variable in the codespace terminal." + }, + "TOGETHER_API_KEY": { + "description": "This key is optional and only needed if you are working with Together API-related code. Leave it blank if not required. You can always set it later as an environment variable in the codespace terminal." + }, + "ANTHROPIC_API_KEY": { + "description": "This key is optional and only needed if you are working with Anthropic API-related code. Leave it blank if not required. You can always set it later as an environment variable in the codespace terminal." + }, + "AZURE_OPENAI_API_KEY": { + "description": "This key is optional and only needed if you are using Azure's OpenAI services. For it to work, you must also set the related environment variables: AZURE_API_ENDPOINT, AZURE_API_VERSION. Leave it blank if not required. You can always set these variables later in the codespace terminal." + }, + "AZURE_API_ENDPOINT": { + "description": "This key is required if you are using Azure's OpenAI services. It must be used in conjunction with AZURE_OPENAI_API_KEY, AZURE_API_VERSION to ensure proper configuration. You can always set these variables later as environment variables in the codespace terminal." + }, + "AZURE_API_VERSION": { + "description": "This key is required to specify the version of the Azure API you are using. Set this along with AZURE_OPENAI_API_KEY, AZURE_API_ENDPOINT for Azure OpenAI services. These variables can be configured later as environment variables in the codespace terminal." + }, + }, + "shutdownAction": "stopCompose", + "workspaceFolder": "/workspaces/ag2", + // "runArgs": [], + "remoteEnv": {}, + "features": { + "ghcr.io/devcontainers/features/common-utils:2": { + "installZsh": true, + "installOhMyZsh": true, + "configureZshAsDefaultShell": true, + "username": "vscode", + "userUid": "1000", + "userGid": "1000" + // "upgradePackages": "true" + }, + // "ghcr.io/devcontainers/features/python:1": {}, + "ghcr.io/devcontainers/features/node:1": {}, + // The below configuration with "version" set to "latest" fails in codespace + // "ghcr.io/devcontainers/features/git:1": { + // "version": "latest", + // "ppa": true + // }, + "ghcr.io/devcontainers/features/git:1": {}, + "ghcr.io/devcontainers/features/git-lfs:1": {}, + "ghcr.io/robbert229/devcontainer-features/postgresql-client:1": {} + }, + "updateContentCommand": "bash .devcontainer/setup.sh", + "customizations": { + "vscode": { + "settings": { + "python.linting.enabled": true, + "python.testing.pytestEnabled": true, + "editor.formatOnSave": true, + "editor.codeActionsOnSave": { + "source.organizeImports": "always" + }, + "[python]": { + "editor.defaultFormatter": "ms-python.vscode-pylance" + }, + "editor.rulers": [ + 80 + ] + }, + "extensions": [ + "ms-python.python", + "ms-toolsai.jupyter", + "ms-toolsai.vscode-jupyter-cell-tags", + "ms-toolsai.jupyter-keymap", + "ms-toolsai.jupyter-renderers", + "ms-toolsai.vscode-jupyter-slideshow", + "ms-python.vscode-pylance" + ] + } + } +} diff --git a/.devcontainer/python-3.9/docker-compose.yml b/.devcontainer/python-3.9/docker-compose.yml new file mode 100644 index 0000000000..ba67247be7 --- /dev/null +++ b/.devcontainer/python-3.9/docker-compose.yml @@ -0,0 +1,21 @@ +# Do not edit this file directly. +# This file is auto generated from the template file `scripts/devcontainer_templates/docker-compose.yml.jinja`. +# If you need to make changes, please update the template file and regenerate this file by running `./scripts/generate_devcontainer.sh`. + +version: '3' + +services: + python-3.9-ag2: # nosemgrep + image: mcr.microsoft.com/devcontainers/python:3.9 + container_name: ag2-${USER}-python-3.9 + volumes: + - ../../:/workspaces/ag2:cached + command: sleep infinity + env_file: + - ../../devcontainer.env + networks: + - ag2-network + +networks: + ag2-network: + name: ag2-${USER}-network diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f691dcd097..bbd394d465 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -17,7 +17,7 @@ repos: - id: check-json exclude: | (?x)^( - .devcontainer/devcontainer.json | + .devcontainer/.*devcontainer\.json | ^notebook/agentchat_pdf_rag/(parsed_elements|processed_elements)\.json$ )$ - id: check-byte-order-marker diff --git a/scripts/devcontainer_templates/devcontainer.json.jinja b/scripts/devcontainer_templates/devcontainer.json.jinja new file mode 100644 index 0000000000..be617ee1d4 --- /dev/null +++ b/scripts/devcontainer_templates/devcontainer.json.jinja @@ -0,0 +1,84 @@ +// Do not edit this file directly. +// This file is auto generated from the template file `scripts/devcontainer_templates/docker-compose.yml.jinja`. +// If you need to make changes, please update the template file and regenerate this file by running `./scripts/generate_devcontainer.sh`. +{ + "name": "python-{{ python_version }}", + // "image": "mcr.microsoft.com/devcontainers/python:{{ python_version }}", + "dockerComposeFile": [ + "./docker-compose.yml" + ], + "service": "python-{{ python_version }}-ag2", + "secrets": { + "OPENAI_API_KEY": { + "description": "This key is optional and only needed if you are working on OpenAI-related code. Leave it blank if not required. You can always set it later as an environment variable in the codespace terminal." + }, + "TOGETHER_API_KEY": { + "description": "This key is optional and only needed if you are working with Together API-related code. Leave it blank if not required. You can always set it later as an environment variable in the codespace terminal." + }, + "ANTHROPIC_API_KEY": { + "description": "This key is optional and only needed if you are working with Anthropic API-related code. Leave it blank if not required. You can always set it later as an environment variable in the codespace terminal." + }, + "AZURE_OPENAI_API_KEY": { + "description": "This key is optional and only needed if you are using Azure's OpenAI services. For it to work, you must also set the related environment variables: AZURE_API_ENDPOINT, AZURE_API_VERSION. Leave it blank if not required. You can always set these variables later in the codespace terminal." + }, + "AZURE_API_ENDPOINT": { + "description": "This key is required if you are using Azure's OpenAI services. It must be used in conjunction with AZURE_OPENAI_API_KEY, AZURE_API_VERSION to ensure proper configuration. You can always set these variables later as environment variables in the codespace terminal." + }, + "AZURE_API_VERSION": { + "description": "This key is required to specify the version of the Azure API you are using. Set this along with AZURE_OPENAI_API_KEY, AZURE_API_ENDPOINT for Azure OpenAI services. These variables can be configured later as environment variables in the codespace terminal." + }, + }, + "shutdownAction": "stopCompose", + "workspaceFolder": "/workspaces/ag2", + // "runArgs": [], + "remoteEnv": {}, + "features": { + "ghcr.io/devcontainers/features/common-utils:2": { + "installZsh": true, + "installOhMyZsh": true, + "configureZshAsDefaultShell": true, + "username": "vscode", + "userUid": "1000", + "userGid": "1000" + // "upgradePackages": "true" + }, + // "ghcr.io/devcontainers/features/python:1": {}, + "ghcr.io/devcontainers/features/node:1": {}, + // The below configuration with "version" set to "latest" fails in codespace + // "ghcr.io/devcontainers/features/git:1": { + // "version": "latest", + // "ppa": true + // }, + "ghcr.io/devcontainers/features/git:1": {}, + "ghcr.io/devcontainers/features/git-lfs:1": {}, + "ghcr.io/robbert229/devcontainer-features/postgresql-client:1": {} + }, + "updateContentCommand": "bash .devcontainer/setup.sh", + "customizations": { + "vscode": { + "settings": { + "python.linting.enabled": true, + "python.testing.pytestEnabled": true, + "editor.formatOnSave": true, + "editor.codeActionsOnSave": { + "source.organizeImports": "always" + }, + "[python]": { + "editor.defaultFormatter": "ms-python.vscode-pylance" + }, + "editor.rulers": [ + 80 + ] + }, + "extensions": [ + "ms-python.python", + "ms-toolsai.jupyter", + "ms-toolsai.vscode-jupyter-cell-tags", + "ms-toolsai.jupyter-keymap", + "ms-toolsai.jupyter-renderers", + "ms-toolsai.vscode-jupyter-slideshow", + "ms-python.vscode-pylance" + ] + } + } +} diff --git a/scripts/devcontainer_templates/docker-compose.yml.jinja b/scripts/devcontainer_templates/docker-compose.yml.jinja new file mode 100644 index 0000000000..108c388339 --- /dev/null +++ b/scripts/devcontainer_templates/docker-compose.yml.jinja @@ -0,0 +1,21 @@ +# Do not edit this file directly. +# This file is auto generated from the template file `scripts/devcontainer_templates/docker-compose.yml.jinja`. +# If you need to make changes, please update the template file and regenerate this file by running `./scripts/generate_devcontainer.sh`. + +version: '3' + +services: + python-{{ python_version }}-ag2: # nosemgrep + image: mcr.microsoft.com/devcontainers/python:{{ python_version }} + container_name: ag2-${USER}-python-{{ python_version }} + volumes: + - {{ mount_volume }}:/workspaces/ag2:cached + command: sleep infinity + env_file: + - {{ env_file }} + networks: + - ag2-network + +networks: + ag2-network: + name: ag2-${USER}-network diff --git a/scripts/generate-devcontainers.py b/scripts/generate-devcontainers.py new file mode 100644 index 0000000000..89bed142ea --- /dev/null +++ b/scripts/generate-devcontainers.py @@ -0,0 +1,74 @@ +# Copyright (c) 2023 - 2024, Owners of https://github.com/ag2ai +# +# SPDX-License-Identifier: Apache-2.0 + +# A script to generate devcontainer files for different python versions + +import os +from pathlib import Path + +from jinja2 import Template + +# List of python versions to generate devcontainer files for +PYTHON_VERSIONS = ["3.9", "3.10", "3.11", "3.12", "3.13"] +DEFAULT = "3.10" + + +def generate_docker_compose_file(python_version: str): + print(f"Generating docker-compose.yml for python {python_version}") + + # Read file docker-compose.yml.jinja from ./devcontainer_templates/docker-compose.yml.jinja + docker_compose_template = Path("scripts/devcontainer_templates/docker-compose.yml.jinja") + with open(docker_compose_template, "r") as f: + content = f.read() + + # Replace python_version with the current version using jinja template + template = Template(content) + data = { + "python_version": python_version, + "mount_volume": "../" if python_version == DEFAULT else "../../", + "env_file": "./devcontainer.env" if python_version == DEFAULT else "../../devcontainer.env", + } + docker_compose_content = template.render(data) + + file_dir = ( + Path("./.devcontainer/") if python_version == DEFAULT else Path(f"./.devcontainer/python-{python_version}/") + ) + file_dir.mkdir(parents=True, exist_ok=True) + + with open(file_dir / "docker-compose.yml", "w") as f: + f.write(docker_compose_content + "\n") + + +def generate_devcontainer_json_file(python_version: str): + print(f"Generating devcontainer.json for python {python_version}") + + # Read file devcontainer.json.jinja from ./devcontainer_templates/devcontainer.json.jinja + devcontainer_template = Path("scripts/devcontainer_templates/devcontainer.json.jinja") + with open(devcontainer_template, "r") as f: + content = f.read() + + # Replace python_version with the current version using jinja template + template = Template(content) + data = { + "python_version": python_version, + } + devcontainer_content = template.render(data) + + file_dir = ( + Path("./.devcontainer/") if python_version == DEFAULT else Path(f"./.devcontainer/python-{python_version}/") + ) + file_dir.mkdir(parents=True, exist_ok=True) + + with open(file_dir / "devcontainer.json", "w") as f: + f.write(devcontainer_content + "\n") + + +def generate_devcontainer_files(): + for python_version in PYTHON_VERSIONS: + generate_docker_compose_file(python_version) + generate_devcontainer_json_file(python_version) + + +if __name__ == "__main__": + generate_devcontainer_files() diff --git a/scripts/generate-devcontainers.sh b/scripts/generate-devcontainers.sh new file mode 100755 index 0000000000..d00ad22c0d --- /dev/null +++ b/scripts/generate-devcontainers.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +python3 scripts/generate-devcontainers.py From 264a61c4dfd4bf5e15ba6ef31f8a1d1f5e2d8e46 Mon Sep 17 00:00:00 2001 From: Kumaran Rajendhiran Date: Thu, 9 Jan 2025 10:05:06 +0000 Subject: [PATCH 03/37] Add generate devcontainer files in pre-commit --- .pre-commit-config.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index bbd394d465..d9037568d5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -88,3 +88,13 @@ repos: rev: 1.8.5 hooks: - id: nbqa-black + + - repo: local + hooks: + - id: generate-devcontainer-files + name: Generate devcontainer files + entry: "scripts/generate-devcontainers.sh" + language: python + require_serial: true + verbose: true + files: ^(scripts/devcontainer_templates/.*|scripts/generate-devcontainer\.sh|scripts/generate-devcontainer\.py)$ From f1441310d2bdae3cc9c47091cb79e0388783050d Mon Sep 17 00:00:00 2001 From: Kumaran Rajendhiran Date: Thu, 9 Jan 2025 10:21:30 +0000 Subject: [PATCH 04/37] Add additional dependency in pre-commit config --- .pre-commit-config.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d9037568d5..03b7b51424 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -97,4 +97,5 @@ repos: language: python require_serial: true verbose: true + additional_dependencies: ['jinja2'] files: ^(scripts/devcontainer_templates/.*|scripts/generate-devcontainer\.sh|scripts/generate-devcontainer\.py)$ From fa8cc5dbc774b4953eb62ed52b70a2876775bcdb Mon Sep 17 00:00:00 2001 From: Kumaran Rajendhiran Date: Thu, 9 Jan 2025 11:30:04 +0000 Subject: [PATCH 05/37] Update comments --- .devcontainer/devcontainer.json | 4 +++- .devcontainer/docker-compose.yml | 4 +++- .devcontainer/python-3.11/devcontainer.json | 4 +++- .devcontainer/python-3.11/docker-compose.yml | 4 +++- .devcontainer/python-3.12/devcontainer.json | 4 +++- .devcontainer/python-3.12/docker-compose.yml | 4 +++- .devcontainer/python-3.13/devcontainer.json | 4 +++- .devcontainer/python-3.13/docker-compose.yml | 4 +++- .devcontainer/python-3.9/devcontainer.json | 4 +++- .devcontainer/python-3.9/docker-compose.yml | 4 +++- scripts/devcontainer_templates/devcontainer.json.jinja | 4 +++- scripts/devcontainer_templates/docker-compose.yml.jinja | 4 +++- 12 files changed, 36 insertions(+), 12 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index f3461e8596..b17b5c18d0 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,6 +1,8 @@ // Do not edit this file directly. // This file is auto generated from the template file `scripts/devcontainer_templates/docker-compose.yml.jinja`. -// If you need to make changes, please update the template file and regenerate this file by running `./scripts/generate_devcontainer.sh`. +// If you need to make changes, please update the template file and regenerate this file +// by running pre-commit command `pre-commit run --all-files` +// or by manually running the script `./scripts/devcontainer/generate_devcontainer.sh`. { "name": "python-3.10", // "image": "mcr.microsoft.com/devcontainers/python:3.10", diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml index 080a6c9957..cda6011303 100644 --- a/.devcontainer/docker-compose.yml +++ b/.devcontainer/docker-compose.yml @@ -1,6 +1,8 @@ # Do not edit this file directly. # This file is auto generated from the template file `scripts/devcontainer_templates/docker-compose.yml.jinja`. -# If you need to make changes, please update the template file and regenerate this file by running `./scripts/generate_devcontainer.sh`. +# If you need to make changes, please update the template file and regenerate this file +# by running pre-commit command `pre-commit run --all-files` +# or by manually running the script `./scripts/devcontainer/generate_devcontainer.sh`. version: '3' diff --git a/.devcontainer/python-3.11/devcontainer.json b/.devcontainer/python-3.11/devcontainer.json index 9d096fa7c8..fe0aeddf79 100644 --- a/.devcontainer/python-3.11/devcontainer.json +++ b/.devcontainer/python-3.11/devcontainer.json @@ -1,6 +1,8 @@ // Do not edit this file directly. // This file is auto generated from the template file `scripts/devcontainer_templates/docker-compose.yml.jinja`. -// If you need to make changes, please update the template file and regenerate this file by running `./scripts/generate_devcontainer.sh`. +// If you need to make changes, please update the template file and regenerate this file +// by running pre-commit command `pre-commit run --all-files` +// or by manually running the script `./scripts/devcontainer/generate_devcontainer.sh`. { "name": "python-3.11", // "image": "mcr.microsoft.com/devcontainers/python:3.11", diff --git a/.devcontainer/python-3.11/docker-compose.yml b/.devcontainer/python-3.11/docker-compose.yml index 671413ff78..2476d280e2 100644 --- a/.devcontainer/python-3.11/docker-compose.yml +++ b/.devcontainer/python-3.11/docker-compose.yml @@ -1,6 +1,8 @@ # Do not edit this file directly. # This file is auto generated from the template file `scripts/devcontainer_templates/docker-compose.yml.jinja`. -# If you need to make changes, please update the template file and regenerate this file by running `./scripts/generate_devcontainer.sh`. +# If you need to make changes, please update the template file and regenerate this file +# by running pre-commit command `pre-commit run --all-files` +# or by manually running the script `./scripts/devcontainer/generate_devcontainer.sh`. version: '3' diff --git a/.devcontainer/python-3.12/devcontainer.json b/.devcontainer/python-3.12/devcontainer.json index 88767c77ff..19cee98380 100644 --- a/.devcontainer/python-3.12/devcontainer.json +++ b/.devcontainer/python-3.12/devcontainer.json @@ -1,6 +1,8 @@ // Do not edit this file directly. // This file is auto generated from the template file `scripts/devcontainer_templates/docker-compose.yml.jinja`. -// If you need to make changes, please update the template file and regenerate this file by running `./scripts/generate_devcontainer.sh`. +// If you need to make changes, please update the template file and regenerate this file +// by running pre-commit command `pre-commit run --all-files` +// or by manually running the script `./scripts/devcontainer/generate_devcontainer.sh`. { "name": "python-3.12", // "image": "mcr.microsoft.com/devcontainers/python:3.12", diff --git a/.devcontainer/python-3.12/docker-compose.yml b/.devcontainer/python-3.12/docker-compose.yml index 912fad82b4..fe4e70bacb 100644 --- a/.devcontainer/python-3.12/docker-compose.yml +++ b/.devcontainer/python-3.12/docker-compose.yml @@ -1,6 +1,8 @@ # Do not edit this file directly. # This file is auto generated from the template file `scripts/devcontainer_templates/docker-compose.yml.jinja`. -# If you need to make changes, please update the template file and regenerate this file by running `./scripts/generate_devcontainer.sh`. +# If you need to make changes, please update the template file and regenerate this file +# by running pre-commit command `pre-commit run --all-files` +# or by manually running the script `./scripts/devcontainer/generate_devcontainer.sh`. version: '3' diff --git a/.devcontainer/python-3.13/devcontainer.json b/.devcontainer/python-3.13/devcontainer.json index 057299448f..9031740288 100644 --- a/.devcontainer/python-3.13/devcontainer.json +++ b/.devcontainer/python-3.13/devcontainer.json @@ -1,6 +1,8 @@ // Do not edit this file directly. // This file is auto generated from the template file `scripts/devcontainer_templates/docker-compose.yml.jinja`. -// If you need to make changes, please update the template file and regenerate this file by running `./scripts/generate_devcontainer.sh`. +// If you need to make changes, please update the template file and regenerate this file +// by running pre-commit command `pre-commit run --all-files` +// or by manually running the script `./scripts/devcontainer/generate_devcontainer.sh`. { "name": "python-3.13", // "image": "mcr.microsoft.com/devcontainers/python:3.13", diff --git a/.devcontainer/python-3.13/docker-compose.yml b/.devcontainer/python-3.13/docker-compose.yml index a8482481a3..fce5a1f454 100644 --- a/.devcontainer/python-3.13/docker-compose.yml +++ b/.devcontainer/python-3.13/docker-compose.yml @@ -1,6 +1,8 @@ # Do not edit this file directly. # This file is auto generated from the template file `scripts/devcontainer_templates/docker-compose.yml.jinja`. -# If you need to make changes, please update the template file and regenerate this file by running `./scripts/generate_devcontainer.sh`. +# If you need to make changes, please update the template file and regenerate this file +# by running pre-commit command `pre-commit run --all-files` +# or by manually running the script `./scripts/devcontainer/generate_devcontainer.sh`. version: '3' diff --git a/.devcontainer/python-3.9/devcontainer.json b/.devcontainer/python-3.9/devcontainer.json index b5e727b2f6..ffed487592 100644 --- a/.devcontainer/python-3.9/devcontainer.json +++ b/.devcontainer/python-3.9/devcontainer.json @@ -1,6 +1,8 @@ // Do not edit this file directly. // This file is auto generated from the template file `scripts/devcontainer_templates/docker-compose.yml.jinja`. -// If you need to make changes, please update the template file and regenerate this file by running `./scripts/generate_devcontainer.sh`. +// If you need to make changes, please update the template file and regenerate this file +// by running pre-commit command `pre-commit run --all-files` +// or by manually running the script `./scripts/devcontainer/generate_devcontainer.sh`. { "name": "python-3.9", // "image": "mcr.microsoft.com/devcontainers/python:3.9", diff --git a/.devcontainer/python-3.9/docker-compose.yml b/.devcontainer/python-3.9/docker-compose.yml index ba67247be7..ebb7cb5f3d 100644 --- a/.devcontainer/python-3.9/docker-compose.yml +++ b/.devcontainer/python-3.9/docker-compose.yml @@ -1,6 +1,8 @@ # Do not edit this file directly. # This file is auto generated from the template file `scripts/devcontainer_templates/docker-compose.yml.jinja`. -# If you need to make changes, please update the template file and regenerate this file by running `./scripts/generate_devcontainer.sh`. +# If you need to make changes, please update the template file and regenerate this file +# by running pre-commit command `pre-commit run --all-files` +# or by manually running the script `./scripts/devcontainer/generate_devcontainer.sh`. version: '3' diff --git a/scripts/devcontainer_templates/devcontainer.json.jinja b/scripts/devcontainer_templates/devcontainer.json.jinja index be617ee1d4..fb296b2812 100644 --- a/scripts/devcontainer_templates/devcontainer.json.jinja +++ b/scripts/devcontainer_templates/devcontainer.json.jinja @@ -1,6 +1,8 @@ // Do not edit this file directly. // This file is auto generated from the template file `scripts/devcontainer_templates/docker-compose.yml.jinja`. -// If you need to make changes, please update the template file and regenerate this file by running `./scripts/generate_devcontainer.sh`. +// If you need to make changes, please update the template file and regenerate this file +// by running pre-commit command `pre-commit run --all-files` +// or by manually running the script `./scripts/devcontainer/generate_devcontainer.sh`. { "name": "python-{{ python_version }}", // "image": "mcr.microsoft.com/devcontainers/python:{{ python_version }}", diff --git a/scripts/devcontainer_templates/docker-compose.yml.jinja b/scripts/devcontainer_templates/docker-compose.yml.jinja index 108c388339..c174187da0 100644 --- a/scripts/devcontainer_templates/docker-compose.yml.jinja +++ b/scripts/devcontainer_templates/docker-compose.yml.jinja @@ -1,6 +1,8 @@ # Do not edit this file directly. # This file is auto generated from the template file `scripts/devcontainer_templates/docker-compose.yml.jinja`. -# If you need to make changes, please update the template file and regenerate this file by running `./scripts/generate_devcontainer.sh`. +# If you need to make changes, please update the template file and regenerate this file +# by running pre-commit command `pre-commit run --all-files` +# or by manually running the script `./scripts/devcontainer/generate_devcontainer.sh`. version: '3' From acbaa122e0cc4776066337dce8e3e4d86731bc02 Mon Sep 17 00:00:00 2001 From: Kumaran Rajendhiran Date: Thu, 9 Jan 2025 11:36:14 +0000 Subject: [PATCH 06/37] Move scripts to single directory inside scripts --- .pre-commit-config.yaml | 4 ++-- scripts/{ => devcontainer}/generate-devcontainers.py | 11 +++++------ scripts/devcontainer/generate-devcontainers.sh | 3 +++ .../templates}/devcontainer.json.jinja | 0 .../templates}/docker-compose.yml.jinja | 0 scripts/generate-devcontainers.sh | 3 --- 6 files changed, 10 insertions(+), 11 deletions(-) rename scripts/{ => devcontainer}/generate-devcontainers.py (81%) create mode 100755 scripts/devcontainer/generate-devcontainers.sh rename scripts/{devcontainer_templates => devcontainer/templates}/devcontainer.json.jinja (100%) rename scripts/{devcontainer_templates => devcontainer/templates}/docker-compose.yml.jinja (100%) delete mode 100755 scripts/generate-devcontainers.sh diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 03b7b51424..4c88e76099 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -93,9 +93,9 @@ repos: hooks: - id: generate-devcontainer-files name: Generate devcontainer files - entry: "scripts/generate-devcontainers.sh" + entry: "scripts/devcontainer/generate-devcontainers.sh" language: python require_serial: true verbose: true additional_dependencies: ['jinja2'] - files: ^(scripts/devcontainer_templates/.*|scripts/generate-devcontainer\.sh|scripts/generate-devcontainer\.py)$ + files: ^(scripts/devcontainer/.*)$ diff --git a/scripts/generate-devcontainers.py b/scripts/devcontainer/generate-devcontainers.py similarity index 81% rename from scripts/generate-devcontainers.py rename to scripts/devcontainer/generate-devcontainers.py index 89bed142ea..a424a6bde8 100644 --- a/scripts/generate-devcontainers.py +++ b/scripts/devcontainer/generate-devcontainers.py @@ -13,13 +13,14 @@ PYTHON_VERSIONS = ["3.9", "3.10", "3.11", "3.12", "3.13"] DEFAULT = "3.10" +DOCKER_COMPOSE_TEMPLATE = Path("scripts/devcontainer/templates/docker-compose.yml.jinja") +DEVCONTAINER_JSON_TEMPLATE = Path("scripts/devcontainer/templates/devcontainer.json.jinja") + def generate_docker_compose_file(python_version: str): print(f"Generating docker-compose.yml for python {python_version}") - # Read file docker-compose.yml.jinja from ./devcontainer_templates/docker-compose.yml.jinja - docker_compose_template = Path("scripts/devcontainer_templates/docker-compose.yml.jinja") - with open(docker_compose_template, "r") as f: + with open(DOCKER_COMPOSE_TEMPLATE, "r") as f: content = f.read() # Replace python_version with the current version using jinja template @@ -43,9 +44,7 @@ def generate_docker_compose_file(python_version: str): def generate_devcontainer_json_file(python_version: str): print(f"Generating devcontainer.json for python {python_version}") - # Read file devcontainer.json.jinja from ./devcontainer_templates/devcontainer.json.jinja - devcontainer_template = Path("scripts/devcontainer_templates/devcontainer.json.jinja") - with open(devcontainer_template, "r") as f: + with open(DEVCONTAINER_JSON_TEMPLATE, "r") as f: content = f.read() # Replace python_version with the current version using jinja template diff --git a/scripts/devcontainer/generate-devcontainers.sh b/scripts/devcontainer/generate-devcontainers.sh new file mode 100755 index 0000000000..312116052b --- /dev/null +++ b/scripts/devcontainer/generate-devcontainers.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +python3 scripts/devcontainer/generate-devcontainers.py diff --git a/scripts/devcontainer_templates/devcontainer.json.jinja b/scripts/devcontainer/templates/devcontainer.json.jinja similarity index 100% rename from scripts/devcontainer_templates/devcontainer.json.jinja rename to scripts/devcontainer/templates/devcontainer.json.jinja diff --git a/scripts/devcontainer_templates/docker-compose.yml.jinja b/scripts/devcontainer/templates/docker-compose.yml.jinja similarity index 100% rename from scripts/devcontainer_templates/docker-compose.yml.jinja rename to scripts/devcontainer/templates/docker-compose.yml.jinja diff --git a/scripts/generate-devcontainers.sh b/scripts/generate-devcontainers.sh deleted file mode 100755 index d00ad22c0d..0000000000 --- a/scripts/generate-devcontainers.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash - -python3 scripts/generate-devcontainers.py From 6bb61c8743d3a1ea0510e8575e5c72195285b87c Mon Sep 17 00:00:00 2001 From: Kumaran Rajendhiran Date: Thu, 9 Jan 2025 11:49:18 +0000 Subject: [PATCH 07/37] Use python 3.9 as default devcontainer version --- .devcontainer/devcontainer.json | 6 +++--- .devcontainer/docker-compose.yml | 6 +++--- .../devcontainer.json | 6 +++--- .../docker-compose.yml | 6 +++--- .../devcontainer/generate-devcontainers.py | 19 ++++++++++++++++++- 5 files changed, 30 insertions(+), 13 deletions(-) rename .devcontainer/{python-3.9 => python-3.10}/devcontainer.json (97%) rename .devcontainer/{python-3.9 => python-3.10}/docker-compose.yml (82%) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index b17b5c18d0..ffed487592 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -4,12 +4,12 @@ // by running pre-commit command `pre-commit run --all-files` // or by manually running the script `./scripts/devcontainer/generate_devcontainer.sh`. { - "name": "python-3.10", - // "image": "mcr.microsoft.com/devcontainers/python:3.10", + "name": "python-3.9", + // "image": "mcr.microsoft.com/devcontainers/python:3.9", "dockerComposeFile": [ "./docker-compose.yml" ], - "service": "python-3.10-ag2", + "service": "python-3.9-ag2", "secrets": { "OPENAI_API_KEY": { "description": "This key is optional and only needed if you are working on OpenAI-related code. Leave it blank if not required. You can always set it later as an environment variable in the codespace terminal." diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml index cda6011303..2d4b9c1931 100644 --- a/.devcontainer/docker-compose.yml +++ b/.devcontainer/docker-compose.yml @@ -7,9 +7,9 @@ version: '3' services: - python-3.10-ag2: # nosemgrep - image: mcr.microsoft.com/devcontainers/python:3.10 - container_name: ag2-${USER}-python-3.10 + python-3.9-ag2: # nosemgrep + image: mcr.microsoft.com/devcontainers/python:3.9 + container_name: ag2-${USER}-python-3.9 volumes: - ../:/workspaces/ag2:cached command: sleep infinity diff --git a/.devcontainer/python-3.9/devcontainer.json b/.devcontainer/python-3.10/devcontainer.json similarity index 97% rename from .devcontainer/python-3.9/devcontainer.json rename to .devcontainer/python-3.10/devcontainer.json index ffed487592..b17b5c18d0 100644 --- a/.devcontainer/python-3.9/devcontainer.json +++ b/.devcontainer/python-3.10/devcontainer.json @@ -4,12 +4,12 @@ // by running pre-commit command `pre-commit run --all-files` // or by manually running the script `./scripts/devcontainer/generate_devcontainer.sh`. { - "name": "python-3.9", - // "image": "mcr.microsoft.com/devcontainers/python:3.9", + "name": "python-3.10", + // "image": "mcr.microsoft.com/devcontainers/python:3.10", "dockerComposeFile": [ "./docker-compose.yml" ], - "service": "python-3.9-ag2", + "service": "python-3.10-ag2", "secrets": { "OPENAI_API_KEY": { "description": "This key is optional and only needed if you are working on OpenAI-related code. Leave it blank if not required. You can always set it later as an environment variable in the codespace terminal." diff --git a/.devcontainer/python-3.9/docker-compose.yml b/.devcontainer/python-3.10/docker-compose.yml similarity index 82% rename from .devcontainer/python-3.9/docker-compose.yml rename to .devcontainer/python-3.10/docker-compose.yml index ebb7cb5f3d..fc1f41b4ce 100644 --- a/.devcontainer/python-3.9/docker-compose.yml +++ b/.devcontainer/python-3.10/docker-compose.yml @@ -7,9 +7,9 @@ version: '3' services: - python-3.9-ag2: # nosemgrep - image: mcr.microsoft.com/devcontainers/python:3.9 - container_name: ag2-${USER}-python-3.9 + python-3.10-ag2: # nosemgrep + image: mcr.microsoft.com/devcontainers/python:3.10 + container_name: ag2-${USER}-python-3.10 volumes: - ../../:/workspaces/ag2:cached command: sleep infinity diff --git a/scripts/devcontainer/generate-devcontainers.py b/scripts/devcontainer/generate-devcontainers.py index a424a6bde8..5b296fbc71 100644 --- a/scripts/devcontainer/generate-devcontainers.py +++ b/scripts/devcontainer/generate-devcontainers.py @@ -11,7 +11,7 @@ # List of python versions to generate devcontainer files for PYTHON_VERSIONS = ["3.9", "3.10", "3.11", "3.12", "3.13"] -DEFAULT = "3.10" +DEFAULT = "3.9" DOCKER_COMPOSE_TEMPLATE = Path("scripts/devcontainer/templates/docker-compose.yml.jinja") DEVCONTAINER_JSON_TEMPLATE = Path("scripts/devcontainer/templates/devcontainer.json.jinja") @@ -65,6 +65,23 @@ def generate_devcontainer_json_file(python_version: str): def generate_devcontainer_files(): for python_version in PYTHON_VERSIONS: + # Delete existing devcontainer files + files_to_delete = [] + if python_version == DEFAULT: + files_to_delete = [Path("./.devcontainer/docker-compose.yml"), Path("./.devcontainer/devcontainer.json")] + + files_to_delete = files_to_delete + [ + Path(f"./.devcontainer/python-{python_version}/docker-compose.yml"), + Path(f"./.devcontainer/python-{python_version}/devcontainer.json"), + Path(f"./.devcontainer/python-{python_version}/"), + ] + for file in files_to_delete: + if file.exists(): + if file.is_file(): + file.unlink() + elif file.is_dir(): + file.rmdir() + generate_docker_compose_file(python_version) generate_devcontainer_json_file(python_version) From b9268d8a24271a36f19551951957a9b995458a43 Mon Sep 17 00:00:00 2001 From: Kumaran Rajendhiran Date: Thu, 9 Jan 2025 12:39:15 +0000 Subject: [PATCH 08/37] Add dev optional dependency and add docs support to devcontainer --- .devcontainer/setup.sh | 7 ++++++- pyproject.toml | 13 +++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/.devcontainer/setup.sh b/.devcontainer/setup.sh index 0b137d3858..59262f75df 100755 --- a/.devcontainer/setup.sh +++ b/.devcontainer/setup.sh @@ -1,8 +1,13 @@ # update pip pip install --upgrade pip +# install pre-release of quarto for docs +wget https://github.com/quarto-dev/quarto-cli/releases/download/v1.7.7/quarto-1.7.7-linux-amd64.deb -O quarto.deb && \ + sudo dpkg -i quarto.deb && \ + rm quarto.deb + # install dev packages -pip install -e ".[test,teachable,lmm,retrievechat,mathchat,blendsearch]" +pip install -e ".[dev]" # install pre-commit hook if not installed already pre-commit install diff --git a/pyproject.toml b/pyproject.toml index 560fe7cb85..35280252ce 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -187,6 +187,19 @@ test = [ "fastapi>=0.115.0,<1", ] +docs = [ + "pydoc-markdown", + "pyyaml", + "termcolor", + "nbclient", +] + +dev = [ + "pyautogen[test]", + "pyautogen[docs]", + "pyautogen[types]", +] + [project.urls] Homepage = "https://ag2.ai/" Documentation = "https://docs.ag2.ai/docs/Home" From b606b8590e5994642dff2e3c96db5f39d2b2862d Mon Sep 17 00:00:00 2001 From: Kumaran Rajendhiran Date: Thu, 9 Jan 2025 13:26:24 +0000 Subject: [PATCH 09/37] Remove old devcontainer files --- .devcontainer/dev/devcontainer.json | 3 --- .devcontainer/full/devcontainer.json | 3 --- 2 files changed, 6 deletions(-) delete mode 100644 .devcontainer/dev/devcontainer.json delete mode 100644 .devcontainer/full/devcontainer.json diff --git a/.devcontainer/dev/devcontainer.json b/.devcontainer/dev/devcontainer.json deleted file mode 100644 index 9ebff28d5c..0000000000 --- a/.devcontainer/dev/devcontainer.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "dockerFile": "Dockerfile" -} diff --git a/.devcontainer/full/devcontainer.json b/.devcontainer/full/devcontainer.json deleted file mode 100644 index 9ebff28d5c..0000000000 --- a/.devcontainer/full/devcontainer.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "dockerFile": "Dockerfile" -} From efb4029876f242cb48e1c6a78e2880ca61640d95 Mon Sep 17 00:00:00 2001 From: Kumaran Rajendhiran Date: Thu, 9 Jan 2025 13:27:16 +0000 Subject: [PATCH 10/37] Update docs on using devcontainer --- .devcontainer/README.md | 87 +++---------------- website/README.md | 18 ++-- website/docs/contributor-guide/docker.mdx | 53 +++-------- .../docs/contributor-guide/documentation.mdx | 18 ++-- 4 files changed, 38 insertions(+), 138 deletions(-) diff --git a/.devcontainer/README.md b/.devcontainer/README.md index ae4535a388..d11060089f 100644 --- a/.devcontainer/README.md +++ b/.devcontainer/README.md @@ -1,87 +1,28 @@ -# Dockerfiles and Devcontainer Configurations for AutoGen +# Devcontainer Configurations for AutoGen -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. +Welcome to the `.devcontainer` directory! Here you'll find Dockerfiles and devcontainer configurations that are essential for setting up your AutoGen development environment. Below is a brief overview and how you can utilize them effectively. These configurations can be used with Codespaces and locally. -## Dockerfile Descriptions +## Developing AutoGen with Devcontainers -### base +### Prerequisites -- **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. -- **Usage**: Ideal for those just starting with AutoGen or for general-purpose applications. -- **Building the Image**: Run `docker build -f ./Dockerfile -t ag2_base_img .` in this directory. -- **Using with Codespaces**: `Code > Codespaces > Click on +` By default + creates a Codespace on the current branch. +- [Docker](https://docs.docker.com/get-docker/) +- [Visual Studio Code](https://code.visualstudio.com/) +- [Visual Studio Code Remote - Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) -### full +### Getting Started -- **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. -- **Usage**: Suited for advanced users who need the full range of AutoGen's capabilities. -- **Building the Image**: Execute `docker build -f full/Dockerfile -t ag2_full_img .`. -- **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. +1. Open the project in Visual Studio Code. +2. Press `Ctrl+Shift+P` and select `Dev Containers: Reopen in Container`. +3. Select the desired python environment and wait for the container to build. +4. Once the container is built, you can start developing AutoGen. -### dev - -- **Purpose**: Tailored for AutoGen project developers, this Dockerfile, i.e., `./dev/Dockerfile` includes tools and configurations aiding in development and contribution. -- **Usage**: Recommended for developers who are contributing to the AutoGen project. -- **Building the Image**: Run `docker build -f dev/Dockerfile -t ag2_dev_img .`. -- **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. -- **Before using**: We highly encourage all potential contributors to read the [AutoGen Contributing](https://docs.ag2.ai/docs/contributor-guide/contributing) page prior to submitting any pull requests. - - -## Customizing Dockerfiles - -Feel free to modify these Dockerfiles for your specific project needs. Here are some common customizations: - -- **Adding New Dependencies**: If your project requires additional Python packages, you can add them using the `RUN pip install` command. -- **Changing the Base Image**: You may change the base image (e.g., from a Python image to an Ubuntu image) to suit your project's requirements. -- **Changing the Python version**: do you need a different version of python other than 3.11. Just update the first line of each of the Dockerfiles like so: - `FROM python:3.11-slim-bookworm` to `FROM python:3.10-slim-bookworm` -- **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. - `# ENV OPENAI_API_KEY="{OpenAI-API-Key}"` to `ENV OPENAI_API_KEY="{OpenAI-API-Key}"` -- **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. -`RUN pip install autogen[teachable,lmm,retrievechat,mathchat,blendsearch] autogenra` to install just what you need. `RUN pip install autogen[retrievechat,blendsearch] autogenra` -- **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. - - ```code - RUN apt-get update \ - && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ - software-properties-common sudo net-tools vim\ - && apt-get clean \ - && rm -rf /var/lib/apt/lists/* - ``` - -### Managing Your Docker Environment - -After customizing your Dockerfile, build the Docker image using the `docker build` command as shown above. To run a container based on your new image, use: - -```bash -docker run -it -v $(pwd)/your_app:/app your_image_name -``` - -Replace `your_app` with your application directory and `your_image_name` with the name of the image you built. - -#### Closing for the Day - -- **Exit the container**: Type `exit`. -- **Stop the container**: Use `docker stop {application_project_name}`. - -#### Resuming Work - -- **Restart the container**: Use `docker start {application_project_name}`. -- **Access the container**: Execute `sudo docker exec -it {application_project_name} bash`. -- **Reactivate the environment**: Run `source /usr/src/app/autogen_env/bin/activate`. - -### Useful Docker Commands - -- **View running containers**: `docker ps -a`. -- **View Docker images**: `docker images`. -- **Restart container setup**: Stop (`docker stop my_container`), remove the container (`docker rm my_container`), and remove the image (`docker rmi my_image:latest`). - -#### Troubleshooting Common Issues +### Troubleshooting Common Issues - Check Docker daemon, port conflicts, and permissions issues. -#### Additional Resources +### Additional Resources For more information on Docker usage and best practices, refer to the [official Docker documentation](https://docs.docker.com). diff --git a/website/README.md b/website/README.md index 7bdd03be4e..b38480cd6b 100644 --- a/website/README.md +++ b/website/README.md @@ -31,24 +31,16 @@ pip install pydoc-markdown pyyaml termcolor nbclient The last command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server. -## Build with Docker +## Build with devcontainer -To build and test documentation within a docker container, run the following commands from your project root directory: +To build and test documentation using devcontainer, open the project using [VSCode](https://code.visualstudio.com/), press `Ctrl+Shift+P` and select `Dev Containers: Reopen in Container`. -```bash -docker build -f .devcontainer/dev/Dockerfile -t ag2ai_dev_img https://github.com/ag2ai/ag2.git#main -``` - -Then start the container like so, this will log you in and ensure that Docker port 3000 is mapped to port 8081 on your local machine: - -```bash -docker run -it -p 8081:3000 -v $(pwd):/home/autogen/ag2 ag2ai_dev_img bash -``` +This will open the project in a devcontainer with all the required dependencies installed. -Once at the CLI in Docker run the following commands: +Open a terminal and run the following command to build and serve the documentation: ```console ./scripts/docs_serve.sh ``` -Once done you should be able to access the documentation at `http://127.0.0.1:8081` +Once done you should be able to access the documentation at `http://localhost:3000/`. diff --git a/website/docs/contributor-guide/docker.mdx b/website/docs/contributor-guide/docker.mdx index 2e0d1b1256..712ee89f85 100644 --- a/website/docs/contributor-guide/docker.mdx +++ b/website/docs/contributor-guide/docker.mdx @@ -2,52 +2,27 @@ title: Docker for Development --- -For developers contributing to the AG2 project, we offer a specialized Docker environment. This setup is designed to streamline the development process, ensuring that all contributors work within a consistent and well-equipped environment. +For developers contributing to the AG2 project, we offer a specialized devcontainer environment. This setup is designed to streamline the development process, ensuring that all contributors work within a consistent and well-equipped environment. -## AG2 Developer Image (ag2_dev_img) +## AG2 Devcontainer -- **Purpose**: The `ag2_dev_img` is tailored for contributors to the AG2 project. It includes a suite of tools and configurations that aid in the development and testing of new features or fixes. +- **Purpose**: The devcontainer is tailored for contributors to the AG2 project. It includes a suite of tools and configurations that aid in the development and testing of new features or fixes. - **Usage**: This image is recommended for developers who intend to contribute code or documentation to AG2. - **Forking the Project**: It's advisable to fork the AG2 GitHub project to your own repository. This allows you to make changes in a separate environment without affecting the main project. -- **Updating Dockerfile**: Modify your copy of `Dockerfile` in the `dev` folder as needed for your development work. - **Submitting Pull Requests**: Once your changes are ready, submit a pull request from your branch to the upstream AG2 GitHub project for review and integration. For more details on contributing, see the [AG2 Contributing](/docs/contributor-guide/contributing) page. -## Building the Developer Docker Image +## Developing AutoGen with Devcontainers -- To build the developer Docker image (`ag2_dev_img`), use the following commands: +1. Open the project in Visual Studio Code. +2. Press `Ctrl+Shift+P` and select `Dev Containers: Reopen in Container`. +3. Select the desired python environment and wait for the container to build. +4. Once the container is built, you can start developing AutoGen. - ```bash - docker build -f .devcontainer/dev/Dockerfile -t ag2_dev_img https://github.com/ag2ai/ag2.git#main - ``` +## Developing Autogen with Codespaces -- For building the developer image built from a specific Dockerfile in a branch other than main/master +Provided devcontainer files can be used with GitHub Codespaces. To use the devcontainer with GitHub Codespaces, follow the steps below: - ```bash - # clone the branch you want to work out of - git clone --branch {branch-name} https://github.com/ag2ai/ag2.git - - # cd to your new directory - cd ag2 - - # build your Docker image - docker build -f .devcontainer/dev/Dockerfile -t autogen_dev-srv_img . - ``` - -## Using the Developer Docker Image - -Once you have built the `ag2_dev_img`, you can run it using the standard Docker commands. This will place you inside the containerized development environment where you can run tests, develop code, and ensure everything is functioning as expected before submitting your contributions. - -```bash -docker run -it -p 8081:3000 -v `pwd`/autogen-newcode:newstuff/ ag2_dev_img bash -``` - -- Note that the `pwd` is shorthand for present working directory. Thus, any path after the pwd is relative to that. If you want a more verbose method you could remove the "`pwd`/autogen-newcode" and replace it with the full path to your directory - -```bash -docker run -it -p 8081:3000 -v /home/AutoGenDeveloper/autogen-newcode:newstuff/ ag2_dev_img bash -``` - -## Develop in Remote Container - -If you use vscode, you can open the ag2 folder in a [Container](https://code.visualstudio.com/docs/devcontainers/containers). -We have provided the configuration in [devcontainer](https://github.com/ag2ai/ag2/blob/main/.devcontainer). They can be used in GitHub codespace too. Developing AG2 in dev containers is recommended. +1. Open the AG2 repository in GitHub. +2. Click on the `Code` button and select `Open with Codespaces`. +3. Select the desired python environment and wait for the container to build. +4. Once the container is built, you can start developing AutoGen. diff --git a/website/docs/contributor-guide/documentation.mdx b/website/docs/contributor-guide/documentation.mdx index 9c0bf36c46..2a71cbdb90 100644 --- a/website/docs/contributor-guide/documentation.mdx +++ b/website/docs/contributor-guide/documentation.mdx @@ -35,21 +35,13 @@ npm run mintlify:dev The last command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server. -## Build with Docker +## Build with devcontainer -To build and test documentation within a docker container, run the following commands from your project root directory: +To build and test documentation using devcontainer, open the project using [VSCode](https://code.visualstudio.com/), press `Ctrl+Shift+P` and select `Dev Containers: Reopen in Container`. -```bash -docker build -f .devcontainer/dev/Dockerfile -t ag2ai_dev_img https://github.com/ag2ai/ag2.git#main -``` - -Then start the container like so, this will log you in and ensure that Docker port 3000 is mapped to port 8081 on your local machine: - -```bash -docker run -it -p 8081:3000 -v $(pwd):/home/autogen/ag2 ag2ai_dev_img bash -``` +This will open the project in a devcontainer with all the required dependencies installed. -Once at the CLI in Docker run the following commands: +Open a terminal and run the following command to build and serve the documentation: ```console cd website @@ -59,4 +51,4 @@ npm install npm run mintlify:dev ``` -Once done you should be able to access the documentation at `http://127.0.0.1:8081` +Once done you should be able to access the documentation at `http://localhost:3000/`. From ba3adffbeb72c7722d82a31a83be6dc9bc2a8b58 Mon Sep 17 00:00:00 2001 From: Kumaran Rajendhiran Date: Thu, 9 Jan 2025 14:30:36 +0000 Subject: [PATCH 11/37] Remove commented lines --- .devcontainer/devcontainer.json | 7 ------- .devcontainer/python-3.10/devcontainer.json | 7 ------- .devcontainer/python-3.11/devcontainer.json | 7 ------- .devcontainer/python-3.12/devcontainer.json | 7 ------- .devcontainer/python-3.13/devcontainer.json | 7 ------- scripts/devcontainer/templates/devcontainer.json.jinja | 7 ------- 6 files changed, 42 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index ffed487592..273d3f789c 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -44,16 +44,9 @@ "userGid": "1000" // "upgradePackages": "true" }, - // "ghcr.io/devcontainers/features/python:1": {}, "ghcr.io/devcontainers/features/node:1": {}, - // The below configuration with "version" set to "latest" fails in codespace - // "ghcr.io/devcontainers/features/git:1": { - // "version": "latest", - // "ppa": true - // }, "ghcr.io/devcontainers/features/git:1": {}, "ghcr.io/devcontainers/features/git-lfs:1": {}, - "ghcr.io/robbert229/devcontainer-features/postgresql-client:1": {} }, "updateContentCommand": "bash .devcontainer/setup.sh", "customizations": { diff --git a/.devcontainer/python-3.10/devcontainer.json b/.devcontainer/python-3.10/devcontainer.json index b17b5c18d0..539713d459 100644 --- a/.devcontainer/python-3.10/devcontainer.json +++ b/.devcontainer/python-3.10/devcontainer.json @@ -44,16 +44,9 @@ "userGid": "1000" // "upgradePackages": "true" }, - // "ghcr.io/devcontainers/features/python:1": {}, "ghcr.io/devcontainers/features/node:1": {}, - // The below configuration with "version" set to "latest" fails in codespace - // "ghcr.io/devcontainers/features/git:1": { - // "version": "latest", - // "ppa": true - // }, "ghcr.io/devcontainers/features/git:1": {}, "ghcr.io/devcontainers/features/git-lfs:1": {}, - "ghcr.io/robbert229/devcontainer-features/postgresql-client:1": {} }, "updateContentCommand": "bash .devcontainer/setup.sh", "customizations": { diff --git a/.devcontainer/python-3.11/devcontainer.json b/.devcontainer/python-3.11/devcontainer.json index fe0aeddf79..576ef189d5 100644 --- a/.devcontainer/python-3.11/devcontainer.json +++ b/.devcontainer/python-3.11/devcontainer.json @@ -44,16 +44,9 @@ "userGid": "1000" // "upgradePackages": "true" }, - // "ghcr.io/devcontainers/features/python:1": {}, "ghcr.io/devcontainers/features/node:1": {}, - // The below configuration with "version" set to "latest" fails in codespace - // "ghcr.io/devcontainers/features/git:1": { - // "version": "latest", - // "ppa": true - // }, "ghcr.io/devcontainers/features/git:1": {}, "ghcr.io/devcontainers/features/git-lfs:1": {}, - "ghcr.io/robbert229/devcontainer-features/postgresql-client:1": {} }, "updateContentCommand": "bash .devcontainer/setup.sh", "customizations": { diff --git a/.devcontainer/python-3.12/devcontainer.json b/.devcontainer/python-3.12/devcontainer.json index 19cee98380..f85f36c4ac 100644 --- a/.devcontainer/python-3.12/devcontainer.json +++ b/.devcontainer/python-3.12/devcontainer.json @@ -44,16 +44,9 @@ "userGid": "1000" // "upgradePackages": "true" }, - // "ghcr.io/devcontainers/features/python:1": {}, "ghcr.io/devcontainers/features/node:1": {}, - // The below configuration with "version" set to "latest" fails in codespace - // "ghcr.io/devcontainers/features/git:1": { - // "version": "latest", - // "ppa": true - // }, "ghcr.io/devcontainers/features/git:1": {}, "ghcr.io/devcontainers/features/git-lfs:1": {}, - "ghcr.io/robbert229/devcontainer-features/postgresql-client:1": {} }, "updateContentCommand": "bash .devcontainer/setup.sh", "customizations": { diff --git a/.devcontainer/python-3.13/devcontainer.json b/.devcontainer/python-3.13/devcontainer.json index 9031740288..675c7e0e53 100644 --- a/.devcontainer/python-3.13/devcontainer.json +++ b/.devcontainer/python-3.13/devcontainer.json @@ -44,16 +44,9 @@ "userGid": "1000" // "upgradePackages": "true" }, - // "ghcr.io/devcontainers/features/python:1": {}, "ghcr.io/devcontainers/features/node:1": {}, - // The below configuration with "version" set to "latest" fails in codespace - // "ghcr.io/devcontainers/features/git:1": { - // "version": "latest", - // "ppa": true - // }, "ghcr.io/devcontainers/features/git:1": {}, "ghcr.io/devcontainers/features/git-lfs:1": {}, - "ghcr.io/robbert229/devcontainer-features/postgresql-client:1": {} }, "updateContentCommand": "bash .devcontainer/setup.sh", "customizations": { diff --git a/scripts/devcontainer/templates/devcontainer.json.jinja b/scripts/devcontainer/templates/devcontainer.json.jinja index fb296b2812..8ab3e48a10 100644 --- a/scripts/devcontainer/templates/devcontainer.json.jinja +++ b/scripts/devcontainer/templates/devcontainer.json.jinja @@ -44,16 +44,9 @@ "userGid": "1000" // "upgradePackages": "true" }, - // "ghcr.io/devcontainers/features/python:1": {}, "ghcr.io/devcontainers/features/node:1": {}, - // The below configuration with "version" set to "latest" fails in codespace - // "ghcr.io/devcontainers/features/git:1": { - // "version": "latest", - // "ppa": true - // }, "ghcr.io/devcontainers/features/git:1": {}, "ghcr.io/devcontainers/features/git-lfs:1": {}, - "ghcr.io/robbert229/devcontainer-features/postgresql-client:1": {} }, "updateContentCommand": "bash .devcontainer/setup.sh", "customizations": { From 2d3243cb771ca5b867be31084fa88b6e4b204968 Mon Sep 17 00:00:00 2001 From: Kumaran Rajendhiran Date: Thu, 9 Jan 2025 15:12:07 +0000 Subject: [PATCH 12/37] Use devcontainer.json alone and remove docker-compose.yml --- .devcontainer/devcontainer.json | 15 +++++---- .devcontainer/docker-compose.yml | 23 ------------- .devcontainer/python-3.10/devcontainer.json | 15 +++++---- .devcontainer/python-3.10/docker-compose.yml | 23 ------------- .devcontainer/python-3.11/devcontainer.json | 15 +++++---- .devcontainer/python-3.11/docker-compose.yml | 23 ------------- .devcontainer/python-3.12/devcontainer.json | 15 +++++---- .devcontainer/python-3.12/docker-compose.yml | 23 ------------- .devcontainer/python-3.13/devcontainer.json | 15 +++++---- .devcontainer/python-3.13/docker-compose.yml | 23 ------------- .../devcontainer/generate-devcontainers.py | 33 ++----------------- .../templates/devcontainer.json.jinja | 15 +++++---- 12 files changed, 51 insertions(+), 187 deletions(-) delete mode 100644 .devcontainer/docker-compose.yml delete mode 100644 .devcontainer/python-3.10/docker-compose.yml delete mode 100644 .devcontainer/python-3.11/docker-compose.yml delete mode 100644 .devcontainer/python-3.12/docker-compose.yml delete mode 100644 .devcontainer/python-3.13/docker-compose.yml diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 273d3f789c..5e55c00256 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -5,11 +5,7 @@ // or by manually running the script `./scripts/devcontainer/generate_devcontainer.sh`. { "name": "python-3.9", - // "image": "mcr.microsoft.com/devcontainers/python:3.9", - "dockerComposeFile": [ - "./docker-compose.yml" - ], - "service": "python-3.9-ag2", + "image": "mcr.microsoft.com/devcontainers/python:3.9", "secrets": { "OPENAI_API_KEY": { "description": "This key is optional and only needed if you are working on OpenAI-related code. Leave it blank if not required. You can always set it later as an environment variable in the codespace terminal." @@ -30,9 +26,14 @@ "description": "This key is required to specify the version of the Azure API you are using. Set this along with AZURE_OPENAI_API_KEY, AZURE_API_ENDPOINT for Azure OpenAI services. These variables can be configured later as environment variables in the codespace terminal." }, }, - "shutdownAction": "stopCompose", + "shutdownAction": "stopContainer", "workspaceFolder": "/workspaces/ag2", - // "runArgs": [], + "runArgs": [ + "--name", + "python-3.9-ag2", + "--env-file", + "${localWorkspaceFolder}/.devcontainer/devcontainer.env" + ], "remoteEnv": {}, "features": { "ghcr.io/devcontainers/features/common-utils:2": { diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml deleted file mode 100644 index 2d4b9c1931..0000000000 --- a/.devcontainer/docker-compose.yml +++ /dev/null @@ -1,23 +0,0 @@ -# Do not edit this file directly. -# This file is auto generated from the template file `scripts/devcontainer_templates/docker-compose.yml.jinja`. -# If you need to make changes, please update the template file and regenerate this file -# by running pre-commit command `pre-commit run --all-files` -# or by manually running the script `./scripts/devcontainer/generate_devcontainer.sh`. - -version: '3' - -services: - python-3.9-ag2: # nosemgrep - image: mcr.microsoft.com/devcontainers/python:3.9 - container_name: ag2-${USER}-python-3.9 - volumes: - - ../:/workspaces/ag2:cached - command: sleep infinity - env_file: - - ./devcontainer.env - networks: - - ag2-network - -networks: - ag2-network: - name: ag2-${USER}-network diff --git a/.devcontainer/python-3.10/devcontainer.json b/.devcontainer/python-3.10/devcontainer.json index 539713d459..e57bb767cc 100644 --- a/.devcontainer/python-3.10/devcontainer.json +++ b/.devcontainer/python-3.10/devcontainer.json @@ -5,11 +5,7 @@ // or by manually running the script `./scripts/devcontainer/generate_devcontainer.sh`. { "name": "python-3.10", - // "image": "mcr.microsoft.com/devcontainers/python:3.10", - "dockerComposeFile": [ - "./docker-compose.yml" - ], - "service": "python-3.10-ag2", + "image": "mcr.microsoft.com/devcontainers/python:3.10", "secrets": { "OPENAI_API_KEY": { "description": "This key is optional and only needed if you are working on OpenAI-related code. Leave it blank if not required. You can always set it later as an environment variable in the codespace terminal." @@ -30,9 +26,14 @@ "description": "This key is required to specify the version of the Azure API you are using. Set this along with AZURE_OPENAI_API_KEY, AZURE_API_ENDPOINT for Azure OpenAI services. These variables can be configured later as environment variables in the codespace terminal." }, }, - "shutdownAction": "stopCompose", + "shutdownAction": "stopContainer", "workspaceFolder": "/workspaces/ag2", - // "runArgs": [], + "runArgs": [ + "--name", + "python-3.9-ag2", + "--env-file", + "${localWorkspaceFolder}/.devcontainer/devcontainer.env" + ], "remoteEnv": {}, "features": { "ghcr.io/devcontainers/features/common-utils:2": { diff --git a/.devcontainer/python-3.10/docker-compose.yml b/.devcontainer/python-3.10/docker-compose.yml deleted file mode 100644 index fc1f41b4ce..0000000000 --- a/.devcontainer/python-3.10/docker-compose.yml +++ /dev/null @@ -1,23 +0,0 @@ -# Do not edit this file directly. -# This file is auto generated from the template file `scripts/devcontainer_templates/docker-compose.yml.jinja`. -# If you need to make changes, please update the template file and regenerate this file -# by running pre-commit command `pre-commit run --all-files` -# or by manually running the script `./scripts/devcontainer/generate_devcontainer.sh`. - -version: '3' - -services: - python-3.10-ag2: # nosemgrep - image: mcr.microsoft.com/devcontainers/python:3.10 - container_name: ag2-${USER}-python-3.10 - volumes: - - ../../:/workspaces/ag2:cached - command: sleep infinity - env_file: - - ../../devcontainer.env - networks: - - ag2-network - -networks: - ag2-network: - name: ag2-${USER}-network diff --git a/.devcontainer/python-3.11/devcontainer.json b/.devcontainer/python-3.11/devcontainer.json index 576ef189d5..fd69fc9f61 100644 --- a/.devcontainer/python-3.11/devcontainer.json +++ b/.devcontainer/python-3.11/devcontainer.json @@ -5,11 +5,7 @@ // or by manually running the script `./scripts/devcontainer/generate_devcontainer.sh`. { "name": "python-3.11", - // "image": "mcr.microsoft.com/devcontainers/python:3.11", - "dockerComposeFile": [ - "./docker-compose.yml" - ], - "service": "python-3.11-ag2", + "image": "mcr.microsoft.com/devcontainers/python:3.11", "secrets": { "OPENAI_API_KEY": { "description": "This key is optional and only needed if you are working on OpenAI-related code. Leave it blank if not required. You can always set it later as an environment variable in the codespace terminal." @@ -30,9 +26,14 @@ "description": "This key is required to specify the version of the Azure API you are using. Set this along with AZURE_OPENAI_API_KEY, AZURE_API_ENDPOINT for Azure OpenAI services. These variables can be configured later as environment variables in the codespace terminal." }, }, - "shutdownAction": "stopCompose", + "shutdownAction": "stopContainer", "workspaceFolder": "/workspaces/ag2", - // "runArgs": [], + "runArgs": [ + "--name", + "python-3.9-ag2", + "--env-file", + "${localWorkspaceFolder}/.devcontainer/devcontainer.env" + ], "remoteEnv": {}, "features": { "ghcr.io/devcontainers/features/common-utils:2": { diff --git a/.devcontainer/python-3.11/docker-compose.yml b/.devcontainer/python-3.11/docker-compose.yml deleted file mode 100644 index 2476d280e2..0000000000 --- a/.devcontainer/python-3.11/docker-compose.yml +++ /dev/null @@ -1,23 +0,0 @@ -# Do not edit this file directly. -# This file is auto generated from the template file `scripts/devcontainer_templates/docker-compose.yml.jinja`. -# If you need to make changes, please update the template file and regenerate this file -# by running pre-commit command `pre-commit run --all-files` -# or by manually running the script `./scripts/devcontainer/generate_devcontainer.sh`. - -version: '3' - -services: - python-3.11-ag2: # nosemgrep - image: mcr.microsoft.com/devcontainers/python:3.11 - container_name: ag2-${USER}-python-3.11 - volumes: - - ../../:/workspaces/ag2:cached - command: sleep infinity - env_file: - - ../../devcontainer.env - networks: - - ag2-network - -networks: - ag2-network: - name: ag2-${USER}-network diff --git a/.devcontainer/python-3.12/devcontainer.json b/.devcontainer/python-3.12/devcontainer.json index f85f36c4ac..e47ea73e08 100644 --- a/.devcontainer/python-3.12/devcontainer.json +++ b/.devcontainer/python-3.12/devcontainer.json @@ -5,11 +5,7 @@ // or by manually running the script `./scripts/devcontainer/generate_devcontainer.sh`. { "name": "python-3.12", - // "image": "mcr.microsoft.com/devcontainers/python:3.12", - "dockerComposeFile": [ - "./docker-compose.yml" - ], - "service": "python-3.12-ag2", + "image": "mcr.microsoft.com/devcontainers/python:3.12", "secrets": { "OPENAI_API_KEY": { "description": "This key is optional and only needed if you are working on OpenAI-related code. Leave it blank if not required. You can always set it later as an environment variable in the codespace terminal." @@ -30,9 +26,14 @@ "description": "This key is required to specify the version of the Azure API you are using. Set this along with AZURE_OPENAI_API_KEY, AZURE_API_ENDPOINT for Azure OpenAI services. These variables can be configured later as environment variables in the codespace terminal." }, }, - "shutdownAction": "stopCompose", + "shutdownAction": "stopContainer", "workspaceFolder": "/workspaces/ag2", - // "runArgs": [], + "runArgs": [ + "--name", + "python-3.9-ag2", + "--env-file", + "${localWorkspaceFolder}/.devcontainer/devcontainer.env" + ], "remoteEnv": {}, "features": { "ghcr.io/devcontainers/features/common-utils:2": { diff --git a/.devcontainer/python-3.12/docker-compose.yml b/.devcontainer/python-3.12/docker-compose.yml deleted file mode 100644 index fe4e70bacb..0000000000 --- a/.devcontainer/python-3.12/docker-compose.yml +++ /dev/null @@ -1,23 +0,0 @@ -# Do not edit this file directly. -# This file is auto generated from the template file `scripts/devcontainer_templates/docker-compose.yml.jinja`. -# If you need to make changes, please update the template file and regenerate this file -# by running pre-commit command `pre-commit run --all-files` -# or by manually running the script `./scripts/devcontainer/generate_devcontainer.sh`. - -version: '3' - -services: - python-3.12-ag2: # nosemgrep - image: mcr.microsoft.com/devcontainers/python:3.12 - container_name: ag2-${USER}-python-3.12 - volumes: - - ../../:/workspaces/ag2:cached - command: sleep infinity - env_file: - - ../../devcontainer.env - networks: - - ag2-network - -networks: - ag2-network: - name: ag2-${USER}-network diff --git a/.devcontainer/python-3.13/devcontainer.json b/.devcontainer/python-3.13/devcontainer.json index 675c7e0e53..14ee1b37a7 100644 --- a/.devcontainer/python-3.13/devcontainer.json +++ b/.devcontainer/python-3.13/devcontainer.json @@ -5,11 +5,7 @@ // or by manually running the script `./scripts/devcontainer/generate_devcontainer.sh`. { "name": "python-3.13", - // "image": "mcr.microsoft.com/devcontainers/python:3.13", - "dockerComposeFile": [ - "./docker-compose.yml" - ], - "service": "python-3.13-ag2", + "image": "mcr.microsoft.com/devcontainers/python:3.13", "secrets": { "OPENAI_API_KEY": { "description": "This key is optional and only needed if you are working on OpenAI-related code. Leave it blank if not required. You can always set it later as an environment variable in the codespace terminal." @@ -30,9 +26,14 @@ "description": "This key is required to specify the version of the Azure API you are using. Set this along with AZURE_OPENAI_API_KEY, AZURE_API_ENDPOINT for Azure OpenAI services. These variables can be configured later as environment variables in the codespace terminal." }, }, - "shutdownAction": "stopCompose", + "shutdownAction": "stopContainer", "workspaceFolder": "/workspaces/ag2", - // "runArgs": [], + "runArgs": [ + "--name", + "python-3.9-ag2", + "--env-file", + "${localWorkspaceFolder}/.devcontainer/devcontainer.env" + ], "remoteEnv": {}, "features": { "ghcr.io/devcontainers/features/common-utils:2": { diff --git a/.devcontainer/python-3.13/docker-compose.yml b/.devcontainer/python-3.13/docker-compose.yml deleted file mode 100644 index fce5a1f454..0000000000 --- a/.devcontainer/python-3.13/docker-compose.yml +++ /dev/null @@ -1,23 +0,0 @@ -# Do not edit this file directly. -# This file is auto generated from the template file `scripts/devcontainer_templates/docker-compose.yml.jinja`. -# If you need to make changes, please update the template file and regenerate this file -# by running pre-commit command `pre-commit run --all-files` -# or by manually running the script `./scripts/devcontainer/generate_devcontainer.sh`. - -version: '3' - -services: - python-3.13-ag2: # nosemgrep - image: mcr.microsoft.com/devcontainers/python:3.13 - container_name: ag2-${USER}-python-3.13 - volumes: - - ../../:/workspaces/ag2:cached - command: sleep infinity - env_file: - - ../../devcontainer.env - networks: - - ag2-network - -networks: - ag2-network: - name: ag2-${USER}-network diff --git a/scripts/devcontainer/generate-devcontainers.py b/scripts/devcontainer/generate-devcontainers.py index 5b296fbc71..2bc5ba5bd4 100644 --- a/scripts/devcontainer/generate-devcontainers.py +++ b/scripts/devcontainer/generate-devcontainers.py @@ -13,35 +13,10 @@ PYTHON_VERSIONS = ["3.9", "3.10", "3.11", "3.12", "3.13"] DEFAULT = "3.9" -DOCKER_COMPOSE_TEMPLATE = Path("scripts/devcontainer/templates/docker-compose.yml.jinja") DEVCONTAINER_JSON_TEMPLATE = Path("scripts/devcontainer/templates/devcontainer.json.jinja") -def generate_docker_compose_file(python_version: str): - print(f"Generating docker-compose.yml for python {python_version}") - - with open(DOCKER_COMPOSE_TEMPLATE, "r") as f: - content = f.read() - - # Replace python_version with the current version using jinja template - template = Template(content) - data = { - "python_version": python_version, - "mount_volume": "../" if python_version == DEFAULT else "../../", - "env_file": "./devcontainer.env" if python_version == DEFAULT else "../../devcontainer.env", - } - docker_compose_content = template.render(data) - - file_dir = ( - Path("./.devcontainer/") if python_version == DEFAULT else Path(f"./.devcontainer/python-{python_version}/") - ) - file_dir.mkdir(parents=True, exist_ok=True) - - with open(file_dir / "docker-compose.yml", "w") as f: - f.write(docker_compose_content + "\n") - - -def generate_devcontainer_json_file(python_version: str): +def generate_devcontainer_json_file(python_version: str) -> None: print(f"Generating devcontainer.json for python {python_version}") with open(DEVCONTAINER_JSON_TEMPLATE, "r") as f: @@ -63,15 +38,14 @@ def generate_devcontainer_json_file(python_version: str): f.write(devcontainer_content + "\n") -def generate_devcontainer_files(): +def generate_devcontainer_files() -> None: for python_version in PYTHON_VERSIONS: # Delete existing devcontainer files files_to_delete = [] if python_version == DEFAULT: - files_to_delete = [Path("./.devcontainer/docker-compose.yml"), Path("./.devcontainer/devcontainer.json")] + files_to_delete = [Path("./.devcontainer/devcontainer.json")] files_to_delete = files_to_delete + [ - Path(f"./.devcontainer/python-{python_version}/docker-compose.yml"), Path(f"./.devcontainer/python-{python_version}/devcontainer.json"), Path(f"./.devcontainer/python-{python_version}/"), ] @@ -82,7 +56,6 @@ def generate_devcontainer_files(): elif file.is_dir(): file.rmdir() - generate_docker_compose_file(python_version) generate_devcontainer_json_file(python_version) diff --git a/scripts/devcontainer/templates/devcontainer.json.jinja b/scripts/devcontainer/templates/devcontainer.json.jinja index 8ab3e48a10..51d74d41e6 100644 --- a/scripts/devcontainer/templates/devcontainer.json.jinja +++ b/scripts/devcontainer/templates/devcontainer.json.jinja @@ -5,11 +5,7 @@ // or by manually running the script `./scripts/devcontainer/generate_devcontainer.sh`. { "name": "python-{{ python_version }}", - // "image": "mcr.microsoft.com/devcontainers/python:{{ python_version }}", - "dockerComposeFile": [ - "./docker-compose.yml" - ], - "service": "python-{{ python_version }}-ag2", + "image": "mcr.microsoft.com/devcontainers/python:{{ python_version }}", "secrets": { "OPENAI_API_KEY": { "description": "This key is optional and only needed if you are working on OpenAI-related code. Leave it blank if not required. You can always set it later as an environment variable in the codespace terminal." @@ -30,9 +26,14 @@ "description": "This key is required to specify the version of the Azure API you are using. Set this along with AZURE_OPENAI_API_KEY, AZURE_API_ENDPOINT for Azure OpenAI services. These variables can be configured later as environment variables in the codespace terminal." }, }, - "shutdownAction": "stopCompose", + "shutdownAction": "stopContainer", "workspaceFolder": "/workspaces/ag2", - // "runArgs": [], + "runArgs": [ + "--name", + "python-3.9-ag2", + "--env-file", + "${localWorkspaceFolder}/.devcontainer/devcontainer.env" + ], "remoteEnv": {}, "features": { "ghcr.io/devcontainers/features/common-utils:2": { From 8230bb6833b4ae789698c4321aa84efc09b503f5 Mon Sep 17 00:00:00 2001 From: Kumaran Rajendhiran Date: Thu, 9 Jan 2025 15:20:54 +0000 Subject: [PATCH 13/37] Remove leftover template file --- .../templates/docker-compose.yml.jinja | 23 ------------------- 1 file changed, 23 deletions(-) delete mode 100644 scripts/devcontainer/templates/docker-compose.yml.jinja diff --git a/scripts/devcontainer/templates/docker-compose.yml.jinja b/scripts/devcontainer/templates/docker-compose.yml.jinja deleted file mode 100644 index c174187da0..0000000000 --- a/scripts/devcontainer/templates/docker-compose.yml.jinja +++ /dev/null @@ -1,23 +0,0 @@ -# Do not edit this file directly. -# This file is auto generated from the template file `scripts/devcontainer_templates/docker-compose.yml.jinja`. -# If you need to make changes, please update the template file and regenerate this file -# by running pre-commit command `pre-commit run --all-files` -# or by manually running the script `./scripts/devcontainer/generate_devcontainer.sh`. - -version: '3' - -services: - python-{{ python_version }}-ag2: # nosemgrep - image: mcr.microsoft.com/devcontainers/python:{{ python_version }} - container_name: ag2-${USER}-python-{{ python_version }} - volumes: - - {{ mount_volume }}:/workspaces/ag2:cached - command: sleep infinity - env_file: - - {{ env_file }} - networks: - - ag2-network - -networks: - ag2-network: - name: ag2-${USER}-network From 99124a8a5d8b79fe54a7927bf1aabbb60b934e91 Mon Sep 17 00:00:00 2001 From: Kumaran Rajendhiran Date: Fri, 10 Jan 2025 00:52:35 +0000 Subject: [PATCH 14/37] Add OAI_CONFIG_LIST to devcontainer secrets --- .devcontainer/devcontainer.env | 1 + .devcontainer/devcontainer.json | 3 +++ .devcontainer/python-3.10/devcontainer.json | 3 +++ .devcontainer/python-3.11/devcontainer.json | 3 +++ .devcontainer/python-3.12/devcontainer.json | 3 +++ .devcontainer/python-3.13/devcontainer.json | 3 +++ scripts/devcontainer/templates/devcontainer.json.jinja | 3 +++ 7 files changed, 19 insertions(+) diff --git a/.devcontainer/devcontainer.env b/.devcontainer/devcontainer.env index 815a038625..bbf5073d3f 100644 --- a/.devcontainer/devcontainer.env +++ b/.devcontainer/devcontainer.env @@ -2,6 +2,7 @@ AZURE_API_ENDPOINT=${AZURE_API_ENDPOINT} AZURE_API_VERSION=${AZURE_API_VERSION} # LLM keys +OAI_CONFIG_LIST='[{"model": "gpt-4o","api_key": "","tags": ["gpt-4o", "tool", "vision"]}]' ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY} AZURE_OPENAI_API_KEY=${AZURE_OPENAI_API_KEY} OPENAI_API_KEY=${OPENAI_API_KEY} diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 5e55c00256..0b5b6b13b2 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -7,6 +7,9 @@ "name": "python-3.9", "image": "mcr.microsoft.com/devcontainers/python:3.9", "secrets": { + "OAI_CONFIG_LIST": { + "description": "This key is optional and only needed if you are working on OpenAI-related code. Leave it blank if not required. You can always set it later as an environment variable in the codespace terminal." + }, "OPENAI_API_KEY": { "description": "This key is optional and only needed if you are working on OpenAI-related code. Leave it blank if not required. You can always set it later as an environment variable in the codespace terminal." }, diff --git a/.devcontainer/python-3.10/devcontainer.json b/.devcontainer/python-3.10/devcontainer.json index e57bb767cc..f9ae08b1aa 100644 --- a/.devcontainer/python-3.10/devcontainer.json +++ b/.devcontainer/python-3.10/devcontainer.json @@ -7,6 +7,9 @@ "name": "python-3.10", "image": "mcr.microsoft.com/devcontainers/python:3.10", "secrets": { + "OAI_CONFIG_LIST": { + "description": "This key is optional and only needed if you are working on OpenAI-related code. Leave it blank if not required. You can always set it later as an environment variable in the codespace terminal." + }, "OPENAI_API_KEY": { "description": "This key is optional and only needed if you are working on OpenAI-related code. Leave it blank if not required. You can always set it later as an environment variable in the codespace terminal." }, diff --git a/.devcontainer/python-3.11/devcontainer.json b/.devcontainer/python-3.11/devcontainer.json index fd69fc9f61..89f974b137 100644 --- a/.devcontainer/python-3.11/devcontainer.json +++ b/.devcontainer/python-3.11/devcontainer.json @@ -7,6 +7,9 @@ "name": "python-3.11", "image": "mcr.microsoft.com/devcontainers/python:3.11", "secrets": { + "OAI_CONFIG_LIST": { + "description": "This key is optional and only needed if you are working on OpenAI-related code. Leave it blank if not required. You can always set it later as an environment variable in the codespace terminal." + }, "OPENAI_API_KEY": { "description": "This key is optional and only needed if you are working on OpenAI-related code. Leave it blank if not required. You can always set it later as an environment variable in the codespace terminal." }, diff --git a/.devcontainer/python-3.12/devcontainer.json b/.devcontainer/python-3.12/devcontainer.json index e47ea73e08..09a5108dc6 100644 --- a/.devcontainer/python-3.12/devcontainer.json +++ b/.devcontainer/python-3.12/devcontainer.json @@ -7,6 +7,9 @@ "name": "python-3.12", "image": "mcr.microsoft.com/devcontainers/python:3.12", "secrets": { + "OAI_CONFIG_LIST": { + "description": "This key is optional and only needed if you are working on OpenAI-related code. Leave it blank if not required. You can always set it later as an environment variable in the codespace terminal." + }, "OPENAI_API_KEY": { "description": "This key is optional and only needed if you are working on OpenAI-related code. Leave it blank if not required. You can always set it later as an environment variable in the codespace terminal." }, diff --git a/.devcontainer/python-3.13/devcontainer.json b/.devcontainer/python-3.13/devcontainer.json index 14ee1b37a7..6cc5e335e4 100644 --- a/.devcontainer/python-3.13/devcontainer.json +++ b/.devcontainer/python-3.13/devcontainer.json @@ -7,6 +7,9 @@ "name": "python-3.13", "image": "mcr.microsoft.com/devcontainers/python:3.13", "secrets": { + "OAI_CONFIG_LIST": { + "description": "This key is optional and only needed if you are working on OpenAI-related code. Leave it blank if not required. You can always set it later as an environment variable in the codespace terminal." + }, "OPENAI_API_KEY": { "description": "This key is optional and only needed if you are working on OpenAI-related code. Leave it blank if not required. You can always set it later as an environment variable in the codespace terminal." }, diff --git a/scripts/devcontainer/templates/devcontainer.json.jinja b/scripts/devcontainer/templates/devcontainer.json.jinja index 51d74d41e6..f0b5ab3c78 100644 --- a/scripts/devcontainer/templates/devcontainer.json.jinja +++ b/scripts/devcontainer/templates/devcontainer.json.jinja @@ -7,6 +7,9 @@ "name": "python-{{ python_version }}", "image": "mcr.microsoft.com/devcontainers/python:{{ python_version }}", "secrets": { + "OAI_CONFIG_LIST": { + "description": "This key is optional and only needed if you are working on OpenAI-related code. Leave it blank if not required. You can always set it later as an environment variable in the codespace terminal." + }, "OPENAI_API_KEY": { "description": "This key is optional and only needed if you are working on OpenAI-related code. Leave it blank if not required. You can always set it later as an environment variable in the codespace terminal." }, From 9dac91e05d904860c4b6a6294b5e4e8d37f7bcfb Mon Sep 17 00:00:00 2001 From: Harish Mohan Raj Date: Fri, 10 Jan 2025 04:35:52 +0000 Subject: [PATCH 15/37] Add default social image to all blog posts --- .../blog/2023-04-21-LLM-tuning-math/index.mdx | 7 ++ .../index.mdx | 7 ++ website/blog/2023-06-28-MathChat/index.mdx | 7 ++ website/blog/2023-07-14-Local-LLMs/index.mdx | 7 ++ .../blog/2023-10-18-RetrieveChat/index.mdx | 7 ++ .../blog/2023-10-26-TeachableAgent/index.mdx | 7 ++ website/blog/2023-11-06-LMM-Agent/index.mdx | 7 ++ .../blog/2023-11-09-EcoAssistant/index.mdx | 7 ++ .../blog/2023-11-13-OAI-assistants/index.mdx | 7 ++ website/blog/2023-11-20-AgentEval/index.mdx | 7 ++ .../blog/2023-11-26-Agent-AutoBuild/index.mdx | 7 ++ .../blog/2023-12-01-AutoGenStudio/index.mdx | 7 ++ .../blog/2023-12-23-AgentOptimizer/index.mdx | 7 ++ .../2023-12-29-AgentDescriptions/index.mdx | 7 ++ .../index.mdx | 7 ++ .../blog/2024-01-25-AutoGenBench/index.mdx | 7 ++ .../blog/2024-01-26-Custom-Models/index.mdx | 7 ++ website/blog/2024-02-02-AutoAnny/index.mdx | 7 ++ .../blog/2024-02-11-FSM-GroupChat/index.mdx | 7 ++ website/blog/2024-02-29-StateFlow/index.mdx | 7 ++ .../blog/2024-03-03-AutoGen-Update/index.mdx | 7 ++ website/blog/2024-03-11-AutoDefense/index.mdx | 7 ++ website/blog/2024-05-24-Agent/index.mdx | 7 ++ website/blog/2024-06-21-AgentEval/index.mdx | 7 ++ .../2024-06-24-AltModels-Classes/index.mdx | 7 ++ website/blog/2024-07-25-AgentOps/index.mdx | 7 ++ website/blog/2024-10-23-NOVA/index.mdx | 7 ++ .../blog/2024-11-15-CaptainAgent/index.mdx | 8 ++ website/blog/2024-11-17-Swarm/index.mdx | 7 ++ .../index.mdx | 7 ++ .../blog/2024-12-02-ReasoningAgent2/index.mdx | 7 ++ .../2024-12-06-FalkorDB-Structured/index.mdx | 7 ++ .../blog/2024-12-20-RealtimeAgent/index.mdx | 7 ++ .../2024-12-20-Reasoning-Update/index.mdx | 7 ++ .../index.mdx | 7 ++ .../index.mdx | 7 ++ .../index.mdx | 7 ++ .../index.mdx | 7 ++ website/mint.json | 17 ++- website/process_notebooks.py | 113 ++++++++++++++++++ 40 files changed, 393 insertions(+), 4 deletions(-) diff --git a/website/blog/2023-04-21-LLM-tuning-math/index.mdx b/website/blog/2023-04-21-LLM-tuning-math/index.mdx index f75ff3b59f..703a9097b3 100644 --- a/website/blog/2023-04-21-LLM-tuning-math/index.mdx +++ b/website/blog/2023-04-21-LLM-tuning-math/index.mdx @@ -4,6 +4,13 @@ authors: sonichi tags: [LLM, GPT, research] --- + +social preview +

Author:

diff --git a/website/blog/2023-05-18-GPT-adaptive-humaneval/index.mdx b/website/blog/2023-05-18-GPT-adaptive-humaneval/index.mdx index c3f7762fc5..e9b4800e03 100644 --- a/website/blog/2023-05-18-GPT-adaptive-humaneval/index.mdx +++ b/website/blog/2023-05-18-GPT-adaptive-humaneval/index.mdx @@ -4,6 +4,13 @@ authors: sonichi tags: [LLM, GPT, research] --- + +social preview +

Author:

diff --git a/website/blog/2023-06-28-MathChat/index.mdx b/website/blog/2023-06-28-MathChat/index.mdx index c6476051c4..b83aedb766 100644 --- a/website/blog/2023-06-28-MathChat/index.mdx +++ b/website/blog/2023-06-28-MathChat/index.mdx @@ -4,6 +4,13 @@ authors: yiranwu tags: [LLM, GPT, research] --- + +social preview +

Author:

diff --git a/website/blog/2023-07-14-Local-LLMs/index.mdx b/website/blog/2023-07-14-Local-LLMs/index.mdx index 147a896709..606496ff97 100644 --- a/website/blog/2023-07-14-Local-LLMs/index.mdx +++ b/website/blog/2023-07-14-Local-LLMs/index.mdx @@ -4,6 +4,13 @@ authors: jialeliu tags: [LLM] --- + +social preview +

Author:

diff --git a/website/blog/2023-10-18-RetrieveChat/index.mdx b/website/blog/2023-10-18-RetrieveChat/index.mdx index 24637e23d1..4a3aac7dbc 100644 --- a/website/blog/2023-10-18-RetrieveChat/index.mdx +++ b/website/blog/2023-10-18-RetrieveChat/index.mdx @@ -4,6 +4,13 @@ authors: thinkall tags: [LLM, RAG] --- + +social preview +

Author:

diff --git a/website/blog/2023-10-26-TeachableAgent/index.mdx b/website/blog/2023-10-26-TeachableAgent/index.mdx index 7cfe7fc841..076fe10c8a 100644 --- a/website/blog/2023-10-26-TeachableAgent/index.mdx +++ b/website/blog/2023-10-26-TeachableAgent/index.mdx @@ -4,6 +4,13 @@ authors: rickyloynd-microsoft tags: [LLM, teach] --- + +social preview +

Author:

diff --git a/website/blog/2023-11-06-LMM-Agent/index.mdx b/website/blog/2023-11-06-LMM-Agent/index.mdx index 7649b18b13..8bd29c2069 100644 --- a/website/blog/2023-11-06-LMM-Agent/index.mdx +++ b/website/blog/2023-11-06-LMM-Agent/index.mdx @@ -4,6 +4,13 @@ authors: beibinli tags: [LMM, multimodal] --- + +social preview +

Author:

diff --git a/website/blog/2023-11-09-EcoAssistant/index.mdx b/website/blog/2023-11-09-EcoAssistant/index.mdx index ddbcd41046..1f14dc15c8 100644 --- a/website/blog/2023-11-09-EcoAssistant/index.mdx +++ b/website/blog/2023-11-09-EcoAssistant/index.mdx @@ -4,6 +4,13 @@ authors: jieyuz2 tags: [LLM, RAG, cost-effectiveness] --- + +social preview +

Author:

diff --git a/website/blog/2023-11-13-OAI-assistants/index.mdx b/website/blog/2023-11-13-OAI-assistants/index.mdx index 83d58b2042..ee882cbcc9 100644 --- a/website/blog/2023-11-13-OAI-assistants/index.mdx +++ b/website/blog/2023-11-13-OAI-assistants/index.mdx @@ -4,6 +4,13 @@ authors: gagb tags: [openai-assistant] --- + +social preview +

Author:

diff --git a/website/blog/2023-11-20-AgentEval/index.mdx b/website/blog/2023-11-20-AgentEval/index.mdx index 5894ee9a02..7ea4922177 100644 --- a/website/blog/2023-11-20-AgentEval/index.mdx +++ b/website/blog/2023-11-20-AgentEval/index.mdx @@ -6,6 +6,13 @@ authors: tags: [LLM, GPT, evaluation, task utility] --- + +social preview +

Authors:

diff --git a/website/blog/2023-11-26-Agent-AutoBuild/index.mdx b/website/blog/2023-11-26-Agent-AutoBuild/index.mdx index 6f51849631..3d740b35a7 100644 --- a/website/blog/2023-11-26-Agent-AutoBuild/index.mdx +++ b/website/blog/2023-11-26-Agent-AutoBuild/index.mdx @@ -6,6 +6,13 @@ authors: tags: [LLM, research] --- + +social preview +

Authors:

diff --git a/website/blog/2023-12-01-AutoGenStudio/index.mdx b/website/blog/2023-12-01-AutoGenStudio/index.mdx index d1bcc7d819..7cc82e8863 100644 --- a/website/blog/2023-12-01-AutoGenStudio/index.mdx +++ b/website/blog/2023-12-01-AutoGenStudio/index.mdx @@ -7,6 +7,13 @@ authors: tags: [AutoGen, UI, web, UX] --- + +social preview +

Authors:

diff --git a/website/blog/2023-12-23-AgentOptimizer/index.mdx b/website/blog/2023-12-23-AgentOptimizer/index.mdx index 101a53650c..3c962530f8 100644 --- a/website/blog/2023-12-23-AgentOptimizer/index.mdx +++ b/website/blog/2023-12-23-AgentOptimizer/index.mdx @@ -6,6 +6,13 @@ authors: tags: [LLM, research] --- + +social preview +

Authors:

diff --git a/website/blog/2023-12-29-AgentDescriptions/index.mdx b/website/blog/2023-12-29-AgentDescriptions/index.mdx index 53c0a264c0..165dcf9328 100644 --- a/website/blog/2023-12-29-AgentDescriptions/index.mdx +++ b/website/blog/2023-12-29-AgentDescriptions/index.mdx @@ -5,6 +5,13 @@ authors: tags: [AutoGen] --- + +social preview +

Author:

diff --git a/website/blog/2024-01-23-Code-execution-in-docker/index.mdx b/website/blog/2024-01-23-Code-execution-in-docker/index.mdx index a433aae11c..24061e6a73 100644 --- a/website/blog/2024-01-23-Code-execution-in-docker/index.mdx +++ b/website/blog/2024-01-23-Code-execution-in-docker/index.mdx @@ -5,6 +5,13 @@ authors: tags: [AutoGen] --- + +social preview +

Author:

diff --git a/website/blog/2024-01-25-AutoGenBench/index.mdx b/website/blog/2024-01-25-AutoGenBench/index.mdx index 8b18c1e998..1cfafa5ab6 100644 --- a/website/blog/2024-01-25-AutoGenBench/index.mdx +++ b/website/blog/2024-01-25-AutoGenBench/index.mdx @@ -6,6 +6,13 @@ authors: tags: [AutoGen] --- + +social preview +

Authors:

diff --git a/website/blog/2024-01-26-Custom-Models/index.mdx b/website/blog/2024-01-26-Custom-Models/index.mdx index 8c9d3e2a57..7e78723d98 100644 --- a/website/blog/2024-01-26-Custom-Models/index.mdx +++ b/website/blog/2024-01-26-Custom-Models/index.mdx @@ -5,6 +5,13 @@ authors: tags: [AutoGen] --- + +social preview +

Author:

diff --git a/website/blog/2024-02-02-AutoAnny/index.mdx b/website/blog/2024-02-02-AutoAnny/index.mdx index ca4a239bab..5b0969790a 100644 --- a/website/blog/2024-02-02-AutoAnny/index.mdx +++ b/website/blog/2024-02-02-AutoAnny/index.mdx @@ -5,6 +5,13 @@ authors: tags: [AutoGen] --- + +social preview +

Author:

diff --git a/website/blog/2024-02-11-FSM-GroupChat/index.mdx b/website/blog/2024-02-11-FSM-GroupChat/index.mdx index f7a4c32a4e..042dc00db3 100644 --- a/website/blog/2024-02-11-FSM-GroupChat/index.mdx +++ b/website/blog/2024-02-11-FSM-GroupChat/index.mdx @@ -6,6 +6,13 @@ authors: tags: [AutoGen] --- + +social preview +

Authors:

diff --git a/website/blog/2024-02-29-StateFlow/index.mdx b/website/blog/2024-02-29-StateFlow/index.mdx index 4382ac5574..a70bd7d7a2 100644 --- a/website/blog/2024-02-29-StateFlow/index.mdx +++ b/website/blog/2024-02-29-StateFlow/index.mdx @@ -4,6 +4,13 @@ authors: yiranwu tags: [LLM, research] --- + +social preview +

Author:

diff --git a/website/blog/2024-03-03-AutoGen-Update/index.mdx b/website/blog/2024-03-03-AutoGen-Update/index.mdx index 233ff52e76..baf5cfd49f 100644 --- a/website/blog/2024-03-03-AutoGen-Update/index.mdx +++ b/website/blog/2024-03-03-AutoGen-Update/index.mdx @@ -4,6 +4,13 @@ authors: sonichi tags: [news, summary, roadmap] --- + +social preview +

Author:

diff --git a/website/blog/2024-03-11-AutoDefense/index.mdx b/website/blog/2024-03-11-AutoDefense/index.mdx index 1cef402845..0ae1e352e1 100644 --- a/website/blog/2024-03-11-AutoDefense/index.mdx +++ b/website/blog/2024-03-11-AutoDefense/index.mdx @@ -6,6 +6,13 @@ authors: tags: [LLM, GPT, research] --- + +social preview +

Authors:

diff --git a/website/blog/2024-05-24-Agent/index.mdx b/website/blog/2024-05-24-Agent/index.mdx index 27e081c909..daa57f6be4 100644 --- a/website/blog/2024-05-24-Agent/index.mdx +++ b/website/blog/2024-05-24-Agent/index.mdx @@ -4,6 +4,13 @@ authors: sonichi tags: [thoughts, interview notes] --- + +social preview +

Author:

diff --git a/website/blog/2024-06-21-AgentEval/index.mdx b/website/blog/2024-06-21-AgentEval/index.mdx index 7d6417d298..5098855f8a 100644 --- a/website/blog/2024-06-21-AgentEval/index.mdx +++ b/website/blog/2024-06-21-AgentEval/index.mdx @@ -6,6 +6,13 @@ authors: tags: [LLM, GPT, evaluation, task utility] --- + +social preview +

Authors:

diff --git a/website/blog/2024-06-24-AltModels-Classes/index.mdx b/website/blog/2024-06-24-AltModels-Classes/index.mdx index f2ef0657d4..95b6e49882 100644 --- a/website/blog/2024-06-24-AltModels-Classes/index.mdx +++ b/website/blog/2024-06-24-AltModels-Classes/index.mdx @@ -6,6 +6,13 @@ authors: tags: [mistral ai,anthropic,together.ai,gemini] --- + +social preview +

Authors:

diff --git a/website/blog/2024-07-25-AgentOps/index.mdx b/website/blog/2024-07-25-AgentOps/index.mdx index 53990f24b3..c2a2299dc6 100644 --- a/website/blog/2024-07-25-AgentOps/index.mdx +++ b/website/blog/2024-07-25-AgentOps/index.mdx @@ -6,6 +6,13 @@ authors: tags: [LLM,Agent,Observability,AutoGen,AgentOps] --- + +social preview +

Authors:

diff --git a/website/blog/2024-10-23-NOVA/index.mdx b/website/blog/2024-10-23-NOVA/index.mdx index ee15646b18..44e41cd052 100644 --- a/website/blog/2024-10-23-NOVA/index.mdx +++ b/website/blog/2024-10-23-NOVA/index.mdx @@ -6,6 +6,13 @@ authors: tags: [data automation, agents, Autogen, Nexla] --- + +social preview +

Authors:

diff --git a/website/blog/2024-11-15-CaptainAgent/index.mdx b/website/blog/2024-11-15-CaptainAgent/index.mdx index 7f1aba3fe3..dd904e737c 100644 --- a/website/blog/2024-11-15-CaptainAgent/index.mdx +++ b/website/blog/2024-11-15-CaptainAgent/index.mdx @@ -8,6 +8,14 @@ authors: - qingyunwu tags: [LLM, GPT, AutoBuild] --- + + +social preview +

Authors:

diff --git a/website/blog/2024-11-17-Swarm/index.mdx b/website/blog/2024-11-17-Swarm/index.mdx index fb56da9084..615ced2873 100644 --- a/website/blog/2024-11-17-Swarm/index.mdx +++ b/website/blog/2024-11-17-Swarm/index.mdx @@ -6,6 +6,13 @@ authors: tags: [groupchat, swarm] --- + +social preview +

Authors:

diff --git a/website/blog/2024-11-27-Prompt-Leakage-Probing/index.mdx b/website/blog/2024-11-27-Prompt-Leakage-Probing/index.mdx index 036221a647..621c090047 100644 --- a/website/blog/2024-11-27-Prompt-Leakage-Probing/index.mdx +++ b/website/blog/2024-11-27-Prompt-Leakage-Probing/index.mdx @@ -7,6 +7,13 @@ authors: tags: [LLM, security] --- + +social preview +

Authors:

diff --git a/website/blog/2024-12-02-ReasoningAgent2/index.mdx b/website/blog/2024-12-02-ReasoningAgent2/index.mdx index 20cc6c398e..4f0209cd52 100644 --- a/website/blog/2024-12-02-ReasoningAgent2/index.mdx +++ b/website/blog/2024-12-02-ReasoningAgent2/index.mdx @@ -9,6 +9,13 @@ authors: tags: [LLM, GPT, research] --- + +social preview +

Authors:

diff --git a/website/blog/2024-12-06-FalkorDB-Structured/index.mdx b/website/blog/2024-12-06-FalkorDB-Structured/index.mdx index bb0d22d962..34521b305c 100644 --- a/website/blog/2024-12-06-FalkorDB-Structured/index.mdx +++ b/website/blog/2024-12-06-FalkorDB-Structured/index.mdx @@ -9,6 +9,13 @@ authors: tags: [RAG, Graph RAG, Structured Outputs, swarm, nested chat] --- + +social preview +

Authors:

diff --git a/website/blog/2024-12-20-RealtimeAgent/index.mdx b/website/blog/2024-12-20-RealtimeAgent/index.mdx index ffd390df1b..ed2df0327e 100644 --- a/website/blog/2024-12-20-RealtimeAgent/index.mdx +++ b/website/blog/2024-12-20-RealtimeAgent/index.mdx @@ -9,6 +9,13 @@ tags: [Realtime API, Voice Agents, Swarm Teams, Twilio, AI Tools] --- + +social preview +

Authors:

diff --git a/website/blog/2024-12-20-Reasoning-Update/index.mdx b/website/blog/2024-12-20-Reasoning-Update/index.mdx index a296a01e74..5bb37138ec 100644 --- a/website/blog/2024-12-20-Reasoning-Update/index.mdx +++ b/website/blog/2024-12-20-Reasoning-Update/index.mdx @@ -8,6 +8,13 @@ authors: tags: [LLM, GPT, research, tutorial] --- + +social preview +

Authors:

diff --git a/website/blog/2024-12-20-Tools-interoperability/index.mdx b/website/blog/2024-12-20-Tools-interoperability/index.mdx index 0746c5e69c..b9fcbcf039 100644 --- a/website/blog/2024-12-20-Tools-interoperability/index.mdx +++ b/website/blog/2024-12-20-Tools-interoperability/index.mdx @@ -5,6 +5,13 @@ authors: tags: [LLM, tools, langchain, crewai, pydanticai] --- + +social preview +

Author:

diff --git a/website/blog/2025-01-07-Tools-Dependency-Injection/index.mdx b/website/blog/2025-01-07-Tools-Dependency-Injection/index.mdx index c0ef3e2582..afac1ddf1c 100644 --- a/website/blog/2025-01-07-Tools-Dependency-Injection/index.mdx +++ b/website/blog/2025-01-07-Tools-Dependency-Injection/index.mdx @@ -5,6 +5,13 @@ authors: tags: [tools, tool calling, dependency injection] --- + +social preview +

Author:

diff --git a/website/blog/2025-01-08-RealtimeAgent-over-websocket/index.mdx b/website/blog/2025-01-08-RealtimeAgent-over-websocket/index.mdx index 6885e53379..abef502956 100644 --- a/website/blog/2025-01-08-RealtimeAgent-over-websocket/index.mdx +++ b/website/blog/2025-01-08-RealtimeAgent-over-websocket/index.mdx @@ -9,6 +9,13 @@ tags: [Realtime API, Voice Agents, AI Tools] --- + +social preview +

Authors:

diff --git a/website/blog/2025-01-09-RealtimeAgent-over-WebRTC/index.mdx b/website/blog/2025-01-09-RealtimeAgent-over-WebRTC/index.mdx index 55e24575e6..7c8d05fcda 100644 --- a/website/blog/2025-01-09-RealtimeAgent-over-WebRTC/index.mdx +++ b/website/blog/2025-01-09-RealtimeAgent-over-WebRTC/index.mdx @@ -9,6 +9,13 @@ tags: [Realtime API, Voice Agents, AI Tools, WebRTC] --- + +social preview +

Authors:

diff --git a/website/mint.json b/website/mint.json index 9c28ece4a1..d4b699dea2 100644 --- a/website/mint.json +++ b/website/mint.json @@ -6,7 +6,7 @@ "light": "/logo/ag2.svg" }, "metadata": { - "og:image": "https://media.githubusercontent.com/media/harishmohanraj/ag2/refs/heads/main/website/static/img/cover.png" + "og:image": "https://media.githubusercontent.com/media/ag2ai/ag2/refs/heads/main/website/static/img/cover.png" }, "favicon": "/logo/ag2.svg", "search": { @@ -342,6 +342,7 @@ "docs/reference/coding/jupyter/base", "docs/reference/coding/jupyter/docker_jupyter_server", "docs/reference/coding/jupyter/embedded_ipython_code_executor", + "docs/reference/coding/jupyter/helpers", "docs/reference/coding/jupyter/jupyter_client", "docs/reference/coding/jupyter/jupyter_code_executor", "docs/reference/coding/jupyter/local_jupyter_server" @@ -395,14 +396,19 @@ "group": "logger", "pages": [ "docs/reference/logger/base_logger", - "docs/reference/logger/file_logger" + "docs/reference/logger/file_logger", + "docs/reference/logger/logger_factory", + "docs/reference/logger/logger_utils", + "docs/reference/logger/sqlite_logger" ] }, { "group": "messages", "pages": [ "docs/reference/messages/agent_messages", - "docs/reference/messages/base_message" + "docs/reference/messages/base_message", + "docs/reference/messages/client_messages", + "docs/reference/messages/print_message" ] }, { @@ -434,11 +440,14 @@ "docs/reference/browser_utils", "docs/reference/code_utils", "docs/reference/exception_utils", + "docs/reference/formatting_utils", + "docs/reference/function_utils", "docs/reference/graph_utils", "docs/reference/math_utils", "docs/reference/retrieve_utils", "docs/reference/runtime_logging", - "docs/reference/token_count_utils" + "docs/reference/token_count_utils", + "docs/reference/types" ] }, { diff --git a/website/process_notebooks.py b/website/process_notebooks.py index e17265f5d3..3871345d81 100755 --- a/website/process_notebooks.py +++ b/website/process_notebooks.py @@ -24,6 +24,7 @@ from dataclasses import dataclass from multiprocessing import current_process from pathlib import Path +from textwrap import dedent, indent from typing import Dict, List, Optional, Tuple, Union from termcolor import colored @@ -729,6 +730,117 @@ def fix_internal_references_in_mdx_files(website_dir: Path) -> None: sys.exit(1) +def construct_authors_html(authors_list: List[str], authors_dict: Dict[str, Dict[str, str]]) -> str: + """Constructs HTML for displaying author cards in a blog. + Args: + authors_list: List of author identifiers + authors_dict: Dictionary containing author information keyed by author identifier + Returns: + str: Formatted HTML string containing author cards + """ + + if not authors_list: + return "" + + card_template = """ + +
+
+ +
+
+

{name}

+

{title}

+
+
+
""" + + authors_html = [card_template.format(**authors_dict[author]) for author in authors_list] + + author_label = "Author:" if len(authors_list) == 1 else "Authors:" + authors_html_str = indent("".join(authors_html), " ") + retval = dedent( + f""" +
+

{author_label}

+ {authors_html_str} + +
+ """ + ) + return retval + + +def separate_front_matter_and_content(file_path: Path) -> Tuple[str, str]: + """Separate front matter and content from a markdown file. + Args: + file_path (Path): Path to the mdx file + """ + content = file_path.read_text(encoding="utf-8") + + if content.startswith("---"): + front_matter_end = content.find("---", 3) + front_matter = content[0 : front_matter_end + 3] + content = content[front_matter_end + 3 :].strip() + return front_matter, content + + return "", content + + +def add_authors_and_social_img_to_blog_posts(website_dir: Path) -> None: + """Add authors info to blog posts. + Args: + website_dir (Path): Root directory of the website + """ + blog_dir = website_dir / "blog" + authors_yml = blog_dir / "authors.yml" + + try: + all_authors_info = yaml.safe_load(authors_yml.read_text(encoding="utf-8")) + except (yaml.YAMLError, OSError) as e: + print(f"Error reading authors file: {e}") + sys.exit(1) + + for file_path in blog_dir.glob("**/*.mdx"): + try: + front_matter_string, content = separate_front_matter_and_content(file_path) + + # Skip if authors section already exists + # if '
' in content: + # continue + + # Convert single author to list and handle authors + front_matter = yaml.safe_load(front_matter_string[4:-3]) + authors = front_matter.get("authors", []) + authors_list = [authors] if isinstance(authors, str) else authors + + # Social share image + social_img_html = ( + """\nsocial preview""" + if '' not in content + else "" + ) + new_content = f"{front_matter_string}\n{social_img_html}\n{authors_html}\n{content}" + + file_path.write_text(f"{new_content}\n", encoding="utf-8") + print(f"Authors info and social share image checked in {file_path}") + + except Exception as e: + print(f"Error processing {file_path}: {e}") + continue + + def main() -> None: script_dir = Path(__file__).parent.absolute() parser = argparse.ArgumentParser() @@ -824,6 +936,7 @@ def main() -> None: copy_examples_mdx_files(args.website_directory) update_navigation_with_notebooks(args.website_directory) fix_internal_references_in_mdx_files(args.website_directory) + add_authors_and_social_img_to_blog_posts(args.website_directory) else: print("Unknown subcommand") From bab066950212b39089e6cd0e6b13c77a4440479d Mon Sep 17 00:00:00 2001 From: Harish Mohan Raj Date: Fri, 10 Jan 2025 05:30:41 +0000 Subject: [PATCH 16/37] WIP --- website/blog/2023-04-21-LLM-tuning-math/index.mdx | 7 +++++++ website/blog/2023-05-18-GPT-adaptive-humaneval/index.mdx | 4 +++- website/blog/2023-06-28-MathChat/index.mdx | 4 +++- website/blog/2023-07-14-Local-LLMs/index.mdx | 4 +++- website/blog/2023-10-18-RetrieveChat/index.mdx | 4 +++- website/blog/2023-10-26-TeachableAgent/index.mdx | 4 +++- website/blog/2023-11-06-LMM-Agent/index.mdx | 4 +++- website/blog/2023-11-09-EcoAssistant/index.mdx | 4 +++- website/blog/2023-11-13-OAI-assistants/index.mdx | 4 +++- website/blog/2023-11-20-AgentEval/index.mdx | 4 +++- website/blog/2023-11-26-Agent-AutoBuild/index.mdx | 4 +++- website/blog/2023-12-01-AutoGenStudio/index.mdx | 4 +++- website/blog/2023-12-23-AgentOptimizer/index.mdx | 4 +++- website/blog/2023-12-29-AgentDescriptions/index.mdx | 4 +++- .../blog/2024-01-23-Code-execution-in-docker/index.mdx | 4 +++- website/blog/2024-01-25-AutoGenBench/index.mdx | 4 +++- website/blog/2024-01-26-Custom-Models/index.mdx | 4 +++- website/blog/2024-02-02-AutoAnny/index.mdx | 4 +++- website/blog/2024-02-11-FSM-GroupChat/index.mdx | 4 +++- website/blog/2024-02-29-StateFlow/index.mdx | 4 +++- website/blog/2024-03-03-AutoGen-Update/index.mdx | 4 +++- website/blog/2024-03-11-AutoDefense/index.mdx | 4 +++- website/blog/2024-05-24-Agent/index.mdx | 4 +++- website/blog/2024-06-21-AgentEval/index.mdx | 4 +++- website/blog/2024-06-24-AltModels-Classes/index.mdx | 4 +++- website/blog/2024-07-25-AgentOps/index.mdx | 4 +++- website/blog/2024-10-23-NOVA/index.mdx | 4 +++- website/blog/2024-11-15-CaptainAgent/index.mdx | 4 +++- website/blog/2024-11-17-Swarm/index.mdx | 4 +++- website/blog/2024-11-27-Prompt-Leakage-Probing/index.mdx | 4 +++- website/blog/2024-12-02-ReasoningAgent2/index.mdx | 4 +++- website/blog/2024-12-06-FalkorDB-Structured/index.mdx | 4 +++- website/blog/2024-12-20-RealtimeAgent/index.mdx | 4 +++- website/blog/2024-12-20-Reasoning-Update/index.mdx | 4 +++- website/blog/2024-12-20-Tools-interoperability/index.mdx | 4 +++- .../blog/2025-01-07-Tools-Dependency-Injection/index.mdx | 4 +++- .../2025-01-08-RealtimeAgent-over-websocket/index.mdx | 4 +++- .../blog/2025-01-09-RealtimeAgent-over-WebRTC/index.mdx | 4 +++- website/process_notebooks.py | 8 +++++--- 39 files changed, 123 insertions(+), 40 deletions(-) diff --git a/website/blog/2023-04-21-LLM-tuning-math/index.mdx b/website/blog/2023-04-21-LLM-tuning-math/index.mdx index 703a9097b3..16233a1e27 100644 --- a/website/blog/2023-04-21-LLM-tuning-math/index.mdx +++ b/website/blog/2023-04-21-LLM-tuning-math/index.mdx @@ -4,6 +4,13 @@ authors: sonichi tags: [LLM, GPT, research] --- +
+social preview +
+social preview +

Author:

diff --git a/website/blog/2023-06-28-MathChat/index.mdx b/website/blog/2023-06-28-MathChat/index.mdx index b83aedb766..d93d3c0c9a 100644 --- a/website/blog/2023-06-28-MathChat/index.mdx +++ b/website/blog/2023-06-28-MathChat/index.mdx @@ -5,11 +5,13 @@ tags: [LLM, GPT, research] --- - +social preview +

Author:

diff --git a/website/blog/2023-07-14-Local-LLMs/index.mdx b/website/blog/2023-07-14-Local-LLMs/index.mdx index 606496ff97..6e8a00e280 100644 --- a/website/blog/2023-07-14-Local-LLMs/index.mdx +++ b/website/blog/2023-07-14-Local-LLMs/index.mdx @@ -5,11 +5,13 @@ tags: [LLM] --- - +social preview +

Author:

diff --git a/website/blog/2023-10-18-RetrieveChat/index.mdx b/website/blog/2023-10-18-RetrieveChat/index.mdx index 4a3aac7dbc..ff532729b2 100644 --- a/website/blog/2023-10-18-RetrieveChat/index.mdx +++ b/website/blog/2023-10-18-RetrieveChat/index.mdx @@ -5,11 +5,13 @@ tags: [LLM, RAG] --- - +social preview +

Author:

diff --git a/website/blog/2023-10-26-TeachableAgent/index.mdx b/website/blog/2023-10-26-TeachableAgent/index.mdx index 076fe10c8a..a216bd9641 100644 --- a/website/blog/2023-10-26-TeachableAgent/index.mdx +++ b/website/blog/2023-10-26-TeachableAgent/index.mdx @@ -5,11 +5,13 @@ tags: [LLM, teach] --- - +social preview +

Author:

diff --git a/website/blog/2023-11-06-LMM-Agent/index.mdx b/website/blog/2023-11-06-LMM-Agent/index.mdx index 8bd29c2069..2969ee256e 100644 --- a/website/blog/2023-11-06-LMM-Agent/index.mdx +++ b/website/blog/2023-11-06-LMM-Agent/index.mdx @@ -5,11 +5,13 @@ tags: [LMM, multimodal] --- - +social preview +

Author:

diff --git a/website/blog/2023-11-09-EcoAssistant/index.mdx b/website/blog/2023-11-09-EcoAssistant/index.mdx index 1f14dc15c8..de66b9796d 100644 --- a/website/blog/2023-11-09-EcoAssistant/index.mdx +++ b/website/blog/2023-11-09-EcoAssistant/index.mdx @@ -5,11 +5,13 @@ tags: [LLM, RAG, cost-effectiveness] --- - +social preview +

Author:

diff --git a/website/blog/2023-11-13-OAI-assistants/index.mdx b/website/blog/2023-11-13-OAI-assistants/index.mdx index ee882cbcc9..65d7c4b385 100644 --- a/website/blog/2023-11-13-OAI-assistants/index.mdx +++ b/website/blog/2023-11-13-OAI-assistants/index.mdx @@ -5,11 +5,13 @@ tags: [openai-assistant] --- - +social preview +

Author:

diff --git a/website/blog/2023-11-20-AgentEval/index.mdx b/website/blog/2023-11-20-AgentEval/index.mdx index 7ea4922177..ac4a8d44b0 100644 --- a/website/blog/2023-11-20-AgentEval/index.mdx +++ b/website/blog/2023-11-20-AgentEval/index.mdx @@ -7,11 +7,13 @@ tags: [LLM, GPT, evaluation, task utility] --- - +social preview +

Authors:

diff --git a/website/blog/2023-11-26-Agent-AutoBuild/index.mdx b/website/blog/2023-11-26-Agent-AutoBuild/index.mdx index 3d740b35a7..cceab20f51 100644 --- a/website/blog/2023-11-26-Agent-AutoBuild/index.mdx +++ b/website/blog/2023-11-26-Agent-AutoBuild/index.mdx @@ -7,11 +7,13 @@ tags: [LLM, research] --- - +social preview +

Authors:

diff --git a/website/blog/2023-12-01-AutoGenStudio/index.mdx b/website/blog/2023-12-01-AutoGenStudio/index.mdx index 7cc82e8863..a573706e25 100644 --- a/website/blog/2023-12-01-AutoGenStudio/index.mdx +++ b/website/blog/2023-12-01-AutoGenStudio/index.mdx @@ -8,11 +8,13 @@ tags: [AutoGen, UI, web, UX] --- - +social preview +

Authors:

diff --git a/website/blog/2023-12-23-AgentOptimizer/index.mdx b/website/blog/2023-12-23-AgentOptimizer/index.mdx index 3c962530f8..0d736f2759 100644 --- a/website/blog/2023-12-23-AgentOptimizer/index.mdx +++ b/website/blog/2023-12-23-AgentOptimizer/index.mdx @@ -7,11 +7,13 @@ tags: [LLM, research] --- - +social preview +

Authors:

diff --git a/website/blog/2023-12-29-AgentDescriptions/index.mdx b/website/blog/2023-12-29-AgentDescriptions/index.mdx index 165dcf9328..28d4dcca3a 100644 --- a/website/blog/2023-12-29-AgentDescriptions/index.mdx +++ b/website/blog/2023-12-29-AgentDescriptions/index.mdx @@ -6,11 +6,13 @@ tags: [AutoGen] --- - +social preview +

Author:

diff --git a/website/blog/2024-01-23-Code-execution-in-docker/index.mdx b/website/blog/2024-01-23-Code-execution-in-docker/index.mdx index 24061e6a73..be944a10a4 100644 --- a/website/blog/2024-01-23-Code-execution-in-docker/index.mdx +++ b/website/blog/2024-01-23-Code-execution-in-docker/index.mdx @@ -6,11 +6,13 @@ tags: [AutoGen] --- - +social preview +

Author:

diff --git a/website/blog/2024-01-25-AutoGenBench/index.mdx b/website/blog/2024-01-25-AutoGenBench/index.mdx index 1cfafa5ab6..df795d3664 100644 --- a/website/blog/2024-01-25-AutoGenBench/index.mdx +++ b/website/blog/2024-01-25-AutoGenBench/index.mdx @@ -7,11 +7,13 @@ tags: [AutoGen] --- - +social preview +

Authors:

diff --git a/website/blog/2024-01-26-Custom-Models/index.mdx b/website/blog/2024-01-26-Custom-Models/index.mdx index 7e78723d98..ab83e1b666 100644 --- a/website/blog/2024-01-26-Custom-Models/index.mdx +++ b/website/blog/2024-01-26-Custom-Models/index.mdx @@ -6,11 +6,13 @@ tags: [AutoGen] --- - +social preview +

Author:

diff --git a/website/blog/2024-02-02-AutoAnny/index.mdx b/website/blog/2024-02-02-AutoAnny/index.mdx index 5b0969790a..efd011cbd7 100644 --- a/website/blog/2024-02-02-AutoAnny/index.mdx +++ b/website/blog/2024-02-02-AutoAnny/index.mdx @@ -6,11 +6,13 @@ tags: [AutoGen] --- - +social preview +

Author:

diff --git a/website/blog/2024-02-11-FSM-GroupChat/index.mdx b/website/blog/2024-02-11-FSM-GroupChat/index.mdx index 042dc00db3..34c0a2a74f 100644 --- a/website/blog/2024-02-11-FSM-GroupChat/index.mdx +++ b/website/blog/2024-02-11-FSM-GroupChat/index.mdx @@ -7,11 +7,13 @@ tags: [AutoGen] --- - +social preview +

Authors:

diff --git a/website/blog/2024-02-29-StateFlow/index.mdx b/website/blog/2024-02-29-StateFlow/index.mdx index a70bd7d7a2..cf16b081e0 100644 --- a/website/blog/2024-02-29-StateFlow/index.mdx +++ b/website/blog/2024-02-29-StateFlow/index.mdx @@ -5,11 +5,13 @@ tags: [LLM, research] --- - +social preview +

Author:

diff --git a/website/blog/2024-03-03-AutoGen-Update/index.mdx b/website/blog/2024-03-03-AutoGen-Update/index.mdx index baf5cfd49f..506083b79e 100644 --- a/website/blog/2024-03-03-AutoGen-Update/index.mdx +++ b/website/blog/2024-03-03-AutoGen-Update/index.mdx @@ -5,11 +5,13 @@ tags: [news, summary, roadmap] --- - +social preview +

Author:

diff --git a/website/blog/2024-03-11-AutoDefense/index.mdx b/website/blog/2024-03-11-AutoDefense/index.mdx index 0ae1e352e1..d7b0d32e72 100644 --- a/website/blog/2024-03-11-AutoDefense/index.mdx +++ b/website/blog/2024-03-11-AutoDefense/index.mdx @@ -7,11 +7,13 @@ tags: [LLM, GPT, research] --- - +social preview +

Authors:

diff --git a/website/blog/2024-05-24-Agent/index.mdx b/website/blog/2024-05-24-Agent/index.mdx index daa57f6be4..db15e1a072 100644 --- a/website/blog/2024-05-24-Agent/index.mdx +++ b/website/blog/2024-05-24-Agent/index.mdx @@ -5,11 +5,13 @@ tags: [thoughts, interview notes] --- - +social preview +

Author:

diff --git a/website/blog/2024-06-21-AgentEval/index.mdx b/website/blog/2024-06-21-AgentEval/index.mdx index 5098855f8a..c4ff8e80b0 100644 --- a/website/blog/2024-06-21-AgentEval/index.mdx +++ b/website/blog/2024-06-21-AgentEval/index.mdx @@ -7,11 +7,13 @@ tags: [LLM, GPT, evaluation, task utility] --- - +social preview +

Authors:

diff --git a/website/blog/2024-06-24-AltModels-Classes/index.mdx b/website/blog/2024-06-24-AltModels-Classes/index.mdx index 95b6e49882..32b83eadd9 100644 --- a/website/blog/2024-06-24-AltModels-Classes/index.mdx +++ b/website/blog/2024-06-24-AltModels-Classes/index.mdx @@ -7,11 +7,13 @@ tags: [mistral ai,anthropic,together.ai,gemini] --- - +social preview +

Authors:

diff --git a/website/blog/2024-07-25-AgentOps/index.mdx b/website/blog/2024-07-25-AgentOps/index.mdx index c2a2299dc6..ee84c4dedb 100644 --- a/website/blog/2024-07-25-AgentOps/index.mdx +++ b/website/blog/2024-07-25-AgentOps/index.mdx @@ -7,11 +7,13 @@ tags: [LLM,Agent,Observability,AutoGen,AgentOps] --- - +social preview +

Authors:

diff --git a/website/blog/2024-10-23-NOVA/index.mdx b/website/blog/2024-10-23-NOVA/index.mdx index 44e41cd052..ce1825b1fa 100644 --- a/website/blog/2024-10-23-NOVA/index.mdx +++ b/website/blog/2024-10-23-NOVA/index.mdx @@ -7,11 +7,13 @@ tags: [data automation, agents, Autogen, Nexla] --- - +social preview +

Authors:

diff --git a/website/blog/2024-11-15-CaptainAgent/index.mdx b/website/blog/2024-11-15-CaptainAgent/index.mdx index dd904e737c..f682db893a 100644 --- a/website/blog/2024-11-15-CaptainAgent/index.mdx +++ b/website/blog/2024-11-15-CaptainAgent/index.mdx @@ -10,11 +10,13 @@ tags: [LLM, GPT, AutoBuild] --- - +social preview +

Authors:

diff --git a/website/blog/2024-11-17-Swarm/index.mdx b/website/blog/2024-11-17-Swarm/index.mdx index 615ced2873..829c1d7bce 100644 --- a/website/blog/2024-11-17-Swarm/index.mdx +++ b/website/blog/2024-11-17-Swarm/index.mdx @@ -7,11 +7,13 @@ tags: [groupchat, swarm] --- - +social preview +

Authors:

diff --git a/website/blog/2024-11-27-Prompt-Leakage-Probing/index.mdx b/website/blog/2024-11-27-Prompt-Leakage-Probing/index.mdx index 621c090047..89419e0f8a 100644 --- a/website/blog/2024-11-27-Prompt-Leakage-Probing/index.mdx +++ b/website/blog/2024-11-27-Prompt-Leakage-Probing/index.mdx @@ -8,11 +8,13 @@ tags: [LLM, security] --- - +social preview +

Authors:

diff --git a/website/blog/2024-12-02-ReasoningAgent2/index.mdx b/website/blog/2024-12-02-ReasoningAgent2/index.mdx index 4f0209cd52..e676733ca1 100644 --- a/website/blog/2024-12-02-ReasoningAgent2/index.mdx +++ b/website/blog/2024-12-02-ReasoningAgent2/index.mdx @@ -10,11 +10,13 @@ tags: [LLM, GPT, research] --- - +social preview +

Authors:

diff --git a/website/blog/2024-12-06-FalkorDB-Structured/index.mdx b/website/blog/2024-12-06-FalkorDB-Structured/index.mdx index 34521b305c..33b9e50d80 100644 --- a/website/blog/2024-12-06-FalkorDB-Structured/index.mdx +++ b/website/blog/2024-12-06-FalkorDB-Structured/index.mdx @@ -10,11 +10,13 @@ tags: [RAG, Graph RAG, Structured Outputs, swarm, nested chat] --- - +social preview +

Authors:

diff --git a/website/blog/2024-12-20-RealtimeAgent/index.mdx b/website/blog/2024-12-20-RealtimeAgent/index.mdx index ed2df0327e..ec98f237d5 100644 --- a/website/blog/2024-12-20-RealtimeAgent/index.mdx +++ b/website/blog/2024-12-20-RealtimeAgent/index.mdx @@ -10,11 +10,13 @@ tags: [Realtime API, Voice Agents, Swarm Teams, Twilio, AI Tools] --- - +social preview +

Authors:

diff --git a/website/blog/2024-12-20-Reasoning-Update/index.mdx b/website/blog/2024-12-20-Reasoning-Update/index.mdx index 5bb37138ec..1abd4c2b5c 100644 --- a/website/blog/2024-12-20-Reasoning-Update/index.mdx +++ b/website/blog/2024-12-20-Reasoning-Update/index.mdx @@ -9,11 +9,13 @@ tags: [LLM, GPT, research, tutorial] --- - +social preview +

Authors:

diff --git a/website/blog/2024-12-20-Tools-interoperability/index.mdx b/website/blog/2024-12-20-Tools-interoperability/index.mdx index b9fcbcf039..16770a9435 100644 --- a/website/blog/2024-12-20-Tools-interoperability/index.mdx +++ b/website/blog/2024-12-20-Tools-interoperability/index.mdx @@ -6,11 +6,13 @@ tags: [LLM, tools, langchain, crewai, pydanticai] --- - +social preview +

Author:

diff --git a/website/blog/2025-01-07-Tools-Dependency-Injection/index.mdx b/website/blog/2025-01-07-Tools-Dependency-Injection/index.mdx index afac1ddf1c..e6a727a2be 100644 --- a/website/blog/2025-01-07-Tools-Dependency-Injection/index.mdx +++ b/website/blog/2025-01-07-Tools-Dependency-Injection/index.mdx @@ -6,11 +6,13 @@ tags: [tools, tool calling, dependency injection] --- - +social preview +

Author:

diff --git a/website/blog/2025-01-08-RealtimeAgent-over-websocket/index.mdx b/website/blog/2025-01-08-RealtimeAgent-over-websocket/index.mdx index abef502956..02a3a123c6 100644 --- a/website/blog/2025-01-08-RealtimeAgent-over-websocket/index.mdx +++ b/website/blog/2025-01-08-RealtimeAgent-over-websocket/index.mdx @@ -10,11 +10,13 @@ tags: [Realtime API, Voice Agents, AI Tools] --- - +social preview +

Authors:

diff --git a/website/blog/2025-01-09-RealtimeAgent-over-WebRTC/index.mdx b/website/blog/2025-01-09-RealtimeAgent-over-WebRTC/index.mdx index 7c8d05fcda..7e8633b1de 100644 --- a/website/blog/2025-01-09-RealtimeAgent-over-WebRTC/index.mdx +++ b/website/blog/2025-01-09-RealtimeAgent-over-WebRTC/index.mdx @@ -10,11 +10,13 @@ tags: [Realtime API, Voice Agents, AI Tools, WebRTC] --- - +social preview +

Authors:

diff --git a/website/process_notebooks.py b/website/process_notebooks.py index 3871345d81..14e9d37b82 100755 --- a/website/process_notebooks.py +++ b/website/process_notebooks.py @@ -816,12 +816,14 @@ def add_authors_and_social_img_to_blog_posts(website_dir: Path) -> None: # Social share image social_img_html = ( - """\n +social preview""" - if ' +
""" + if ' Date: Fri, 10 Jan 2025 05:36:01 +0000 Subject: [PATCH 17/37] WIP --- website/blog/2023-04-21-LLM-tuning-math/index.mdx | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/website/blog/2023-04-21-LLM-tuning-math/index.mdx b/website/blog/2023-04-21-LLM-tuning-math/index.mdx index 16233a1e27..dedcfc51eb 100644 --- a/website/blog/2023-04-21-LLM-tuning-math/index.mdx +++ b/website/blog/2023-04-21-LLM-tuning-math/index.mdx @@ -4,6 +4,7 @@ authors: sonichi tags: [LLM, GPT, research] --- +
-social preview -

Author:

From 465025ea84571b51bd115ce32143b78893e0925c Mon Sep 17 00:00:00 2001 From: Harish Mohan Raj Date: Fri, 10 Jan 2025 07:37:56 +0000 Subject: [PATCH 18/37] Fix linting issues --- notebook/agentchat_websockets.ipynb | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/notebook/agentchat_websockets.ipynb b/notebook/agentchat_websockets.ipynb index 9b380b69d8..095fc64b8c 100644 --- a/notebook/agentchat_websockets.ipynb +++ b/notebook/agentchat_websockets.ipynb @@ -380,11 +380,10 @@ "metadata": {}, "outputs": [], "source": [ - "from http.server import HTTPServer, SimpleHTTPRequestHandler\n", - "from tempfile import TemporaryDirectory\n", - "from pathlib import Path\n", "import json\n", - "from IPython.display import HTML, display, clear_output\n", + "from http.server import HTTPServer, SimpleHTTPRequestHandler\n", + "\n", + "from IPython.display import HTML, clear_output, display\n", "\n", "PORT = 8000\n", "\n", @@ -411,14 +410,14 @@ " type: msg.type || '',\n", " content: formatMessageContent(msg.content)\n", " };\n", - " \n", + "\n", " // Add any additional fields\n", " for (const [key, value] of Object.entries(msg)) {\n", " if (key !== 'type' && key !== 'content') {\n", " formatted[key] = value;\n", " }\n", " }\n", - " \n", + "\n", " return JSON.stringify(formatted, null, 2);\n", " } catch (e) {\n", " return String(data);\n", @@ -487,7 +486,7 @@ " \n", "