Skip to main content

Chat Agent toolkit.

Project description

🇨🇳中文 | 🌐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

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

chatpilot-0.1.2.tar.gz (48.2 kB view details)

Uploaded Source

File details

Details for the file chatpilot-0.1.2.tar.gz.

File metadata

  • Download URL: chatpilot-0.1.2.tar.gz
  • Upload date:
  • Size: 48.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.6

File hashes

Hashes for chatpilot-0.1.2.tar.gz
Algorithm Hash digest
SHA256 ed479df255ff1959c15dc79b6bc27780880b7f6afe64fb383e10d846d41e4409
MD5 8607c57164fdf0ad9b08a62164b5ddc9
BLAKE2b-256 95401d96bd85452647cf610455103761be23301fcfe503138aa89c78cc5f9016

See more details on using hashes here.

Supported by

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