Files
handler-base/messages/proto/messages.proto
Billy D. 35912d5844 feat: add e2e tests, perf benchmarks, and infrastructure improvements
- messages/bench_test.go: serialization benchmarks (msgpack map vs struct vs protobuf)
- clients/clients_test.go: HTTP client tests with pooling verification (20 tests)
- natsutil/natsutil_test.go: encode/decode roundtrip + binary data tests
- handler/handler_test.go: handler dispatch tests + benchmark
- config/config.go: live reload via fsnotify + RWMutex getter methods
- clients/clients.go: SharedTransport + sync.Pool buffer pooling
- messages/messages.go: typed structs with msgpack+json tags
- messages/proto/: protobuf schema + generated code

Benchmark baseline (ChatRequest roundtrip):
  MsgpackMap:    2949 ns/op, 36 allocs
  MsgpackStruct: 2030 ns/op, 13 allocs (31% faster, 64% fewer allocs)
  Protobuf:       793 ns/op,  8 allocs (73% faster, 78% fewer allocs)
2026-02-20 06:44:37 -05:00

175 lines
4.7 KiB
Protocol Buffer

syntax = "proto3";
package messages;
option go_package = "git.daviestechlabs.io/daviestechlabs/handler-base/messages/proto";
// ── Pipeline Bridge ─────────────────────────────────────────────────────────
message PipelineTrigger {
string request_id = 1;
string pipeline = 2;
map<string, string> parameters = 3;
}
message PipelineStatus {
string request_id = 1;
string status = 2;
string run_id = 3;
string engine = 4;
string pipeline = 5;
string submitted_at = 6;
string error = 7;
repeated string available_pipelines = 8;
}
// ── Chat Handler ────────────────────────────────────────────────────────────
message ChatRequest {
string request_id = 1;
string user_id = 2;
string message = 3;
string query = 4;
bool premium = 5;
bool enable_rag = 6;
bool enable_reranker = 7;
bool enable_streaming = 8;
int32 top_k = 9;
string collection = 10;
bool enable_tts = 11;
string system_prompt = 12;
string response_subject = 13;
}
message ChatResponse {
string user_id = 1;
string response = 2;
string response_text = 3;
bool used_rag = 4;
repeated string rag_sources = 5;
bool success = 6;
bytes audio = 7;
string error = 8;
}
message ChatStreamChunk {
string request_id = 1;
string type = 2;
string content = 3;
bool done = 4;
int64 timestamp = 5;
}
// ── Voice Assistant ─────────────────────────────────────────────────────────
message VoiceRequest {
string request_id = 1;
bytes audio = 2;
string language = 3;
string collection = 4;
}
message VoiceResponse {
string request_id = 1;
string response = 2;
bytes audio = 3;
string transcription = 4;
repeated DocumentSource sources = 5;
string error = 6;
}
message DocumentSource {
string text = 1;
double score = 2;
}
// ── TTS Module ──────────────────────────────────────────────────────────────
message TTSRequest {
string text = 1;
string speaker = 2;
string language = 3;
string speaker_wav_b64 = 4;
bool stream = 5;
}
message TTSAudioChunk {
string session_id = 1;
int32 chunk_index = 2;
int32 total_chunks = 3;
bytes audio = 4;
bool is_last = 5;
int64 timestamp = 6;
int32 sample_rate = 7;
}
message TTSFullResponse {
string session_id = 1;
bytes audio = 2;
int64 timestamp = 3;
int32 sample_rate = 4;
}
message TTSStatus {
string session_id = 1;
string status = 2;
string message = 3;
int64 timestamp = 4;
}
message TTSVoiceInfo {
string name = 1;
string language = 2;
string model_type = 3;
string created_at = 4;
}
message TTSVoiceListResponse {
string default_speaker = 1;
repeated TTSVoiceInfo custom_voices = 2;
int64 last_refresh = 3;
int64 timestamp = 4;
}
message TTSVoiceRefreshResponse {
int32 count = 1;
repeated TTSVoiceInfo custom_voices = 2;
int64 timestamp = 3;
}
// ── STT Module ──────────────────────────────────────────────────────────────
message STTStreamMessage {
string type = 1;
bytes audio = 2;
string state = 3;
string speaker_id = 4;
}
message STTTranscription {
string session_id = 1;
string transcript = 2;
int32 sequence = 3;
bool is_partial = 4;
bool is_final = 5;
int64 timestamp = 6;
string speaker_id = 7;
bool has_voice_activity = 8;
string state = 9;
}
message STTInterrupt {
string session_id = 1;
string type = 2;
int64 timestamp = 3;
string speaker_id = 4;
}
// ── Common ──────────────────────────────────────────────────────────────────
message ErrorResponse {
bool error = 1;
string message = 2;
string type = 3;
}