torchbot
1.0.0
电报机器人的代码?专用于Pytorch LLM
该项目旨在模拟文本Mesagge聊天机器人来聊天pytorch
在这个简化的体系结构中,聊天机器人历史记录是交互历史的中心存储库,支持了历史上下文的检索和新互动的记录,包括LLM的完整响应。聊天机器人UI,RETRIEVER,VECTOR数据库,提示存储和LLM都在流体对话循环中扮演角色,从而为用户提供无缝的聊天体验。
+--------+--------+ (11)
| |
| Chatbot UI |
| |
+--------+--------+
^
|
(2) input|(10) output
v
+--------+-----------+
| | (9) response content
| Chatbot History +<-------------------------------+
| | |
+--------+-----------+ |
| |
| (3) message |
v ^
+-------------------+ +---------+------------+ (4) +---------+-----------+
| | | | | |
|Vector Database ? +---------->| Retriever ? | | requests History ? |
| | | | | |
+-------------------+ +---------+------------+ +---------+-----------+
| ^
| (5) Augmented message |
v |
+--------+---------+ (6) |
| | |
|Prompt Storage | |
| | |
+--------+---------+ |
| |
| (7) Augmented prompt with LLM params |
| |
v |
+--------+-----------+ |
| | |
| LLM ? | (8) Generated response |
| (Large Language +--------------------------------+
| Model) |
| |
+--------------------+
在开始之前,请确保您有以下先决条件:
.env文件,在存储库上不忽略它请按照以下步骤设置并运行项目:
克隆存储库:
git clone [email protected]:DLesmes/torchbot.git
cd torchbot
设置带有要求的python虚拟环境.txt:
python3 -m venv venv
source venv/bin/activate
python3 -m pip install -r requirements.txt
运行服务器:
python3 main.py
您也可以在您的首选IDE中进行调试。
默认情况下,将创建一个历史记录文件,模拟一个可以为下一个版本开发的NOS-SQL数据库,其思想是这样:
{
"<user_id>": [
{
"full_chat": [
{
"reply_id": srt, // reply id
"role": "system", // by default the first reply role is the "system"
"content": srt, // message content
"timestamp": int, // timestamp in milliseconds
},
{
"reply_id": str, // reply id
"role": "user", // by default the second reply role is the "user"
"content": srt, // message content
"timestamp": int, // timestamp in milliseconds
},
{
"reply_id": str, // reply id
"role": "assitant", // by default the third reply role is the "assistant"
"content": srt, // message content
"timestamp": int, // timestamp in milliseconds
},
{
"reply_id": str, // reply id
"role": str, // role of the user
"content": srt, // message content
"timestamp": int, // timestamp in milliseconds
}
]
}
]
}
默认情况下,将创建一个请求。
{
"<reply_id>": [
{
"user_id": srt, // reply id
"prompt": srt, // message content
"response": int, // timestamp in milliseconds
"timestamp": int, // timestamp in milliseconds
}
]
}
随时贡献并使此聊天机器人项目变得更好!我们欢迎社区的捐款!如果您想做出贡献,请按照以下步骤:
git checkout -b feature/YourFeatureNamegit commit -am 'Add some feature'git push origin feature/YourFeatureName对于任何疑问或建议,请随时在这里联系是我的个人资料