Skip to main content

This is the UI backend for the dr.sai project.

Project description

OpenDrSai

由高能物理研究所Dr.Sai团队开发的智能体与多智能体协同系统快速开发框架,可快速地开发和部署自己的智能体与多智能体协作系统后端服务。

适配逻辑图

1.特色

  • 1.可基于HepAI平台进行智能体基座模型的灵活切换。
  • 2.为智能体设计了感知、思考、记忆、执行等行为功能,并进行了插件化设计,可灵活扩展,满足多种应用场景。
  • 3.为智能体和多智能体协作系统交互提供了兼容OpenAI Chat和Magenti-UI的标准后端接口,可与兼容OpenAI输出的前端和Magenti-UI人机交互前端进行无缝对接,从而可将智能体和多智能体协作系统作为模型或智能体服务进行部署。

2.快速开始

2.1.安装OpenDrSai

pip 安装

conda create -n drsai python=>3.11
conda activate drsai
pip install drsai -U

从源码安装和配置OpenDrSai运行环境

创建code.ihep.ac.cn账号,克隆OpenDrSai仓库到本地:

git clone https://code.ihep.ac.cn/hepai/drsai.git drsai
cd drsai

配置conda环境,安装依赖包:

conda create -n drsai python>=3.11
conda activate drsai
pip install -e .  # 以开发者模式安装,任何仓库内的修改会直接生效 ,无需重新安装。

配置HepAI平台的API访问密钥

配置HepAIDDF2平台的API访问密钥等环境变量(Based on bash):

linux/mac平台:

vi ~/.bashrc
export HEPAI_API_KEY=your_api_key
source ~/.bashrc

windows平台:

setx "HEPAI_API_KEY" "your_api_key"
# 注意 windows环境变量需要重启电脑才会生效

2.2.命令行启动OpenDrSai服务

pip install drsai_ui -U 
drsai console --agent-config agent_config.yaml # 启动命令行模式的智能体/多智能体服务
drsai backend --agent-config agent_config.yaml # 将智能体/多智能体部署为OpenAI格式的后端模型服务
drsai ui # 启动Magenti-UI人机交互前端

NOTE:

  • agent_config.yaml文件展示了智能体和多智能体的配置信息,进行智能体尝鲜,或者前端用户自定义配置智能体时可以根据配置文件进行智能体/多智能体系统的快速创建,一个案例如下:
# 定义你的智能体基座模型
model_config: &client
  provider: drsai.HepAIChatCompletionClient
  config:
    model: openai/gpt-4o
    api_key: sk-****
    base_url: "https://aiapi.ihep.ac.cn/apiv2"
    max_retries: 10
# 组装你的智能体
myassistant:
  type: AssistantAgent # 定义智能体类型,由OpenDrSai提供或者自己代码开发
  name: myassistant
  system_message: "You are a helpful assistant who responds to user requests based on your tools and knowledge."
  description: "An agent that provides assistance with ability to use tools."
  model_client: *client

具体的配置项说明见配置文件说明文档。在我们AI平台上,提供了丰富的智能体的基座模型、MCP/HEPAI Worker工具、RAG记忆插件;多种逻辑的智能体和多智能体框架;一些预设的智能体/多智能体工作模式供你选择。你可以在前后端选择适合你的智能体/多智能体框架和工具、知识库等,快速搭建自己的智能体/多智能体协作系统。通过配置快速构建智能体/多智能体系统详细的说明见:docs/agent_factory.md.

3.详细文档

见docs目录:

docs/develop.md: 智能体/多智能体系统开发指南
docs/agent_factory.md: 智能体/多智能体开放和社区开发指南
docs/drsai_ui.md: 人机交互前端使用指南
docs/open-webui.md:OpenAI格式的前端访问,以及OpenWebui的Pipeline插件的使用指南

7.联系我们

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

drsai_ui-0.0.1.tar.gz (4.3 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

drsai_ui-0.0.1-py3-none-any.whl (4.4 MB view details)

Uploaded Python 3

File details

Details for the file drsai_ui-0.0.1.tar.gz.

File metadata

  • Download URL: drsai_ui-0.0.1.tar.gz
  • Upload date:
  • Size: 4.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.11

File hashes

Hashes for drsai_ui-0.0.1.tar.gz
Algorithm Hash digest
SHA256 7b52f152a6a9d1a4ee65c26a54e55870f736eadfe5f53b3e567db4fff7dba644
MD5 01b19d2340da292bec124c926219a6e7
BLAKE2b-256 823995a6d93cab96107ad2a8132c879d1261e968aa0288f9c54c51917afe6015

See more details on using hashes here.

File details

Details for the file drsai_ui-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: drsai_ui-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 4.4 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.11

File hashes

Hashes for drsai_ui-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 22b4e020687db1766c996d39733ba9aa96053accef49dd6e8e1af3e211410164
MD5 456200db99583d35ce5a9c43329705c0
BLAKE2b-256 42bb0e79b133f9aaed9f0c81b87c956908b88ee3cde5a6755739daa5168f2fdf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page