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

Function encodeWithCodec

crates/wasm/wrappers/nodejs/typed.js:36–41  ·  view source on GitHub ↗

* Encode an annotated LLM payload with the caller-provided codec. * * Supports both plain request payloads and the `{ annotated, original }` * wrapper used by annotated-aware intercept pipelines. * * @param {{ encode(annotated: *, original: *): * }} codec - Codec used to re-encode the payload.

(codec, payload)

Source from the content-addressed store, hash-verified

34 * annotated payloads preserve both values for intercept-aware codecs.
35 */
36function encodeWithCodec(codec, payload) {
37 if (payload && typeof payload === 'object' && 'annotated' in payload && 'original' in payload) {
38 return codec.encode(payload.annotated, payload.original);
39 }
40 return codec.encode(payload, null);
41}
42
43function collectCodecReturn(value) {
44 return value === undefined ? null : value;

Callers 2

typedLlmExecuteFunction · 0.70
typedLlmStreamExecuteFunction · 0.70

Calls 1

encodeMethod · 0.65

Tested by

no test coverage detected