Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions langfuse/__init__.py
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
8 changes: 5 additions & 3 deletions langfuse/_client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions langfuse/api/resources/commons/types/map_value.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
MapValue = typing.Union[
typing.Optional[str],
typing.Optional[int],
typing.Optional[float],
typing.Optional[bool],
typing.Optional[typing.List[str]],
]