mirror of
https://github.com/katanemo/plano.git
synced 2026-06-23 15:38:07 +02:00
1.9 KiB
1.9 KiB
ADR 004: hermesllm as a Pure Rust Library
Status: Accepted
Context
LLM providers use different API formats (OpenAI Chat Completions, Anthropic Messages, Amazon Bedrock Converse, Gemini). The gateway needs to translate between these formats in two places:
- In the
llm_gatewayWASM filter (inline in Envoy) - In Brightstaff (for routing decisions and response processing)
The options were:
- Duplicate translation logic in both places
- Put translation logic in
common(shared crate, but WASM-constrained) - Create a separate pure Rust library with no WASM dependencies
Decision
Create hermesllm as a standalone Rust library that handles all LLM protocol translation. It must never depend on proxy-wasm or common. Both WASM crates (via common) and Brightstaff use hermesllm directly.
Consequences
Enables:
- Single source of truth for LLM protocol translation
- Reusable outside the gateway context (could be published as an independent crate)
- Full Rust standard library available (no WASM constraints on the library itself)
- Clean separation: protocol knowledge lives in
hermesllm, gateway logic lives in filters
Requires:
hermesllmmust not importproxy-wasm,common, or any WASM-specific crate- Adding a new provider requires changes only in
hermesllm(plus config incommon/configuration.rsandenvoy.template.yaml) - Types shared between
hermesllmand the filters go throughcommon's re-exports
Prevents:
- Circular dependencies (hermesllm is always a leaf in the dependency graph)
- Accidentally coupling protocol translation to WASM runtime specifics
- Needing to maintain two separate translation implementations
Dependency direction:
prompt_gateway → common → hermesllm
llm_gateway → common → hermesllm
llm_gateway → hermesllm (direct)
brightstaff → hermesllm (direct)
hermesllm → (no workspace deps)