lmnr 0.4.29b1__py3-none-any.whl → 0.4.29b2__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.
- lmnr/sdk/types.py +24 -24
- lmnr/sdk/utils.py +5 -5
- {lmnr-0.4.29b1.dist-info → lmnr-0.4.29b2.dist-info}/METADATA +1 -1
- {lmnr-0.4.29b1.dist-info → lmnr-0.4.29b2.dist-info}/RECORD +7 -7
- {lmnr-0.4.29b1.dist-info → lmnr-0.4.29b2.dist-info}/LICENSE +0 -0
- {lmnr-0.4.29b1.dist-info → lmnr-0.4.29b2.dist-info}/WHEEL +0 -0
- {lmnr-0.4.29b1.dist-info → lmnr-0.4.29b2.dist-info}/entry_points.txt +0 -0
lmnr/sdk/types.py
CHANGED
@@ -77,18 +77,17 @@ class PipelineRunError(Exception):
|
|
77
77
|
return super().__str__()
|
78
78
|
|
79
79
|
|
80
|
-
EvaluationDatapointData =
|
81
|
-
EvaluationDatapointTarget =
|
82
|
-
EvaluationDatapointMetadata = Optional[
|
80
|
+
EvaluationDatapointData = Any # non-null, must be JSON-serializable
|
81
|
+
EvaluationDatapointTarget = Optional[Any] # must be JSON-serializable
|
82
|
+
EvaluationDatapointMetadata = Optional[Any] # must be JSON-serializable
|
83
83
|
|
84
84
|
|
85
85
|
# EvaluationDatapoint is a single data point in the evaluation
|
86
86
|
class Datapoint(pydantic.BaseModel):
|
87
|
-
# input to the executor function.
|
87
|
+
# input to the executor function.
|
88
88
|
data: EvaluationDatapointData
|
89
89
|
# input to the evaluator function (alongside the executor output).
|
90
|
-
|
91
|
-
target: EvaluationDatapointTarget
|
90
|
+
target: EvaluationDatapointTarget = pydantic.Field(default=None)
|
92
91
|
metadata: EvaluationDatapointMetadata = pydantic.Field(default=None)
|
93
92
|
|
94
93
|
|
@@ -135,23 +134,24 @@ class EvaluationResultDatapoint(pydantic.BaseModel):
|
|
135
134
|
|
136
135
|
# uuid is not serializable by default, so we need to convert it to a string
|
137
136
|
def to_dict(self):
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
}
|
154
|
-
|
137
|
+
try:
|
138
|
+
return {
|
139
|
+
"data": serialize(self.data),
|
140
|
+
"target": serialize(self.target),
|
141
|
+
"executorOutput": serialize(self.executor_output),
|
142
|
+
"scores": self.scores,
|
143
|
+
"traceId": str(self.trace_id),
|
144
|
+
"humanEvaluators": {
|
145
|
+
k: (
|
146
|
+
v.model_dump()
|
147
|
+
if isinstance(v, pydantic.BaseModel)
|
148
|
+
else serialize(v)
|
149
|
+
)
|
150
|
+
for k, v in self.human_evaluators.items()
|
151
|
+
},
|
152
|
+
}
|
153
|
+
except Exception as e:
|
154
|
+
raise ValueError(f"Error serializing EvaluationResultDatapoint: {e}")
|
155
155
|
|
156
156
|
|
157
157
|
class SpanType(Enum):
|
@@ -165,7 +165,7 @@ class SpanType(Enum):
|
|
165
165
|
|
166
166
|
class TraceType(Enum):
|
167
167
|
DEFAULT = "DEFAULT"
|
168
|
-
EVENT = "EVENT" #
|
168
|
+
EVENT = "EVENT" # deprecated
|
169
169
|
EVALUATION = "EVALUATION"
|
170
170
|
|
171
171
|
|
lmnr/sdk/utils.py
CHANGED
@@ -50,7 +50,7 @@ def is_iterator(o: typing.Any) -> bool:
|
|
50
50
|
|
51
51
|
|
52
52
|
def serialize(obj: typing.Any) -> dict[str, typing.Any]:
|
53
|
-
def
|
53
|
+
def serialize_inner(o: typing.Any):
|
54
54
|
if isinstance(o, (datetime.datetime, datetime.date)):
|
55
55
|
return o.strftime("%Y-%m-%dT%H:%M:%S.%f%z")
|
56
56
|
elif o is None:
|
@@ -68,17 +68,17 @@ def serialize(obj: typing.Any) -> dict[str, typing.Any]:
|
|
68
68
|
elif isinstance(o, pydantic.BaseModel):
|
69
69
|
return o.model_dump()
|
70
70
|
elif isinstance(o, (tuple, set, frozenset)):
|
71
|
-
return [
|
71
|
+
return [serialize_inner(item) for item in o]
|
72
72
|
elif isinstance(o, list):
|
73
|
-
return [
|
73
|
+
return [serialize_inner(item) for item in o]
|
74
74
|
elif isinstance(o, dict):
|
75
|
-
return {
|
75
|
+
return {serialize_inner(k): serialize_inner(v) for k, v in o.items()}
|
76
76
|
elif isinstance(o, queue.Queue):
|
77
77
|
return type(o).__name__
|
78
78
|
|
79
79
|
return str(o)
|
80
80
|
|
81
|
-
return
|
81
|
+
return serialize_inner(obj)
|
82
82
|
|
83
83
|
|
84
84
|
def get_input_from_func_args(
|
@@ -6,8 +6,8 @@ lmnr/sdk/decorators.py,sha256=ZSDaEZyjo-RUzRCltsNbe6x0t9SKl2xRQ2q4uaKvXtk,2250
|
|
6
6
|
lmnr/sdk/evaluations.py,sha256=BUdsxuh3Rjk-8oj-481geW7fqTmgLcq0CuMOYbgMFx8,16807
|
7
7
|
lmnr/sdk/laminar.py,sha256=H87fXSWb9shcPW4AeoYwvTXJ-jSTjzm2sI1A1U1Vkg8,18780
|
8
8
|
lmnr/sdk/log.py,sha256=cZBeUoSK39LMEV-X4-eEhTWOciULRfHaKfRK8YqIM8I,1532
|
9
|
-
lmnr/sdk/types.py,sha256=
|
10
|
-
lmnr/sdk/utils.py,sha256=
|
9
|
+
lmnr/sdk/types.py,sha256=SyvJ9WMdsfW0Blqp579hfTC4A34YfmYxxY5QKkS4eVs,5513
|
10
|
+
lmnr/sdk/utils.py,sha256=Uk8y15x-sd5tP2ERONahElLDJVEy_3dA_1_5g9A6auY,3358
|
11
11
|
lmnr/traceloop_sdk/.flake8,sha256=bCxuDlGx3YQ55QHKPiGJkncHanh9qGjQJUujcFa3lAU,150
|
12
12
|
lmnr/traceloop_sdk/.python-version,sha256=9OLQBQVbD4zE4cJsPePhnAfV_snrPSoqEQw-PXgPMOs,6
|
13
13
|
lmnr/traceloop_sdk/__init__.py,sha256=hp3q1OsFaGgaQCEanJrL38BJN32hWqCNVCSjYpndEsY,2957
|
@@ -45,8 +45,8 @@ lmnr/traceloop_sdk/utils/in_memory_span_exporter.py,sha256=H_4TRaThMO1H6vUQ0OpQv
|
|
45
45
|
lmnr/traceloop_sdk/utils/json_encoder.py,sha256=dK6b_axr70IYL7Vv-bu4wntvDDuyntoqsHaddqX7P58,463
|
46
46
|
lmnr/traceloop_sdk/utils/package_check.py,sha256=TZSngzJOpFhfUZLXIs38cpMxQiZSmp0D-sCrIyhz7BA,251
|
47
47
|
lmnr/traceloop_sdk/version.py,sha256=OlatFEFA4ttqSSIiV8jdE-sq3KG5zu2hnC4B4mzWF3s,23
|
48
|
-
lmnr-0.4.
|
49
|
-
lmnr-0.4.
|
50
|
-
lmnr-0.4.
|
51
|
-
lmnr-0.4.
|
52
|
-
lmnr-0.4.
|
48
|
+
lmnr-0.4.29b2.dist-info/LICENSE,sha256=67b_wJHVV1CBaWkrKFWU1wyqTPSdzH77Ls-59631COg,10411
|
49
|
+
lmnr-0.4.29b2.dist-info/METADATA,sha256=fWqZcMMmcJ68dGr-5oWyLMT2ac_lBR9vWfolKzqQjIw,10690
|
50
|
+
lmnr-0.4.29b2.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
51
|
+
lmnr-0.4.29b2.dist-info/entry_points.txt,sha256=K1jE20ww4jzHNZLnsfWBvU3YKDGBgbOiYG5Y7ivQcq4,37
|
52
|
+
lmnr-0.4.29b2.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|