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

Class PyLlmCodecWrapper

crates/python/src/py_callable.rs:883–885  ·  view source on GitHub ↗

Wraps a Python object with ``decode``/``encode`` methods into the Rust [`LlmCodec`] trait so it can be stored in the global codec registry. The Python codec object must implement: - ``decode(request: LlmRequest) -> AnnotatedLLMRequest`` - ``encode(annotated: AnnotatedLLMRequest, original: LlmRequest) -> LlmRequest``

Source from the content-addressed store, hash-verified

881/// - ``decode(request: LlmRequest) -> AnnotatedLLMRequest``
882/// - ``encode(annotated: AnnotatedLLMRequest, original: LlmRequest) -> LlmRequest``
883pub(crate) struct PyLlmCodecWrapper {
884 pub py_codec: Py<PyAny>,
885}
886
887// SAFETY: The Py<PyAny> handle is GIL-independent (ref-counted via Python's
888// allocator). All access goes through `Python::attach` which acquires the GIL.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected