Skip to content

Latest commit

 

History

History
8 lines (8 loc) · 1.83 KB

Notes.md

File metadata and controls

8 lines (8 loc) · 1.83 KB

DOCUMENTATIONAL FLOW OF RAG CHATBOT SERVICE

  1. http://localhost:8000/docs is fastAPI's auto generated interactive API docs , can be used to test endpoints. Also 8000 is Uvicorn's default port.
  2. uvicorn — the actual web server program. FastAPI itself doesn't run anything — it just defines what happens when a request comes in. Uvicorn is the ASGI server that actually listens on a port, accepts HTTP connections, and hands each request over to your FastAPI app. --reload — watches your files for changes and automatically restarts the server when you save. in uvicorn app.main:app --reload.
  3. BaseSettings is a special version of a Pydantic model that, in addition to normal validation, knows how to pull its values from environment variables and .env files automatically.
  4. files like app/rag/init.py , just makes rag a proper Python package so from app.rag.embeddings import ... works
  5. Depends() tells FastAPI: "before running this route function, run get_project_id first, pass its return value in as project_id." So FastAPI automatically reads the X-API-Key header, validates it, resolves it to a project_id, and injects it — all before your function body runs. If the key is invalid, it never reaches your function at all.
  6. python -m scripts.backfill_from_mongo — the -m flag runs it as a module, which means Python sets up the path correctly so from app.config import settings resolves. If you try python scripts/backfill_from_mongo.py directly it will fail with an import error (same reason test scripts had to be at the root).
  7. python -m scripts.backfill_from_mongo — the -m flag runs it as a module, which means Python sets up the path correctly so from app.config import settings resolves. If you try python scripts/backfill_from_mongo.py directly it will fail with an import error (same reason test scripts had to be at the root).