Class: DSPy::Teleprompt::GEPA::GEPAConfig

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

Overview

Configuration for GEPA optimization

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeGEPAConfig

Returns a new instance of GEPAConfig.



2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
# File 'lib/dspy/teleprompt/gepa.rb', line 2701

def initialize
  super
  @reflection_lm = 'gpt-4o'
  @num_generations = 10
  @population_size = 8
  @mutation_rate = 0.7
  @use_pareto_selection = true
  @simple_mode = false
  @mutation_types = [MutationType::Rewrite, MutationType::Expand, MutationType::Simplify, MutationType::Combine, MutationType::Rephrase]
  @crossover_rate = 0.6
  @crossover_types = [CrossoverType::Uniform, CrossoverType::Blend, CrossoverType::Structured]
end

Instance Attribute Details

#crossover_rateObject

Returns the value of attribute crossover_rate.



2696
2697
2698
# File 'lib/dspy/teleprompt/gepa.rb', line 2696

def crossover_rate
  @crossover_rate
end

#crossover_typesObject

Returns the value of attribute crossover_types.



2698
2699
2700
# File 'lib/dspy/teleprompt/gepa.rb', line 2698

def crossover_types
  @crossover_types
end

#mutation_rateObject

Returns the value of attribute mutation_rate.



2686
2687
2688
# File 'lib/dspy/teleprompt/gepa.rb', line 2686

def mutation_rate
  @mutation_rate
end

#mutation_typesObject

Returns the value of attribute mutation_types.



2694
2695
2696
# File 'lib/dspy/teleprompt/gepa.rb', line 2694

def mutation_types
  @mutation_types
end

#num_generationsObject

Returns the value of attribute num_generations.



2680
2681
2682
# File 'lib/dspy/teleprompt/gepa.rb', line 2680

def num_generations
  @num_generations
end

#population_sizeObject

Returns the value of attribute population_size.



2683
2684
2685
# File 'lib/dspy/teleprompt/gepa.rb', line 2683

def population_size
  @population_size
end

#reflection_lmObject

Returns the value of attribute reflection_lm.



2677
2678
2679
# File 'lib/dspy/teleprompt/gepa.rb', line 2677

def reflection_lm
  @reflection_lm
end

#simple_modeObject

Returns the value of attribute simple_mode.



2692
2693
2694
# File 'lib/dspy/teleprompt/gepa.rb', line 2692

def simple_mode
  @simple_mode
end

#use_pareto_selectionObject

Returns the value of attribute use_pareto_selection.



2689
2690
2691
# File 'lib/dspy/teleprompt/gepa.rb', line 2689

def use_pareto_selection
  @use_pareto_selection
end

Instance Method Details

#to_hObject



2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
# File 'lib/dspy/teleprompt/gepa.rb', line 2715

def to_h
  super.merge({
    reflection_lm: @reflection_lm,
    num_generations: @num_generations,
    population_size: @population_size,
    mutation_rate: @mutation_rate,
    use_pareto_selection: @use_pareto_selection,
    simple_mode: @simple_mode,
    mutation_types: @mutation_types,
    crossover_rate: @crossover_rate,
    crossover_types: @crossover_types
  })
end