MCPcopy Create free account
hub / github.com/anthropics/anthropic-sdk-python / AsyncCallableMiddleware

Class AsyncCallableMiddleware

tests/test_middleware.py:292–300  ·  view source on GitHub ↗

A middleware object that is a class instance with an async `__call__` method.

Source from the content-addressed store, hash-verified

290
291
292class AsyncCallableMiddleware:
293 """A middleware object that is a class instance with an async `__call__` method."""
294
295 def __init__(self) -> None:
296 self.requests: list[APIRequest] = []
297
298 async def __call__(self, request: APIRequest, call_next: AsyncCallNext) -> Any:
299 self.requests.append(request)
300 return await call_next(request)
301
302
303class SyncCallableMiddleware:

Calls

no outgoing calls