NVIDIA-NeMo / NVIDIA-NeMo/Switchyard
routing: make system prompts follow answer targets
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 3.2k
- Forks
- 291
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 182
Description
Linear: SWITCH-1253
Problem
A client calls a Switchyard route without knowing which upstream model will answer. Those models may need different standing system instructions.
Today this is only configurable through Stage and Composite route fields such as efficient_system_prompt and capable_system_prompt. Other routers do not have the same configuration surface.
Fallback also matters. If a route selects fast and that target fails, the request sent to capable must receive the capable prompt. It cannot reuse a request already prepared for fast.
Proposed interface
Allow the prompt to be configured on a target:
[targets.fast]
id = "meta/llama-small"
llm_client = "together"
system_prompt = "Be concise."
[targets.capable]
id = "meta/llama-large"
llm_client = "together"
system_prompt = "Reason carefully."
[routes.agent]
id = "switchyard/agent"
type = "stage_router"
efficient_target = "fast"
capable_target = "capable"
The prompt should follow the answer target rather than the router type. Judge, classifier, and reviewer calls should remain unchanged.
Implementation
- Translation owns the model and prompt mutation for one request.
libsyremains provider-neutral and does not carry answer-call or request-preparation state.libsy-llm-clientdistinguishes routing dependencies from completion candidates and prepares each selected or fallback candidate immediately before it is called.- The native runner builds the effective prompt map from
[targets.*].system_prompt.
This keeps provider request mutation out of libsy and prevents one candidate's prompt from leaking into a fallback.
Compatibility
- Existing configuration without target prompts behaves as before.
- Native Stage and Composite configuration must move
capable_system_promptandefficient_system_promptto[targets.*].system_prompt. - Direct libsy and Python Stage prompt configuration remain unchanged.
- Routing decisions, retry behavior, and fallback order do not change.
Pull requests
- #455: request preparation helper, merged
- #463: completion-candidate preparation at the client boundary
- #464: target configuration, tests, and docs
Done when
- Every built-in client-visible answer path uses the selected target's prompt.
- Each fallback is prepared independently.
- Existing caller instructions are preserved after the target prompt.
- Judge, classifier, and reviewer calls remain unprompted.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading PRs #455, #463, and #464, then trace how libsy-llm-client prepares completion candidates and how the native runner builds the effective target prompt map. Verify each selected or fallback answer target is prepared independently, caller instructions remain intact, and judge, classifier, and reviewer calls stay unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, rust
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100