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

Function wrap_js_codec

crates/wasm/src/callable.rs:810–828  ·  view source on GitHub ↗
(_decode_fn: Function, _encode_fn: Function)

Source from the content-addressed store, hash-verified

808/// into an `Arc<dyn LlmCodec>`.
809#[cfg(not(target_arch = "wasm32"))]
810pub fn wrap_js_codec(_decode_fn: Function, _encode_fn: Function) -> Arc<dyn LlmCodec> {
811 struct UnsupportedCodec;
812
813 impl LlmCodec for UnsupportedCodec {
814 fn decode(&self, _request: &LlmRequest) -> Result<AnnotatedLlmRequest> {
815 Err(wasm_only_error())
816 }
817
818 fn encode(
819 &self,
820 _annotated: &AnnotatedLlmRequest,
821 _original: &LlmRequest,
822 ) -> Result<LlmRequest> {
823 Err(wasm_only_error())
824 }
825 }
826
827 Arc::new(UnsupportedCodec)
828}
829
830#[cfg(target_arch = "wasm32")]
831pub fn wrap_js_codec(decode_fn: Function, encode_fn: Function) -> Arc<dyn LlmCodec> {

Calls

no outgoing calls