Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
145 changes: 138 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
[workspace]
resolver = "3"
members = [
"examples/dynamo-preproc",
"crates/libsy",
"crates/libsy-llm-client",
"crates/prefill-router",
Expand Down
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ COPY Cargo.toml Cargo.lock rust-toolchain.toml ./
# .cargo/config.toml carries the workspace rustflags (target-cpu, force-frame-pointers).
COPY .cargo ./.cargo
COPY crates ./crates
COPY examples/dynamo-preproc ./examples/dynamo-preproc

RUN cargo build --locked --release -p switchyard-server

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Evaluate the complete agent, model pool, and routing configuration against your
| Gateway | Start here | Current limits |
| --- | --- | --- |
| **LiteLLM** | [Run the Switchyard routing-plugin example](examples/litellm/README.md#quick-start-with-the-local-proxy) | Experimental and checkout-only. The example pins LiteLLM 1.102.0 and supports Stage routing based on request history, plus Random routing. It cannot service intermediate model calls required by classifier or escalation algorithms. |
| **Dynamo / agentgateway** | [Build the Switchyard PreProc example](examples/dynamo-preproc/README.md) | agentgateway 1.0.0, existing Dynamo model pools and EPPs. One PreProc replica; text and function-tool history only. |
| **NeMo Relay** | [Build and configure the native plugin](crates/switchyard-nemo-relay-plugin/README.md#build-from-source) | Requires Relay `>=0.8.0, <1.0.0`. The source-build path requires a Rust toolchain and Python 3. |

Relay 0.8.x and 0.9.0 can lose upstream error status and details when the plugin
Expand Down
1 change: 1 addition & 0 deletions benchmark/switchyard-server.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ ENV PATH="/opt/switchyard/.venv/bin:${PATH}" \

COPY pyproject.toml uv.lock README.md Cargo.toml Cargo.lock ./
COPY crates ./crates
COPY examples/dynamo-preproc ./examples/dynamo-preproc
COPY switchyard ./switchyard
COPY switchyard_rust ./switchyard_rust

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ impl FormatCodec for OpenAiChatCodec {
content: vec![ContentBlock::ToolResult(ToolResult {
tool_call_id,
content: vec![ContentBlock::Text { text }],
is_error: None,
is_error: message.get("is_error").and_then(Value::as_bool),
})],
});
continue;
Expand Down
24 changes: 24 additions & 0 deletions crates/switchyard-translation/tests/request_translation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3311,6 +3311,30 @@ fn openai_stop_string_maps_to_anthropic_stop_sequences() -> TestResult {
Ok(())
}

#[test]
fn openai_tool_result_error_flag_survives_decoding() -> TestResult {
let engine = TranslationEngine::default();
for (flag, expected) in [
(Some(json!(true)), Some(true)),
(Some(json!(false)), Some(false)),
(None, None),
(Some(Value::Null), None),
(Some(json!("true")), None),
] {
let mut message = json!({"role": "tool", "tool_call_id": "call_1", "content": "result"});
if let Some(flag) = flag {
message["is_error"] = flag;
}
let body = json!({"model": "route", "messages": [message]});
let decoded = engine.decode_request(WireFormat::OpenAiChat, &body, &normalized_policy())?;
let ContentBlock::ToolResult(result) = &decoded.request.messages[0].content[0] else {
panic!("expected tool result");
};
assert_eq!(result.is_error, expected);
}
Ok(())
}

// Verifies OpenAI tool results merge into Anthropic user tool-result content.
#[test]
fn openai_tool_results_are_merged_when_translating_to_anthropic() -> TestResult {
Expand Down
43 changes: 43 additions & 0 deletions examples/dynamo-preproc/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

[package]
name = "switchyard-preproc"
version = "0.1.0"
edition = "2024"
rust-version = "1.96.1"
license = "Apache-2.0"
publish = false

[dependencies]
switchyard-runner.workspace = true
switchyard-protocol.workspace = true
switchyard-translation.workspace = true
anyhow = "1"
async-stream.workspace = true
axum = "0.8"
futures-util.workspace = true
http.workspace = true
envoy-types = "=0.6.1"
serde_json = { workspace = true, features = ["raw_value"] }
tokio.workspace = true
tonic = "0.13.1"
thiserror.workspace = true
tracing.workspace = true
tracing-subscriber.workspace = true

[dev-dependencies]
tokio = { workspace = true, features = ["test-util"] }
tokio-stream = { version = "0.1", features = ["net"] }
Loading
Loading