agent-eval-rpc 2.0.2__tar.gz → 2.0.5__tar.gz

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.
Files changed (47) hide show
  1. {agent_eval_rpc-2.0.2 → agent_eval_rpc-2.0.5}/PKG-INFO +3 -1
  2. {agent_eval_rpc-2.0.2 → agent_eval_rpc-2.0.5}/README.md +2 -0
  3. {agent_eval_rpc-2.0.2 → agent_eval_rpc-2.0.5}/pyproject.toml +1 -1
  4. {agent_eval_rpc-2.0.2 → agent_eval_rpc-2.0.5}/src/agent_eval_rpc/__init__.py +1 -1
  5. {agent_eval_rpc-2.0.2 → agent_eval_rpc-2.0.5}/src/agent_eval_rpc/dspy_rlm_bridge.py +5 -3
  6. {agent_eval_rpc-2.0.2 → agent_eval_rpc-2.0.5}/src/agent_eval_rpc/dspy_rlm_output.py +12 -1
  7. {agent_eval_rpc-2.0.2 → agent_eval_rpc-2.0.5}/tests/test_dspy_rlm_bridge.py +71 -0
  8. {agent_eval_rpc-2.0.2 → agent_eval_rpc-2.0.5}/uv.lock +1 -1
  9. {agent_eval_rpc-2.0.2 → agent_eval_rpc-2.0.5}/.gitignore +0 -0
  10. {agent_eval_rpc-2.0.2 → agent_eval_rpc-2.0.5}/examples/judge_anti_slop.py +0 -0
  11. {agent_eval_rpc-2.0.2 → agent_eval_rpc-2.0.5}/scripts/verify_publishable_dist.py +0 -0
  12. {agent_eval_rpc-2.0.2 → agent_eval_rpc-2.0.5}/src/agent_eval_rpc/client.py +0 -0
  13. {agent_eval_rpc-2.0.2 → agent_eval_rpc-2.0.5}/src/agent_eval_rpc/dspy_metric.py +0 -0
  14. {agent_eval_rpc-2.0.2 → agent_eval_rpc-2.0.5}/src/agent_eval_rpc/dspy_rlm_codetrace.py +0 -0
  15. {agent_eval_rpc-2.0.2 → agent_eval_rpc-2.0.5}/src/agent_eval_rpc/dspy_rlm_repair.py +0 -0
  16. {agent_eval_rpc-2.0.2 → agent_eval_rpc-2.0.5}/src/agent_eval_rpc/dspy_rlm_sandbox.py +0 -0
  17. {agent_eval_rpc-2.0.2 → agent_eval_rpc-2.0.5}/src/agent_eval_rpc/dspy_rlm_tools.py +0 -0
  18. {agent_eval_rpc-2.0.2 → agent_eval_rpc-2.0.5}/src/agent_eval_rpc/dspy_rlm_validation.py +0 -0
  19. {agent_eval_rpc-2.0.2 → agent_eval_rpc-2.0.5}/src/agent_eval_rpc/errors.py +0 -0
  20. {agent_eval_rpc-2.0.2 → agent_eval_rpc-2.0.5}/src/agent_eval_rpc/finding_codec.py +0 -0
  21. {agent_eval_rpc-2.0.2 → agent_eval_rpc-2.0.5}/src/agent_eval_rpc/finding_contract.json +0 -0
  22. {agent_eval_rpc-2.0.2 → agent_eval_rpc-2.0.5}/src/agent_eval_rpc/gepa_api.py +0 -0
  23. {agent_eval_rpc-2.0.2 → agent_eval_rpc-2.0.5}/src/agent_eval_rpc/gepa_bridge.py +0 -0
  24. {agent_eval_rpc-2.0.2 → agent_eval_rpc-2.0.5}/src/agent_eval_rpc/gepa_bridge_contract.py +0 -0
  25. {agent_eval_rpc-2.0.2 → agent_eval_rpc-2.0.5}/src/agent_eval_rpc/gepa_bridge_proof.py +0 -0
  26. {agent_eval_rpc-2.0.2 → agent_eval_rpc-2.0.5}/src/agent_eval_rpc/gepa_compat_0_1_4.py +0 -0
  27. {agent_eval_rpc-2.0.2 → agent_eval_rpc-2.0.5}/src/agent_eval_rpc/gepa_model_proxy.py +0 -0
  28. {agent_eval_rpc-2.0.2 → agent_eval_rpc-2.0.5}/src/agent_eval_rpc/hosted.py +0 -0
  29. {agent_eval_rpc-2.0.2 → agent_eval_rpc-2.0.5}/src/agent_eval_rpc/models.py +0 -0
  30. {agent_eval_rpc-2.0.2 → agent_eval_rpc-2.0.5}/src/agent_eval_rpc/optimizer_bridge_common.py +0 -0
  31. {agent_eval_rpc-2.0.2 → agent_eval_rpc-2.0.5}/src/agent_eval_rpc/skillopt_bridge.py +0 -0
  32. {agent_eval_rpc-2.0.2 → agent_eval_rpc-2.0.5}/src/agent_eval_rpc/skillopt_compat_v020.py +0 -0
  33. {agent_eval_rpc-2.0.2 → agent_eval_rpc-2.0.5}/tests/fixtures/gepa-chat-request.json +0 -0
  34. {agent_eval_rpc-2.0.2 → agent_eval_rpc-2.0.5}/tests/fixtures/skillopt-chat-request.json +0 -0
  35. {agent_eval_rpc-2.0.2 → agent_eval_rpc-2.0.5}/tests/test_client.py +0 -0
  36. {agent_eval_rpc-2.0.2 → agent_eval_rpc-2.0.5}/tests/test_dspy_metric.py +0 -0
  37. {agent_eval_rpc-2.0.2 → agent_eval_rpc-2.0.5}/tests/test_dspy_rlm_bridge_codetrace.py +0 -0
  38. {agent_eval_rpc-2.0.2 → agent_eval_rpc-2.0.5}/tests/test_dspy_rlm_bridge_repair.py +0 -0
  39. {agent_eval_rpc-2.0.2 → agent_eval_rpc-2.0.5}/tests/test_finding_codec.py +0 -0
  40. {agent_eval_rpc-2.0.2 → agent_eval_rpc-2.0.5}/tests/test_gepa_bridge.py +0 -0
  41. {agent_eval_rpc-2.0.2 → agent_eval_rpc-2.0.5}/tests/test_gepa_release_compatibility.py +0 -0
  42. {agent_eval_rpc-2.0.2 → agent_eval_rpc-2.0.5}/tests/test_hosted.py +0 -0
  43. {agent_eval_rpc-2.0.2 → agent_eval_rpc-2.0.5}/tests/test_models.py +0 -0
  44. {agent_eval_rpc-2.0.2 → agent_eval_rpc-2.0.5}/tests/test_official_optimizer_compatibility.py +0 -0
  45. {agent_eval_rpc-2.0.2 → agent_eval_rpc-2.0.5}/tests/test_optimizer_bridge_common.py +0 -0
  46. {agent_eval_rpc-2.0.2 → agent_eval_rpc-2.0.5}/tests/test_skillopt_bridge.py +0 -0
  47. {agent_eval_rpc-2.0.2 → agent_eval_rpc-2.0.5}/tests/test_subprocess.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: agent-eval-rpc
3
- Version: 2.0.2
3
+ Version: 2.0.5
4
4
  Summary: Python RPC client, official optimizer bridge, and DSPy metric adapter for @tangle-network/agent-eval.
5
5
  Project-URL: Homepage, https://github.com/tangle-network/agent-eval
6
6
  Project-URL: Issues, https://github.com/tangle-network/agent-eval/issues
@@ -328,6 +328,8 @@ Agent Eval also runs the official `dspy.RLM` for recursive trace analysis.
328
328
  The TypeScript API starts the Python bridge, provides authenticated trace tools, calls a caller-owned model execution path, enforces model and trace-read limits, and validates cited findings.
329
329
  The Python bridge owns no trace storage or model credentials.
330
330
 
331
+ A generic RLM `SUBMIT` answer may be a string or a native dictionary/list of finite JSON. The bridge returns strings unchanged after the existing whitespace check and serializes dictionaries/lists as lossless JSON with Unicode preserved; other native types are errors. It does not evaluate Python-literal text, relax the consumer's answer schema, or spend a repair call on serialization.
332
+
331
333
  ### The raw-finding wire contract
332
334
 
333
335
  Both languages decode a findings array with the same rules.
@@ -297,6 +297,8 @@ Agent Eval also runs the official `dspy.RLM` for recursive trace analysis.
297
297
  The TypeScript API starts the Python bridge, provides authenticated trace tools, calls a caller-owned model execution path, enforces model and trace-read limits, and validates cited findings.
298
298
  The Python bridge owns no trace storage or model credentials.
299
299
 
300
+ A generic RLM `SUBMIT` answer may be a string or a native dictionary/list of finite JSON. The bridge returns strings unchanged after the existing whitespace check and serializes dictionaries/lists as lossless JSON with Unicode preserved; other native types are errors. It does not evaluate Python-literal text, relax the consumer's answer schema, or spend a repair call on serialization.
301
+
300
302
  ### The raw-finding wire contract
301
303
 
302
304
  Both languages decode a findings array with the same rules.
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "agent-eval-rpc"
7
- version = "2.0.2"
7
+ version = "2.0.5"
8
8
  description = "Python RPC client, official optimizer bridge, and DSPy metric adapter for @tangle-network/agent-eval."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
@@ -50,7 +50,7 @@ from .models import (
50
50
  try:
51
51
  __version__ = version("agent-eval-rpc")
52
52
  except PackageNotFoundError:
53
- __version__ = "2.0.2"
53
+ __version__ = "2.0.5"
54
54
 
55
55
  __all__ = [
56
56
  "Client",
@@ -460,11 +460,13 @@ def _build_signature(dspy: Any) -> Any:
460
460
  dspy.InputField(desc="Task-specific investigation and reporting instructions."),
461
461
  ),
462
462
  "answer": (
463
- str,
464
- dspy.OutputField(desc="A concise, evidence-supported answer."),
463
+ str | dict[str, Any] | list[Any] | None,
464
+ dspy.OutputField(
465
+ desc="A concise, evidence-supported string, JSON object, or JSON array."
466
+ ),
465
467
  ),
466
468
  "findings_json": (
467
- str,
469
+ str | dict[str, Any] | list[Any] | None,
468
470
  dspy.OutputField(
469
471
  desc="A strict JSON array of cited findings matching the required schema."
470
472
  ),
@@ -318,8 +318,19 @@ def _prediction_field(prediction: Any, name: str) -> Any:
318
318
 
319
319
  def _prediction_string(prediction: Any, name: str) -> str:
320
320
  value = _prediction_field(prediction, name)
321
+ label = f"DSPy RLM prediction {name}"
322
+ if isinstance(value, (dict, list)):
323
+ submitted = value
324
+ try:
325
+ value = json.dumps(
326
+ value, ensure_ascii=False, allow_nan=False, separators=(",", ":")
327
+ )
328
+ if json.loads(value) != submitted:
329
+ raise ValueError("JSON encoding changed the submitted value")
330
+ except (TypeError, ValueError) as error:
331
+ raise ValueError(f"{label} must be lossless finite JSON") from error
321
332
  # Model output: surrounding whitespace is presentation, not a data-integrity
322
333
  # defect, and this runs after every model call is already paid for.
323
334
  if isinstance(value, str):
324
335
  value = value.strip()
325
- return _require_non_empty_string(value, f"DSPy RLM prediction {name}")
336
+ return _require_non_empty_string(value, label)
@@ -363,6 +363,77 @@ def test_a_list_valued_submission_survives_the_string_boundary() -> None:
363
363
  dspy_rlm_bridge._parse_findings_json(str(rows))
364
364
 
365
365
 
366
+ def test_deno_submit_preserves_native_answer_before_dspy_output_parsing() -> None:
367
+ dspy = pytest.importorskip("dspy")
368
+
369
+ signature = dspy_rlm_bridge._build_signature(dspy)
370
+ program = dspy.RLM(signature, max_iters=1, max_llm_calls=1)
371
+ interpreter = dspy.PythonInterpreter(output_fields=program._get_output_fields_info())
372
+ try:
373
+ submitted = interpreter.execute(
374
+ "answer = {\n"
375
+ " 'score': None,\n"
376
+ " 'verdict': 'Café 世界',\n"
377
+ " 'nested': [True, False, None, {'text': '²'}],\n"
378
+ "}\n"
379
+ "SUBMIT(answer=answer, findings_json=[])"
380
+ )
381
+ assert isinstance(submitted.output["answer"], dict)
382
+ assert submitted.output["answer"]["nested"][2] is None
383
+
384
+ parsed, error = program._process_final_output(
385
+ submitted, ["answer", "findings_json"]
386
+ )
387
+ assert error is None
388
+ assert parsed is not None
389
+ assert parsed["answer"] == submitted.output["answer"]
390
+ assert parsed["findings_json"] == submitted.output["findings_json"]
391
+
392
+ for answer in ("42", "null", "true", '{"score": null, "verdict": "Café 世界"}'):
393
+ submitted = interpreter.execute(
394
+ f"SUBMIT(answer={answer!r}, findings_json=[])"
395
+ )
396
+ parsed, error = program._process_final_output(
397
+ submitted, ["answer", "findings_json"]
398
+ )
399
+ assert error is None
400
+ assert parsed is not None
401
+ assert parsed["answer"] == answer
402
+ finally:
403
+ interpreter.shutdown()
404
+
405
+
406
+ def test_prediction_string_serializes_native_json_without_accepting_other_values() -> None:
407
+ answer = {
408
+ "score": None,
409
+ "verdict": "Café 世界",
410
+ "nested": [True, False, None, {"text": "²"}],
411
+ }
412
+ encoded = dspy_rlm_bridge._prediction_string({"answer": answer}, "answer")
413
+ assert json.loads(encoded) == answer
414
+ assert "Café 世界" in encoded
415
+
416
+ array = [{"value": None}, [True, "雪"]]
417
+ assert json.loads(dspy_rlm_bridge._prediction_string({"answer": array}, "answer")) == array
418
+ assert dspy_rlm_bridge._prediction_string(
419
+ {"answer": " plain 'text' None {not json} "}, "answer"
420
+ ) == "plain 'text' None {not json}"
421
+
422
+ for invalid in (
423
+ None,
424
+ 42,
425
+ True,
426
+ float("nan"),
427
+ {"not-json"},
428
+ {"nested": float("nan")},
429
+ {1: "non-string key"},
430
+ ):
431
+ with pytest.raises((TypeError, ValueError), match="DSPy RLM prediction answer"):
432
+ dspy_rlm_bridge._prediction_string({"answer": invalid}, "answer")
433
+ with pytest.raises(ValueError, match="missing answer"):
434
+ dspy_rlm_bridge._prediction_string({}, "answer")
435
+
436
+
366
437
  def test_the_generic_repair_prompt_does_not_ask_for_incorrect_steps() -> None:
367
438
  # #579: the generic path reused CodeTrace's "no incorrect steps means []"
368
439
  # rule, which erased valid factual findings from a generic analysis.
@@ -37,7 +37,7 @@ conflicts = [[
37
37
 
38
38
  [[package]]
39
39
  name = "agent-eval-rpc"
40
- version = "2.0.2"
40
+ version = "2.0.5"
41
41
  source = { editable = "." }
42
42
  dependencies = [
43
43
  { name = "filelock" },