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

Method __call__

crates/python/src/py_callable.rs:320–334  ·  view source on GitHub ↗
(
        &self,
        py: Python<'py>,
        args: &Bound<'py, PyAny>,
    )

Source from the content-addressed store, hash-verified

318#[pymethods]
319impl PyToolNextFn {
320 fn __call__<'py>(
321 &self,
322 py: Python<'py>,
323 args: &Bound<'py, PyAny>,
324 ) -> PyResult<Bound<'py, PyAny>> {
325 let next = self.inner.clone();
326 let json_args = py_to_json(args)?;
327 let future = next(json_args);
328 pyo3_async_runtimes::tokio::future_into_py(py, async move {
329 let result = future
330 .await
331 .map_err(|e| pyo3::exceptions::PyRuntimeError::new_err(e.to_string()))?;
332 Python::attach(|py| json_to_py(py, &result))
333 })
334 }
335}
336
337/// Python-callable wrapper for the Rust `LlmExecutionNextFn`.

Calls 4

py_to_jsonFunction · 0.85
json_to_pyFunction · 0.85
nextMethod · 0.45
sendMethod · 0.45