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

Method test_codec_parameter

python/tests/test_codecs.py:289–314  ·  view source on GitHub ↗

codec parameter passes the specified codec instance directly.

(self)

Source from the content-addressed store, hash-verified

287 intercepts.deregister_llm_request("test-annot-intercept-pipeline")
288
289 async def test_codec_parameter(self):
290 """codec parameter passes the specified codec instance directly."""
291 alternate = AlternateCodec()
292
293 intercept_data = {}
294
295 def annotated_intercept(name, request, annotated):
296 if annotated is not None:
297 intercept_data["extra"] = annotated.extra
298 return (request, annotated)
299
300 intercepts.register_llm_request("test-annot-intercept-cn", 1, False, annotated_intercept)
301
302 try:
303
304 def func(request):
305 return {"ok": True}
306
307 request = make_request()
308 await llm.execute("cn-llm", request, func, codec=alternate)
309
310 # The alternate codec sets extra={"codec_used": "alternate"}
311 assert intercept_data.get("extra") is not None
312 assert intercept_data["extra"].get("codec_used") == "alternate"
313 finally:
314 intercepts.deregister_llm_request("test-annot-intercept-cn")
315
316 async def test_annotated_request_intercept_receives_typed(self):
317 """Annotated intercept receives an AnnotatedLLMRequest instance when codec is active."""

Callers

nothing calls this directly

Calls 4

AlternateCodecClass · 0.85
getMethod · 0.80
make_requestFunction · 0.70
executeMethod · 0.45

Tested by

no test coverage detected