diff --git a/langfuse/_client/client.py b/langfuse/_client/client.py index ddd9cd883..d262f5047 100644 --- a/langfuse/_client/client.py +++ b/langfuse/_client/client.py @@ -1120,7 +1120,8 @@ def _create_observation_id(self, *, seed: Optional[str] = None) -> str: return sha256(seed.encode("utf-8")).digest()[:8].hex() - def create_trace_id(self, *, seed: Optional[str] = None) -> str: + @staticmethod + def create_trace_id(*, seed: Optional[str] = None) -> str: """Create a unique trace ID for use with Langfuse. This method generates a unique trace ID for use with various Langfuse APIs. @@ -1164,7 +1165,7 @@ def create_trace_id(self, *, seed: Optional[str] = None) -> str: if not seed: trace_id_int = RandomIdGenerator().generate_trace_id() - return self._format_otel_trace_id(trace_id_int) + return Langfuse._format_otel_trace_id(trace_id_int) return sha256(seed.encode("utf-8")).digest()[:16].hex() @@ -1178,7 +1179,8 @@ def _get_otel_span_id(self, otel_span: otel_trace_api.Span): return self._format_otel_span_id(span_context.span_id) - def _format_otel_span_id(self, span_id_int: int) -> str: + @staticmethod + def _format_otel_span_id(span_id_int: int) -> str: """Format an integer span ID to a 16-character lowercase hex string. Internal method to convert an OpenTelemetry integer span ID to the standard @@ -1192,7 +1194,8 @@ def _format_otel_span_id(self, span_id_int: int) -> str: """ return format(span_id_int, "016x") - def _format_otel_trace_id(self, trace_id_int: int) -> str: + @staticmethod + def _format_otel_trace_id(trace_id_int: int) -> str: """Format an integer trace ID to a 32-character lowercase hex string. Internal method to convert an OpenTelemetry integer trace ID to the standard @@ -1482,9 +1485,6 @@ def score_current_trace( config_id=config_id, ) - def update_finished_trace(self): - pass - def flush(self): """Force flush all pending spans and events to the Langfuse API. diff --git a/langfuse/_client/span.py b/langfuse/_client/span.py index 7f65358f8..39d5c62eb 100644 --- a/langfuse/_client/span.py +++ b/langfuse/_client/span.py @@ -1140,8 +1140,8 @@ def __init__( Args: otel_span: The OpenTelemetry span to wrap langfuse_client: Reference to the parent Langfuse client - input: Input data for the generation (e.g., prompts) - output: Output from the generation (e.g., completions) + input: Input data for the event + output: Output from the event metadata: Additional metadata to associate with the generation environment: The tracing environment """