From 714664fe21f49e22fd7b012ef680cd0b42bd646a Mon Sep 17 00:00:00 2001 From: oss-agent-shin Date: Wed, 13 May 2026 13:54:00 -0700 Subject: [PATCH] docs: add class docstring to _LoopWrapper (#27870) Document the purpose of the daemon thread that backs the sync branch of the timeout decorator. Co-authored-by: oss-agent-shin <279349115+oss-agent-shin@users.noreply.github.com> --- litellm/timeout.py | 7 +++++++ 1 file changed, 7 insertions(+) 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()