codec parameter passes the specified codec instance directly.
(self)
| 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.""" |
nothing calls this directly
no test coverage detected