trodo-python 2.26.0__tar.gz → 2.26.1__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.
- {trodo_python-2.26.0 → trodo_python-2.26.1}/PKG-INFO +1 -1
- {trodo_python-2.26.0 → trodo_python-2.26.1}/pyproject.toml +1 -1
- {trodo_python-2.26.0 → trodo_python-2.26.1}/tests/test_datasets.py +16 -0
- {trodo_python-2.26.0 → trodo_python-2.26.1}/trodo/__init__.py +1 -1
- {trodo_python-2.26.0 → trodo_python-2.26.1}/trodo/managers/dataset_manager.py +16 -4
- {trodo_python-2.26.0 → trodo_python-2.26.1}/trodo_python.egg-info/PKG-INFO +1 -1
- {trodo_python-2.26.0 → trodo_python-2.26.1}/README.md +0 -0
- {trodo_python-2.26.0 → trodo_python-2.26.1}/setup.cfg +0 -0
- {trodo_python-2.26.0 → trodo_python-2.26.1}/tests/test_anon_distinct_id.py +0 -0
- {trodo_python-2.26.0 → trodo_python-2.26.1}/tests/test_auto_instrument_fixes.py +0 -0
- {trodo_python-2.26.0 → trodo_python-2.26.1}/tests/test_cross_process_session.py +0 -0
- {trodo_python-2.26.0 → trodo_python-2.26.1}/tests/test_end_run.py +0 -0
- {trodo_python-2.26.0 → trodo_python-2.26.1}/tests/test_error_enrichment.py +0 -0
- {trodo_python-2.26.0 → trodo_python-2.26.1}/tests/test_experiments.py +0 -0
- {trodo_python-2.26.0 → trodo_python-2.26.1}/tests/test_framework_deference.py +0 -0
- {trodo_python-2.26.0 → trodo_python-2.26.1}/tests/test_get_prompt_version_types.py +0 -0
- {trodo_python-2.26.0 → trodo_python-2.26.1}/tests/test_instrumentor_resolution.py +0 -0
- {trodo_python-2.26.0 → trodo_python-2.26.1}/tests/test_llm_usage_cost.py +0 -0
- {trodo_python-2.26.0 → trodo_python-2.26.1}/tests/test_multi_agent_shape.py +0 -0
- {trodo_python-2.26.0 → trodo_python-2.26.1}/tests/test_processor_methods.py +0 -0
- {trodo_python-2.26.0 → trodo_python-2.26.1}/tests/test_prompt_fingerprint.py +0 -0
- {trodo_python-2.26.0 → trodo_python-2.26.1}/tests/test_prompt_trace.py +0 -0
- {trodo_python-2.26.0 → trodo_python-2.26.1}/tests/test_prompts.py +0 -0
- {trodo_python-2.26.0 → trodo_python-2.26.1}/tests/test_register_otel.py +0 -0
- {trodo_python-2.26.0 → trodo_python-2.26.1}/tests/test_sender.py +0 -0
- {trodo_python-2.26.0 → trodo_python-2.26.1}/tests/test_start_run.py +0 -0
- {trodo_python-2.26.0 → trodo_python-2.26.1}/tests/test_user_traits.py +0 -0
- {trodo_python-2.26.0 → trodo_python-2.26.1}/tests/test_wrap_agent_unchanged.py +0 -0
- {trodo_python-2.26.0 → trodo_python-2.26.1}/trodo/_version.py +0 -0
- {trodo_python-2.26.0 → trodo_python-2.26.1}/trodo/api/__init__.py +0 -0
- {trodo_python-2.26.0 → trodo_python-2.26.1}/trodo/api/_retry.py +0 -0
- {trodo_python-2.26.0 → trodo_python-2.26.1}/trodo/api/async_client.py +0 -0
- {trodo_python-2.26.0 → trodo_python-2.26.1}/trodo/api/endpoints.py +0 -0
- {trodo_python-2.26.0 → trodo_python-2.26.1}/trodo/api/http_client.py +0 -0
- {trodo_python-2.26.0 → trodo_python-2.26.1}/trodo/auto/__init__.py +0 -0
- {trodo_python-2.26.0 → trodo_python-2.26.1}/trodo/auto/auto_event_manager.py +0 -0
- {trodo_python-2.26.0 → trodo_python-2.26.1}/trodo/client.py +0 -0
- {trodo_python-2.26.0 → trodo_python-2.26.1}/trodo/delivery/__init__.py +0 -0
- {trodo_python-2.26.0 → trodo_python-2.26.1}/trodo/delivery/sender.py +0 -0
- {trodo_python-2.26.0 → trodo_python-2.26.1}/trodo/managers/__init__.py +0 -0
- {trodo_python-2.26.0 → trodo_python-2.26.1}/trodo/managers/experiment_manager.py +0 -0
- {trodo_python-2.26.0 → trodo_python-2.26.1}/trodo/managers/group_manager.py +0 -0
- {trodo_python-2.26.0 → trodo_python-2.26.1}/trodo/managers/people_manager.py +0 -0
- {trodo_python-2.26.0 → trodo_python-2.26.1}/trodo/managers/prompt_manager.py +0 -0
- {trodo_python-2.26.0 → trodo_python-2.26.1}/trodo/managers/user_manager.py +0 -0
- {trodo_python-2.26.0 → trodo_python-2.26.1}/trodo/otel/__init__.py +0 -0
- {trodo_python-2.26.0 → trodo_python-2.26.1}/trodo/otel/auto_instrument.py +0 -0
- {trodo_python-2.26.0 → trodo_python-2.26.1}/trodo/otel/context.py +0 -0
- {trodo_python-2.26.0 → trodo_python-2.26.1}/trodo/otel/helpers.py +0 -0
- {trodo_python-2.26.0 → trodo_python-2.26.1}/trodo/otel/processor.py +0 -0
- {trodo_python-2.26.0 → trodo_python-2.26.1}/trodo/otel/prompt_trace.py +0 -0
- {trodo_python-2.26.0 → trodo_python-2.26.1}/trodo/otel/register.py +0 -0
- {trodo_python-2.26.0 → trodo_python-2.26.1}/trodo/otel/transport.py +0 -0
- {trodo_python-2.26.0 → trodo_python-2.26.1}/trodo/otel/wrap_agent.py +0 -0
- {trodo_python-2.26.0 → trodo_python-2.26.1}/trodo/prompts/__init__.py +0 -0
- {trodo_python-2.26.0 → trodo_python-2.26.1}/trodo/prompts/compile.py +0 -0
- {trodo_python-2.26.0 → trodo_python-2.26.1}/trodo/prompts/template.py +0 -0
- {trodo_python-2.26.0 → trodo_python-2.26.1}/trodo/prompts/types.py +0 -0
- {trodo_python-2.26.0 → trodo_python-2.26.1}/trodo/queue/__init__.py +0 -0
- {trodo_python-2.26.0 → trodo_python-2.26.1}/trodo/queue/batch_flusher.py +0 -0
- {trodo_python-2.26.0 → trodo_python-2.26.1}/trodo/queue/event_queue.py +0 -0
- {trodo_python-2.26.0 → trodo_python-2.26.1}/trodo/session/__init__.py +0 -0
- {trodo_python-2.26.0 → trodo_python-2.26.1}/trodo/session/server_session.py +0 -0
- {trodo_python-2.26.0 → trodo_python-2.26.1}/trodo/session/session_manager.py +0 -0
- {trodo_python-2.26.0 → trodo_python-2.26.1}/trodo/types.py +0 -0
- {trodo_python-2.26.0 → trodo_python-2.26.1}/trodo/user_context.py +0 -0
- {trodo_python-2.26.0 → trodo_python-2.26.1}/trodo/util/__init__.py +0 -0
- {trodo_python-2.26.0 → trodo_python-2.26.1}/trodo/util/lru.py +0 -0
- {trodo_python-2.26.0 → trodo_python-2.26.1}/trodo_python.egg-info/SOURCES.txt +0 -0
- {trodo_python-2.26.0 → trodo_python-2.26.1}/trodo_python.egg-info/dependency_links.txt +0 -0
- {trodo_python-2.26.0 → trodo_python-2.26.1}/trodo_python.egg-info/requires.txt +0 -0
- {trodo_python-2.26.0 → trodo_python-2.26.1}/trodo_python.egg-info/top_level.txt +0 -0
|
@@ -128,3 +128,19 @@ def test_export_requires_a_token_and_raises_on_http_errors():
|
|
|
128
128
|
DatasetManager(FakeExportHttp({})).export("ds", "")
|
|
129
129
|
with pytest.raises(RuntimeError, match="HTTP 404"):
|
|
130
130
|
DatasetManager(FakeExportHttp({"__error": True, "status": 404, "error": "not_found"})).export("ds", "trodo_dx_abc")
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
def test_append_accepts_unit_references_without_input():
|
|
134
|
+
http = FakeHttp()
|
|
135
|
+
DatasetManager(http).append("ds", [
|
|
136
|
+
{"span_id": "s1", "tags": ["hard"]},
|
|
137
|
+
{"run_id": "r1"},
|
|
138
|
+
{"conversation_id": "c1", "metadata": {"k": 1}},
|
|
139
|
+
{"eval_run_id": "v1"},
|
|
140
|
+
])
|
|
141
|
+
assert http.last_body["items"] == [
|
|
142
|
+
{"span_id": "s1", "tags": ["hard"]},
|
|
143
|
+
{"run_id": "r1"},
|
|
144
|
+
{"conversation_id": "c1", "metadata": {"k": 1}},
|
|
145
|
+
{"eval_run_id": "v1"},
|
|
146
|
+
]
|
|
@@ -17,16 +17,28 @@ from typing import Any, Dict, List, Optional, Union
|
|
|
17
17
|
|
|
18
18
|
__all__ = ["DatasetManager"]
|
|
19
19
|
|
|
20
|
-
# The optional per-item fields, in wire order. ``input`` is
|
|
21
|
-
_ITEM_OPTIONAL = ("expected_output", "metadata", "source_trace_ref")
|
|
20
|
+
# The optional per-item fields, in wire order. ``input`` is required on a row.
|
|
21
|
+
_ITEM_OPTIONAL = ("output", "expected_output", "metadata", "source_trace_ref", "tags")
|
|
22
|
+
# A reference to production instead of content: the item becomes that unit's
|
|
23
|
+
# row (Input, Output and Evaluations filled by Trodo). ``eval_run_id`` names a
|
|
24
|
+
# verdict: Output is what the eval said, Expected its correction.
|
|
25
|
+
_UNIT_REF_KEYS = ("span_id", "run_id", "conversation_id", "eval_run_id")
|
|
26
|
+
_UNIT_REF_OPTIONAL = ("tags", "metadata")
|
|
22
27
|
|
|
23
28
|
|
|
24
29
|
def _clean_item(item: Dict[str, Any]) -> Dict[str, Any]:
|
|
25
30
|
if not isinstance(item, dict):
|
|
26
31
|
raise ValueError("trodo: each dataset item must be a dict")
|
|
32
|
+
ref = [k for k in _UNIT_REF_KEYS if item.get(k)]
|
|
33
|
+
if ref and ("input" not in item or item["input"] is None):
|
|
34
|
+
out: Dict[str, Any] = {ref[0]: str(item[ref[0]])}
|
|
35
|
+
for key in _UNIT_REF_OPTIONAL:
|
|
36
|
+
if item.get(key) is not None:
|
|
37
|
+
out[key] = item[key]
|
|
38
|
+
return out
|
|
27
39
|
if "input" not in item or item["input"] is None:
|
|
28
|
-
raise ValueError("trodo: each dataset item requires an 'input' dict")
|
|
29
|
-
out
|
|
40
|
+
raise ValueError("trodo: each dataset item requires an 'input' dict, or a span_id / run_id / conversation_id / eval_run_id")
|
|
41
|
+
out = {"input": item["input"]}
|
|
30
42
|
for key in _ITEM_OPTIONAL:
|
|
31
43
|
if item.get(key) is not None:
|
|
32
44
|
out[key] = item[key]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|