This project is a headless API system designed to manage Frequently Asked Questions (FAQs) using vector embeddings for semantic search. Built on Cloudflare’s serverless infrastructure, it leverages Workers AI for embedding generation and Vectorize as a vector database.
Features • Question Matching: Submit a user question to retrieve the most relevant FAQ based on semantic similarity. • Admin FAQ Management: Add new FAQs and store their embeddings in the vector database. • Scalability: Powered by Cloudflare Workers for low-latency responses and global scalability.
Add a new FAQ entry to the vector database.
curl -X POST "https://faq-vectordb.fupsonline.workers.dev/insert" \
-H "Content-Type: application/json" \
-d '{
"question": "Who created Nerdle?",
"answer": "Nerdle was created by a team of students in Denmark for their web technologies course work."
}'
Response:
{
"success": true,
"id": "1733915502976"
}
Search for FAQs using natural language queries.
curl "https://faq-vectordb.fupsonline.workers.dev/search?q=how%20do%20returns%20work"
Response:
{
"matches": [
{
"id": "1733915502976",
"score": 0.8723968,
"question": "What is your return policy?",
"answer": "You can return items within 30 days."
}
]
}
score
: Similarity score between 0 and 1 (higher is better)question
: The original FAQ questionanswer
: The corresponding answerid
: Unique identifier for the FAQ entry
- Basic policy questions:
curl "https://faq-vectordb.fupsonline.workers.dev/search?q=Who%20created%20Nerdle?"
- Natural language queries:
curl "https://faq-vectordb.fupsonline.workers.dev/search?q=Nerdle%20was%20created%20by%20a%20team%20of%20students%20in%20Denmark%20for%20their%20web%20technologies%20course%20work."