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 CHANGED
@@ -41,7 +41,7 @@ Downstream microservice (join the caller's run instead of making a new one):
41
41
 
42
42
  from __future__ import annotations
43
43
 
44
- __version__ = "2.26.0"
44
+ __version__ = "2.26.1"
45
45
 
46
46
  from typing import Any, Callable, Dict, List, Optional, Union
47
47
 
@@ -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 always required.
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: Dict[str, Any] = {"input": item["input"]}
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,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: trodo-python
3
- Version: 2.26.0
3
+ Version: 2.26.1
4
4
  Summary: Trodo Analytics SDK for Python — server-side event tracking
5
5
  License: ISC
6
6
  Keywords: analytics,tracking,trodo,server-side
@@ -1,4 +1,4 @@
1
- trodo/__init__.py,sha256=P8tsY10bg0h-A8TjIYYEiFuYpo-jGSbDzViEsKbnKsU,28752
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=kR3aoyuq1gcZ5Gpr6bf2Mz_cqv275dXlO6cGL5qfwEA,4902
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.0.dist-info/METADATA,sha256=RE-9yCbqYEzBYYWCQuyXOGsyhGTSPw6rLpiv9cfEdF4,25308
44
- trodo_python-2.26.0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
45
- trodo_python-2.26.0.dist-info/top_level.txt,sha256=VCQu1CJWFmNsqTs1YxMcw4Mq35Tc3z3uI9RwHEXAayQ,6
46
- trodo_python-2.26.0.dist-info/RECORD,,
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,,