Skip to content

ChatPilot: 实现AgentChat对话,支持Google搜索、文件网址对话(RAG)、代码解释器功能,复现了Kimi Chat(文件,拖进来;网址,发出来)。

License

Notifications You must be signed in to change notification settings

shibing624/ChatPilot

Repository files navigation

🇨🇳中文 | 🌐English


ChatPilot: Chat Agent

PyPI version Downloads Contributions welcome License Apache 2.0 python_version GitHub issues Wechat Group

ChatPilot: 实现AgentChat对话,支持Google搜索、文件网址对话(RAG)、代码解释器功能,复现Kimi Chat(文件,拖进来;网址,发出来),支持OpenAI/Azure API。

Features

  • 本项目基于LangChain实现了ReAct和OpenAI Function Call的Agent问答对话,支持如下工具自动调用:
    • 联网搜索工具:Google Search API(Serper/DuckDuckGo)
    • URL自动解析工具:复现了Kimi Chat网址发出来功能
    • Python代码解释器:支持E2B虚拟环境和本地python编译器环境运行代码
  • 本项目基于LangChain实现了支持query改写的检索增强RAG文件问答
  • 支持前后端服务分离,前端使用Svelte,后端使用FastAPI
  • 支持语音输入输出,支持图像生成
  • 支持用户管理,权限控制,支持聊天记录导入导出

Demo

Official Demo: https://chat.mulanai.com

Install

pip install -U chatpilot

or

git clone https://github.com/shibing624/ChatPilot.git
cd ChatPilot
pip install -e .

Usage

本地部署

1. 构建前端web

两种方法构建前端:

  1. 下载打包并编译好的前端 buid.zip 解压到项目web目录下。
  2. 自己使用npm构建前端

Requirements:

git clone https://github.com/shibing624/ChatPilot.git
cd ChatPilot/

# Copying required .env file
cp .env.example .env

# Building Frontend Using Node
cd web
npm install
npm run build

输出:项目web目录产出build文件夹,包含了前端编译输出文件。

2. 启动后端服务

cd ..
pip install -r requirements.txt -U
bash start.sh

好了,现在你的应用正在运行:http://0.0.0.0:8080 Enjoy! 😄

命令行模式(CLI)

支持命令行对话。

code: cli.py

> chatpilot -h                                    
usage: __main__.py [-h] [--model MODEL] [--search SEARCH] [--openai_api_key OPENAI_API_KEY] [--openai_api_base OPENAI_API_BASE] [--serper_api_key SERPER_API_KEY]



chatpilot cli


options:
  -h, --help            show this help message and exit
  --model MODEL         openai model name
  --search SEARCH       search engine name, e.g. duckduckgo, serper
  --openai_api_key OPENAI_API_KEY
                        openai api key
  --openai_api_base OPENAI_API_BASE
                        openai api base url
  --serper_api_key SERPER_API_KEY
                        serper api key

run:

pip install chatpilot -U
chatpilot

User: 输入问题, 如:"一句话介绍北京"。

Contact

  • Issue(建议):GitHub issues
  • 邮件我:xuming: xuming624@qq.com
  • 微信我:加我微信号:xuming624, 备注:姓名-公司-NLP 进NLP交流群。

Citation

如果你在研究中使用了ChatPilot,请按如下格式引用:

APA:

Xu, M. ChatPilot: LLM agent toolkit (Version 0.0.2) [Computer software]. https://github.com/shibing624/ChatPilot

BibTeX:

@misc{ChatPilot,
  author = {Ming Xu},
  title = {ChatPilot: llm agent},
  year = {2024},
  publisher = {GitHub},
  journal = {GitHub repository},
  howpublished = {\url{https://github.com/shibing624/ChatPilot}},
}

License

授权协议为 The Apache License 2.0,可免费用做商业用途。请在产品说明中附加ChatPilot的链接和授权协议。

Contribute

项目代码还很粗糙,如果大家对代码有所改进,欢迎提交回本项目,在提交之前,注意以下两点:

  • tests添加相应的单元测试
  • 使用python -m pytest -v来运行所有单元测试,确保所有单测都是通过的

之后即可提交PR。

Reference

About

ChatPilot: 实现AgentChat对话,支持Google搜索、文件网址对话(RAG)、代码解释器功能,复现了Kimi Chat(文件,拖进来;网址,发出来)。

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Packages

No packages published