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

Method register_llm_execution_intercept

crates/python/src/py_plugin.rs:493–525  ·  view source on GitHub ↗
(
        &self,
        name: &str,
        priority: i32,
        callback: Py<PyAny>,
    )

Source from the content-addressed store, hash-verified

491
492 #[pyo3(signature = (name: "str", priority: "int", callback: "object") -> "None", text_signature = "(name: str, priority: int, callback: object) -> None")]
493 fn register_llm_execution_intercept(
494 &self,
495 name: &str,
496 priority: i32,
497 callback: Py<PyAny>,
498 ) -> PyResult<()> {
499 let qualified_name = self.qualify_name(name);
500 register_llm_execution_intercept(
501 &qualified_name,
502 priority,
503 wrap_py_llm_exec_intercept_fn(callback),
504 )
505 .map_err(to_py_err)?;
506
507 let name_owned = qualified_name;
508 let mut guard = self.registrations.lock().map_err(|e| {
509 pyo3::exceptions::PyRuntimeError::new_err(format!("plugin context lock poisoned: {e}"))
510 })?;
511 guard.push(PluginRegistration::new(
512 "plugin",
513 name_owned.clone(),
514 Box::new(move || {
515 deregister_llm_execution_intercept(&name_owned)
516 .map(|_| ())
517 .map_err(|e| {
518 PluginError::RegistrationFailed(format!(
519 "llm execution intercept deregistration failed: {e}"
520 ))
521 })
522 }),
523 ));
524 Ok(())
525 }
526
527 #[pyo3(signature = (name: "str", priority: "int", callback: "object") -> "None", text_signature = "(name: str, priority: int, callback: object) -> None")]
528 fn register_llm_stream_execution_intercept(

Calls 5

qualify_nameMethod · 0.45
pushMethod · 0.45