MCPcopy Create free account
hub / github.com/NVIDIA/NeMo-Relay / check_output_rails

Method check_output_rails

crates/core/src/plugins/nemo_guardrails/python.rs:203–224  ·  view source on GitHub ↗
(&self, messages: &[Json], response_text: &str)

Source from the content-addressed store, hash-verified

201 }
202
203 async fn check_output_rails(&self, messages: &[Json], response_text: &str) -> FlowResult<()> {
204 let mut output_messages = messages.to_vec();
205 output_messages.push(json!({
206 "role": "assistant",
207 "content": response_text,
208 }));
209
210 match self
211 .bridge
212 .check(output_messages, LocalRailKind::Output)
213 .await?
214 {
215 LocalCheckOutcome::Passed => Ok(()),
216 LocalCheckOutcome::Blocked { rail, .. } => {
217 Err(blocked_error("output", rail.as_deref()))
218 }
219 LocalCheckOutcome::Modified { .. } => Err(local_violation(
220 "NeMo Guardrails output rail returned modified content, but the local backend \
221 does not rewrite provider responses yet.",
222 )),
223 }
224 }
225
226 async fn check_tool_input(&self, tool_name: &str, args: &Json) -> FlowResult<Json> {
227 let messages = vec![json!({

Callers 1

execute_llmMethod · 0.80

Calls 4

blocked_errorFunction · 0.85
local_violationFunction · 0.85
pushMethod · 0.45
checkMethod · 0.45

Tested by

no test coverage detected