@@ -121,7 +121,7 @@ def observe(
121121 name (Optional[str]): Custom name for the created trace or span. If not provided, the function name is used.
122122 as_type (Optional[Literal["generation"]]): Set to "generation" to create a specialized LLM generation span
123123 with model metrics support, suitable for tracking language model outputs.
124- type (Optional[Literal]): Set the observation type for agentic workflows. Supported values: "SPAN", "EVENT",
124+ type (Optional[Literal]): Set the observation type for agentic workflows. Supported values:
125125 "GENERATION", "AGENT", "TOOL", "CHAIN", "RETRIEVER", "EMBEDDING". When specified, creates spans with
126126 the specified type for graph visualization and filtering in the Langfuse UI.
127127
@@ -182,7 +182,6 @@ def sub_process():
182182 - For async functions, the decorator returns an async function wrapper.
183183 - For sync functions, the decorator returns a synchronous wrapper.
184184 """
185- # Validate parameters
186185 if type is not None and type not in VALID_OBSERVATION_TYPES :
187186 raise ValueError (
188187 f"Invalid observation type '{ type } '. Valid types are: { ', ' .join (sorted (VALID_OBSERVATION_TYPES ))} "
@@ -235,11 +234,11 @@ def decorator(func: F) -> F:
235234 )
236235
237236 """Handle decorator with or without parentheses.
238-
237+
239238 This logic enables the decorator to work both with and without parentheses:
240239 - @observe - Python passes the function directly to the decorator
241240 - @observe() - Python calls the decorator first, which must return a function decorator
242-
241+
243242 When called without arguments (@observe), the func parameter contains the function to decorate,
244243 so we directly apply the decorator to it. When called with parentheses (@observe()),
245244 func is None, so we return the decorator function itself for Python to apply in the next step.
0 commit comments