diff --git a/.gitignore b/.gitignore index 5d947ca8879f8a9072fe485c566204e3c2929e80..657f7203d57a4185089981d07cd02da67d29e087 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,6 @@ bin-release/ # Project files, i.e. `.project`, `.actionScriptProperties` and `.flexProperties` # should NOT be excluded as they contain compiler settings and other important # information for Eclipse / Flash Builder. +.DS_Store +.idea/ +venv/ diff --git a/README.md b/README.md index 39532a03c3a73112444f1dafa35bb29f1ed65516..fda9982c6ad208d24fd19a6dfca8fdb2f70f29e0 100644 --- a/README.md +++ b/README.md @@ -140,6 +140,36 @@ git push origin feat/add-vllm TBD +## 本地测试(Mock Server) + +在本地验证容器时,可使用仓库提供的 `scripts/mock_server.py` 启动一个简易的模拟模型服务,返回固定的模型输出(用于 CI 或本地快速验证)。 + +示例用法: + +1. 启动模拟服务(默认端口 1234,可传入端口) + +```bash +# 在仓库根目录运行(使用端口 12345 作为示例) +python3 scripts/mock_server.py 12345 +``` + +2. 在各版本目录构建并运行镜像(示例以 `0.7.2` 为例): + +```bash +cd frameworks/autogen/0.7.2 +# 构建镜像 +docker build -t oc9-autogen:0.7.2 . +# 运行测试,容器通过环境变量 `BASE_URL` 指向宿主机的 mock 服务 +docker run --rm -e BASE_URL="http://host.docker.internal:12345/v1" oc9-autogen:0.7.2 "12+12=?" +``` + +说明:在 Linux 主机上,`host.docker.internal` 可能不可用,请将 `BASE_URL` 设置为宿主机可被容器访问的地址或使用 Docker network/host 模式。 + +`scripts/mock_server.py` 文件位于仓库: + +- [scripts/mock_server.py](scripts/mock_server.py) + + ## 许可证 本项目采用 [Apache License 2.0](./LICENSE) 许可证。 diff --git a/frameworks/autogen/0.7.2/Dockerfile b/frameworks/autogen/0.7.2/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..8e3b81dafa1ac74492d51c54b6805505f21b193a --- /dev/null +++ b/frameworks/autogen/0.7.2/Dockerfile @@ -0,0 +1,23 @@ +FROM opencloudos/opencloudos9-minimal:latest + +LABEL maintainer="OpenCloudOS Community" +LABEL org.opencontainers.image.source="https://gitee.com/OpenCloudOS/ai-agent-container" +LABEL org.opencontainers.image.description="AutoGen 0.7.2 on OpenCloudOS 9" + +# Install Python and necessary dependencies +RUN dnf update -y && \ + dnf upgrade -y && \ + dnf install -y python3 python3-pip curl && \ + dnf clean all +# Set working directory +WORKDIR /app + +COPY requirements.txt ./requirements.txt + +RUN pip install -r ./requirements.txt + +# Copy the modified test script +COPY openai-test.py ./openai-test.py + +# Set the entrypoint to run the script +ENTRYPOINT ["python3", "openai-test.py"] diff --git a/frameworks/autogen/0.7.2/README.md b/frameworks/autogen/0.7.2/README.md new file mode 100644 index 0000000000000000000000000000000000000000..6fd02ea2c73fb92ef81e3395ecbe9728c9be097d --- /dev/null +++ b/frameworks/autogen/0.7.2/README.md @@ -0,0 +1,78 @@ +# AutoGen on OpenCloudOS 9 + +## 基本信息 + +- **框架版本**:0.7.2 +- **基础镜像**:opencloudos/opencloudos9-minimal:latest +- **Python 版本**:3.11 +- **框架名称**:AutoGen + +## 框架简介 + +AutoGen 是一个开源框架,用于构建多代理 AI 系统。它允许开发者创建能够自主协作的 AI 代理,以解决复杂的任务。AutoGen 支持多种模型提供商,并提供了丰富的工具和扩展。 + +更多信息请访问:[Microsoft AutoGen GitHub](https://github.com/microsoft/autogen) + +## 支持的模型 + +AutoGen 支持多种大型语言模型,包括: + +- **OpenAI**: GPT 系列模型 +- **Azure OpenAI**: Azure 托管的 OpenAI 模型 +- **Azure AI Foundry**: Azure AI Studio 托管的模型(如 Phi-4) +- **Anthropic**: Claude 系列模型(实验性) +- **Ollama**: 本地运行的模型(如 Llama 系列) +- **Gemini**: Google 的 Gemini 模型(通过 OpenAI 兼容 API) +- **Llama API**: Meta 的 Llama 模型 API +- **Semantic Kernel Adapter**: 支持 Anthropic、Google Gemini、Ollama、MistralAI、AWS、Hugging Face 等 + +**注意**:本容器仅提供了 OpenAI 兼容 API 的使用示例,其他模型需要根据 AutoGen 官方文档进行相应配置。 + +## 构建 + +```bash +docker build -t oc9-autogen:0.7.2 . +``` + +## 使用示例 + +构建镜像后,您可以使用以下命令运行容器: + +```bash +docker run --rm oc9-autogen:0.7.2 "您的任务描述" +``` + +例如: + +```bash +docker run --rm oc9-autogen:0.7.2 "2+2等于多少?" +``` + +如果需要自定义模型服务器地址,请使用环境变量 `BASE_URL`: + +```bash +docker run --rm -e BASE_URL="http://your-custom-server:port/v1" oc9-autogen:0.7.2 "您的任务描述" +``` + +### 测试用例 + +容器内包含一个测试用例脚本,用于验证"12+12=?"的计算: + +```bash +./test/test_12_plus_12.sh +``` + +该脚本将运行以下命令: + +```bash +docker run --rm oc9-autogen:0.7.2 "12+12=?" +``` + +容器将使用内置的本地模型(qwen/qwen3.5-9b)来处理您的查询。 + +## 已知问题 + +- 本示例不使用硬编码 IP。请通过环境变量 `BASE_URL` 指定模型服务器地址,例如 `http://:1234/v1`。 +- 如果您的环境不同,请使用 `BASE_URL` 设置自定义地址。 +- 确保本地模型服务器正在运行并且可访问。 +- 如果遇到网络问题,请检查防火墙设置。 diff --git a/frameworks/autogen/0.7.2/build.conf b/frameworks/autogen/0.7.2/build.conf new file mode 100644 index 0000000000000000000000000000000000000000..ecf6b15f8f86ad245b9c1badf767ea558b3f042e --- /dev/null +++ b/frameworks/autogen/0.7.2/build.conf @@ -0,0 +1,11 @@ +# Build configuration for AutoGen 0.7.2 +IMAGE_NAME=oc9-autogen +IMAGE_TAG=0.7.2 +BASE_IMAGE=opencloudos/opencloudos9-minimal:latest +MAINTAINER="OpenCloudOS Community" +DESCRIPTION="AutoGen 0.7.2 on OpenCloudOS 9" +SOURCE_URL=https://gitee.com/OpenCloudOS/ai-agent-container +PYTHON_VERSION=3.11 +FRAMEWORK_NAME=autogen +FRAMEWORK_VERSION=0.7.2 +GPU_TEST=false diff --git a/frameworks/autogen/0.7.2/openai-test.py b/frameworks/autogen/0.7.2/openai-test.py new file mode 100644 index 0000000000000000000000000000000000000000..120411072a3a5cfe770347ac8d0575edc8e6d774 --- /dev/null +++ b/frameworks/autogen/0.7.2/openai-test.py @@ -0,0 +1,37 @@ +import asyncio +import os +import sys +from autogen_agentchat.agents import AssistantAgent +from autogen_ext.models.openai import OpenAIChatCompletionClient + +async def main() -> None: + # Get task from command line argument or default + task = sys.argv[1] if len(sys.argv) > 1 else "Say 'Hello World!'" + + # Get base_url from environment variable and avoid hardcoded IP defaults. + base_url = os.environ.get('BASE_URL') + if not base_url: + raise RuntimeError( + "BASE_URL is required. Set it to your model server URL, " + "e.g. http://:1234/v1" + ) + + model_client = OpenAIChatCompletionClient( + model="qwen/qwen3.5-9b", + api_key="any-key", + base_url=base_url, + model_info={ + "vision": False, + "function_calling": False, + "json_mode": False, + "json_output": False, + "family": "local" + } + ) + + agent = AssistantAgent("assistant", model_client=model_client) + print(await agent.run(task=task)) + await model_client.close() + +if __name__ == "__main__": + asyncio.run(main()) diff --git a/frameworks/autogen/0.7.2/requirements.txt b/frameworks/autogen/0.7.2/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..46ee9fc8e94996f43fa1b91ab7fd2ebda887eb4e --- /dev/null +++ b/frameworks/autogen/0.7.2/requirements.txt @@ -0,0 +1,2 @@ +autogen-agentchat==0.7.2 +autogen-ext[openai]==0.7.2 diff --git a/frameworks/autogen/0.7.2/test/test_12_plus_12.sh b/frameworks/autogen/0.7.2/test/test_12_plus_12.sh new file mode 100644 index 0000000000000000000000000000000000000000..3a4e610cc2cd9ef1e5409ee8ec2cf680e9c61419 --- /dev/null +++ b/frameworks/autogen/0.7.2/test/test_12_plus_12.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +# Test case for 12+12=? +echo "Running test case: 12+12=?" +docker run --rm oc9-autogen:0.7.2 "12+12=?" diff --git a/frameworks/autogen/0.7.2/test/test_12_plus_12_result.png b/frameworks/autogen/0.7.2/test/test_12_plus_12_result.png new file mode 100644 index 0000000000000000000000000000000000000000..bb21ece92938bf1e7bf17c1338e0a24da23c3061 Binary files /dev/null and b/frameworks/autogen/0.7.2/test/test_12_plus_12_result.png differ diff --git a/frameworks/autogen/0.7.3/Dockerfile b/frameworks/autogen/0.7.3/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..c34068d739f33d7754373ea4b7a4e2c446ffe465 --- /dev/null +++ b/frameworks/autogen/0.7.3/Dockerfile @@ -0,0 +1,23 @@ +FROM opencloudos/opencloudos9-minimal:latest + +LABEL maintainer="OpenCloudOS Community" +LABEL org.opencontainers.image.source="https://gitee.com/OpenCloudOS/ai-agent-container" +LABEL org.opencontainers.image.description="AutoGen 0.7.3 on OpenCloudOS 9" + +# Install Python and necessary dependencies +RUN dnf update -y && \ + dnf upgrade -y && \ + dnf install -y python3 python3-pip curl && \ + dnf clean all +# Set working directory +WORKDIR /app + +COPY requirements.txt ./requirements.txt + +RUN pip install -r ./requirements.txt + +# Copy the modified test script +COPY openai-test.py ./openai-test.py + +# Set the entrypoint to run the script +ENTRYPOINT ["python3", "openai-test.py"] diff --git a/frameworks/autogen/0.7.3/README.md b/frameworks/autogen/0.7.3/README.md new file mode 100644 index 0000000000000000000000000000000000000000..e2e7cef5c74906949ef181d8a88c68001cb00f63 --- /dev/null +++ b/frameworks/autogen/0.7.3/README.md @@ -0,0 +1,78 @@ +# AutoGen on OpenCloudOS 9 + +## 基本信息 + +- **框架版本**:0.7.3 +- **基础镜像**:opencloudos/opencloudos9-minimal:latest +- **Python 版本**:3.11 +- **框架名称**:AutoGen + +## 框架简介 + +AutoGen 是一个开源框架,用于构建多代理 AI 系统。它允许开发者创建能够自主协作的 AI 代理,以解决复杂的任务。AutoGen 支持多种模型提供商,并提供了丰富的工具和扩展。 + +更多信息请访问:[Microsoft AutoGen GitHub](https://github.com/microsoft/autogen) + +## 支持的模型 + +AutoGen 支持多种大型语言模型,包括: + +- **OpenAI**: GPT 系列模型 +- **Azure OpenAI**: Azure 托管的 OpenAI 模型 +- **Azure AI Foundry**: Azure AI Studio 托管的模型(如 Phi-4) +- **Anthropic**: Claude 系列模型(实验性) +- **Ollama**: 本地运行的模型(如 Llama 系列) +- **Gemini**: Google 的 Gemini 模型(通过 OpenAI 兼容 API) +- **Llama API**: Meta 的 Llama 模型 API +- **Semantic Kernel Adapter**: 支持 Anthropic、Google Gemini、Ollama、MistralAI、AWS、Hugging Face 等 + +**注意**:本容器仅提供了 OpenAI 兼容 API 的使用示例,其他模型需要根据 AutoGen 官方文档进行相应配置。 + +## 构建 + +```bash +docker build -t oc9-autogen:0.7.3 . +``` + +## 使用示例 + +构建镜像后,您可以使用以下命令运行容器: + +```bash +docker run --rm oc9-autogen:0.7.3 "您的任务描述" +``` + +例如: + +```bash +docker run --rm oc9-autogen:0.7.3 "2+2等于多少?" +``` + +如果需要自定义模型服务器地址,请使用环境变量 `BASE_URL`: + +```bash +docker run --rm -e BASE_URL="http://your-custom-server:port/v1" oc9-autogen:0.7.3 "您的任务描述" +``` + +### 测试用例 + +容器内包含一个测试用例脚本,用于验证"12+12=?"的计算: + +```bash +./test/test_12_plus_12.sh +``` + +该脚本将运行以下命令: + +```bash +docker run --rm oc9-autogen:0.7.3 "12+12=?" +``` + +容器将使用内置的本地模型(qwen/qwen3.5-9b)来处理您的查询。 + +## 已知问题 + +- 本示例不使用硬编码 IP。请通过环境变量 `BASE_URL` 指定模型服务器地址,例如 `http://:1234/v1`。 +- 如果您的环境不同,请使用 `BASE_URL` 设置自定义地址。 +- 确保本地模型服务器正在运行并且可访问。 +- 如果遇到网络问题,请检查防火墙设置。 diff --git a/frameworks/autogen/0.7.3/build.conf b/frameworks/autogen/0.7.3/build.conf new file mode 100644 index 0000000000000000000000000000000000000000..a3760013fa0ed1921ec79d297ee42af9df27f830 --- /dev/null +++ b/frameworks/autogen/0.7.3/build.conf @@ -0,0 +1,11 @@ +# Build configuration for AutoGen 0.7.3 +IMAGE_NAME=oc9-autogen +IMAGE_TAG=0.7.3 +BASE_IMAGE=opencloudos/opencloudos9-minimal:latest +MAINTAINER="OpenCloudOS Community" +DESCRIPTION="AutoGen 0.7.3 on OpenCloudOS 9" +SOURCE_URL=https://gitee.com/OpenCloudOS/ai-agent-container +PYTHON_VERSION=3.11 +FRAMEWORK_NAME=autogen +FRAMEWORK_VERSION=0.7.3 +GPU_TEST=false diff --git a/frameworks/autogen/0.7.3/openai-test.py b/frameworks/autogen/0.7.3/openai-test.py new file mode 100644 index 0000000000000000000000000000000000000000..120411072a3a5cfe770347ac8d0575edc8e6d774 --- /dev/null +++ b/frameworks/autogen/0.7.3/openai-test.py @@ -0,0 +1,37 @@ +import asyncio +import os +import sys +from autogen_agentchat.agents import AssistantAgent +from autogen_ext.models.openai import OpenAIChatCompletionClient + +async def main() -> None: + # Get task from command line argument or default + task = sys.argv[1] if len(sys.argv) > 1 else "Say 'Hello World!'" + + # Get base_url from environment variable and avoid hardcoded IP defaults. + base_url = os.environ.get('BASE_URL') + if not base_url: + raise RuntimeError( + "BASE_URL is required. Set it to your model server URL, " + "e.g. http://:1234/v1" + ) + + model_client = OpenAIChatCompletionClient( + model="qwen/qwen3.5-9b", + api_key="any-key", + base_url=base_url, + model_info={ + "vision": False, + "function_calling": False, + "json_mode": False, + "json_output": False, + "family": "local" + } + ) + + agent = AssistantAgent("assistant", model_client=model_client) + print(await agent.run(task=task)) + await model_client.close() + +if __name__ == "__main__": + asyncio.run(main()) diff --git a/frameworks/autogen/0.7.3/requirements.txt b/frameworks/autogen/0.7.3/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..9f40a4c84d3fb96b925dd8b7a5c46c82f6f98da5 --- /dev/null +++ b/frameworks/autogen/0.7.3/requirements.txt @@ -0,0 +1,2 @@ +autogen-agentchat==0.7.3 +autogen-ext[openai]==0.7.3 diff --git a/frameworks/autogen/0.7.3/test/test_12_plus_12.sh b/frameworks/autogen/0.7.3/test/test_12_plus_12.sh new file mode 100644 index 0000000000000000000000000000000000000000..45e8462c1e1de3c67932d65ff0d3266820390de0 --- /dev/null +++ b/frameworks/autogen/0.7.3/test/test_12_plus_12.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +# Test case for 12+12=? +echo "Running test case: 12+12=?" +docker run --rm oc9-autogen:0.7.3 "12+12=?" diff --git a/frameworks/autogen/0.7.3/test/test_12_plus_12_result.png b/frameworks/autogen/0.7.3/test/test_12_plus_12_result.png new file mode 100644 index 0000000000000000000000000000000000000000..afb0c394b6ec10ed32307e9445cdf1ea339e747a Binary files /dev/null and b/frameworks/autogen/0.7.3/test/test_12_plus_12_result.png differ diff --git a/frameworks/autogen/0.7.4/Dockerfile b/frameworks/autogen/0.7.4/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..583303ff30c94db6aed14d17e4f00e71d94d1152 --- /dev/null +++ b/frameworks/autogen/0.7.4/Dockerfile @@ -0,0 +1,23 @@ +FROM opencloudos/opencloudos9-minimal:latest + +LABEL maintainer="OpenCloudOS Community" +LABEL org.opencontainers.image.source="https://gitee.com/OpenCloudOS/ai-agent-container" +LABEL org.opencontainers.image.description="AutoGen 0.7.4 on OpenCloudOS 9" + +# Install Python and necessary dependencies +RUN dnf update -y && \ + dnf upgrade -y && \ + dnf install -y python3 python3-pip curl && \ + dnf clean all +# Set working directory +WORKDIR /app + +COPY requirements.txt ./requirements.txt + +RUN pip install -r ./requirements.txt + +# Copy the modified test script +COPY openai-test.py ./openai-test.py + +# Set the entrypoint to run the script +ENTRYPOINT ["python3", "openai-test.py"] diff --git a/frameworks/autogen/0.7.4/README.md b/frameworks/autogen/0.7.4/README.md new file mode 100644 index 0000000000000000000000000000000000000000..94f66d94b432ab870886ad34cca93671640afb31 --- /dev/null +++ b/frameworks/autogen/0.7.4/README.md @@ -0,0 +1,78 @@ +# AutoGen on OpenCloudOS 9 + +## 基本信息 + +- **框架版本**:0.7.4 +- **基础镜像**:opencloudos/opencloudos9-minimal:latest +- **Python 版本**:3.11 +- **框架名称**:AutoGen + +## 框架简介 + +AutoGen 是一个开源框架,用于构建多代理 AI 系统。它允许开发者创建能够自主协作的 AI 代理,以解决复杂的任务。AutoGen 支持多种模型提供商,并提供了丰富的工具和扩展。 + +更多信息请访问:[Microsoft AutoGen GitHub](https://github.com/microsoft/autogen) + +## 支持的模型 + +AutoGen 支持多种大型语言模型,包括: + +- **OpenAI**: GPT 系列模型 +- **Azure OpenAI**: Azure 托管的 OpenAI 模型 +- **Azure AI Foundry**: Azure AI Studio 托管的模型(如 Phi-4) +- **Anthropic**: Claude 系列模型(实验性) +- **Ollama**: 本地运行的模型(如 Llama 系列) +- **Gemini**: Google 的 Gemini 模型(通过 OpenAI 兼容 API) +- **Llama API**: Meta 的 Llama 模型 API +- **Semantic Kernel Adapter**: 支持 Anthropic、Google Gemini、Ollama、MistralAI、AWS、Hugging Face 等 + +**注意**:本容器仅提供了 OpenAI 兼容 API 的使用示例,其他模型需要根据 AutoGen 官方文档进行相应配置。 + +## 构建 + +```bash +docker build -t oc9-autogen:0.7.4 . +``` + +## 使用示例 + +构建镜像后,您可以使用以下命令运行容器: + +```bash +docker run --rm oc9-autogen:0.7.4 "您的任务描述" +``` + +例如: + +```bash +docker run --rm oc9-autogen:0.7.4 "2+2等于多少?" +``` + +如果需要自定义模型服务器地址,请使用环境变量 `BASE_URL`: + +```bash +docker run --rm -e BASE_URL="http://your-custom-server:port/v1" oc9-autogen:0.7.4 "您的任务描述" +``` + +### 测试用例 + +容器内包含一个测试用例脚本,用于验证"12+12=?"的计算: + +```bash +./test/test_12_plus_12.sh +``` + +该脚本将运行以下命令: + +```bash +docker run --rm oc9-autogen:0.7.4 "12+12=?" +``` + +容器将使用内置的本地模型(qwen/qwen3.5-9b)来处理您的查询。 + +## 已知问题 + +- 本示例不使用硬编码 IP。请通过环境变量 `BASE_URL` 指定模型服务器地址,例如 `http://:1234/v1`。 +- 如果您的环境不同,请使用 `BASE_URL` 设置自定义地址。 +- 确保本地模型服务器正在运行并且可访问。 +- 如果遇到网络问题,请检查防火墙设置。 diff --git a/frameworks/autogen/0.7.4/build.conf b/frameworks/autogen/0.7.4/build.conf new file mode 100644 index 0000000000000000000000000000000000000000..7788406824ff2f7b747843e1158c26090736f5f9 --- /dev/null +++ b/frameworks/autogen/0.7.4/build.conf @@ -0,0 +1,11 @@ +# Build configuration for AutoGen 0.7.4 +IMAGE_NAME=oc9-autogen +IMAGE_TAG=0.7.4 +BASE_IMAGE=opencloudos/opencloudos9-minimal:latest +MAINTAINER="OpenCloudOS Community" +DESCRIPTION="AutoGen 0.7.4 on OpenCloudOS 9" +SOURCE_URL=https://gitee.com/OpenCloudOS/ai-agent-container +PYTHON_VERSION=3.11 +FRAMEWORK_NAME=autogen +FRAMEWORK_VERSION=0.7.4 +GPU_TEST=false diff --git a/frameworks/autogen/0.7.4/openai-test.py b/frameworks/autogen/0.7.4/openai-test.py new file mode 100644 index 0000000000000000000000000000000000000000..120411072a3a5cfe770347ac8d0575edc8e6d774 --- /dev/null +++ b/frameworks/autogen/0.7.4/openai-test.py @@ -0,0 +1,37 @@ +import asyncio +import os +import sys +from autogen_agentchat.agents import AssistantAgent +from autogen_ext.models.openai import OpenAIChatCompletionClient + +async def main() -> None: + # Get task from command line argument or default + task = sys.argv[1] if len(sys.argv) > 1 else "Say 'Hello World!'" + + # Get base_url from environment variable and avoid hardcoded IP defaults. + base_url = os.environ.get('BASE_URL') + if not base_url: + raise RuntimeError( + "BASE_URL is required. Set it to your model server URL, " + "e.g. http://:1234/v1" + ) + + model_client = OpenAIChatCompletionClient( + model="qwen/qwen3.5-9b", + api_key="any-key", + base_url=base_url, + model_info={ + "vision": False, + "function_calling": False, + "json_mode": False, + "json_output": False, + "family": "local" + } + ) + + agent = AssistantAgent("assistant", model_client=model_client) + print(await agent.run(task=task)) + await model_client.close() + +if __name__ == "__main__": + asyncio.run(main()) diff --git a/frameworks/autogen/0.7.4/requirements.txt b/frameworks/autogen/0.7.4/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..6d23a43d6c33614eb8911c9ec2d53e85c53eabab --- /dev/null +++ b/frameworks/autogen/0.7.4/requirements.txt @@ -0,0 +1,2 @@ +autogen-agentchat==0.7.4 +autogen-ext[openai]==0.7.4 diff --git a/frameworks/autogen/0.7.4/test/test_12_plus_12.sh b/frameworks/autogen/0.7.4/test/test_12_plus_12.sh new file mode 100644 index 0000000000000000000000000000000000000000..877fd1804ac067b78618ed4bc69fd3a168f65bd2 --- /dev/null +++ b/frameworks/autogen/0.7.4/test/test_12_plus_12.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +# Test case for 12+12=? +echo "Running test case: 12+12=?" +docker run --rm oc9-autogen:0.7.4 "12+12=?" diff --git a/frameworks/autogen/0.7.4/test/test_12_plus_12_result.png b/frameworks/autogen/0.7.4/test/test_12_plus_12_result.png new file mode 100644 index 0000000000000000000000000000000000000000..68009d686b84388bb36e17829fd5d24ed733707b Binary files /dev/null and b/frameworks/autogen/0.7.4/test/test_12_plus_12_result.png differ diff --git a/frameworks/autogen/0.7.5/Dockerfile b/frameworks/autogen/0.7.5/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..eb8191809b842bc4d5d305d48bf6d15529eab34d --- /dev/null +++ b/frameworks/autogen/0.7.5/Dockerfile @@ -0,0 +1,23 @@ +FROM opencloudos/opencloudos9-minimal:latest + +LABEL maintainer="OpenCloudOS Community" +LABEL org.opencontainers.image.source="https://gitee.com/OpenCloudOS/ai-agent-container" +LABEL org.opencontainers.image.description="AutoGen 0.7.5 on OpenCloudOS 9" + +# Install Python and necessary dependencies +RUN dnf update -y && \ + dnf upgrade -y && \ + dnf install -y python3 python3-pip curl && \ + dnf clean all +# Set working directory +WORKDIR /app + +COPY requirements.txt ./requirements.txt + +RUN pip install -r ./requirements.txt + +# Copy the modified test script +COPY openai-test.py ./openai-test.py + +# Set the entrypoint to run the script +ENTRYPOINT ["python3", "openai-test.py"] diff --git a/frameworks/autogen/0.7.5/README.md b/frameworks/autogen/0.7.5/README.md new file mode 100644 index 0000000000000000000000000000000000000000..31cd993688b4f99f31c9dd92f0181c1e7c0614e7 --- /dev/null +++ b/frameworks/autogen/0.7.5/README.md @@ -0,0 +1,78 @@ +# AutoGen on OpenCloudOS 9 + +## 基本信息 + +- **框架版本**:0.7.5 +- **基础镜像**:opencloudos/opencloudos9-minimal:latest +- **Python 版本**:3.11 +- **框架名称**:AutoGen + +## 框架简介 + +AutoGen 是一个开源框架,用于构建多代理 AI 系统。它允许开发者创建能够自主协作的 AI 代理,以解决复杂的任务。AutoGen 支持多种模型提供商,并提供了丰富的工具和扩展。 + +更多信息请访问:[Microsoft AutoGen GitHub](https://github.com/microsoft/autogen) + +## 支持的模型 + +AutoGen 支持多种大型语言模型,包括: + +- **OpenAI**: GPT 系列模型 +- **Azure OpenAI**: Azure 托管的 OpenAI 模型 +- **Azure AI Foundry**: Azure AI Studio 托管的模型(如 Phi-4) +- **Anthropic**: Claude 系列模型(实验性) +- **Ollama**: 本地运行的模型(如 Llama 系列) +- **Gemini**: Google 的 Gemini 模型(通过 OpenAI 兼容 API) +- **Llama API**: Meta 的 Llama 模型 API +- **Semantic Kernel Adapter**: 支持 Anthropic、Google Gemini、Ollama、MistralAI、AWS、Hugging Face 等 + +**注意**:本容器仅提供了 OpenAI 兼容 API 的使用示例,其他模型需要根据 AutoGen 官方文档进行相应配置。 + +## 构建 + +```bash +docker build -t oc9-autogen:0.7.5 . +``` + +## 使用示例 + +构建镜像后,您可以使用以下命令运行容器: + +```bash +docker run --rm oc9-autogen:0.7.5 "您的任务描述" +``` + +例如: + +```bash +docker run --rm oc9-autogen:0.7.5 "2+2等于多少?" +``` + +如果需要自定义模型服务器地址,请使用环境变量 `BASE_URL`: + +```bash +docker run --rm -e BASE_URL="http://your-custom-server:port/v1" oc9-autogen:0.7.5 "您的任务描述" +``` + +### 测试用例 + +容器内包含一个测试用例脚本,用于验证"12+12=?"的计算: + +```bash +./test/test_12_plus_12.sh +``` + +该脚本将运行以下命令: + +```bash +docker run --rm oc9-autogen:0.7.5 "12+12=?" +``` + +容器将使用内置的本地模型(qwen/qwen3.5-9b)来处理您的查询。 + +## 已知问题 + +- 本示例不使用硬编码 IP。请通过环境变量 `BASE_URL` 指定模型服务器地址,例如 `http://:1234/v1`。 +- 如果您的环境不同,请使用 `BASE_URL` 设置自定义地址。 +- 确保本地模型服务器正在运行并且可访问。 +- 如果遇到网络问题,请检查防火墙设置。 \ No newline at end of file diff --git a/frameworks/autogen/0.7.5/build.conf b/frameworks/autogen/0.7.5/build.conf new file mode 100644 index 0000000000000000000000000000000000000000..fcc5fb15ecdd2a9447c6a5d3b0d48bde40e3eb39 --- /dev/null +++ b/frameworks/autogen/0.7.5/build.conf @@ -0,0 +1,11 @@ +# Build configuration for AutoGen 0.7.5 +IMAGE_NAME=oc9-autogen +IMAGE_TAG=0.7.5 +BASE_IMAGE=opencloudos/opencloudos9-minimal:latest +MAINTAINER="OpenCloudOS Community" +DESCRIPTION="AutoGen 0.7.5 on OpenCloudOS 9" +SOURCE_URL=https://gitee.com/OpenCloudOS/ai-agent-container +PYTHON_VERSION=3.11 +FRAMEWORK_NAME=autogen +FRAMEWORK_VERSION=0.7.5 +GPU_TEST=false diff --git a/frameworks/autogen/0.7.5/openai-test.py b/frameworks/autogen/0.7.5/openai-test.py new file mode 100644 index 0000000000000000000000000000000000000000..120411072a3a5cfe770347ac8d0575edc8e6d774 --- /dev/null +++ b/frameworks/autogen/0.7.5/openai-test.py @@ -0,0 +1,37 @@ +import asyncio +import os +import sys +from autogen_agentchat.agents import AssistantAgent +from autogen_ext.models.openai import OpenAIChatCompletionClient + +async def main() -> None: + # Get task from command line argument or default + task = sys.argv[1] if len(sys.argv) > 1 else "Say 'Hello World!'" + + # Get base_url from environment variable and avoid hardcoded IP defaults. + base_url = os.environ.get('BASE_URL') + if not base_url: + raise RuntimeError( + "BASE_URL is required. Set it to your model server URL, " + "e.g. http://:1234/v1" + ) + + model_client = OpenAIChatCompletionClient( + model="qwen/qwen3.5-9b", + api_key="any-key", + base_url=base_url, + model_info={ + "vision": False, + "function_calling": False, + "json_mode": False, + "json_output": False, + "family": "local" + } + ) + + agent = AssistantAgent("assistant", model_client=model_client) + print(await agent.run(task=task)) + await model_client.close() + +if __name__ == "__main__": + asyncio.run(main()) diff --git a/frameworks/autogen/0.7.5/requirements.txt b/frameworks/autogen/0.7.5/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..9605087b8133f53c73ee5d44b0f1d65ad0f7172d --- /dev/null +++ b/frameworks/autogen/0.7.5/requirements.txt @@ -0,0 +1,2 @@ +autogen-agentchat==0.7.5 +autogen-ext[openai]==0.7.5 \ No newline at end of file diff --git a/frameworks/autogen/0.7.5/test/test_12_plus_12.sh b/frameworks/autogen/0.7.5/test/test_12_plus_12.sh new file mode 100755 index 0000000000000000000000000000000000000000..862383c4cee4b314acda8f59d8a5a2c1b553a5e0 --- /dev/null +++ b/frameworks/autogen/0.7.5/test/test_12_plus_12.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +# Test case for 12+12=? +echo "Running test case: 12+12=?" +docker run --rm oc9-autogen:0.7.5 "12+12=?" \ No newline at end of file diff --git a/frameworks/autogen/0.7.5/test/test_12_plus_12_result.png b/frameworks/autogen/0.7.5/test/test_12_plus_12_result.png new file mode 100644 index 0000000000000000000000000000000000000000..19da71f1f72a3cb1512bec4ed13bd6014082c8d5 Binary files /dev/null and b/frameworks/autogen/0.7.5/test/test_12_plus_12_result.png differ diff --git a/scripts/mock_server.py b/scripts/mock_server.py new file mode 100644 index 0000000000000000000000000000000000000000..c729e7e53cfcd3918e075af7eaa384a7c1c9dc03 --- /dev/null +++ b/scripts/mock_server.py @@ -0,0 +1,32 @@ +from http.server import BaseHTTPRequestHandler, HTTPServer +import json + +class H(BaseHTTPRequestHandler): + def do_POST(self): + if self.path.endswith('/v1/chat/completions'): + length = int(self.headers.get('content-length', 0)) + _ = self.rfile.read(length) + resp = { + "id": "cmpl-mock", + "object": "chat.completion", + "choices": [ + {"message": {"role": "assistant", "content": "24"}} + ], + "usage": {"prompt_tokens": 0, "completion_tokens": 1} + } + data = json.dumps(resp).encode() + self.send_response(200) + self.send_header('Content-Type', 'application/json') + self.send_header('Content-Length', str(len(data))) + self.end_headers() + self.wfile.write(data) + else: + self.send_response(404) + self.end_headers() + +if __name__ == '__main__': + import sys + port = int(sys.argv[1]) if len(sys.argv) > 1 else 1234 + server = HTTPServer(('0.0.0.0', port), H) + print(f'Mock server listening on 0.0.0.0:{port}') + server.serve_forever()