Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

docs: add class docstring to _LoopWrapper (#27870)

oss-agent-shin714664fe21f4
diff --git a/litellm/timeout.py b/litellm/timeout.py
index f9bf036cea2..0d03a3e45e8 100644
--- a/litellm/timeout.py
+++ b/litellm/timeout.py
@@ -90,6 +90,13 @@ def timeout(timeout_duration: float = 0.0, exception_to_raise=Timeout):
class _LoopWrapper(Thread):
+ """Daemon thread that owns a dedicated asyncio event loop.
+
+ Used by the sync branch of :func:`timeout` to run a coroutine on a
+ background event loop so the calling thread can wait on it with a
+ timeout via :func:`asyncio.run_coroutine_threadsafe`.
+ """
+
def __init__(self):
super().__init__(daemon=True)
self.loop = asyncio.new_event_loop()