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
13 changes: 10 additions & 3 deletions verifiers/v1/clients/eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import re

import httpx
from pydantic_core import from_json, to_json

from verifiers.v1.clients.client import SESSION_ID_HEADER, Client, RelayReply
from verifiers.v1.dialects import ChatDialect, Dialect
Expand Down Expand Up @@ -89,7 +90,7 @@ async def get_response(
dialect.apply_overrides(body, model, sampling_args),
self._headers(dialect, headers, session_id),
)
raw = resp.json()
raw = from_json(resp.content)
response = dialect.parse_response(dialect.validate_response(raw))
response.raw = raw # the program gets the provider's bytes back 1:1
return response
Expand Down Expand Up @@ -126,7 +127,13 @@ async def _request(
*,
stream: bool = False,
) -> httpx.Response:
request = self.http.build_request("POST", url, json=body, headers=headers)
headers.setdefault("content-type", "application/json")
request = self.http.build_request(
"POST",
url,
content=to_json(body, inf_nan_mode="null"),
headers=headers,
)
try:
response = await self.http.send(request, stream=stream)
except httpx.TimeoutException as e:
Expand Down Expand Up @@ -200,7 +207,7 @@ async def relay_aux(self, dialect: Dialect, route: str, body: dict) -> dict:
body,
self._headers(dialect, None, None),
)
return resp.json()
return from_json(resp.content)

async def close(self) -> None:
await self.http.aclose()
Loading