Optional
asType?: LangfuseObservationTypeType of observation to create. Defaults to 'span'
Optional
asType?: LangfuseObservationTypeType of observation to create. Defaults to 'span'
Optional
asType?: LangfuseObservationTypeType of observation to create. Defaults to 'span'
Optional
asType?: LangfuseObservationTypeType of observation to create. Defaults to 'span'
Optional
asType?: LangfuseObservationTypeType of observation to create. Defaults to 'span'
Optional
asType?: LangfuseObservationTypeType of observation to create. Defaults to 'span'
Optional
asType?: LangfuseObservationTypeType of observation to create. Defaults to 'span'
Optional
asType?: LangfuseObservationTypeType of observation to create. Defaults to 'span'
Optional
asType?: LangfuseObservationTypeType of observation to create. Defaults to 'span'
Optional
attributes: LangfuseSpanAttributesOptional
options: StartObservationOptions & { asType?: LangfuseObservationType } & {Optional
asType?: LangfuseObservationTypeType of observation to create. Defaults to 'span'
Optional
asType?: "span"
Creates and starts a new Langfuse observation with automatic TypeScript type inference.
This is the primary method for creating observations in Langfuse. It supports multiple observation types with full TypeScript type safety - the return type is automatically inferred based on the
asType
parameter.Supported Observation Types
Param: name
Descriptive name for the observation (e.g., 'openai-gpt-4', 'vector-search')
Param: attributes
Type-specific attributes (input, output, metadata, etc.)
Param: options
Configuration options including observation type and timing
Returns
Strongly-typed observation object based on
asType
parameterExample
See