Module: GEPA

Extended by:
T::Sig
Defined in:
lib/gepa.rb,
lib/gepa/api.rb,
lib/gepa/logging.rb,
lib/gepa/version.rb,
lib/gepa/telemetry.rb,
lib/gepa/core/state.rb,
lib/gepa/core/engine.rb,
lib/gepa/core/result.rb,
lib/gepa/utils/pareto.rb,
lib/gepa/proposer/base.rb,
lib/gepa/logging/logger.rb,
lib/gepa/core/evaluation_batch.rb,
lib/gepa/proposer/merge_proposer.rb,
lib/gepa/strategies/batch_sampler.rb,
lib/gepa/logging/experiment_tracker.rb,
lib/gepa/strategies/candidate_selector.rb,
lib/gepa/strategies/component_selector.rb,
lib/gepa/strategies/instruction_proposal.rb,
lib/gepa/proposer/reflective_mutation/base.rb,
lib/gepa/proposer/reflective_mutation/reflective_mutation.rb

Defined Under Namespace

Modules: Core, Logging, Proposer, Strategies, Telemetry, Utils

Constant Summary collapse

VERSION =
DSPy::VERSION

Class Method Summary collapse

Class Method Details

.optimize(seed_candidate:, trainset:, valset:, adapter:, reflective_proposer:, merge_proposer: nil, logger:, experiment_tracker:, max_metric_calls:, telemetry: nil) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/gepa/api.rb', line 26

def optimize(
  seed_candidate:,
  trainset:,
  valset:,
  adapter:,
  reflective_proposer:,
  merge_proposer: nil,
  logger:,
  experiment_tracker:,
  max_metric_calls:,
  telemetry: nil
)
  evaluator = proc { |dataset, candidate| adapter.evaluate(dataset, candidate) }

  engine = GEPA::Core::Engine.new(
    run_dir: nil,
    evaluator: evaluator,
    valset: valset,
    seed_candidate: seed_candidate,
    max_metric_calls: max_metric_calls,
    perfect_score: Float::INFINITY,
    seed: 0,
    reflective_proposer: reflective_proposer,
    merge_proposer: merge_proposer,
    logger: logger,
    experiment_tracker: experiment_tracker,
    telemetry: telemetry || GEPA::Telemetry,
    track_best_outputs: false,
    display_progress_bar: false,
    raise_on_exception: true
  )

  state = engine.run
  GEPA::Core::Result.from_state(state)
end