Skip to content

Commit c3be3d8

Browse files
committed
cleanup
1 parent df8ff8e commit c3be3d8

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

langfuse/_client/attributes.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,8 @@ def create_span_attributes(
9595
version: Optional[str] = None,
9696
observation_type: Optional[str] = None,
9797
) -> dict:
98-
final_observation_type = observation_type or "span"
9998
attributes = {
100-
LangfuseOtelSpanAttributes.OBSERVATION_TYPE: final_observation_type,
99+
LangfuseOtelSpanAttributes.OBSERVATION_TYPE: observation_type or "span",
101100
LangfuseOtelSpanAttributes.OBSERVATION_LEVEL: level,
102101
LangfuseOtelSpanAttributes.OBSERVATION_STATUS_MESSAGE: status_message,
103102
LangfuseOtelSpanAttributes.VERSION: version,

langfuse/_client/client.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ def start_as_current_span(
350350
level: Optional[SpanLevel] = None,
351351
status_message: Optional[str] = None,
352352
end_on_exit: Optional[bool] = None,
353-
as_type: Optional[str] = None,
353+
as_type: Optional[Literal["generation", "span", "event", "agent", "tool", "chain", "retriever"]] = None,
354354
) -> _AgnosticContextManager[LangfuseSpan]:
355355
"""Create a new span and set it as the current span in a context manager.
356356
@@ -743,7 +743,7 @@ def _start_as_current_otel_span_with_processed_media(
743743
self,
744744
*,
745745
name: str,
746-
as_type: Optional[str] = None,
746+
as_type: Optional[Literal["generation", "span", "event", "AGENT", "TOOL", "CHAIN", "RETRIEVER"]] = None,
747747
end_on_exit: Optional[bool] = None,
748748
input: Optional[Any] = None,
749749
output: Optional[Any] = None,
@@ -762,7 +762,7 @@ def _start_as_current_otel_span_with_processed_media(
762762
name=name,
763763
end_on_exit=end_on_exit if end_on_exit is not None else True,
764764
) as otel_span:
765-
span_class = self._get_span_class(as_type)
765+
span_class = self._get_span_class(as_type or "generation")
766766
common_args = {
767767
"otel_span": otel_span,
768768
"langfuse_client": self,

0 commit comments

Comments
 (0)