รหัสสำหรับบอทโทรเลข? พิเศษใน Pytorch LLM ขับเคลื่อน
โครงการนี้มีวัตถุประสงค์เพื่อจำลองข้อความ mesagge chatbot เพื่อแชทเกี่ยวกับ pytorch
ในสถาปัตยกรรมที่มีความคล่องตัวนี้ประวัติศาสตร์ Chatbot ทำหน้าที่เป็นที่เก็บศูนย์กลางของประวัติศาสตร์ปฏิสัมพันธ์ซึ่งสนับสนุนทั้งการดึงบริบททางประวัติศาสตร์และการบันทึกการโต้ตอบใหม่รวมถึงการตอบสนองอย่างเต็มรูปแบบจาก LLM chatbot UI, Retriever, ฐานข้อมูลเวกเตอร์, ที่เก็บข้อมูลพร้อมท์และ 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 ที่ไม่ได้ถูกละเว้นใน repo ทำตามขั้นตอนเหล่านี้เพื่อตั้งค่าและเรียกใช้โครงการ:
โคลนที่เก็บ:
git clone [email protected]:DLesmes/torchbot.git
cd torchbot
ตั้งค่าสภาพแวดล้อมเสมือนจริงของ Python ด้วย required.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 จะถูกสร้างขึ้นเพื่อจำลองฐานข้อมูล No-SQL ที่สามารถพัฒนาได้สำหรับเวอร์ชันถัดไปไฟล์นี้ใจเป็นแบบนี้:
{
"<reply_id>": [
{
"user_id": srt, // reply id
"prompt": srt, // message content
"response": int, // timestamp in milliseconds
"timestamp": int, // timestamp in milliseconds
}
]
}
อย่าลังเลที่จะมีส่วนร่วมและทำให้โครงการ chatbot นี้ดียิ่งขึ้น! เรายินดีต้อนรับการมีส่วนร่วมจากชุมชน! หากคุณต้องการมีส่วนร่วมโปรดทำตามขั้นตอนเหล่านี้:
git checkout -b feature/YourFeatureNamegit commit -am 'Add some feature'git push origin feature/YourFeatureNameสำหรับคำถามหรือคำแนะนำใด ๆ อย่าลังเลที่จะติดต่อที่นี่คือโปรไฟล์ของฉัน