|
3 | 3 | This module defines constants used throughout the Langfuse OpenTelemetry integration. |
4 | 4 | """ |
5 | 5 |
|
6 | | -from typing import Literal, List, get_args |
| 6 | +from typing import Literal, List, get_args, Union |
7 | 7 | from typing_extensions import TypeAlias |
8 | 8 |
|
9 | 9 | LANGFUSE_TRACER_NAME = "langfuse-sdk" |
|
20 | 20 | "embedding", |
21 | 21 | ] |
22 | 22 |
|
23 | | -ObservationTypeLiteralNoEvent: TypeAlias = ( |
24 | | - ObservationTypeGenerationLike |
25 | | - | Literal[ |
| 23 | +ObservationTypeLiteralNoEvent: TypeAlias = Union[ |
| 24 | + ObservationTypeGenerationLike, |
| 25 | + Literal[ |
26 | 26 | "span", |
27 | 27 | "guardrail", |
28 | | - ] |
29 | | -) |
| 28 | + ], |
| 29 | +] |
30 | 30 |
|
31 | | -ObservationTypeLiteral: TypeAlias = ObservationTypeLiteralNoEvent | Literal["event"] |
| 31 | +ObservationTypeLiteral: TypeAlias = Union[ |
| 32 | + ObservationTypeLiteralNoEvent, Literal["event"] |
| 33 | +] |
32 | 34 | """Enumeration of valid observation types for Langfuse tracing. |
33 | 35 |
|
34 | 36 | This Literal defines all available observation types that can be used with the @observe |
|
37 | 39 |
|
38 | 40 |
|
39 | 41 | def get_observation_types_list( |
40 | | - literal_type: ObservationTypeGenerationLike |
41 | | - | ObservationTypeLiteralNoEvent |
42 | | - | ObservationTypeLiteral, |
| 42 | + literal_type: Union[ |
| 43 | + ObservationTypeGenerationLike, |
| 44 | + ObservationTypeLiteralNoEvent, |
| 45 | + ObservationTypeLiteral, |
| 46 | + ], |
43 | 47 | ) -> List[str]: |
44 | 48 | """Flattens the Literal type to provide a list of strings. |
45 | 49 |
|
|
0 commit comments