AI Application Starter Kit
1.0.0
ชุดเริ่มต้นสำหรับการสร้างแอปพลิเคชัน AI โดยใช้นีออนเป็นฐานข้อมูลเวกเตอร์
โคลนที่เก็บ:
git clone https://github.com/imabutahersiddik/AI-Application-Starter-Kit.git
cd ai-starter-kitติดตั้งการพึ่งพา:
npm installตั้งค่าฐานข้อมูลของคุณ:
.env ในไดเรกทอรีรูทและเพิ่ม URL ฐานข้อมูลของคุณ: DATABASE_URL=postgres://user:password@localhost:5432/mydb
เรียกใช้แอปพลิเคชัน:
npm start{
"input" : " Hello, how are you? "
}{
"response" : " I'm doing well, thank you! "
}{
"query" : " Find similar documents "
}{
"results" : [
{ "id" : 1 , "title" : " Document 1 " , "content" : " Content of document 1 " },
{ "id" : 2 , "title" : " Document 2 " , "content" : " Content of document 2 " }
]
} ในการร้องขอจุดสิ้นสุดของคุณโดยใช้ curl คุณสามารถใช้ตัวอย่างต่อไปนี้สำหรับจุดสิ้นสุดการค้นหาของ Chatbot และ Semantic
หากต้องการส่งคำขอโพสต์ไปยังจุดสิ้นสุด chatbot ให้ใช้คำสั่งนี้:
curl -X POST http://localhost:3000/chat
-H " Content-Type: application/json "
-d ' {"input": "Hello, how are you?"} 'หากต้องการส่งคำขอโพสต์ไปยังจุดสิ้นสุดการค้นหาแบบความหมายให้ใช้คำสั่งนี้:
curl -X POST http://localhost:3000/search
-H " Content-Type: application/json "
-d ' {"query": "Find similar documents"} '-X POST : ระบุวิธีการขอเป็นโพสต์http://localhost:3000/chat หรือ http://localhost:3000/search : URL ของจุดสิ้นสุด-H "Content-Type: application/json" : ตั้งส่วนหัวคำขอเพื่อระบุว่าประเภทเนื้อหาคือ JSON-d '{...}' : ข้อมูลที่ถูกส่งในรูปแบบ JSON คำสั่งเหล่านี้จะช่วยให้คุณทดสอบจุดสิ้นสุด API ของคุณจากบรรทัดคำสั่งโดยใช้ curl
chatbot_responses และ documents ) และติดตั้งส่วนขยาย pgvector