chainlit / README_OLD.md
Gustav2811's picture
Initial deployment to Hugging Face Spaces
971a10e

Naked Insurance - LLM Chat Client POC

This repository contains the Proof of Concept (POC) for a Large Language Model (LLM) powered chat client for internal use at Naked Insurance. The application is built using the Chainlit framework for both the frontend and backend.

🎯 Project Overview

This POC demonstrates a modern, production-ready approach to building an LLM-powered chat interface that can integrate with multiple AI providers (OpenAI, Google Gemini) while maintaining a clean, maintainable codebase.

Key Features

  • Multi-Provider LLM Support: Seamless integration with OpenAI GPT models (including flagship and reasoning models) and Google Gemini
  • Latest AI Models: Support for GPT-4.1, GPT-4o, o3 series reasoning models, and Gemini 2.5 Pro/Flash
  • Modern Python Architecture: Uses the src layout with proper packaging and dependency management
  • Production-Ready Foundation: Comprehensive tooling for linting, testing, and type checking
  • Chainlit Framework: Leverages Chainlit for rapid prototyping of chat interfaces
  • Environment-Based Configuration: Secure handling of API keys and configuration

πŸ—οΈ Architecture

The project follows modern Python best practices with a clear separation of concerns:

naked-chat-poc/
β”œβ”€β”€ .chainlit/              # Chainlit-specific configurations
β”œβ”€β”€ .github/                # GitHub templates and workflows
β”œβ”€β”€ public/                 # Static assets (themes, logos, etc.)
β”œβ”€β”€ src/naked_chat/         # Main application package
β”œβ”€β”€ tests/                  # Test suite
β”œβ”€β”€ pyproject.toml          # Project configuration and dependencies
└── README.md              # This file

πŸš€ Quick Start

Prerequisites

  • Python 3.9 or higher
  • uv (recommended) or pip

Installation

  1. Clone the repository:

    git clone https://github.com/naked-insurance/naked-chat-poc.git
    cd naked-chat-poc
    
  2. Set up the environment:

    # Using uv (recommended)
    uv venv
    source .venv/bin/activate  # On Windows: .venv\Scripts\activate
    uv pip install -e ".[dev]"
    
    # Or using pip
    python -m venv .venv
    source .venv/bin/activate  # On Windows: .venv\Scripts\activate
    pip install -e ".[dev]"
    
  3. Configure environment variables:

    cp .env.example .env
    # Edit .env with your API keys and configuration
    
  4. Run the application:

    chainlit run src/naked_chat/app.py
    

The application will be available at http://localhost:8000.

βš™οΈ Configuration

Environment Variables

Copy .env.example to .env and configure the following variables:

  • OPENAI_API_KEY: Your OpenAI API key
  • GOOGLE_API_KEY: Your Google Gemini API key
  • DEFAULT_MODEL: Default LLM model to use

Chainlit Configuration

The .chainlit/config.toml file contains Chainlit-specific settings for data persistence, file uploads, and UI customization.

πŸ§ͺ Development

Running Tests

# Run all tests
pytest

# Run with coverage
pytest --cov=naked_chat

Code Quality

# Linting and formatting with Ruff
ruff check .
ruff format .

# Type checking with mypy
mypy src/naked_chat

Development Workflow

  1. Create a feature branch: git checkout -b feature/your-feature-name
  2. Make your changes
  3. Run tests and quality checks: pytest && ruff check . && mypy src/naked_chat
  4. Commit your changes: git commit -m "Add your feature"
  5. Push and create a pull request

πŸ“ Project Structure Details

  • src/naked_chat/: Main application package following the src layout
    • app.py: Chainlit application entry point
    • models/: LLM integration modules
    • utils/: Utility functions and helpers
  • tests/: Comprehensive test suite
    • Unit tests for core functionality
    • Integration tests for LLM providers
  • .chainlit/: Chainlit configuration
    • config.toml: Framework settings and customizations
  • public/: Static assets
    • theme.json: Custom branding and themes
    • Assets like logos, favicons, etc.

🀝 Contributing

This is an internal POC project. Please follow the established code style and ensure all tests pass before submitting changes.

πŸ“„ License

This project is proprietary to Naked Insurance.


Note: This is a Proof of Concept intended for internal evaluation and demonstration purposes.