Skip to content

Latest commit

 

History

History
48 lines (35 loc) · 1.36 KB

File metadata and controls

48 lines (35 loc) · 1.36 KB

Contributing

Thanks for poking at this. The project values a small, readable surface over feature sprawl.

Dev setup

conda create -y -n selfhosted-chat-api python=3.12
conda activate selfhosted-chat-api
cd api && pip install -r requirements-dev.txt

Loops you'll run

make test         # pytest
make lint         # ruff
make dev          # uvicorn with --reload (points at BACKEND_BASE_URL)

Adding a new backend

See docs/BACKENDS.md. Edits needed:

  1. api/app/backends.py — capability flags + display name
  2. docker-compose.yml — service under a new compose profile
  3. deploy/env/<name>.env — template
  4. api/tests/test_backends.py — coverage

No route changes required.

PR checklist

  • make lint and make test both green
  • Public behaviour changes reflected in README.md or a file under docs/
  • New envs documented in .env.example
  • No secrets, no committed .env

Design guardrails

  • The gateway is a thin, OpenAI-shaped adapter. Resist the urge to add business logic. If a feature is model- or backend-specific, let the OpenAI pass-through carry it.
  • Features that don't work on a given backend should return a structured 501, not pretend to work.
  • Tests use httpx.MockTransport. Don't add integration tests that require a real GPU to the default pytest target.