Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.gaussia.ai/llms.txt

Use this file to discover all available pages before exploring further.

Overview

The Prompt Optimizer module provides algorithms for automatically improving LLM prompts based on evaluation metrics. It uses Optuna for hyperparameter optimization.

Available algorithms

AlgorithmDescription
GEPAGenetic Evolution Prompt Algorithm — evolves prompts through selection and mutation
MIPROv2Multi-Instance Prompt Optimization v2 — generates and evaluates prompt candidates

Usage

from gaussia.prompt_optimizer import PromptOptimizer

optimizer = PromptOptimizer(
    algorithm="gepa",
    n_trials=50,
)

best_prompt = optimizer.optimize(
    initial_prompt="You are a helpful assistant.",
    evaluation_fn=my_evaluation_function,
)
Requires the prompt-optimizer extra: pip install "gaussia[prompt-optimizer]".