File size: 4,474 Bytes
971a10e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# 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](https://github.com/astral-sh/uv) (recommended) or pip

### Installation

1. **Clone the repository**:

   ```bash
   git clone https://github.com/naked-insurance/naked-chat-poc.git
   cd naked-chat-poc
   ```

2. **Set up the environment**:

   ```bash
   # 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**:

   ```bash
   cp .env.example .env
   # Edit .env with your API keys and configuration
   ```

4. **Run the application**:
   ```bash
   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

```bash
# Run all tests
pytest

# Run with coverage
pytest --cov=naked_chat
```

### Code Quality

```bash
# 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.