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

Method new

crates/python/src/py_adaptive.rs:40–50  ·  view source on GitHub ↗
(config: &Bound<'_, PyAny>)

Source from the content-addressed store, hash-verified

38 #[new]
39 #[pyo3(signature = (config: "object"), text_signature = "(config: object)")]
40 fn new(config: &Bound<'_, PyAny>) -> PyResult<Self> {
41 let config_json = py_to_json(config)?;
42 let config: AdaptiveConfig = serde_json::from_value(config_json)
43 .map_err(|e| pyo3::exceptions::PyValueError::new_err(e.to_string()))?;
44 let report = validate_adaptive_config_or_err(&config)?;
45 Ok(Self {
46 inner: Arc::new(tokio::sync::Mutex::new(Some(
47 PyAdaptiveRuntimeState::Pending { config, report },
48 ))),
49 })
50 }
51
52 #[pyo3(signature = () -> "object", text_signature = "() -> object")]
53 fn register<'py>(&self, py: Python<'py>) -> PyResult<Bound<'py, PyAny>> {

Callers

nothing calls this directly

Calls 2

py_to_jsonFunction · 0.85

Tested by

no test coverage detected