feat: route with Switchyard libsy in process - #586
Draft
bbednarski9 wants to merge 3 commits into
Draft
Conversation
Signed-off-by: Bryan Bednarski <bbednarski@nvidia.com>
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Enterprise Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
Signed-off-by: Bryan Bednarski <bbednarski@nvidia.com>
Signed-off-by: Bryan Bednarski <bbednarski@nvidia.com>
License DiffCompared against Lockfile license changesLockfile License ChangesRustAdded
Removed
Updated/Changed
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Replaces the service-backed Switchyard plugin with an in-process, library-first
integration driven by
libsy::Algorithm::run_stream. Relay remains responsiblefor provider dispatch, authentication, retries, fallback, and observability.
The draft now supports both weighted random routing and libsy's judge-backed LLM
classifier. It remains a placeholder while the focused Switchyard dependencies
land and compatible Switchyard 0.2 crates are published.
Details
run_streamlifecycle. Switchyard requests provider work,Relay dispatches every
CallLlm, and Relay returns the real buffered response,stream, or provider error through
CallLlmRequest::respond.kind = "llm_classifier"with classifier, weak, and strong semantictargets; solve/confidence thresholds; optional capability floor; session
affinity; and message-hash fallback.
configured provider bindings. The plugin does not use
switchyard-llm-clientorswitchyard-server.targets may use OpenAI Chat, OpenAI Responses, or Anthropic Messages.
switchyard-translationas the sole request, response, and streamtranslation layer. The plugin does not fall back to Relay provider codecs.
follows libsy's fail-closed strong-target behavior; only a failed final routed
call participates in Relay retry classification.
genuine libsy lifecycle data. Classifier consultations are marked
is_routed_call = false.telemetry, process-boundary, and standalone no-service classifier coverage.
examples, dedicated Switchyard ATOF receiver, and service-backed version-1
configuration.
switchyard-libsy,switchyard-protocol, andswitchyard-translationto773a451125231e69209cadb697666a1f03d8f909, the source behindfeat(translation): preserve raw stream events NVIDIA-NeMo/Switchyard#192.
Breaking change: the Switchyard plugin no longer supports service-backed
version-1 configuration.
Current upstream dependency:
LIBSY-GAP-005records that the pinned classifier builds its governing promptas a normal system-role message. The OpenAI encoders consequently emit it as
user content or omit the native instructions field. Relay does not rewrite the
request around this gap.
pin. The rest of the classifier lifecycle is active and passing.
but is not committed or pushed as part of this Relay-only update.
Validation:
cargo test -p nemo-relay-switchyard— 31 passed, 1 upstream contract probe ignoredcargo test -p nemo-relay-cli --features switchyard --test switchyard_process_e2e— 2 passedexamples/switchyard/run-classifier-e2e.shcargo clippy --workspace --all-targets -- -D warningscargo fmt --all --checkuv run pre-commit run --files ...uv run pre-commit run --all-filesjust docs— 0 errors; authenticated Fern redirect check unavailable locallyKnown repository-wide validation issue:
just test-rustis not green in thischeckout. Its first failure is in a core pricing/plugin-registry test because
the
pii_redactioncomponent is not registered; later tests inherit poisonedregistry locks. The first failure reproduces in isolation and is unrelated to
the Switchyard classifier paths.
Where should the reviewer start?
Start with
crates/switchyard/src/component.rsfor algorithm construction andthe generic
run_streamdriver. Then reviewclassifier_run_stream_offloads_the_judge_and_routed_calls_to_relayandswitchyard_plugin_runs_classifier_and_routed_calls_without_a_servicefor thelibrary/Relay ownership boundary.
Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)