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

Class AlternateCodec

python/tests/test_codecs.py:50–66  ·  view source on GitHub ↗

Second codec for testing codec parameter selection.

Source from the content-addressed store, hash-verified

48
49
50class AlternateCodec(LlmCodec):
51 """Second codec for testing codec parameter selection."""
52
53 def decode(self, request):
54 content = request.content
55 messages = content.get("messages", [])
56 return AnnotatedLLMRequest(
57 messages,
58 model=content.get("model"),
59 extra={"codec_used": "alternate"},
60 )
61
62 def encode(self, annotated, original):
63 content = {**original.content, "messages": annotated.messages}
64 if annotated.extra and "codec_used" in annotated.extra:
65 content["codec_used"] = annotated.extra["codec_used"]
66 return LLMRequest(original.headers, content)
67
68
69def make_request():

Callers 1

test_codec_parameterMethod · 0.85

Calls

no outgoing calls

Tested by 1

test_codec_parameterMethod · 0.68