Skip to content

Commit 7bb5817

Browse files
committed
add metadata to score() functions
1 parent afbf6cd commit 7bb5817

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

langfuse/client.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1573,6 +1573,7 @@ def score(
15731573
trace_id: typing.Optional[str] = None,
15741574
id: typing.Optional[str] = None,
15751575
comment: typing.Optional[str] = None,
1576+
metadata: typing.Optional[typing.Any] = None,
15761577
observation_id: typing.Optional[str] = None,
15771578
config_id: typing.Optional[str] = None,
15781579
**kwargs,
@@ -1588,6 +1589,7 @@ def score(
15881589
trace_id: typing.Optional[str] = None,
15891590
id: typing.Optional[str] = None,
15901591
comment: typing.Optional[str] = None,
1592+
metadata: typing.Optional[typing.Any] = None,
15911593
observation_id: typing.Optional[str] = None,
15921594
config_id: typing.Optional[str] = None,
15931595
**kwargs,
@@ -1602,6 +1604,7 @@ def score(
16021604
trace_id: typing.Optional[str] = None,
16031605
id: typing.Optional[str] = None,
16041606
comment: typing.Optional[str] = None,
1607+
metadata: typing.Optional[typing.Any] = None,
16051608
observation_id: typing.Optional[str] = None,
16061609
config_id: typing.Optional[str] = None,
16071610
**kwargs,
@@ -1616,6 +1619,7 @@ def score(
16161619
trace_id (str): The id of the trace to which the score should be attached.
16171620
id (Optional[str]): The id of the score. If not provided, a new UUID is generated.
16181621
comment (Optional[str]): Additional context/explanation of the score.
1622+
metadata (Optional[Any]): Additional metadata of the score. Can be any JSON object. Metadata is merged when being updated via the API.
16191623
observation_id (Optional[str]): The id of the observation to which the score should be attached.
16201624
config_id (Optional[str]): The id of the score config. When set, the score value is validated against the config. Defaults to None.
16211625
**kwargs: Additional keyword arguments to include in the score.
@@ -1655,6 +1659,7 @@ def score(
16551659
"value": value,
16561660
"data_type": data_type,
16571661
"comment": comment,
1662+
"metadata": metadata,
16581663
"config_id": config_id,
16591664
"environment": self.environment,
16601665
**kwargs,
@@ -2415,6 +2420,7 @@ def score(
24152420
value: float,
24162421
data_type: typing.Optional[Literal["NUMERIC", "BOOLEAN"]] = None,
24172422
comment: typing.Optional[str] = None,
2423+
metadata: typing.Optional[typing.Any] = None,
24182424
config_id: typing.Optional[str] = None,
24192425
**kwargs,
24202426
) -> "StatefulClient": ...
@@ -2428,6 +2434,7 @@ def score(
24282434
value: str,
24292435
data_type: typing.Optional[Literal["CATEGORICAL"]] = "CATEGORICAL",
24302436
comment: typing.Optional[str] = None,
2437+
metadata: typing.Optional[typing.Any] = None,
24312438
config_id: typing.Optional[str] = None,
24322439
**kwargs,
24332440
) -> "StatefulClient": ...
@@ -2440,6 +2447,7 @@ def score(
24402447
value: typing.Union[float, str],
24412448
data_type: typing.Optional[ScoreDataType] = None,
24422449
comment: typing.Optional[str] = None,
2450+
metadata: typing.Optional[typing.Any] = None,
24432451
config_id: typing.Optional[str] = None,
24442452
**kwargs,
24452453
) -> "StatefulClient":
@@ -2451,6 +2459,7 @@ def score(
24512459
data_type (Optional[ScoreDataType]): The data type of the score. When not set, the data type is inferred from the score config's data type, when present.
24522460
When no config is set, the data type is inferred from the value's type, i.e. float values are categorized as numeric scores and string values as categorical scores.
24532461
comment (Optional[str]): Additional context/explanation of the score.
2462+
metadata (Optional[Any]): Additional metadata of the score. Can be any JSON object. Metadata is merged when being updated via the API.
24542463
id (Optional[str]): The id of the score. If not provided, a new UUID is generated.
24552464
config_id (Optional[str]): The id of the score config. When set, the score value is validated against the config. Defaults to None.
24562465
**kwargs: Additional keyword arguments to include in the score.
@@ -2484,6 +2493,7 @@ def score(
24842493
"value": value,
24852494
"data_type": data_type,
24862495
"comment": comment,
2496+
"metadata": metadata,
24872497
"config_id": config_id,
24882498
"environment": self.environment,
24892499
**kwargs,

0 commit comments

Comments
 (0)