Repository navigation
refactor(http): extract server core and separate chat inference - #17178
sachalmalick wants to merge 2 commits into
Conversation
Signed-off-by: Sachal Malick <s@chal.ai>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
WalkthroughChat completions now use a typed controller for model resolution, readiness checks, and inference. The HTTP service can inject an alternate controller. The default Dynamo controller retains model and parser selection. Integration tests cover injected controllers across streaming and non-streaming requests. ChangesChat completions controller
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~25 minutes Merge Risk: ⚪ Minimal · up to
|
| // issue the generate call on the engine | ||
| let stream = engine.generate(request).await.map_err(|e| { | ||
| if super::metrics::request_was_rejected(e.as_ref()) { | ||
| // The controller returns typed output; HTTP retains delivery and metrics. |
There was a problem hiding this comment.
This comment only narrates the immediately following ChatOutput destructuring and repeats the controller/HTTP ownership already documented on ChatController; it adds no non-obvious constraint.
🤖 AI Fix
Remove this comment.
Signed-off-by: Ishan Dhanani <ishandhanani@gmail.com> Signed-off-by: Sachal Malick <s@chal.ai>
Summary
Extract production HTTP transport, lifecycle, disconnect monitoring, and metric primitives into
dynamo-http-server, and separate chat inference behindChatController. Services can reuse the server core and supply a different chat implementation while retaining the existing API schema, validation, metrics, cancellation, and JSON/SSE delivery.Closes #17177. Part of #11320.
How This Was Implemented
lib/http-server.dynamo-llm.ChatControllerandDynamoChatControllerinlib/llm, with.chat_controller(...)builder injection and the existing route/schema.Walkthrough
lib/http-server/src/server.rs:HttpServer::prepareperforms fallible setup before background tasks start;servehandles drain and shutdown.lib/llm/src/http/service/service_v2.rs: builds routes and runtime-backed state, then supplies the completed router to the reusable server.lib/llm/src/controller/chat.rsandcontroller/chat/dynamo.rs: the replaceable inference contract and its default implementation.The server crate depends on runtime utility types but does not activate discovery or request-plane infrastructure, and has no dependency on
dynamo-llm.Validation
Validated on macOS; LLM commands use
--no-default-features.cargo test -p dynamo-http-server --offline --lib -- --test-threads=1— 56 passed.cargo test -p dynamo-llm --no-default-features --locked --offline --lib -- http::service:: frontend_load prompt_tokens --test-threads=1— 389 passed.chat_controller,http-service,chat_template_render_errors,http_metrics,http_websocket,protocols,frontend_protocol_validation_http,anthropic_http_replay,responses_http_replay) — 125 passed.cargo checkpassed for both crates anddynamo-ext-proc.-D warnings. LLM Clippy passed with-D warnings -A clippy::collapsible_match; the allowance covers two existing findings in unchangedprotocols/codec.rs.All existing HTTP tests were retained across the move. Performance was not benchmarked; the chat-controller boundary adds one boxed async future per request.
Summary by CodeRabbit