Class: DSPy::Propose::GroundedProposer::ProposalResult

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

Overview

Result of instruction proposal

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(candidate_instructions:, analysis:, metadata:) ⇒ ProposalResult

Returns a new instance of ProposalResult.



72
73
74
75
76
# File 'lib/dspy/propose/grounded_proposer.rb', line 72

def initialize(candidate_instructions:, analysis:, metadata:)
  @candidate_instructions = candidate_instructions.freeze
  @analysis = analysis.freeze
  @metadata = .freeze
end

Instance Attribute Details

#analysisObject (readonly)

Returns the value of attribute analysis.



60
61
62
# File 'lib/dspy/propose/grounded_proposer.rb', line 60

def analysis
  @analysis
end

#candidate_instructionsObject (readonly)

Returns the value of attribute candidate_instructions.



57
58
59
# File 'lib/dspy/propose/grounded_proposer.rb', line 57

def candidate_instructions
  @candidate_instructions
end

#metadataObject (readonly)

Returns the value of attribute metadata.



63
64
65
# File 'lib/dspy/propose/grounded_proposer.rb', line 63

def 
  @metadata
end

Instance Method Details

#best_instructionObject



79
80
81
# File 'lib/dspy/propose/grounded_proposer.rb', line 79

def best_instruction
  @candidate_instructions.first || ""
end

#num_candidatesObject



84
85
86
# File 'lib/dspy/propose/grounded_proposer.rb', line 84

def num_candidates
  @candidate_instructions.size
end