Class: DSPy::Teleprompt::SimpleOptimizer::TrialResult

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

Overview

Result of a single optimization trial

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(trial_number:, program:, instruction:, few_shot_examples:, evaluation_result:, score:, metadata:) ⇒ TrialResult

Returns a new instance of TrialResult.



81
82
83
84
85
86
87
88
89
# File 'lib/dspy/teleprompt/simple_optimizer.rb', line 81

def initialize(trial_number:, program:, instruction:, few_shot_examples:, evaluation_result:, score:, metadata:)
  @trial_number = trial_number
  @program = program
  @instruction = instruction
  @few_shot_examples = few_shot_examples
  @evaluation_result = evaluation_result
  @score = score
   = .freeze
end

Instance Attribute Details

#evaluation_resultObject (readonly)

Returns the value of attribute evaluation_result.



62
63
64
# File 'lib/dspy/teleprompt/simple_optimizer.rb', line 62

def evaluation_result
  @evaluation_result
end

#few_shot_examplesObject (readonly)

Returns the value of attribute few_shot_examples.



59
60
61
# File 'lib/dspy/teleprompt/simple_optimizer.rb', line 59

def few_shot_examples
  @few_shot_examples
end

#instructionObject (readonly)

Returns the value of attribute instruction.



56
57
58
# File 'lib/dspy/teleprompt/simple_optimizer.rb', line 56

def instruction
  @instruction
end

#metadataObject (readonly)

Returns the value of attribute metadata.



68
69
70
# File 'lib/dspy/teleprompt/simple_optimizer.rb', line 68

def 
  
end

#programObject (readonly)

Returns the value of attribute program.



53
54
55
# File 'lib/dspy/teleprompt/simple_optimizer.rb', line 53

def program
  @program
end

#scoreObject (readonly)

Returns the value of attribute score.



65
66
67
# File 'lib/dspy/teleprompt/simple_optimizer.rb', line 65

def score
  @score
end

#trial_numberObject (readonly)

Returns the value of attribute trial_number.



50
51
52
# File 'lib/dspy/teleprompt/simple_optimizer.rb', line 50

def trial_number
  @trial_number
end

Instance Method Details

#successful?Boolean

Returns:

  • (Boolean)


92
93
94
# File 'lib/dspy/teleprompt/simple_optimizer.rb', line 92

def successful?
  @score > 0.0
end