Class: DSPy::Evals::EvaluationResult

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/dspy/evals.rb

Overview

Result of evaluating a single example

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(example:, prediction:, trace:, metrics:, passed:) ⇒ EvaluationResult

Returns a new instance of EvaluationResult.



43
44
45
46
47
48
49
# File 'lib/dspy/evals.rb', line 43

def initialize(example:, prediction:, trace:, metrics:, passed:)
  @example = example
  @prediction = prediction
  @trace = trace
  @metrics = metrics
  @passed = passed
end

Instance Attribute Details

#exampleObject (readonly)

Returns the value of attribute example.



20
21
22
# File 'lib/dspy/evals.rb', line 20

def example
  @example
end

#metricsObject (readonly)

Returns the value of attribute metrics.



29
30
31
# File 'lib/dspy/evals.rb', line 29

def metrics
  @metrics
end

#passedObject (readonly)

Returns the value of attribute passed.



32
33
34
# File 'lib/dspy/evals.rb', line 32

def passed
  @passed
end

#predictionObject (readonly)

Returns the value of attribute prediction.



23
24
25
# File 'lib/dspy/evals.rb', line 23

def prediction
  @prediction
end

#traceObject (readonly)

Returns the value of attribute trace.



26
27
28
# File 'lib/dspy/evals.rb', line 26

def trace
  @trace
end

Instance Method Details

#to_hObject



52
53
54
55
56
57
58
59
60
# File 'lib/dspy/evals.rb', line 52

def to_h
  {
    example: @example,
    prediction: @prediction.respond_to?(:to_h) ? @prediction.to_h : @prediction,
    trace: @trace,
    metrics: @metrics,
    passed: @passed
  }
end