Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 1 addition & 13 deletions verifiers/clients/renderer_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
concurrent rollouts tokenize in parallel instead of blocking the event loop.
"""

import asyncio
import json
import threading
from collections.abc import Mapping
Expand All @@ -31,7 +30,7 @@
)
from renderers import ToolCall as RendererToolCall
from renderers import ToolCallFunction
from renderers.client import generate
from renderers.client import _maybe_offload, generate

from verifiers.clients.client import Client
from verifiers.clients.openai_chat_completions_client import (
Expand Down Expand Up @@ -98,17 +97,6 @@ def _record_bridge(success: bool) -> None:
# ── Helpers ─────────────────────────────────────────────────────────


async def _maybe_offload(renderer: Renderer | RendererPool, fn):
"""Run sync renderer work on a thread iff ``renderer`` is a pool.

Pool methods can block on the internal queue/lock; we offload to keep
the event loop responsive. A bare ``Renderer`` runs inline.
"""
if isinstance(renderer, RendererPool):
return await asyncio.to_thread(fn)
return fn()


def _get_value(obj: Any, key: str, default: Any = None) -> Any:
if isinstance(obj, Mapping):
return obj.get(key, default)
Expand Down
Loading