Skip to content

Commit 8c0272e

Browse files
wochingeclaude
andcommitted
fix(scores): update stale casts and export ExperimentScoreType
Update cast(Literal["CATEGORICAL"], ...) to include "TEXT" in score/score_trace/score_current_span/score_current_trace impl bodies. Add ExperimentScoreType to __all__ in types.py. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 5d14025 commit 8c0272e

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

langfuse/_client/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1971,7 +1971,7 @@ def score_current_span(
19711971
name=name,
19721972
value=cast(str, value),
19731973
score_id=score_id,
1974-
data_type=cast(Literal["CATEGORICAL"], data_type),
1974+
data_type=cast(Literal["CATEGORICAL", "TEXT"], data_type),
19751975
comment=comment,
19761976
config_id=config_id,
19771977
metadata=metadata,
@@ -2060,7 +2060,7 @@ def score_current_trace(
20602060
name=name,
20612061
value=cast(str, value),
20622062
score_id=score_id,
2063-
data_type=cast(Literal["CATEGORICAL"], data_type),
2063+
data_type=cast(Literal["CATEGORICAL", "TEXT"], data_type),
20642064
comment=comment,
20652065
config_id=config_id,
20662066
metadata=metadata,

langfuse/_client/span.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ def score(
364364
trace_id=self.trace_id,
365365
observation_id=self.id,
366366
score_id=score_id,
367-
data_type=cast(Literal["CATEGORICAL"], data_type),
367+
data_type=cast(Literal["CATEGORICAL", "TEXT"], data_type),
368368
comment=comment,
369369
config_id=config_id,
370370
timestamp=timestamp,
@@ -451,7 +451,7 @@ def score_trace(
451451
value=cast(str, value),
452452
trace_id=self.trace_id,
453453
score_id=score_id,
454-
data_type=cast(Literal["CATEGORICAL"], data_type),
454+
data_type=cast(Literal["CATEGORICAL", "TEXT"], data_type),
455455
comment=comment,
456456
config_id=config_id,
457457
timestamp=timestamp,

langfuse/types.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ class TraceContext(TypedDict):
7676
__all__ = [
7777
"SpanLevel",
7878
"ScoreDataType",
79+
"ExperimentScoreType",
7980
"MaskFunction",
8081
"ParsedMediaReference",
8182
"TraceContext",

0 commit comments

Comments
 (0)