Class: DSPy::ObservationType

Inherits:
T::Enum
  • Object
show all
Defined in:
lib/dspy/observability/observation_type.rb

Overview

Langfuse observation types as a T::Enum for type safety Maps to the official Langfuse observation types: langfuse.com/docs/observability/features/observation-types

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.for_module_class(module_class) ⇒ Object



40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/dspy/observability/observation_type.rb', line 40

def self.for_module_class(module_class)
  case module_class.name
  when /ReAct/, /CodeAct/
    Agent
  when /ChainOfThought/
    Chain
  when /Evaluator/
    Evaluator
  else
    Span
  end
end

Instance Method Details

#langfuse_attributeObject



55
56
57
# File 'lib/dspy/observability/observation_type.rb', line 55

def langfuse_attribute
  ['langfuse.observation.type', serialize]
end

#langfuse_attributesObject



61
62
63
# File 'lib/dspy/observability/observation_type.rb', line 61

def langfuse_attributes
  { 'langfuse.observation.type' => serialize }
end