安装#
创建虚拟环境(可选)#
在本地安装 AgentChat 时,我们建议使用虚拟环境进行安装。这将确保 AgentChat 的依赖项与您系统的其余部分隔离。
创建并激活
Linux/Mac
python3 -m venv .venv
source .venv/bin/activate
Windows 命令行
# The command may be `python3` instead of `python` depending on your setup
python -m venv .venv
.venv\Scripts\activate.bat
要稍后停用,请运行
deactivate
安装 Conda,如果尚未安装。
创建并激活
conda create -n autogen python=3.12
conda activate autogen
要稍后停用,请运行
conda deactivate
使用 pip 安装#
使用 pip 安装 autogen-agentchat 包
pip install -U "autogen-agentchat"
注意
需要 Python 3.10 或更高版本。
为模型客户端安装 OpenAI#
要使用 OpenAI 和 Azure OpenAI 模型,您需要安装以下扩展
pip install "autogen-ext[openai]"
如果您正在使用 Azure OpenAI 进行 AAD 身份验证,则需要安装以下内容
pip install "autogen-ext[azure]"