Skip to content
Closed
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
718 changes: 667 additions & 51 deletions ATTRIBUTIONS-Rust.md

Large diffs are not rendered by default.

92 changes: 76 additions & 16 deletions Cargo.lock

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

4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ nemo-relay-worker = { version = "0.6.0", path = "crates/worker" }
nemo-relay-adaptive = { version = "0.6.0", path = "crates/adaptive" }
nemo-relay-pii-redaction = { version = "0.6.0", path = "crates/pii-redaction" }
nemo-relay-switchyard = { version = "0.6.0", path = "crates/switchyard" }
switchyard-translation = "0.1.0"
switchyard-libsy = { git = "https://github.com/bbednarski9/Switchyard.git", rev = "aa0a31126cc7ca922a6acdf4f1ef656744698c6c" }
switchyard-protocol = { git = "https://github.com/bbednarski9/Switchyard.git", rev = "aa0a31126cc7ca922a6acdf4f1ef656744698c6c" }
switchyard-translation = { git = "https://github.com/bbednarski9/Switchyard.git", rev = "aa0a31126cc7ca922a6acdf4f1ef656744698c6c" }
nemo-relay-ffi = { version = "0.6.0", path = "crates/ffi" }
nemo-relay-cli = { version = "0.6.0", path = "crates/cli" }
opentelemetry = { version = "0.31", default-features = false }
Expand Down
17 changes: 8 additions & 9 deletions crates/cli/src/plugins/editor_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use nemo_relay_adaptive::AdaptiveConfig;
use nemo_relay_adaptive::plugin_component::ADAPTIVE_PLUGIN_KIND;
use nemo_relay_pii_redaction::component::{PII_REDACTION_PLUGIN_KIND, PiiRedactionConfig};
#[cfg(feature = "switchyard")]
use nemo_relay_switchyard::{SWITCHYARD_PLUGIN_KIND, SwitchyardConfig};
use nemo_relay_switchyard::{AlgorithmConfig, SWITCHYARD_PLUGIN_KIND, SwitchyardConfig};
use serde::Serialize;
use serde::de::DeserializeOwned;
use serde_json::{Map, Value, json};
Expand Down Expand Up @@ -52,7 +52,7 @@ impl EditableComponent {
Self::NemoGuardrails(_) => "NeMo Guardrails",
Self::PiiRedaction(_) => "PII Redaction",
#[cfg(feature = "switchyard")]
Self::Switchyard(_) => "Switchyard Decision API",
Self::Switchyard(_) => "Switchyard libsy",
}
}

Expand Down Expand Up @@ -1174,20 +1174,19 @@ pub(super) fn pii_redaction_summary(state: &ComponentEditorState<PiiRedactionCon

#[cfg(feature = "switchyard")]
pub(super) fn switchyard_configured(config: &SwitchyardConfig) -> bool {
!config.decision_profile_id.is_empty() || !config.targets.is_empty()
!config.targets.is_empty()
}

#[cfg(feature = "switchyard")]
pub(super) fn switchyard_summary(state: &ComponentEditorState<SwitchyardConfig>) -> String {
let profile = if state.config.decision_profile_id.is_empty() {
"unconfigured"
} else {
state.config.decision_profile_id.as_str()
let algorithm = match &state.config.algorithm {
AlgorithmConfig::Random { .. } => "random",
AlgorithmConfig::LlmClassifier { .. } => "llm classifier",
};
format!(
"component {}, profile {}, targets {}",
"component {}, algorithm {}, targets {}",
if state.enabled { "enabled" } else { "disabled" },
profile,
algorithm,
state.config.targets.len()
)
}
18 changes: 1 addition & 17 deletions crates/cli/src/server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ use nemo_relay::plugin::{
use nemo_relay_adaptive::plugin_component::register_adaptive_component;
use nemo_relay_pii_redaction::component::register_pii_redaction_component;
#[cfg(feature = "switchyard")]
use nemo_relay_switchyard::{
register_switchyard_component, validate_switchyard_atof_configuration,
};
use nemo_relay_switchyard::register_switchyard_component;
use reqwest::Client;
use serde_json::Value;
use subtle::ConstantTimeEq;
Expand Down Expand Up @@ -894,8 +892,6 @@ pub(crate) enum PluginComponentSetupError {
PiiRedaction(String),
#[cfg(feature = "switchyard")]
Switchyard(String),
#[cfg(feature = "switchyard")]
SwitchyardAtof(String),
}

impl PluginComponentSetupError {
Expand All @@ -905,8 +901,6 @@ impl PluginComponentSetupError {
Self::PiiRedaction(_) => "PII redaction plugin",
#[cfg(feature = "switchyard")]
Self::Switchyard(_) => "Switchyard plugin",
#[cfg(feature = "switchyard")]
Self::SwitchyardAtof(_) => "Switchyard ATOF",
}
}

Expand All @@ -917,8 +911,6 @@ impl PluginComponentSetupError {
}
#[cfg(feature = "switchyard")]
Self::Switchyard(error) => format!("registration failed: {error}"),
#[cfg(feature = "switchyard")]
Self::SwitchyardAtof(error) => error.clone(),
}
}
}
Expand All @@ -939,10 +931,6 @@ impl std::fmt::Display for PluginComponentSetupError {
Self::Switchyard(error) => {
write!(formatter, "Switchyard plugin registration failed: {error}")
}
#[cfg(feature = "switchyard")]
Self::SwitchyardAtof(error) => {
write!(formatter, "Switchyard ATOF validation failed: {error}")
}
}
}
}
Expand All @@ -961,10 +949,6 @@ pub(crate) fn register_and_validate_plugin_components(
if let Err(error) = register_switchyard_component() {
errors.push(PluginComponentSetupError::Switchyard(error.to_string()));
}
#[cfg(feature = "switchyard")]
if let Err(error) = validate_switchyard_atof_configuration(_plugin_config) {
errors.push(PluginComponentSetupError::SwitchyardAtof(error));
}
errors
}

Expand Down
Loading
Loading