diff --git a/langfuse/__init__.py b/langfuse/__init__.py index 9c8010c21..9031052a5 100644 --- a/langfuse/__init__.py +++ b/langfuse/__init__.py @@ -1,11 +1,10 @@ """.. include:: ../README.md""" -from ._client.client import Langfuse # noqa -from ._client.get_client import get_client # noqa -from ._client.observe import observe # noqa -from .version import __version__ # noqa -from ._client.span import LangfuseSpan, LangfuseGeneration, LangfuseEvent from ._client.attributes import LangfuseOtelSpanAttributes +from ._client.client import Langfuse +from ._client.get_client import get_client +from ._client.observe import observe +from ._client.span import LangfuseEvent, LangfuseGeneration, LangfuseSpan __all__ = [ "Langfuse", diff --git a/langfuse/_client/client.py b/langfuse/_client/client.py index bd57ab418..0f80f1816 100644 --- a/langfuse/_client/client.py +++ b/langfuse/_client/client.py @@ -16,8 +16,8 @@ import httpx from opentelemetry import trace from opentelemetry import trace as otel_trace_api -from opentelemetry.sdk.trace.id_generator import RandomIdGenerator from opentelemetry.sdk.trace import TracerProvider +from opentelemetry.sdk.trace.id_generator import RandomIdGenerator from opentelemetry.util._decorator import ( _AgnosticContextManager, _agnosticcontextmanager, @@ -1643,7 +1643,8 @@ def get_current_trace_id(self) -> Optional[str]: langfuse_logger.debug( "Operation skipped: get_current_trace_id - Tracing is disabled or client is in no-op mode." ) - return + return None + current_otel_span = self._get_current_otel_span() return self._get_otel_trace_id(current_otel_span) if current_otel_span else None @@ -1675,7 +1676,8 @@ def get_current_observation_id(self) -> Optional[str]: langfuse_logger.debug( "Operation skipped: get_current_observation_id - Tracing is disabled or client is in no-op mode." ) - return + return None + current_otel_span = self._get_current_otel_span() return self._get_otel_span_id(current_otel_span) if current_otel_span else None diff --git a/langfuse/api/resources/commons/types/map_value.py b/langfuse/api/resources/commons/types/map_value.py index e1e771a9b..46115a967 100644 --- a/langfuse/api/resources/commons/types/map_value.py +++ b/langfuse/api/resources/commons/types/map_value.py @@ -5,6 +5,7 @@ MapValue = typing.Union[ typing.Optional[str], typing.Optional[int], + typing.Optional[float], typing.Optional[bool], typing.Optional[typing.List[str]], ]