Skip to content

Latest commit

 

History

History
62 lines (49 loc) · 2.55 KB

File metadata and controls

62 lines (49 loc) · 2.55 KB

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

Project Overview

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.

Development Commands

Running the Application Locally

Testing Commands

  • 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

Alternative Test Commands (via Makefile)

  • Start test harness: make test-up
  • Run tests: make test-chat-backend
  • Stop test harness: make test-down

Architecture

Core Stack

  • 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

Service Structure

The main service is in services/chat-backend/ with:

  • src/app.py: Main FastAPI application entry point
  • src/routers/: API endpoint definitions (chat, health, main)
  • src/schemas/: Pydantic models for request/response validation
  • src/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

Key Configuration

  • Environment: Copy .env.example to .env in 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

Deployment

  • 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)

Code Quality Tools

  • Linting: ruff (configured in pyproject.toml)
  • Type checking: mypy with Pydantic plugin
  • Testing: pytest with async support and recording for external calls
  • SonarQube: Automated code quality scanning (project: TLM-app)