trodo-python 2.26.0__py3-none-any.whl → 2.26.1__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.
- trodo/__init__.py +1 -1
- trodo/managers/dataset_manager.py +16 -4
- {trodo_python-2.26.0.dist-info → trodo_python-2.26.1.dist-info}/METADATA +1 -1
- {trodo_python-2.26.0.dist-info → trodo_python-2.26.1.dist-info}/RECORD +6 -6
- {trodo_python-2.26.0.dist-info → trodo_python-2.26.1.dist-info}/WHEEL +0 -0
- {trodo_python-2.26.0.dist-info → trodo_python-2.26.1.dist-info}/top_level.txt +0 -0
trodo/__init__.py
CHANGED
|
@@ -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]
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
trodo/__init__.py,sha256=
|
|
1
|
+
trodo/__init__.py,sha256=RCoNO_seZkIUmweHvyKb8t6J5ydktoAHOg2nt2sp448,28752
|
|
2
2
|
trodo/_version.py,sha256=MX7IGM5dYbXPeFIXOWPhV7DPbCslhEe8Q7DCvxwKmhY,23
|
|
3
3
|
trodo/client.py,sha256=6k6HeKrGV2720kK17--u6BjbhAUFZNUzpd9yEYiaQOs,24137
|
|
4
4
|
trodo/types.py,sha256=eySgUvCXROG2TxtxgiU0MNr5iH0DEcduK8bmYtTKG44,3138
|
|
@@ -13,7 +13,7 @@ trodo/auto/auto_event_manager.py,sha256=cztuRsRkNoJE5R4NfSfTrTJTGl4jx2Yb-Ncy0aVA
|
|
|
13
13
|
trodo/delivery/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
14
14
|
trodo/delivery/sender.py,sha256=urO7m6mRMnSEW7_cNAmJ4A6jtDNxuihZHOxCx1jQScI,21348
|
|
15
15
|
trodo/managers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
16
|
-
trodo/managers/dataset_manager.py,sha256=
|
|
16
|
+
trodo/managers/dataset_manager.py,sha256=mifHYkHLWo0olXCNfQOqvpLPL8DDgbub7YAWWlrjIHQ,5609
|
|
17
17
|
trodo/managers/experiment_manager.py,sha256=V-vemLtenfSI5VIcP0HPiXzEy8AyTrRrbJVCA9Z6wjo,10579
|
|
18
18
|
trodo/managers/group_manager.py,sha256=ki3Se3qEoSZfREX63oeDeBmEfZF-ISHLE8azEtLg0tM,3542
|
|
19
19
|
trodo/managers/people_manager.py,sha256=mMVnx40Mlifx6NGgChvohC9ViK6dQu2mkXNHbV8pK1E,2882
|
|
@@ -40,7 +40,7 @@ trodo/session/server_session.py,sha256=McsudEiq33XDq3nqxgzBcUvIjQxCMscwEuAPnYXrT
|
|
|
40
40
|
trodo/session/session_manager.py,sha256=7ht5LeeZX1HLLfPeNV_a8NkXGbHl3up0CRtCGr3EzjQ,2995
|
|
41
41
|
trodo/util/__init__.py,sha256=Z9c4rPPdKg06Kk3byKheDqksSgR4WNvS475oQ5sNljc,54
|
|
42
42
|
trodo/util/lru.py,sha256=QIsM7s6J_E9ZjiXatSyReZIEeGypTAcgrPWWy8YsRa4,2465
|
|
43
|
-
trodo_python-2.26.
|
|
44
|
-
trodo_python-2.26.
|
|
45
|
-
trodo_python-2.26.
|
|
46
|
-
trodo_python-2.26.
|
|
43
|
+
trodo_python-2.26.1.dist-info/METADATA,sha256=2I7mNSS6gC_w6I3Mc9iOT-E6VHLboXBB9o8i4F-8YN0,25308
|
|
44
|
+
trodo_python-2.26.1.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
|
|
45
|
+
trodo_python-2.26.1.dist-info/top_level.txt,sha256=VCQu1CJWFmNsqTs1YxMcw4Mq35Tc3z3uI9RwHEXAayQ,6
|
|
46
|
+
trodo_python-2.26.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|