verifiers 0.3.2.dev69__py3-none-any.whl → 0.3.2.dev70__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,6 +8,7 @@ from pathlib import Path
8
8
  from uuid import UUID
9
9
 
10
10
  import numpy as np
11
+ from pydantic_core import to_jsonable_python
11
12
 
12
13
  # Marker key inside the encoded payload so a decoder can recognize a
13
14
  # tensor round-trip without disturbing arbitrary user dicts.
@@ -31,14 +32,17 @@ def msgpack_encoder(obj):
31
32
  is ONLY called for types msgpack doesn't recognize. This avoids the massive
32
33
  performance penalty of recursing through millions of tokens in Python.
33
34
 
34
- Handles: Path, UUID, Enum, datetime, Pydantic models, numpy scalars,
35
+ Handles: Path, UUID, sets, Enum, datetime, Pydantic models, numpy scalars,
35
36
  numpy arrays, torch tensors, and dataclasses (e.g. renderers'
36
37
  ``MultiModalData`` / ``PlaceholderRange``). Tensors and ndarrays are
37
38
  encoded as ``{__torch_tensor__: True, dtype, shape, data}``.
39
+ Other types use Pydantic's JSON conversions; unsupported types still raise.
38
40
  Does NOT handle: lists, dicts, basic types (msgpack does this natively in C).
39
41
  """
40
42
  if isinstance(obj, (Path, UUID)):
41
43
  return str(obj)
44
+ elif isinstance(obj, (set, frozenset)):
45
+ return list(obj)
42
46
  elif isinstance(obj, Enum):
43
47
  return obj.value
44
48
  elif isinstance(obj, (datetime, date)):
@@ -61,5 +65,4 @@ def msgpack_encoder(obj):
61
65
  elif dataclasses.is_dataclass(obj) and not isinstance(obj, type):
62
66
  return dataclasses.asdict(obj)
63
67
  else:
64
- # raise on unknown types to make issues visible
65
- raise TypeError(f"Object of type {type(obj)} is not msgpack serializable")
68
+ return to_jsonable_python(obj)
@@ -136,11 +136,21 @@ class EnvServer:
136
136
  ) as e: # a failed request is data, not a crash — report and keep serving
137
137
  logger.warning("request failed: %s", e, exc_info=True)
138
138
  response = BaseResponse(success=False, error=f"{type(e).__name__}: {e}")
139
- data = msgpack.packb(
140
- response.model_dump(mode="python"),
141
- default=msgpack_encoder,
142
- use_bin_type=True,
143
- )
139
+ try:
140
+ data = msgpack.packb(
141
+ response.model_dump(mode="python"),
142
+ default=msgpack_encoder,
143
+ use_bin_type=True,
144
+ )
145
+ except Exception as e:
146
+ # Encoding failures must also reply so clients don't wait indefinitely.
147
+ logger.warning("response encoding failed: %s", e, exc_info=True)
148
+ data = msgpack.packb(
149
+ BaseResponse(
150
+ success=False, error=f"{type(e).__name__}: {e}"
151
+ ).model_dump(),
152
+ use_bin_type=True,
153
+ )
144
154
  try:
145
155
  # Let ZMQ retain the packed response instead of copying large traces.
146
156
  await self.frontend.send_multipart(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: verifiers
3
- Version: 0.3.2.dev69
3
+ Version: 0.3.2.dev70
4
4
  Summary: Verifiers: Environments for LLM Reinforcement Learning
5
5
  Project-URL: Homepage, https://github.com/primeintellect-ai/verifiers
6
6
  Project-URL: Documentation, https://github.com/primeintellect-ai/verifiers
@@ -150,9 +150,9 @@ verifiers/v1/runtimes/docker/__init__.py,sha256=JN0mI10a_BKQpRRJKX_NqStAoODAEk2d
150
150
  verifiers/v1/runtimes/docker/egress.py,sha256=iFH_1XotlEM-OCaW7GNu3TWVEq1sqesKYweyVBX8g90,14360
151
151
  verifiers/v1/serve/__init__.py,sha256=doImCSxSYZEjVDXfRafLHkhHXcXQxzA6qUGMBQ8bSko,477
152
152
  verifiers/v1/serve/client.py,sha256=biy46qOOFTjMXSIsY8W1vMEfctn7usCeNuBQsJqc2mc,7789
153
- verifiers/v1/serve/encoding.py,sha256=5tKagKZKwBPN6VydLObCKDzLnijrvRwMjuyVQUq5BKA,2399
153
+ verifiers/v1/serve/encoding.py,sha256=hBZFucAZK9riXOV3DaHcskq9zHTT8gVGkoFVOPfnr30,2499
154
154
  verifiers/v1/serve/pool.py,sha256=HZsJPcru9eNrxo3Rmi-Vdt1tjZwqo2oI4Ql_IKfUMtY,15443
155
- verifiers/v1/serve/server.py,sha256=h1B53RZBuYgRt4xmh9L6jBJ0KvCdq7wmCAa3nwkJMok,8778
155
+ verifiers/v1/serve/server.py,sha256=-XfvWN_7kzN7z49YWd2rADHABiDTAdpPszEMjhWgyno,9216
156
156
  verifiers/v1/serve/types.py,sha256=CjZ6PWQlzSRkBG77gXfzKHnw_S_qKUm9dZSSxVgkv1w,1552
157
157
  verifiers/v1/tasksets/__init__.py,sha256=5hTKSPLXSZTgKBbeKQI7FEp06c0ZsaQfuwvrvVFLgb8,712
158
158
  verifiers/v1/tasksets/harbor/__init__.py,sha256=JxThzHFYEkuSfQbVf3pEnjordgdfe4MU-QOsSSbyovU,326
@@ -189,8 +189,8 @@ verifiers/v1/utils/prime.py,sha256=UTYRjp9cbjNb6CVmBHda-1wWZAIIfxNOmTyNuT7_wL4,9
189
189
  verifiers/v1/utils/retries.py,sha256=Y2ZgrAjn-qNkRKZP_RVNL_7EK0iaRcZeCa404lpGYi4,5417
190
190
  verifiers/v1/utils/score.py,sha256=493yJVMw8teCu9JxapxMFPFzI0hNUqdo0Y2nGW4kckk,6200
191
191
  verifiers/v1/utils/version.py,sha256=-obEo_-l9-D8FLef4hYxncOe-uJpxrM1g2Hig_37Sgs,1607
192
- verifiers-0.3.2.dev69.dist-info/METADATA,sha256=B7eBrvCxW5X6Hmj6jqQXQmVDyUH912GaawkvdJ3md10,4204
193
- verifiers-0.3.2.dev69.dist-info/WHEEL,sha256=zOwg4jB6zX2kU910N-cMawjivD6tO8NEWvE12je1bVk,87
194
- verifiers-0.3.2.dev69.dist-info/entry_points.txt,sha256=uqQje0TMsr7k6nXlWxlPs13Si0evb3pVCEDF6c-YL80,241
195
- verifiers-0.3.2.dev69.dist-info/licenses/LICENSE,sha256=v0RrUsdV3IDoZhrRce297IXS3xMHNJ-_LdLpFAUWb9k,1072
196
- verifiers-0.3.2.dev69.dist-info/RECORD,,
192
+ verifiers-0.3.2.dev70.dist-info/METADATA,sha256=Db5MJf31phEx5wl2P-glZjUl7InSxps2uJLXwIYy9K8,4204
193
+ verifiers-0.3.2.dev70.dist-info/WHEEL,sha256=zOwg4jB6zX2kU910N-cMawjivD6tO8NEWvE12je1bVk,87
194
+ verifiers-0.3.2.dev70.dist-info/entry_points.txt,sha256=uqQje0TMsr7k6nXlWxlPs13Si0evb3pVCEDF6c-YL80,241
195
+ verifiers-0.3.2.dev70.dist-info/licenses/LICENSE,sha256=v0RrUsdV3IDoZhrRce297IXS3xMHNJ-_LdLpFAUWb9k,1072
196
+ verifiers-0.3.2.dev70.dist-info/RECORD,,