Coverage for .venv/lib/python3.13/site-packages/litellm/proxy/common_utils/realtime_utils.py: 80%
5 statements
« prev ^ index » next coverage.py v7.15.2, created at 2026-10-10 12:01 +0000
« prev ^ index » next coverage.py v7.15.2, created at 2026-10-10 12:01 +0000
1from functools import lru_cache
3from litellm.constants import _REALTIME_BODY_CACHE_SIZE
6@lru_cache(maxsize=_REALTIME_BODY_CACHE_SIZE)
7def _realtime_request_body(model: str | None) -> bytes:
8 """
9 Generate the realtime websocket request body. Cached with LRU semantics to avoid repeated
10 string formatting work while keeping memory usage bounded.
11 """
12 return f'{{"model": "{model or ""}"}}'.encode()