Skip to content

MarwanMashra/Lattia-Dialogue

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

30 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

L'Attia Dialogue banner

L'Attia Dialogue

L'Attia Dialogue is an AI-powered health intake interview system inspired by Peter Attia’s structured style. It conducts adaptive intake conversations across domains like sleep, nutrition, lifestyle, medical history, and more. The system can run both as a web-based chat UI and as a CLI tool for quick terminal-based interaction.


Quick Start

1. Setup

  1. Download curated questions Download the questions.json file containing curated intake questions and place it at:

    data/health_questions.fr.json
    
  2. Environment variables Create a .env file with either:

    • OpenAI

      OPENAI_API_KEY=your-openai-api-key
      
    • Azure OpenAI

      AZURE_OPENAI_API_KEY=your-azure-api-key
      AZURE_OPENAI_ENDPOINT=your-azure-endpoint
      

2. Run the app (Chat UI)

Build and start the app with Docker Compose:

docker-compose up --build

Then access the app at http://localhost:8000


3. Run the CLI

To run the chat interface directly in your terminal:

  1. Make sure the backend services are running:

    docker-compose up
  2. Install uv (a fast Python package manager).

  3. Sync dependencies:

    uv sync
  4. Launch the CLI chat:

    lattia

This will start the interactive intake interview directly in your terminal.

Project Layout

The project is organized as follows:

src/lattia/
β”‚
β”œβ”€β”€ core/
β”‚   β”œβ”€β”€ agent/         # Agent code: prompts, agent loop, schemas, interview logic
β”‚   β”œβ”€β”€ parsers/       # Parsers for curated question files (knowledge base JSON)
β”‚   β”œβ”€β”€ pii/           # PII redaction module
β”‚   β”œβ”€β”€ utils/         # General utilities
β”‚   └── vector_db/     # Vector DB client code (Qdrant): embeddings, ingestion, retriever
β”‚
β”œβ”€β”€ chat.py            # CLI entry point for running the chat interface
β”‚
β”œβ”€β”€ static/            # Frontend assets (HTML, CSS, JavaScript)
β”‚   β”œβ”€β”€ app.py         # FastAPI application entry point
β”‚   β”œβ”€β”€ db.py          # Database setup: engine, session, declarative base
β”‚   β”œβ”€β”€ models.py      # SQLAlchemy models (database tables)
β”‚   β”œβ”€β”€ schemas.py     # Pydantic models (FastAPI input/output schemas)
β”‚   └── warmup.py      # Warm-up tasks when starting the server (models, caches, etc.)

This structure separates the agent logic, data access, frontend, and infrastructure code, making the project modular and easier to extend.

Limitations

  1. Latency Current response time is around 6–10 seconds per turn. Improvements are possible (see design doc).

  2. Cost Average cost is about $0.01 per query. Optimizations are outlined in the design doc.

  3. Scalability The application is stateful in its current form and cannot scale well horizontally. Stateless redesign would improve scalability (see design doc).

  4. PII handling PII redaction happens server-side. Sensitive information is never stored in the database, but it is still transmitted from client to server before being redacted.

TODO

  • Build the Home page, Chat UI, and Dashboard overlay
  • Implement the FastAPI backend and DB
  • Add PII redaction
  • Add rate bucket limiting
  • Create a CLI chat client for development
  • Implement the main agent loop with the data models
  • Ensure the Attia-style of the conversation
  • Decide when you have enough data on every category, and when to stop the interview
  • Find a good first question strategy
  • Add RAG over provided questions to suggest next questions
  • Implement the post-interview flow
  • Check FHIR standards, understand what a FHIR-lite JSON format should look like
  • Consider GDPR compliance
  • Add proper README documentation with design decisions
  • Ensure people can run it smoothly
  • Film Loom video walkthrough

Credits

About

πŸ‘¨πŸ»β€βš•οΈπŸ©Ί L'Attia Dialogue: Peter Attia–style chat with an AI doctor to better understand your health

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors