Class: DSPy::Teleprompt::GEPA::GEPAConfig
- Inherits:
-
Config
- Object
- Config
- DSPy::Teleprompt::GEPA::GEPAConfig
- Extended by:
- T::Sig
- Defined in:
- lib/dspy/teleprompt/gepa.rb
Overview
Configuration for GEPA optimization
Instance Attribute Summary collapse
-
#crossover_rate ⇒ Object
Returns the value of attribute crossover_rate.
-
#crossover_types ⇒ Object
Returns the value of attribute crossover_types.
-
#mutation_rate ⇒ Object
Returns the value of attribute mutation_rate.
-
#mutation_types ⇒ Object
Returns the value of attribute mutation_types.
-
#num_generations ⇒ Object
Returns the value of attribute num_generations.
-
#population_size ⇒ Object
Returns the value of attribute population_size.
-
#reflection_lm ⇒ Object
Returns the value of attribute reflection_lm.
-
#use_pareto_selection ⇒ Object
Returns the value of attribute use_pareto_selection.
Instance Method Summary collapse
-
#initialize ⇒ GEPAConfig
constructor
A new instance of GEPAConfig.
- #to_h ⇒ Object
Constructor Details
#initialize ⇒ GEPAConfig
Returns a new instance of GEPAConfig.
2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 |
# File 'lib/dspy/teleprompt/gepa.rb', line 2439 def initialize super # reflection_lm must be explicitly set by user - no default provided @reflection_lm = nil @num_generations = 10 @population_size = 8 @mutation_rate = 0.7 @use_pareto_selection = true @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_rate ⇒ Object
Returns the value of attribute crossover_rate.
2434 2435 2436 |
# File 'lib/dspy/teleprompt/gepa.rb', line 2434 def crossover_rate @crossover_rate end |
#crossover_types ⇒ Object
Returns the value of attribute crossover_types.
2436 2437 2438 |
# File 'lib/dspy/teleprompt/gepa.rb', line 2436 def crossover_types @crossover_types end |
#mutation_rate ⇒ Object
Returns the value of attribute mutation_rate.
2426 2427 2428 |
# File 'lib/dspy/teleprompt/gepa.rb', line 2426 def mutation_rate @mutation_rate end |
#mutation_types ⇒ Object
Returns the value of attribute mutation_types.
2432 2433 2434 |
# File 'lib/dspy/teleprompt/gepa.rb', line 2432 def mutation_types @mutation_types end |
#num_generations ⇒ Object
Returns the value of attribute num_generations.
2420 2421 2422 |
# File 'lib/dspy/teleprompt/gepa.rb', line 2420 def num_generations @num_generations end |
#population_size ⇒ Object
Returns the value of attribute population_size.
2423 2424 2425 |
# File 'lib/dspy/teleprompt/gepa.rb', line 2423 def population_size @population_size end |
#reflection_lm ⇒ Object
Returns the value of attribute reflection_lm.
2417 2418 2419 |
# File 'lib/dspy/teleprompt/gepa.rb', line 2417 def reflection_lm @reflection_lm end |
#use_pareto_selection ⇒ Object
Returns the value of attribute use_pareto_selection.
2429 2430 2431 |
# File 'lib/dspy/teleprompt/gepa.rb', line 2429 def use_pareto_selection @use_pareto_selection end |
Instance Method Details
#to_h ⇒ Object
2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 |
# File 'lib/dspy/teleprompt/gepa.rb', line 2453 def to_h super.merge({ reflection_lm: @reflection_lm&.model, # Serialize the model name for hash representation num_generations: @num_generations, population_size: @population_size, mutation_rate: @mutation_rate, use_pareto_selection: @use_pareto_selection, mutation_types: @mutation_types, crossover_rate: @crossover_rate, crossover_types: @crossover_types }) end |