From 44ce8e0d1fdc3823d42798d527fc7918cde77abe Mon Sep 17 00:00:00 2001 From: Hassieb Pakzad <68423100+hassiebp@users.noreply.github.com> Date: Mon, 12 Jan 2026 17:19:30 +0200 Subject: [PATCH] feat(client): add score metadata argument to span client score methods --- langfuse/_client/span.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/langfuse/_client/span.py b/langfuse/_client/span.py index 2f0000e41..92c1556ca 100644 --- a/langfuse/_client/span.py +++ b/langfuse/_client/span.py @@ -277,6 +277,7 @@ def score( comment: Optional[str] = None, config_id: Optional[str] = None, timestamp: Optional[datetime] = None, + metadata: Optional[Any] = None, ) -> None: ... @overload @@ -290,6 +291,7 @@ def score( comment: Optional[str] = None, config_id: Optional[str] = None, timestamp: Optional[datetime] = None, + metadata: Optional[Any] = None, ) -> None: ... def score( @@ -302,6 +304,7 @@ def score( comment: Optional[str] = None, config_id: Optional[str] = None, timestamp: Optional[datetime] = None, + metadata: Optional[Any] = None, ) -> None: """Create a score for this specific span. @@ -316,6 +319,7 @@ def score( comment: Optional comment or explanation for the score config_id: Optional ID of a score config defined in Langfuse timestamp: Optional timestamp for the score (defaults to current UTC time) + metadata: Optional metadata to be attached to the score Example: ```python @@ -342,6 +346,7 @@ def score( comment=comment, config_id=config_id, timestamp=timestamp, + metadata=metadata, ) @overload @@ -355,6 +360,7 @@ def score_trace( comment: Optional[str] = None, config_id: Optional[str] = None, timestamp: Optional[datetime] = None, + metadata: Optional[Any] = None, ) -> None: ... @overload @@ -368,6 +374,7 @@ def score_trace( comment: Optional[str] = None, config_id: Optional[str] = None, timestamp: Optional[datetime] = None, + metadata: Optional[Any] = None, ) -> None: ... def score_trace( @@ -380,6 +387,7 @@ def score_trace( comment: Optional[str] = None, config_id: Optional[str] = None, timestamp: Optional[datetime] = None, + metadata: Optional[Any] = None, ) -> None: """Create a score for the entire trace that this span belongs to. @@ -395,6 +403,7 @@ def score_trace( comment: Optional comment or explanation for the score config_id: Optional ID of a score config defined in Langfuse timestamp: Optional timestamp for the score (defaults to current UTC time) + metadata: Optional metadata to be attached to the score Example: ```python @@ -420,6 +429,7 @@ def score_trace( comment=comment, config_id=config_id, timestamp=timestamp, + metadata=metadata, ) def _set_processed_span_attributes(