Skip to content

Commit 1815a45

Browse files
committed
refactor(relay): trim plugin-only surface
Signed-off-by: Bryan Bednarski <bbednarski@nvidia.com>
1 parent f28309b commit 1815a45

3 files changed

Lines changed: 10 additions & 42 deletions

File tree

crates/switchyard-nemo-relay-plugin/src/client.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,6 @@ impl TargetClient {
7373
metadata.http_headers = None;
7474
request
7575
}
76-
77-
#[cfg(test)]
78-
fn provider_model(&self) -> &str {
79-
&self.provider_model
80-
}
8176
}
8277

8378
#[async_trait]
@@ -161,12 +156,6 @@ mod tests {
161156
);
162157
}
163158

164-
#[test]
165-
fn semantic_selection_does_not_replace_the_provider_model() {
166-
let client = client(WireFormat::OpenAiChat);
167-
assert_eq!(client.provider_model(), "provider/model");
168-
}
169-
170159
#[test]
171160
fn only_anthropic_targets_advertise_count_tokens() {
172161
assert!(client(WireFormat::AnthropicMessages).supports_count_tokens());

crates/switchyard-nemo-relay-plugin/src/config.rs

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,6 @@ enum AlgorithmConfig {
162162
classifier_target: String,
163163
weak_target: String,
164164
strong_target: String,
165-
#[serde(default)]
166-
escalation: Option<serde_json::Value>,
167165
#[serde(flatten)]
168166
config: TaskClassifierConfig,
169167
},
@@ -296,15 +294,8 @@ impl SwitchyardConfig {
296294
classifier_target,
297295
weak_target,
298296
strong_target,
299-
escalation,
300297
config,
301298
} => {
302-
if escalation.is_some() {
303-
return Err(
304-
"llm_classifier escalation mode is not supported by this plugin version"
305-
.into(),
306-
);
307-
}
308299
let classifier_binding = self.targets.get(classifier_target).ok_or_else(|| {
309300
format!("algorithm target {classifier_target:?} is not configured")
310301
})?;
@@ -357,7 +348,7 @@ fn validate_dispatch_url(
357348
}
358349

359350
// The current switchyard-llm-client accepts provider base URLs and complete
360-
// canonical endpoints. Reject a custom terminal route here instead of
351+
// canonical endpoints. Reject a custom terminal route to avoid
361352
// allowing Backend::url() to append another provider suffix silently.
362353
let expected_suffix = match protocol {
363354
WireFormat::OpenAiChat => "/chat/completions",
@@ -686,7 +677,6 @@ mod tests {
686677
classifier_target: "anthropic".into(),
687678
weak_target: "responses".into(),
688679
strong_target: "chat".into(),
689-
escalation: None,
690680
config: TaskClassifierConfig {
691681
base_threshold: 0.5,
692682
..Default::default()
@@ -743,7 +733,6 @@ mod tests {
743733
classifier_target: "chat".into(),
744734
weak_target: "responses".into(),
745735
strong_target: "anthropic".into(),
746-
escalation: None,
747736
config: TaskClassifierConfig {
748737
base_threshold: 1.1,
749738
..Default::default()

crates/switchyard-nemo-relay-plugin/src/runtime.rs

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,15 @@ impl SwitchyardRuntime {
115115
failure_mark_data(attempt, &failure),
116116
&metadata,
117117
);
118-
return self
119-
.fallback_buffered(inbound, request, marks, &metadata)
120-
.await;
118+
let response = self
119+
.fallback_response(inbound, request, marks, &metadata)
120+
.await?;
121+
let LlmResponse::Agg(response) = response.llm_response else {
122+
return Err(
123+
"trusted fallback returned a stream for a buffered request".into()
124+
);
125+
};
126+
return translation::encode_response(&self.translation, inbound, &response);
121127
}
122128
}
123129
}
@@ -322,22 +328,6 @@ impl SwitchyardRuntime {
322328
call.respond(result)
323329
}
324330

325-
async fn fallback_buffered(
326-
&self,
327-
inbound: WireFormat,
328-
request: Request,
329-
marks: &mut Vec<RoutingMark>,
330-
metadata: &Json,
331-
) -> Result<Json, String> {
332-
let response = self
333-
.fallback_response(inbound, request, marks, metadata)
334-
.await?;
335-
let LlmResponse::Agg(response) = response.llm_response else {
336-
return Err("trusted fallback returned a stream for a buffered request".into());
337-
};
338-
translation::encode_response(&self.translation, inbound, &response)
339-
}
340-
341331
async fn fallback_response(
342332
&self,
343333
inbound: WireFormat,

0 commit comments

Comments
 (0)