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對於任何疑問或建議,請隨時在這里聯係是我的個人資料