updates to adrs and fixing to reflect go refactor.
All checks were successful
Update README with ADR Index / update-readme (push) Successful in 1m2s

This commit is contained in:
2026-02-23 06:14:23 -05:00
parent f19fa3e969
commit 100ba21eba
7 changed files with 181 additions and 129 deletions

View File

@@ -28,27 +28,29 @@ kubernetes/
### AI/ML Repos (git.daviestechlabs.io/daviestechlabs)
```
handler-base/ # Shared library for all handlers
├── handler_base/
│ ├── handler.py # Base Handler class
│ ├── nats_client.py # NATS wrapper
│ ├── config.py # Pydantic Settings
├── health.py # K8s probes
│ ├── telemetry.py # OpenTelemetry
│ └── clients/ # Service clients
├── tests/
── pyproject.toml
handler-base/ # Shared Go module for all NATS handlers
├── clients/ # HTTP clients (LLM, STT, TTS, embeddings, reranker)
├── config/ # Env-based configuration (struct tags)
├── gen/messagespb/ # Generated protobuf stubs
├── handler/ # Typed NATS message handler with OTel + health wiring
├── health/ # HTTP health + readiness server
├── messages/ # Type aliases from generated protobuf stubs
├── natsutil/ # NATS publish/request with protobuf encoding
├── proto/messages/v1/ # .proto schema source
── go.mod
└── buf.yaml # buf protobuf toolchain config
chat-handler/ # Text chat service
voice-assistant/ # Voice pipeline service
pipeline-bridge/ # Workflow engine bridge
├── {name}.py # Handler implementation (uses handler-base)
├── pyproject.toml # PEP 621 project metadata (see ADR-0012)
├── uv.lock # Deterministic lock file
├── tests/
│ ├── conftest.py
│ └── test_{name}.py
── Dockerfile
chat-handler/ # Text chat service (Go)
voice-assistant/ # Voice pipeline service (Go)
pipeline-bridge/ # Workflow engine bridge (Go)
stt-module/ # Speech-to-text bridge (Go)
tts-module/ # Text-to-speech bridge (Go)
├── main.go # Service entry point
├── main_test.go # Unit tests
├── e2e_test.go # End-to-end tests
├── go.mod # Go module (depends on handler-base)
── Dockerfile # Distroless container (~20 MB)
└── renovate.json # Dependency update config
argo/ # Argo WorkflowTemplates
├── {workflow-name}.yaml
@@ -138,7 +140,20 @@ tts_task = synthesize_speech(text=llm_task.output) # noqa: F841
### Project Structure
```go
// Go handler services use handler-base shared module
import (
"git.daviestechlabs.io/daviestechlabs/handler-base/clients"
"git.daviestechlabs.io/daviestechlabs/handler-base/config"
"git.daviestechlabs.io/daviestechlabs/handler-base/handler"
"git.daviestechlabs.io/daviestechlabs/handler-base/health"
"git.daviestechlabs.io/daviestechlabs/handler-base/messages"
"git.daviestechlabs.io/daviestechlabs/handler-base/natsutil"
)
```
```python
# Python remains for Ray Serve, Kubeflow pipelines, Gradio UIs
# Use async/await for I/O
async def handle_message(msg: Msg) -> None:
...
@@ -149,10 +164,6 @@ class ChatRequest:
user_id: str
message: str
enable_rag: bool = True
# Use msgpack for NATS messages
import msgpack
data = msgpack.packb({"key": "value"})
```
### Naming
@@ -200,31 +211,36 @@ except Exception as e:
### NATS Message Handling
```python
import nats
import msgpack
All NATS handler services use Go with Protocol Buffers encoding (see [ADR-0061](decisions/0061-go-handler-refactor.md)):
async def message_handler(msg: Msg) -> None:
try:
# Decode MessagePack
data = msgpack.unpackb(msg.data, raw=False)
# Process
result = await process(data)
# Reply if request-reply pattern
if msg.reply:
await msg.respond(msgpack.packb(result))
# Acknowledge for JetStream
await msg.ack()
except Exception as e:
logger.error(f"Handler error: {e}")
# NAK for retry (JetStream)
await msg.nak()
```go
// Go NATS handler (production pattern)
func (h *Handler) handleMessage(msg *nats.Msg) {
var req messages.ChatRequest
if err := proto.Unmarshal(msg.Data, &req); err != nil {
h.logger.Error("failed to unmarshal", "error", err)
return
}
// Process
result, err := h.process(ctx, &req)
if err != nil {
h.logger.Error("handler error", "error", err)
msg.Nak()
return
}
// Reply if request-reply pattern
if msg.Reply != "" {
data, _ := proto.Marshal(result)
msg.Respond(data)
}
msg.Ack()
}
```
> **Python NATS** is still used in Ray Serve `runtime_env` and Kubeflow pipeline components where needed, but all dedicated NATS handler services are Go.
---
## Kubernetes Manifest Conventions
@@ -499,8 +515,9 @@ Each application should have a README with:
| Use `latest` image tags | Pin to specific versions |
| Skip health checks | Always define liveness/readiness |
| Ignore resource limits | Set appropriate requests/limits |
| Use JSON for NATS messages | Use MessagePack (binary) |
| Synchronous I/O in handlers | Use async/await |
| Use JSON for NATS messages | Use Protocol Buffers (see ADR-0061) |
| Write handler services in Python | Use Go with handler-base module (ADR-0061) |
| Synchronous I/O in handlers | Use goroutines / async patterns |
---