feat: route with Switchyard libsy in process - #586
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
|
Signed-off-by: Bryan Bednarski <bbednarski@nvidia.com>
Signed-off-by: Bryan Bednarski <bbednarski@nvidia.com>
Keep preservation on TranslationEngine, the API consumed by NVIDIA/NeMo-Relay#586, and remove the unused built-in convenience decoder. Signed-off-by: Bryan Bednarski <bbednarski@nvidia.com>
Keep preservation on TranslationEngine, the API consumed by NVIDIA/NeMo-Relay#586, and remove the unused built-in convenience decoder. Signed-off-by: Bryan Bednarski <bbednarski@nvidia.com>
|
Superseded by the generic native C ABI v2 host/SDK in #594 and the external Switchyard run_stream plugin in NVIDIA-NeMo/Switchyard#220. Parity is now proven with fake-provider process E2E plus a live Inference Hub smoke across two models (8 buffered, 4 streaming); the resulting Phoenix trace contains 12 switchyard.routing.requested and 12 switchyard.routing.decision events: http://10.193.162.160:6006/projects/UHJvamVjdDoxOA==/traces. This PR remains the behavioral reference for the static implementation. |
Keep preservation on TranslationEngine, the API consumed by NVIDIA/NeMo-Relay#586, and remove the unused built-in convenience decoder. Signed-off-by: Bryan Bednarski <bbednarski@nvidia.com>
Keep preservation on TranslationEngine, the API consumed by NVIDIA/NeMo-Relay#586, and remove the unused built-in convenience decoder. Signed-off-by: Bryan Bednarski <bbednarski@nvidia.com>
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 supports both weighted random routing and libsy's judge-backed LLM
classifier. It remains a placeholder while the focused raw-stream preservation
dependency lands 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-translationtoaa0a31126cc7ca922a6acdf4f1ef656744698c6c, the rebased 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-005. Theclassifier now places its governing policy in
LlmRequest.instructions, soOpenAI Chat receives a system message and OpenAI Responses receives its
native instructions field.
classifier protocols.
policy with role
system, followed by the task with roleuser, for bothbuffered and streaming classifier runs.
TaskClassifierConfig.recent_turn_windowafter the originaldevelopment pin. Relay explicitly sets it to
Noneto preserve the existingclassifier behavior; exposing it as Relay configuration is outside this
compatibility update.
After it lands, the fork pin can move to upstream
main; compatible versionedcrates will replace source pins after Switchyard publishes them.
Validation:
cargo test -p nemo-relay-switchyard— 32 passedcargo test -p nemo-relay-cli --features switchyard --test switchyard_process_e2e— 2 passedcargo test -p nemo-relay-ffi -- --test-threads=1— 155 passedcargo clippy --workspace --all-targets -- -D warningscargo fmt --alluv run pre-commit run --files ...uv run pre-commit run --all-filesexamples/switchyard/run-classifier-e2e.shKnown repository-wide validation issue:
just test-rustis not green in thischeckout. It reproduces the existing
release/0.6plugin-registry orderingfailure (
pii_redactionis not registered, followed by poisoned sharedregistries): 895 core tests pass before 77 related failures. The focused
Switchyard and serialized FFI paths are green, and this PR's previous
cross-platform CI matrix passed.
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_relay,classifier_prompt_is_encoded_as_a_system_instruction, andswitchyard_plugin_runs_classifier_and_routed_calls_without_a_servicefor thelibrary/Relay ownership and provider-boundary contracts.
Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)