Class: DSPy::Teleprompt::Utils::BootstrapResult Deprecated

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

Overview

Deprecated.

This class is deprecated and kept only for backward compatibility. The new create_n_fewshot_demo_sets returns a Hash=> [[demos]] instead of this BootstrapResult object. Use the dict interface directly.

Result of bootstrap operation

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(candidate_sets:, successful_examples:, failed_examples:, statistics:) ⇒ BootstrapResult

Returns a new instance of BootstrapResult.



181
182
183
184
185
186
# File 'lib/dspy/teleprompt/utils.rb', line 181

def initialize(candidate_sets:, successful_examples:, failed_examples:, statistics:)
  @candidate_sets = candidate_sets.freeze
  @successful_examples = successful_examples.freeze
  @failed_examples = failed_examples.freeze
  @statistics = statistics.freeze
end

Instance Attribute Details

#candidate_setsObject (readonly)

Returns the value of attribute candidate_sets.



162
163
164
# File 'lib/dspy/teleprompt/utils.rb', line 162

def candidate_sets
  @candidate_sets
end

#failed_examplesObject (readonly)

Returns the value of attribute failed_examples.



168
169
170
# File 'lib/dspy/teleprompt/utils.rb', line 168

def failed_examples
  @failed_examples
end

#statisticsObject (readonly)

Returns the value of attribute statistics.



171
172
173
# File 'lib/dspy/teleprompt/utils.rb', line 171

def statistics
  @statistics
end

#successful_examplesObject (readonly)

Returns the value of attribute successful_examples.



165
166
167
# File 'lib/dspy/teleprompt/utils.rb', line 165

def successful_examples
  @successful_examples
end

Instance Method Details

#success_rateObject



189
190
191
192
193
# File 'lib/dspy/teleprompt/utils.rb', line 189

def success_rate
  total = @successful_examples.size + @failed_examples.size
  return 0.0 if total == 0
  @successful_examples.size.to_f / total.to_f
end

#total_examplesObject



196
197
198
# File 'lib/dspy/teleprompt/utils.rb', line 196

def total_examples
  @successful_examples.size + @failed_examples.size
end