-
Notifications
You must be signed in to change notification settings - Fork 196
feat(server): add config-only conversation routing example #453
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| # Conversation routing example | ||
|
Comment on lines
+1
to
+4
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# List the first lines of every Markdown file to see the established SPDX header style.
fd -e md --exec sh -c 'echo "== $1"; head -3 "$1"' sh {}Repository: NVIDIA-NeMo/Switchyard Length of output: 5925 🏁 Script executed: #!/bin/bash
set -euo pipefail
python3 - <<'PY'
from pathlib import Path
import re
target = Path("examples/conversation-routing/README.md")
print(f"== {target}")
for i, line in enumerate(target.read_text().splitlines()[:6], 1):
print(f"{i}: {line}")
print("ATX headings in first six lines:")
for i, line in enumerate(target.read_text().splitlines()[:6], 1):
if re.match(r"^ {0,3}#{1,6}(?:[ \t]+|$)", line):
print(f" line {i}: {line}")
print("\nMarkdown files with SPDX headers:")
for path in sorted(Path(".").rglob("*.md")):
lines = path.read_text(errors="replace").splitlines()[:5]
if any("SPDX-" in line for line in lines):
print(f"== {path}")
for i, line in enumerate(lines, 1):
if "SPDX-" in line or i <= 3:
print(f"{i}: {line}")
PY
printf '\n== Markdown/config references to the conversation-routing README or SPDX style\n'
rg -n --hidden -g '*.md' -g '*.yml' -g '*.yaml' -g '*.toml' -g '*.json' \
'conversation-routing|SPDX-FileCopyrightText|SPDX-License-Identifier' . \
| head -120Repository: NVIDIA-NeMo/Switchyard Length of output: 6530 🏁 Script executed: #!/bin/bash
set -euo pipefail
sed -n '45,105p' .github/workflows/ci.ymlRepository: NVIDIA-NeMo/Switchyard Length of output: 2459 Hide the SPDX header from Markdown rendering. Lines 1–2 render as level-1 headings. Use HTML comments, consistent with the repository’s Markdown files. 🤖 Prompt for AI Agents |
||
|
|
||
| A two-tier conversation deployment built entirely from the checked-in | ||
| `switchyard-server` config surface — no custom code. | ||
|
|
||
| | Route | Mechanism | Behavior | | ||
| |---|---|---| | ||
| | `switchyard/conversation` | `llm_classifier` custom mode | Pre-hoc scoring card: a judge reads the turn against the conversation capability card (CONV-1..9) and names `efficient` or `capable`. | | ||
| | `switchyard/conversation-regret` | `llm_classifier` escalation mode | Regret-driven escalation: the efficient tier answers by default; when the judge sees user regret (correction, re-ask, dissatisfaction), the session latches to capable. | | ||
|
|
||
| Run: | ||
|
|
||
| ```bash | ||
| export OPENROUTER_API_KEY=sk-or-... | ||
| switchyard-server --config examples/conversation-routing/conversation-routing.toml --port 4000 | ||
| ``` | ||
|
|
||
| Then point an OpenAI-compatible client at `http://localhost:4000/v1` with | ||
| `model = "switchyard/conversation"` or `"switchyard/conversation-regret"`. | ||
|
|
||
| Notes: | ||
|
|
||
| - Replace the OpenRouter model ids with your own tiers; the judge target is a | ||
| separate small model, not a routing destination. | ||
| - The scoring card is uncalibrated. Tune the CONV rules and thresholds against | ||
| your own traffic (user-regret logs are the free calibration label). | ||
| - Escalation latches one-way for the session and does not decay back to the | ||
| efficient tier; a conversation "task" spans the whole session. | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we remove these tests? these include live tests which we don't want, and an example doesn't need tests, thanks