synth-ai 0.2.8.dev11__py3-none-any.whl → 0.2.8.dev12__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.

Potentially problematic release.


This version of synth-ai might be problematic. Click here for more details.

@@ -205,12 +205,14 @@ def fastapi_app():
205
205
  """Return Hendrycks MATH problem/answer and tool schema for a seed."""
206
206
  q, a = _load_hendrycks_problem(int(seed), subject=subject)
207
207
  tools = [{
208
- "name": "interact",
209
- "description": "Submit one or more actions to the math environment.",
208
+ "name": "submit_answer",
209
+ "description": "Provide the final numerical or algebraic answer for the current math problem.",
210
210
  "parameters": {
211
211
  "type": "object",
212
- "properties": {"actions": {"type": "array", "items": {"type": "string"}}},
213
- "required": ["actions"],
212
+ "properties": {
213
+ "answer": {"type": "string", "description": "The proposed final answer"},
214
+ },
215
+ "required": ["answer"],
214
216
  },
215
217
  }]
216
218
  return {
@@ -245,7 +247,7 @@ def fastapi_app():
245
247
 
246
248
  OPENAI_REMOVE_FIELDS = ("stop_after_tool_calls", "thinking_mode", "thinking_budget", "reasoning")
247
249
  OPENAI_REMOVE_SAMPLING_FIELDS = ("temperature", "top_p")
248
- TOOL_CHOICE_FORCE = {"type": "function", "function": {"name": "interact_many"}}
250
+ TOOL_CHOICE_FORCE = {"type": "function", "function": {"name": "submit_answer"}}
249
251
 
250
252
  def _prepare_openai_payload(model: str | None, payload: dict[str, object]) -> dict[str, object]:
251
253
  sanitized = dict(payload)
@@ -258,9 +260,9 @@ def fastapi_app():
258
260
  sanitized.pop("max_tokens", None)
259
261
  for field in OPENAI_REMOVE_SAMPLING_FIELDS:
260
262
  sanitized.pop(field, None)
261
- sanitized["tool_choice"] = TOOL_CHOICE_FORCE
262
- sanitized["parallel_tool_calls"] = False
263
- return sanitized
263
+ sanitized["tool_choice"] = TOOL_CHOICE_FORCE
264
+ sanitized["parallel_tool_calls"] = False
265
+ return sanitized
264
266
 
265
267
  @api.post("/proxy/v1/chat/completions")
266
268
  def proxy_chat_completions(request: dict[str, object] = Body(...)):
@@ -330,11 +332,11 @@ def fastapi_app():
330
332
  sanitized.pop("max_tokens", None)
331
333
  for field in ("temperature", "top_p"):
332
334
  sanitized.pop(field, None)
333
- sanitized["tool_choice"] = {"type": "function", "function": {"name": "interact"}}
335
+ sanitized["tool_choice"] = {"type": "function", "function": {"name": "submit_answer"}}
334
336
  sanitized["parallel_tool_calls"] = False
335
337
  return sanitized
336
338
 
337
- def _parse_tool_actions(resp: dict[str, Any]) -> list[str]:
339
+ def _parse_tool_answer(resp: dict[str, Any]) -> str:
338
340
  try:
339
341
  choices = resp.get("choices")
340
342
  if isinstance(choices, list) and choices:
@@ -343,7 +345,7 @@ def fastapi_app():
343
345
  if isinstance(tcs, list) and tcs:
344
346
  fn = tcs[0].get("function", {}) if isinstance(tcs[0], dict) else {}
345
347
  args = fn.get("arguments")
346
- obj = {}
348
+ obj: dict[str, Any] = {}
347
349
  if isinstance(args, str):
348
350
  try:
349
351
  obj = _json.loads(args)
@@ -351,12 +353,12 @@ def fastapi_app():
351
353
  obj = {}
352
354
  elif isinstance(args, dict):
353
355
  obj = args
354
- acts = obj.get("actions")
355
- if isinstance(acts, list):
356
- return [str(a) for a in acts][:5]
356
+ ans = obj.get("answer")
357
+ if isinstance(ans, str):
358
+ return ans.strip()
357
359
  except Exception:
358
360
  pass
359
- return []
361
+ return ""
360
362
 
361
363
  # Single-step rollout: one agent call followed by evaluation of the returned tool answer
362
364
  history: list[dict[str, Any]] = []
@@ -373,7 +375,16 @@ def fastapi_app():
373
375
  "messages": [{"role": "user", "content": user_prompt}],
374
376
  "tools": [{
375
377
  "type": "function",
376
- "function": {"name": "interact", "parameters": {"type": "object", "properties": {"actions": {"type": "array", "items": {"type": "string"}}}, "required": ["actions"]}},
378
+ "function": {
379
+ "name": "submit_answer",
380
+ "parameters": {
381
+ "type": "object",
382
+ "properties": {
383
+ "answer": {"type": "string"},
384
+ },
385
+ "required": ["answer"],
386
+ },
387
+ },
377
388
  }],
378
389
  "max_tokens": 256,
379
390
  "temperature": 0.2,
@@ -431,11 +442,11 @@ def fastapi_app():
431
442
  except Exception:
432
443
  pass
433
444
 
434
- tool_actions = _parse_tool_actions(data)
435
- history.append({"actions": tool_actions})
445
+ tool_answer = _parse_tool_answer(data)
446
+ history.append({"answer": tool_answer})
436
447
  steps.append({
437
448
  "obs": {},
438
- "tool_calls": [{"tool_name": "interact", "arguments": _json.dumps({"actions": tool_actions})}],
449
+ "tool_calls": [{"tool_name": "submit_answer", "arguments": _json.dumps({"answer": tool_answer})}],
439
450
  "reward": None,
440
451
  "done": False,
441
452
  "truncated": False,
@@ -444,13 +455,8 @@ def fastapi_app():
444
455
 
445
456
  # Evaluate answer correctness using tool output (or fall back to assistant text)
446
457
  reward_val = 0.0
447
- candidate = ""
458
+ candidate = tool_answer or ""
448
459
  try:
449
- if isinstance(tool_actions, list):
450
- for s in reversed(tool_actions):
451
- if isinstance(s, str) and s.strip():
452
- candidate = s.strip()
453
- break
454
460
  if not candidate and llm_text is not None:
455
461
  candidate = _extract_boxed(llm_text) or llm_text
456
462
  if expected_answer is not None:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: synth-ai
3
- Version: 0.2.8.dev11
3
+ Version: 0.2.8.dev12
4
4
  Summary: RL as a service SDK - Core AI functionality and tracing
5
5
  Author-email: Synth AI <josh@usesynth.ai>
6
6
  License-Expression: MIT
@@ -30,7 +30,7 @@ synth_ai/demos/demo_task_apps/math/app.py,sha256=gNopoAhwM0vzdKuCa7AwQqSwiV2xagr
30
30
  synth_ai/demos/demo_task_apps/math/config.toml,sha256=Kxrzuyj7Az5mvzXaipPIyngKTDqphohf6uSWOHCF5cw,2105
31
31
  synth_ai/demos/demo_task_apps/math/deploy_modal.py,sha256=O4745sFuGEZTsygl-mz6ZOFJ7mog8CquXMgMyjFKr_c,2288
32
32
  synth_ai/demos/demo_task_apps/math/deploy_task_app.sh,sha256=qVffbAmsiCAxzFDzcxNVF4f7yyLWnmqPc1cNydHT5BQ,791
33
- synth_ai/demos/demo_task_apps/math/modal_task_app.py,sha256=eJtNUZvO0foucqQ5-jHOygu3VaffrUEHn9jd1_9ncdM,20112
33
+ synth_ai/demos/demo_task_apps/math/modal_task_app.py,sha256=nKrYZBtehAC3J9WHsmV9V2iiC7vbexEz1rTkOoU0wDI,20180
34
34
  synth_ai/environments/__init__.py,sha256=BQW0Nc_BFQq_N-pcqTyJVjW56kSEXu7XZyaSer-U95Q,1032
35
35
  synth_ai/environments/environment/__init__.py,sha256=EBol9AKxPTIPXWcbH9Tja-l3yL-N2kB8e5atyf6F66c,31
36
36
  synth_ai/environments/environment/core.py,sha256=0jd0CZ88_s_qqA3d1lOgVsnv-ucw_1lJDAIUj1gTSt0,2201
@@ -412,9 +412,9 @@ synth_ai/v0/tracing_v1/events/manage.py,sha256=ZDXXP-ZwLH9LCsmw7Ru9o55d7bl_diPtJ
412
412
  synth_ai/v0/tracing_v1/events/scope.py,sha256=BuBkhSpVHUJt8iGT9HJZF82rbb88mQcd2vM2shg-w2I,2550
413
413
  synth_ai/v0/tracing_v1/events/store.py,sha256=0342lvAcalyJbVEIzQFaPuMQGgwiFm7M5rE6gr-G0E8,9041
414
414
  synth_ai/zyk/__init__.py,sha256=htVLnzTYQ5rxzYpzSYBm7_o6uNKZ3pB_PrqkBrgTRS4,771
415
- synth_ai-0.2.8.dev11.dist-info/licenses/LICENSE,sha256=ynhjRQUfqA_RdGRATApfFA_fBAy9cno04sLtLUqxVFM,1069
416
- synth_ai-0.2.8.dev11.dist-info/METADATA,sha256=ibi9UBO3d-6_HewGfYvGBR01F-HxD5G-lYV-on2Gp8s,5153
417
- synth_ai-0.2.8.dev11.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
418
- synth_ai-0.2.8.dev11.dist-info/entry_points.txt,sha256=Neq-3bT7TAijjgOIR77pKL-WYg6TWBDeO8pp_nL4vGY,91
419
- synth_ai-0.2.8.dev11.dist-info/top_level.txt,sha256=fBmtZyVHuKaGa29oHBaaUkrUIWTqSpoVMPiVdCDP3k8,9
420
- synth_ai-0.2.8.dev11.dist-info/RECORD,,
415
+ synth_ai-0.2.8.dev12.dist-info/licenses/LICENSE,sha256=ynhjRQUfqA_RdGRATApfFA_fBAy9cno04sLtLUqxVFM,1069
416
+ synth_ai-0.2.8.dev12.dist-info/METADATA,sha256=quM_ZNMni7xFu7ZSTwA06eAcZbzJjNxbZgrNFDcn22Q,5153
417
+ synth_ai-0.2.8.dev12.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
418
+ synth_ai-0.2.8.dev12.dist-info/entry_points.txt,sha256=Neq-3bT7TAijjgOIR77pKL-WYg6TWBDeO8pp_nL4vGY,91
419
+ synth_ai-0.2.8.dev12.dist-info/top_level.txt,sha256=fBmtZyVHuKaGa29oHBaaUkrUIWTqSpoVMPiVdCDP3k8,9
420
+ synth_ai-0.2.8.dev12.dist-info/RECORD,,