This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
TLM App is a standalone web application for serving the Trustworthy Language Model (TLM) using FastAPI. The main service is chat-backend which provides a REST API for chat functionality.
- Setup: Requires Docker, Tilt, and Kind
- Create cluster:
kind create cluster --name tlm-app - Start development:
tilt up - Access application: http://localhost:8080
- API docs: http://localhost:8080/api/docs
- Run all tests:
./scripts/dev/test.sh chat-backend - Run specific test:
./scripts/dev/test.sh chat-backend tests/routers/test_chat.py - Run with debugger:
./scripts/dev/test.sh chat-backend --pdb - Run with stdout:
./scripts/dev/test.sh chat-backend -s
- Start test harness:
make test-up - Run tests:
make test-chat-backend - Stop test harness:
make test-down
- FastAPI: ASGI web framework with type annotations and auto-generated docs
- Pydantic: Data validation and parsing
- uvicorn: ASGI server for production
- Python 3.10+: Required runtime
The main service is in services/chat-backend/ with:
src/app.py: Main FastAPI application entry pointsrc/routers/: API endpoint definitions (chat, health, main)src/schemas/: Pydantic models for request/response validationsrc/services/: Business logic (Azure integration, chat config, streaming)src/middleware/: Request/response processing (audit logging)src/utils/: Utilities (logging, models configuration)tests/: Test suite with pytest and async support
- Environment: Copy
.env.exampleto.envin service directories (values unquoted) - TLM Core: External dependency at version v0.0.39
- Code quality: Ruff formatter (120 char line length), mypy type checking
- Test coverage: Coverage reporting with pytest
- Kubernetes: Helm charts in
deploy/helm/ - Container registry: Uses Docker build with live updates via Tilt
- Infrastructure: Terraform configs for Azure (AKS) and AWS (EKS)
- Linting:
ruff(configured in pyproject.toml) - Type checking:
mypywith Pydantic plugin - Testing:
pytestwith async support and recording for external calls - SonarQube: Automated code quality scanning (project: TLM-app)