A Retrieval-Augmented Generation (RAG) backend. Required rag-worker image
302
A Retrieval-Augmented Generation (RAG) backend for document ingestion, semantic search, and LLM-powered question answering.
Endpoint:
POST /api/ingest/text
Content-Type: application/json
Request Example:
curl -X POST http://localhost:3000/api/ingest/text \
-H "Content-Type: application/json" \
-d '{
"text": "This is a test document for ingestion.",
"title": "Test Doc",
"sourceType": "txt"
}'
Response Example:
{
"status": "queued",
"docId": "<generated-uuid>"
}
Endpoint:
POST /api/ingest/files
Content-Type: multipart/form-data
files: one or more files (PDF, DOCX, TXT)urls: JSON array of URLs as a string (e.g., '["https://example.com"]')File Upload Example:
curl -X POST http://localhost:3000/api/ingest/files \
-F "files=@/path/to/your/file.pdf"
URL Ingestion Example:
curl -X POST http://localhost:3000/api/ingest/files \
-H "Content-Type: application/json"
-d '{"urls":[
"https://en.wikipedia.org/wiki/Space_exploration",
"https://en.wikipedia.org/wiki/Apollo_program"
]}'
Response Example:
{
"message": "Ingestion jobs queued",
"count": 2,
"errors": []
}
Endpoint:
POST /api/query
Content-Type: application/json
Request Example:
curl -X POST http://localhost:3000/api/query \
-H "Content-Type: application/json" \
-d '{
"query": "Tell me about space exploration on the Moon and Mars",
"topK": 15,
"generate": true
}'
Response Example (with generate=false):
{
"results": [
{
"id": "chunk-uuid",
"docId": "doc-uuid",
"title": "Test Doc",
"sourceType": "txt",
"score": 0.92
}
// ...more results
]
}
Response Example (with generate=true):
{
"answer": "OpenAI is an AI research and deployment company...",
"citations": [
{
"id": "chunk-uuid",
"docId": "doc-uuid",
"title": "Test Doc",
"sourceType": "txt",
"score": 0.92
}
// ...more results
]
}
Endpoint:
POST /api/vectorstore/clear
Content-Type: application/json
Request Example:
curl -X POST http://localhost:3000/api/vectorstore/clear
Response Example:
{
"status": "ok",
"message": "Vector store cleared."
}
Refer to this document for quick manual testing of the API endpoints. For more details, see the README or source code.
version: '3.8'
services:
app:
image: godbehere/rag-server:latest
container_name: rag-app
ports:
- "3000:3000"
env_file: .env.docker
environment:
- NODE_ENV=development
- PORT=3000
- REDIS_URL=redis://redis:6379
- QDRANT_URL=http://qdrant:6333
# Add other env vars as needed
depends_on:
- redis
- qdrant
command: npm run dev
worker:
image: godbehere/rag-worker:latest
container_name: rag-worker
env_file: .env.docker
environment:
- NODE_ENV=development
- REDIS_URL=redis://redis:6379
- QDRANT_URL=http://qdrant:6333
depends_on:
- redis
- qdrant
command: npm run worker
redis:
image: redis:7-alpine
container_name: rag-redis
ports:
- "6379:6379"
qdrant:
image: qdrant/qdrant:latest
container_name: rag-qdrant
ports:
- "6333:6333"
- "6334:6334"
volumes:
- qdrant_data:/qdrant/storage
volumes:
qdrant_data:
Content type
Image
Digest
sha256:d7991edfc…
Size
114.9 MB
Last updated
about 1 year ago
docker pull godbehere/rag-server