Skip to content

feat(protocol): add decision model request and response types - #880

Merged
nachiketb-nvidia merged 4 commits into
mainfrom
nachiketb/switch-1591-decision-protocol
Sep 30, 2026
Merged

nachiketb-nvidia merged 4 commits into
mainfrom
nachiketb/switch-1591-decision-protocol

Conversation

@nachiketb-nvidia

@nachiketb-nvidia nachiketb-nvidia commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

What

Add public Decision Model types in crates/protocol:

  • Boolean, Choice, and Score questions and answers.
  • Structured input content, string IDs, optional ModelId, and shared Usage.
  • Optional probability distributions and separate provider confidence.

Why

Provide the Decision Model protocol for future clients and algorithms.

Notes for reviewers

All fields are public, with derived serialization and deserialization. No constructors, validation helpers, or new error type. Score levels remain in the request; responses preserve provider scores and probabilities.

Validation: formatting, protocol compilation, and targeted Clippy passed. No tests added or run, as requested.

Signed-off-by: nachiketb <nachiketb@nvidia.com>
@nachiketb-nvidia
nachiketb-nvidia requested a review from a team as a code owner September 30, 2026 19:02
@github-actions

github-actions Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
PR Preview Action v1.8.1

🚀 View preview at
https://NVIDIA-NeMo.github.io/Switchyard/pr-preview/pr-880/

Built to branch gh-pages at 2026-09-30 19:14 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@coderabbitai

coderabbitai Bot commented Sep 30, 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: NVIDIA-NeMo/Switchyard/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 5d14ca51-8ead-4de4-82f3-d4bc1b035587

📥 Commits

Reviewing files that changed from the base of the PR and between fbabf51 and d6df493.

📒 Files selected for processing (2)
  • crates/protocol/src/decision.rs
  • crates/protocol/src/lib.rs

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 protocol crate adds a public decision protocol. It validates request questions, response answers, numeric values, and probability distributions during construction and deserialization.

Changes

Decision Protocol

Layer / File(s) Summary
Validated decision values
crates/protocol/src/decision.rs
Adds checked probability, score, and provider-confidence types. Defines the distribution sum tolerance.
Decision request contract
crates/protocol/src/decision.rs
Adds Boolean, choice, and score question types. Request construction and deserialization validate the question set, choice options, and score levels.
Request-bound response validation
crates/protocol/src/decision.rs, crates/protocol/src/lib.rs
Adds response and answer types. Response validation checks question IDs, answer kinds, choices, scores, and optional distributions. Deserialization rejects duplicate map keys. The crate root exports the decision API.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~25 minutes

Merge Risk: ⚪ Minimal · up to d6df4

This adds standalone decision protocol types with validation at construction and deserialization. No concrete merge-blocking risk was identified in the supplied material. The author reports that formatting, check and clippy passed. No tests were added.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 45.83% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 24 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding Decision Model request and response types to the protocol crate.
  • 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.


I’m a rabbit with a protocol to try,
I check each answer as it hops by.
Choice IDs line up, scores stay in range,
Probabilities sum without a change.
I tuck the new decision types away,
Then nibble some clover to end the day.

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

Signed-off-by: nachiketb <nachiketb@nvidia.com>
Signed-off-by: nachiketb <nachiketb@nvidia.com>
Signed-off-by: nachiketb <nachiketb@nvidia.com>
@nachiketb-nvidia
nachiketb-nvidia merged commit 0266133 into main Sep 30, 2026
19 checks passed
@nachiketb-nvidia
nachiketb-nvidia deleted the nachiketb/switch-1591-decision-protocol branch September 30, 2026 20:00
linj-glitch added a commit to pst2154/Switchyard that referenced this pull request Oct 1, 2026
Bring in NVIDIA-NeMo#794, NVIDIA-NeMo#878 and NVIDIA-NeMo#880 from main. None of them touch the
escalation router, judge, prompts, or docs changed by this PR, and the
merge applied without conflicts.

Signed-off-by: Lin Jia <linj@nvidia.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants