Skip to content

feat(llm): add unary chat model publisher - #15552

Merged
furionw merged 4 commits into
mainfrom
qiwa/unary-chat-model
Oct 6, 2026
Merged

furionw merged 4 commits into
mainfrom
qiwa/unary-chat-model

Conversation

@furionw

@furionw furionw commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Why

Application-owned unary chat handlers currently call both register_model and serve_unary_endpoint to become public chat models. An application that calls a remote generator also has to create its endpoint client and wait for a routable worker before advertising its public model.

What changes

  • Add UnaryChatModel(model_path, service_name, public_model_name=None, chat_template=None) to dynamo.llm. Its serve(runtime, handler) creates <service_name>.app.generate, registers an aggregated token-input Chat model, and serves the application handler.
  • Add await LLMUnaryClient.connect(runtime, endpoint_name), which creates the endpoint client and waits for a routable instance before returning the existing unary client wrapper. The direct constructor remains available.
  • The public model name defaults to the service name and can be overridden. Request logic remains in the application handler.

Full PR sequence

  1. #13293 — encoder handoff (merged)
  2. #15195 — unary endpoint helpers (merged)
  3. #15552 — model and client utilities
  4. #14859 — application-owned orchestrator example
  5. #15200 — draft end-to-end verification

The three open PRs form GitHub stack #15572. The first two remain in completed stack #15197.

Verification

  • Exact stacked test head 7655a83052a9c721571a6a101715337b4cbc329d (test(examples): cover the remote custom encoder topology end to end #15200), rebuilt in release mode on dl-a100 with two A100 80GB GPUs: 29 focused utility/orchestrator tests and both plain-text and image serve cases passed.
  • The image case confirmed 42, the classifier label, and the logged encoder-to-generator handoff. Pre-commit and pre-merge checks passed on all three stacked PR heads.

Summary by CodeRabbit

  • New Features
    • Added support for serving application-owned handlers as chat models, with configurable model names and chat templates.
    • Added an asynchronous client connection method that waits for a service instance to become available before connecting.

@devin-ai-integration

devin-ai-integration Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

✅ Dynamo PR CI passed — run 37032048466 (attempt 1) on 2e1226b792

Gate checks: ✅ backend-status-check · ✅ deploy-status-check · ✅ dynamo-status-check

Posted automatically by Devin for run 37032048466. Updated on every full-CI run of this PR.

@furionw
furionw marked this pull request as ready for review October 2, 2026 17:15
@furionw
furionw requested a review from a team as a code owner October 2, 2026 17:15
@coderabbitai

coderabbitai Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: ai-dynamo/dynamo/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: bec39a6d-74ae-4bf6-b03d-c7d3cbeefb9e

📥 Commits

Reviewing files that changed from the base of the PR and between e07d871 and 2e1226b.

📒 Files selected for processing (3)
  • lib/bindings/python/src/dynamo/llm/__init__.py
  • lib/bindings/python/src/dynamo/llm/_unary.py
  • lib/bindings/python/tests/test_llm_unary.py

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.


Walkthrough

The Python LLM package now exports UnaryChatModel. The new model registers an application handler as an aggregated chat model and serves it through a unary endpoint. LLMUnaryClient.connect creates a client for a named runtime endpoint and waits for instances. Tests cover registration, request forwarding, readiness, and errors.

Changes

Unary chat model

Layer / File(s) Summary
Register and serve unary chat handlers
lib/bindings/python/src/dynamo/llm/__init__.py, lib/bindings/python/src/dynamo/llm/_unary.py, lib/bindings/python/tests/test_llm_unary.py
UnaryChatModel registers the configured endpoint as an aggregated chat model and serves the handler. The package exports the class. Tests cover default and explicit public names, optional templates, endpoint selection, and request forwarding.
Connect unary clients to runtime endpoints
lib/bindings/python/src/dynamo/llm/_unary.py, lib/bindings/python/tests/test_llm_unary.py
LLMUnaryClient.connect obtains the named endpoint client, waits for available instances, and returns a wrapped client. Tests cover readiness and error propagation.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~12 minutes

Merge Risk: ⚪ Minimal · up to 2e122

The unary chat model and client connection changes appear ready to merge after normal checks.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 15 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ⚠️ Warning The description explains the motivation, implementation, PR sequence, and verification results. However, it does not include the required Related Issues section or identify where the reviewer should s… Add the required Related Issues section and either link the relevant issue or check the no-related-issue confirmation. Also add a Where should the reviewer start section that names the key files or changes for review.
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly identifies the main change: adding a unary chat model publisher to the LLM package.
Full details: Description check

Explanation

The description explains the motivation, implementation, PR sequence, and verification results. However, it does not include the required Related Issues section or identify where the reviewer should start.

  • Fix all pre-merge checks with AI
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


Comment @coderabbitai help to get the list of available commands.

Comment thread lib/bindings/python/src/dynamo/llm/_unary.py

@jthomson04 jthomson04 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No actionable findings from the source review at 2e1226b. Tests and CI were not independently validated.

@furionw
furionw merged commit b8c57d6 into main Oct 6, 2026
120 checks passed
@furionw
furionw deleted the qiwa/unary-chat-model branch October 6, 2026 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants