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.
164 165 166 167 168 169 |
# File 'lib/dspy/teleprompt/mipro_v2.rb', line 164 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.
155 156 157 |
# File 'lib/dspy/teleprompt/mipro_v2.rb', line 155 def config_id @config_id end |
#few_shot_examples ⇒ Object (readonly)
Returns the value of attribute few_shot_examples.
149 150 151 |
# File 'lib/dspy/teleprompt/mipro_v2.rb', line 149 def few_shot_examples @few_shot_examples end |
#instruction ⇒ Object (readonly)
Returns the value of attribute instruction.
146 147 148 |
# File 'lib/dspy/teleprompt/mipro_v2.rb', line 146 def instruction @instruction end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
152 153 154 |
# File 'lib/dspy/teleprompt/mipro_v2.rb', line 152 def @metadata end |
Instance Method Details
#to_h ⇒ Object
172 173 174 175 176 177 178 179 |
# File 'lib/dspy/teleprompt/mipro_v2.rb', line 172 def to_h { instruction: @instruction, few_shot_examples: @few_shot_examples.size, metadata: @metadata, config_id: @config_id } end |