amer003100/RAG_PostgreSQL
0
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
Overview
This Space hosts a simple RAG API powered by FastAPI, vecs (Postgres/Timescale), and an LLM provider.
Environment
Copy the template and fill in your secrets:
cp app/example.env app/.envRequired keys:
OPENAI_API_KEYTIMESCALE_SERVICE_URL
Run locally (Docker)
docker build -t rag-space .
docker run --rm -p 7860:7860 --env-file app/.env rag-spaceThen open: http://localhost:7860
Run locally (no Docker)
Python 3.12 is required.
Using uv:
uv venv
uv sync
uv run uvicorn app.api:app --host 0.0.0.0 --port 7860Or using pip:
python -m venv .venv
. .venv/bin/activate
pip install -e .
uvicorn app.api:app --host 0.0.0.0 --port 7860API
POST /api/chat
Payload example:
{
"question": "ما هي طرق التوصيل؟",
"provider": "openai",
"filters": { "category": { "$eq": "الشحن" } }
}