torchbot
1.0.0
電報ボットのコード? Pytorch LLM Poweredで特別
このプロジェクトは、PytorchについてチャットするためにテキストMesaggeチャットボットをシミュレートすることを目的としています
この合理化されたアーキテクチャでは、チャットボットの履歴は、相互作用履歴の中心的なリポジトリとして機能し、LLMからの完全な応答を含む歴史的文脈の検索と新しい相互作用の伐採の両方をサポートしています。チャットボットUI、レトリバー、ベクトルデータベース、プロンプトストレージ、および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でデバッグすることもできます。
デフォルトでは、history.jsonファイルが作成され、次のバージョンで開発できるNO-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
}
]
}
]
}
デフォルトでは、requests.jsonファイルが作成されます。
{
"<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質問や提案については、ここでお気軽にご連絡ください私のプロフィール