Skip to content

Commit cc7820b

Browse files
committed
fix typing
1 parent 34298e8 commit cc7820b

File tree

1 file changed

+23
-7
lines changed

1 file changed

+23
-7
lines changed

langfuse/_client/span.py

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ def __init__(
182182
),
183183
)
184184

185+
# We don't want to overwrite the observation type, and already set it
185186
attributes.pop(LangfuseOtelSpanAttributes.OBSERVATION_TYPE, None)
186187

187188
self._otel_span.set_attributes(
@@ -919,7 +920,7 @@ def start_as_current_observation(
919920
self,
920921
*,
921922
name: str,
922-
as_type: ObservationTypeGenerationLike,
923+
as_type: Literal["generation"],
923924
input: Optional[Any] = None,
924925
output: Optional[Any] = None,
925926
metadata: Optional[Any] = None,
@@ -932,12 +933,27 @@ def start_as_current_observation(
932933
usage_details: Optional[Dict[str, int]] = None,
933934
cost_details: Optional[Dict[str, float]] = None,
934935
prompt: Optional[PromptClient] = None,
935-
) -> _AgnosticContextManager[
936-
Union[
937-
"LangfuseGeneration",
938-
"LangfuseEmbedding",
939-
]
940-
]: ...
936+
) -> _AgnosticContextManager["LangfuseGeneration"]: ...
937+
938+
@overload
939+
def start_as_current_observation(
940+
self,
941+
*,
942+
name: str,
943+
as_type: Literal["embedding"],
944+
input: Optional[Any] = None,
945+
output: Optional[Any] = None,
946+
metadata: Optional[Any] = None,
947+
version: Optional[str] = None,
948+
level: Optional[SpanLevel] = None,
949+
status_message: Optional[str] = None,
950+
completion_start_time: Optional[datetime] = None,
951+
model: Optional[str] = None,
952+
model_parameters: Optional[Dict[str, MapValue]] = None,
953+
usage_details: Optional[Dict[str, int]] = None,
954+
cost_details: Optional[Dict[str, float]] = None,
955+
prompt: Optional[PromptClient] = None,
956+
) -> _AgnosticContextManager["LangfuseEmbedding"]: ...
941957

942958
@overload
943959
def start_as_current_observation(

0 commit comments

Comments
 (0)