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

Function resolve_json_or_future

crates/python/src/py_callable.rs:63–78  ·  view source on GitHub ↗
(
    outcome: FlowResult<Result<Json, PyValueFuture>>,
)

Source from the content-addressed store, hash-verified

61}
62
63async fn resolve_json_or_future(
64 outcome: FlowResult<Result<Json, PyValueFuture>>,
65) -> FlowResult<Json> {
66 match outcome? {
67 Ok(json) => Ok(json),
68 Err(future) => {
69 let py_result = future
70 .await
71 .map_err(|e| FlowError::Internal(e.to_string()))?;
72 Python::attach(|py| {
73 py_to_json(py_result.bind(py))
74 .map_err(|e: PyErr| FlowError::Internal(e.to_string()))
75 })
76 }
77 }
78}
79
80fn split_py_object_or_future(
81 py: Python<'_>,

Callers 1

wrap_py_llm_exec_fnFunction · 0.85

Calls 1

py_to_jsonFunction · 0.85

Tested by

no test coverage detected