refactor(libsy): use conversation IR request and response types#58
Open
nachiketb-nvidia wants to merge 10 commits into
Open
refactor(libsy): use conversation IR request and response types#58nachiketb-nvidia wants to merge 10 commits into
nachiketb-nvidia wants to merge 10 commits into
Conversation
Signed-off-by: Greg Clark <grclark@nvidia.com> feat: poc rand router Signed-off-by: Greg Clark <grclark@nvidia.com> feat: poc llm class router Signed-off-by: Greg Clark <grclark@nvidia.com> docs: add @route decorator design spec for libsy optimizer port docs: clarify abstract optimize and classifier preamble in @route spec feat(agentapi): add chat data types for optimizer port feat(agentapi): add optimizer role interfaces and decision types feat(agentapi): add weighted random router feat(agentapi): add multi-round LLM-classifier router feat(agentapi): add @route decorator driving the optimizer loop feat(agentapi): export public @route API from subpackage test(agentapi): cover default-adapter prompt and system-message paths feat: python decorator example Signed-off-by: Greg Clark <grclark@nvidia.com> docs: libsy design doc Signed-off-by: Greg Clark <grclark@nvidia.com> docs: fix design doc Signed-off-by: Greg Clark <grclark@nvidia.com> docs: fix design doc Signed-off-by: Greg Clark <grclark@nvidia.com> feat(libsy): add RoutedClient LLM-client wrapper over the optimizer traits docs(libsy): reflect RoutedClient wrapper in design doc style(libsy): apply rustfmt to client.rs docs(libsy): add README and LLM-classifier research-agent examples feat: multi llm orch and algo Signed-off-by: Greg Clark <grclark@nvidia.com> refactor(libsy): migrate routers and examples to the OrchAlgo/MultiLlmOrchestrator model feat: orchestrate_direct Signed-off-by: Greg Clark <grclark@nvidia.com> fix: concurrency bug Signed-off-by: Greg Clark <grclark@nvidia.com> fix: promise.set_reponse need to take Result Signed-off-by: Greg Clark <grclark@nvidia.com> chore: move interfaces to lib Signed-off-by: Greg Clark <grclark@nvidia.com> feat: proxy demo Signed-off-by: Greg Clark <grclark@nvidia.com> feat(libsy): add ensemble router with per-session state docs: libsy documentation update Signed-off-by: Greg Clark <grclark@nvidia.com> chore: remove old files Signed-off-by: Greg Clark <grclark@nvidia.com> docs: add srd Signed-off-by: Greg Clark <grclark@nvidia.com> docs: srd rm image Signed-off-by: Greg Clark <grclark@nvidia.com> docs: remove srd doc from branch chore: review feedback Signed-off-by: Greg Clark <grclark@nvidia.com> docs: fix llm_class eg Signed-off-by: Greg Clark <grclark@nvidia.com> chore: review cleanup Signed-off-by: Greg Clark <grclark@nvidia.com> fix: unbounded_channel in orch for promise_tx Signed-off-by: Greg Clark <grclark@nvidia.com> chore: add get_target_set to algo Signed-off-by: Greg Clark <grclark@nvidia.com> chore: remove OrchAlgo builder Signed-off-by: Greg Clark <grclark@nvidia.com> docs: improve README Signed-off-by: Greg Clark <grclark@nvidia.com> docs: cleanup readme Signed-off-by: Greg Clark <grclark@nvidia.com>
Signed-off-by: Greg Clark <grclark@nvidia.com>
Signed-off-by: Greg Clark <grclark@nvidia.com>
Signed-off-by: Greg Clark <grclark@nvidia.com>
Signed-off-by: Greg Clark <grclark@nvidia.com>
Signed-off-by: Greg Clark <grclark@nvidia.com>
Signed-off-by: Greg Clark <grclark@nvidia.com>
Signed-off-by: Greg Clark <grclark@nvidia.com>
fcdc0ad to
eab29f6
Compare
Contributor
|
#17 is merged can you rebase? @nachiketb-nvidia |
messiaen
requested changes
Jul 14, 2026
Contributor
There was a problem hiding this comment.
Let's move these types into a protocol or similar crate.
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.
Why
PR #17 introduced libsy with bespoke
LlmRequest/LlmResponsestructs that only carried a text prompt and completion. That makes libsy look like it owns a new LLM wire abstraction, when Switchyard already has a shared provider-neutral conversation IR inswitchyard-translation.This change makes libsy align with that direction now:
LlmRequestandLlmResponseare semantic aliases overConversationRequestandConversationResponse, while provider-specific details stay in clients/hosts rather than in router algorithms.What
LlmRequestandLlmResponsestructs with aliases toConversationRequestandConversationResponse.text_request,text_response,request_text, andresponse_text.llm_class,ensemble, andrandto inspect conversation IR via the helpers instead of oldprompt/completionfields.Step::ReturnToAgentso the larger conversation response does not inflate the stream enum.Algorithm/Request/ResponseAPI and compiles it against the shared router builder.How
The algorithms still operate on plain text where their current logic requires text, but that text is now extracted from the shared IR. Generated subcalls are built as text-only
ConversationRequests with the inbound model preserved inmodel; routed target selection remains onDecision::selected_model().The proxy demo still lets libsy make routing decisions and Switchyard own HTTP/profile serving. The demo now creates a text-only libsy request from inbound prompt text, runs the classifier algorithm directly, and returns a chat-completion response for Switchyard to translate back to the inbound format.
What to Review
LlmRequest/LlmResponseto the translation IR is the right libsy contract for this PR.Step::ReturnToAgentis acceptable for the stream API after the response type becomes larger.Validation
cargo test -p libsycargo check -p libsy --examplescargo check -p libsy-proxycargo test -p libsy-proxycargo fmt,cargo clippy