Class: DSPy::Propose::GroundedProposer::ProposalResult
- Inherits:
-
Object
- Object
- DSPy::Propose::GroundedProposer::ProposalResult
- Extended by:
- T::Sig
- Defined in:
- lib/dspy/propose/grounded_proposer.rb
Overview
Result of instruction proposal
Instance Attribute Summary collapse
-
#analysis ⇒ Object
readonly
Returns the value of attribute analysis.
-
#candidate_instructions ⇒ Object
readonly
Returns the value of attribute candidate_instructions.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#predictor_instructions ⇒ Object
readonly
Returns the value of attribute predictor_instructions.
Instance Method Summary collapse
- #best_instruction ⇒ Object
-
#initialize(candidate_instructions:, analysis:, metadata:, predictor_instructions: nil) ⇒ ProposalResult
constructor
A new instance of ProposalResult.
- #num_candidates ⇒ Object
Constructor Details
#initialize(candidate_instructions:, analysis:, metadata:, predictor_instructions: nil) ⇒ ProposalResult
Returns a new instance of ProposalResult.
115 116 117 118 119 120 121 122 123 |
# File 'lib/dspy/propose/grounded_proposer.rb', line 115 def initialize(candidate_instructions:, analysis:, metadata:, predictor_instructions: nil) @candidate_instructions = candidate_instructions.freeze normalized_predictor_instructions = (predictor_instructions || {}).each_with_object({}) do |(index, instructions), memo| memo[index] = instructions.dup.freeze end @predictor_instructions = normalized_predictor_instructions.freeze @analysis = analysis.freeze @metadata = .freeze end |
Instance Attribute Details
#analysis ⇒ Object (readonly)
Returns the value of attribute analysis.
102 103 104 |
# File 'lib/dspy/propose/grounded_proposer.rb', line 102 def analysis @analysis end |
#candidate_instructions ⇒ Object (readonly)
Returns the value of attribute candidate_instructions.
96 97 98 |
# File 'lib/dspy/propose/grounded_proposer.rb', line 96 def candidate_instructions @candidate_instructions end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
105 106 107 |
# File 'lib/dspy/propose/grounded_proposer.rb', line 105 def @metadata end |
#predictor_instructions ⇒ Object (readonly)
Returns the value of attribute predictor_instructions.
99 100 101 |
# File 'lib/dspy/propose/grounded_proposer.rb', line 99 def predictor_instructions @predictor_instructions end |
Instance Method Details
#best_instruction ⇒ Object
126 127 128 |
# File 'lib/dspy/propose/grounded_proposer.rb', line 126 def best_instruction @candidate_instructions.first || "" end |
#num_candidates ⇒ Object
131 132 133 |
# File 'lib/dspy/propose/grounded_proposer.rb', line 131 def num_candidates @candidate_instructions.size end |