Class: DSPy::Teleprompt::MIPROv2::CandidateConfig
- Inherits:
-
Object
- Object
- DSPy::Teleprompt::MIPROv2::CandidateConfig
- Extended by:
- T::Sig
- Defined in:
- lib/dspy/teleprompt/mipro_v2.rb
Overview
Candidate configuration for optimization trials
Instance Attribute Summary collapse
-
#config_id ⇒ Object
readonly
Returns the value of attribute config_id.
-
#few_shot_examples ⇒ Object
readonly
Returns the value of attribute few_shot_examples.
-
#instruction ⇒ Object
readonly
Returns the value of attribute instruction.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
Instance Method Summary collapse
-
#initialize(instruction:, few_shot_examples:, metadata: {}) ⇒ CandidateConfig
constructor
A new instance of CandidateConfig.
- #to_h ⇒ Object
Constructor Details
#initialize(instruction:, few_shot_examples:, metadata: {}) ⇒ CandidateConfig
Returns a new instance of CandidateConfig.
149 150 151 152 153 154 |
# File 'lib/dspy/teleprompt/mipro_v2.rb', line 149 def initialize(instruction:, few_shot_examples:, metadata: {}) @instruction = instruction @few_shot_examples = few_shot_examples @metadata = .freeze @config_id = generate_config_id end |
Instance Attribute Details
#config_id ⇒ Object (readonly)
Returns the value of attribute config_id.
140 141 142 |
# File 'lib/dspy/teleprompt/mipro_v2.rb', line 140 def config_id @config_id end |
#few_shot_examples ⇒ Object (readonly)
Returns the value of attribute few_shot_examples.
134 135 136 |
# File 'lib/dspy/teleprompt/mipro_v2.rb', line 134 def few_shot_examples @few_shot_examples end |
#instruction ⇒ Object (readonly)
Returns the value of attribute instruction.
131 132 133 |
# File 'lib/dspy/teleprompt/mipro_v2.rb', line 131 def instruction @instruction end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
137 138 139 |
# File 'lib/dspy/teleprompt/mipro_v2.rb', line 137 def @metadata end |
Instance Method Details
#to_h ⇒ Object
157 158 159 160 161 162 163 164 |
# File 'lib/dspy/teleprompt/mipro_v2.rb', line 157 def to_h { instruction: @instruction, few_shot_examples: @few_shot_examples.size, metadata: @metadata, config_id: @config_id } end |