Skip to content

Commit 8756e11

Browse files
committed
py3.9 compat
1 parent 79cb0a5 commit 8756e11

1 file changed

Lines changed: 14 additions & 10 deletions

File tree

langfuse/_client/constants.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
This module defines constants used throughout the Langfuse OpenTelemetry integration.
44
"""
55

6-
from typing import Literal, List, get_args
6+
from typing import Literal, List, get_args, Union
77
from typing_extensions import TypeAlias
88

99
LANGFUSE_TRACER_NAME = "langfuse-sdk"
@@ -20,15 +20,17 @@
2020
"embedding",
2121
]
2222

23-
ObservationTypeLiteralNoEvent: TypeAlias = (
24-
ObservationTypeGenerationLike
25-
| Literal[
23+
ObservationTypeLiteralNoEvent: TypeAlias = Union[
24+
ObservationTypeGenerationLike,
25+
Literal[
2626
"span",
2727
"guardrail",
28-
]
29-
)
28+
],
29+
]
3030

31-
ObservationTypeLiteral: TypeAlias = ObservationTypeLiteralNoEvent | Literal["event"]
31+
ObservationTypeLiteral: TypeAlias = Union[
32+
ObservationTypeLiteralNoEvent, Literal["event"]
33+
]
3234
"""Enumeration of valid observation types for Langfuse tracing.
3335
3436
This Literal defines all available observation types that can be used with the @observe
@@ -37,9 +39,11 @@
3739

3840

3941
def get_observation_types_list(
40-
literal_type: ObservationTypeGenerationLike
41-
| ObservationTypeLiteralNoEvent
42-
| ObservationTypeLiteral,
42+
literal_type: Union[
43+
ObservationTypeGenerationLike,
44+
ObservationTypeLiteralNoEvent,
45+
ObservationTypeLiteral,
46+
],
4347
) -> List[str]:
4448
"""Flattens the Literal type to provide a list of strings.
4549

0 commit comments

Comments
 (0)