A FastAPI service powering the UALR Chatbot, retrieving documents via FAISS + Google Gemini embeddings and serving a /query and /feedback API.
.
├── app/
│ ├── **init**.py
│ ├── main.py # FastAPI app entrypoint 
│ ├── retriever.py # FAISS-based document retriever 
│ └── llm.py # LLM invocation helpers (Gemini/Ollama) 
├── faiss\_index.index # Precomputed FAISS index (binary)
├── doc\_metadata.pkl # Pickled metadata for indexed docs
├── feedback\_log.jsonl # Local store for user feedback
├── Dockerfile # Production image build recipe 
├── docker-compose.yml # Dev compose setup (hot-reload) 
├── pyproject.toml # Poetry dependencies & configuration
└── README.md # ← You are here
- Docker & Docker Compose
- Poetry (for local installs, optional)
- A Google GenAI API key for embeddings & chat (set
LANGSMITH_API_KEY/GOOGLE_API_KEYenv var)
Create a .env file in the project root:
PORT=8000These will be picked up by both Docker Compose and the application.
We mount your local code into the container and use Uvicorn’s --reload for instant hot-reloading:
# First time (or after pyproject/poetry.lock changes):
docker-compose up --build
# Subsequent code edits:
# Uvicorn will auto-reload; just save files and refresh your HTTP client
# Teardown:
docker-compose down-
API endpoints
POST /query→ run a search & LLM roundtripPOST /feedback→ store user feedback locally & to LangSmithGET /health→ simple health check
If you prefer plain Docker:
# 1. Build image
docker build -t ualr-chatbot-backend:latest .
# 2. Run (detached)
docker run -d \
--name ualr-backend \
--env-file .env \
-p 8000:8000 \
ualr-chatbot-backend:latest \
uvicorn app.main:app --host 0.0.0.0 --port 8000 --workers 1
# 3. Check logs
docker logs -f ualr-backend
# 4. Health-check
curl http://localhost:8000/healthbrowse to -> https://localhost:8000/docs use the ui to test inputs
# Install dev deps locally (optional)
poetry install --with dev
# Run pytest
pytest- Render (or your target host) will use the Dockerfile and its
CMDto build & run. - No need to push
docker-compose.ymlor.env—just ensure your Dockerfile and start command in Render matchapp.main:app.
- Module import errors → ensure you run
uvicorn app.main:app(notmain:app). - Port conflicts → adjust
PORTin.envand host mapping. - Missing keys → verify
LANGSMITH_API_KEY/GOOGLE_API_KEYare set.
Happy coding! 🚀