refactor: consolidate to handler-base, migrate to pyproject.toml, add tests

This commit is contained in:
2026-02-02 07:11:02 -05:00
parent 6ef42b3d2c
commit bed9fa4297
10 changed files with 585 additions and 1132 deletions

View File

@@ -4,19 +4,10 @@ Text-based chat pipeline for the DaviesTechLabs AI/ML platform.
## Overview
A NATS-based service that handles chat completion requests with RAG (Retrieval Augmented Generation).
A NATS-based service that handles chat completion requests with RAG (Retrieval Augmented Generation). It uses the [handler-base](https://git.daviestechlabs.io/daviestechlabs/handler-base) library for standardized NATS handling, telemetry, and health checks.
**Pipeline:** Query → Embeddings → Milvus → Rerank → LLM → (optional TTS)
## Versions
| File | Description |
|------|-------------|
| `chat_handler.py` | Standalone implementation (v1) |
| `chat_handler_v2.py` | Uses handler-base library (recommended) |
| `Dockerfile` | Standalone image |
| `Dockerfile.v2` | Handler-base image |
## Architecture
```
@@ -88,19 +79,10 @@ NATS (ai.chat.request)
## Building
```bash
# Standalone image (v1)
docker build -f Dockerfile -t chat-handler:latest .
docker build -t chat-handler:latest .
# Handler-base image (v2 - recommended)
docker build -f Dockerfile.v2 -t chat-handler:v2 .
```
## Dependencies
The v2 handler depends on [handler-base](https://git.daviestechlabs.io/daviestechlabs/handler-base):
```bash
pip install git+https://git.daviestechlabs.io/daviestechlabs/handler-base.git
# With specific handler-base tag
docker build --build-arg BASE_TAG=latest -t chat-handler:latest .
```
## Related