Skip to content

Commit f4148bc

Browse files
authored
feat(client): add score metadata argument to span client score methods (#1498)
1 parent 898a10c commit f4148bc

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

langfuse/_client/span.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@ def score(
277277
comment: Optional[str] = None,
278278
config_id: Optional[str] = None,
279279
timestamp: Optional[datetime] = None,
280+
metadata: Optional[Any] = None,
280281
) -> None: ...
281282

282283
@overload
@@ -290,6 +291,7 @@ def score(
290291
comment: Optional[str] = None,
291292
config_id: Optional[str] = None,
292293
timestamp: Optional[datetime] = None,
294+
metadata: Optional[Any] = None,
293295
) -> None: ...
294296

295297
def score(
@@ -302,6 +304,7 @@ def score(
302304
comment: Optional[str] = None,
303305
config_id: Optional[str] = None,
304306
timestamp: Optional[datetime] = None,
307+
metadata: Optional[Any] = None,
305308
) -> None:
306309
"""Create a score for this specific span.
307310
@@ -316,6 +319,7 @@ def score(
316319
comment: Optional comment or explanation for the score
317320
config_id: Optional ID of a score config defined in Langfuse
318321
timestamp: Optional timestamp for the score (defaults to current UTC time)
322+
metadata: Optional metadata to be attached to the score
319323
320324
Example:
321325
```python
@@ -342,6 +346,7 @@ def score(
342346
comment=comment,
343347
config_id=config_id,
344348
timestamp=timestamp,
349+
metadata=metadata,
345350
)
346351

347352
@overload
@@ -355,6 +360,7 @@ def score_trace(
355360
comment: Optional[str] = None,
356361
config_id: Optional[str] = None,
357362
timestamp: Optional[datetime] = None,
363+
metadata: Optional[Any] = None,
358364
) -> None: ...
359365

360366
@overload
@@ -368,6 +374,7 @@ def score_trace(
368374
comment: Optional[str] = None,
369375
config_id: Optional[str] = None,
370376
timestamp: Optional[datetime] = None,
377+
metadata: Optional[Any] = None,
371378
) -> None: ...
372379

373380
def score_trace(
@@ -380,6 +387,7 @@ def score_trace(
380387
comment: Optional[str] = None,
381388
config_id: Optional[str] = None,
382389
timestamp: Optional[datetime] = None,
390+
metadata: Optional[Any] = None,
383391
) -> None:
384392
"""Create a score for the entire trace that this span belongs to.
385393
@@ -395,6 +403,7 @@ def score_trace(
395403
comment: Optional comment or explanation for the score
396404
config_id: Optional ID of a score config defined in Langfuse
397405
timestamp: Optional timestamp for the score (defaults to current UTC time)
406+
metadata: Optional metadata to be attached to the score
398407
399408
Example:
400409
```python
@@ -420,6 +429,7 @@ def score_trace(
420429
comment=comment,
421430
config_id=config_id,
422431
timestamp=timestamp,
432+
metadata=metadata,
423433
)
424434

425435
def _set_processed_span_attributes(

0 commit comments

Comments
 (0)