File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -27,21 +27,6 @@ class ObservationType(str, enum.Enum):
2727 EVALUATOR = "EVALUATOR"
2828 GUARDRAIL = "GUARDRAIL"
2929
30-
31- # Valid observation types for the @observe decorator (lowercase user interface)
32- VALID_OBSERVATION_TYPES = {
33- "span" ,
34- "event" ,
35- "generation" ,
36- "agent" ,
37- "tool" ,
38- "chain" ,
39- "retriever" ,
40- "evaluator" ,
41- "embedding" ,
42- "guardrail" ,
43- }
44-
4530ObservationTypeLiteralNoEvent : TypeAlias = Literal [
4631 "span" ,
4732 "generation" ,
Original file line number Diff line number Diff line change 1616 Union ,
1717 cast ,
1818 overload ,
19+ get_args ,
1920)
2021
2122from opentelemetry .util ._decorator import _AgnosticContextManager
2627)
2728
2829from langfuse ._client .constants import (
29- VALID_OBSERVATION_TYPES ,
3030 ObservationTypeLiteralNoEvent ,
3131)
3232from langfuse ._client .get_client import _set_current_public_key , get_client
@@ -169,9 +169,10 @@ def sub_process():
169169 - For async functions, the decorator returns an async function wrapper.
170170 - For sync functions, the decorator returns a synchronous wrapper.
171171 """
172- if as_type is not None and as_type not in VALID_OBSERVATION_TYPES :
172+ valid_types = set (get_args (ObservationTypeLiteralNoEvent ))
173+ if as_type is not None and as_type not in valid_types :
173174 self ._log .warning (
174- f"Invalid as_type '{ as_type } '. Valid types are: { ', ' .join (sorted (VALID_OBSERVATION_TYPES ))} . Defaulting to 'span'."
175+ f"Invalid as_type '{ as_type } '. Valid types are: { ', ' .join (sorted (valid_types ))} . Defaulting to 'span'."
175176 )
176177 as_type = "span"
177178
You can’t perform that action at this time.
0 commit comments