Skip to content

Configuration Reference

All configurable settings and their defaults.

Environment Variables

VariableRequiredDescription
OPENAI_API_KEYYesOpenAI API key
OPENAI_ORG_IDNoOrganization ID (for multi-org accounts)
bash
# .env file
OPENAI_API_KEY=sk-...

Core Thresholds

Evaluation Thresholds

python
# Lenient pass criteria (OR logic)
LENIENT_PASS_RATIO = 0.75        # 75% of graders must pass
LENIENT_AVERAGE_THRESHOLD = 0.85  # OR average score >= 85%

# Optimization control
MAX_OPTIMIZATION_RETRIES = 3      # Max prompt revision attempts per section

Grader Thresholds

python
# Individual grader pass thresholds
CHEMICAL_NAME_THRESHOLD = 0.9     # 90% of chemicals preserved
WORD_LENGTH_THRESHOLD = 0.65      # Within acceptable length range
COSINE_SIMILARITY_THRESHOLD = 0.5 # Semantic similarity minimum
LLM_JUDGE_THRESHOLD = 0.85        # LLM quality score minimum

Word Length Configuration

python
# Summary length control
WORD_LENGTH_TARGET = 80           # Target word count
WORD_LENGTH_DEVIATION = 0.35      # 35% allowed deviation (56-108 words)

Model Configuration

Available Models

Model IDUse CaseTemperatureMax Tokens
gpt-5Highest quality0.7500
gpt-4.1Default, balanced0.7500
gpt-5-miniHigh volume0.7500

Agent Configuration

python
from agents import Agent

agent = Agent(
    name="SummarizationAgent",
    instructions=prompt,
    model="gpt-5",  # or "gpt-4.1", "gpt-5-mini"
)

LLM-as-Judge Model Selection

python
# For judge graders
llm_as_judge = {
    "model": "gpt-4.1",  # Fast, cost-effective for judging
    # "model": "gpt-5",  # Use for critical evaluations
}

GEPA Configuration

python
import gepa

result = gepa.optimize(
    seed_candidate=seed_candidate,
    trainset=trainset,
    valset=valset,
    adapter=adapter,

    # Configuration options
    reflection_lm="gpt-5",           # Model for reflection
    max_metric_calls=10,             # Max evaluation iterations
    track_best_outputs=True,         # Store best outputs
    display_progress_bar=True,       # Show progress
)
ParameterDefaultDescription
reflection_lm"gpt-5"Model for prompt reflection
max_metric_calls10Maximum evaluation iterations
track_best_outputsTrueStore best outputs for analysis
display_progress_barTrueShow optimization progress

Monitoring Configuration

python
from dataclasses import dataclass
from datetime import timedelta

@dataclass
class MonitoringConfig:
    eval_id: str
    sample_rate: float = 0.1          # 10% of requests sampled
    window_size: int = 100            # Metrics window size

    # Health thresholds
    score_healthy: float = 0.85       # Healthy if above
    score_warning: float = 0.75       # Warning if below healthy
    pass_rate_healthy: float = 0.90   # 90% pass rate for healthy
    pass_rate_warning: float = 0.75   # 75% pass rate for warning
    max_consecutive_failures: int = 3  # Alert after 3 failures
    max_score_variance: float = 0.2   # Alert on high variance

    # Timing
    check_interval: timedelta = timedelta(minutes=5)
    alert_cooldown: timedelta = timedelta(hours=1)

Deployment Configuration

python
@dataclass
class DeploymentConfig:
    # Validation thresholds
    min_score_threshold: float = 0.85  # Min score to deploy
    rollback_threshold: float = 0.75   # Trigger rollback below

    # Agent settings
    temperature: float = 0.7
    max_tokens: int = 500

    # Canary settings
    initial_canary_percentage: float = 0.05  # Start at 5%
    canary_increment: float = 0.10           # Increase by 10%

Data Source Configuration

Eval Data Source Schema

python
data_source_config = {
    "type": "custom",
    "item_schema": {
        "type": "object",
        "properties": {
            "section": {
                "type": "string",
                "description": "Source text to summarize"
            },
            "summary": {
                "type": "string",
                "description": "Generated or reference summary"
            },
        },
        "required": ["section", "summary"],
    },
}

Run Data Source

python
data_source = {
    "type": "jsonl",
    "source": {
        "type": "file_content",
        "content": [
            {"item": {"section": "...", "summary": "..."}}
        ],
    },
}

Polling Configuration

python
# Eval run polling
MAX_POLLS = 10        # Maximum poll attempts
POLL_INTERVAL = 5     # Seconds between polls

def poll_eval_run(eval_id, run_id, max_polls=MAX_POLLS):
    for attempt in range(1, max_polls + 1):
        run = client.evals.runs.retrieve(eval_id=eval_id, run_id=run_id)
        if run.status == "completed":
            break
        time.sleep(POLL_INTERVAL)
    return client.evals.runs.output_items.list(eval_id=eval_id, run_id=run_id)

Caching Configuration

python
# Simple in-memory cache
eval_cache: dict[tuple[str, str], list[dict]] = {}

async def get_eval_grader_score(eval_id, section, summary):
    cache_key = (section, summary)

    if cache_key in eval_cache:
        return eval_cache[cache_key]

    # Run evaluation...
    results = run_evaluation(eval_id, section, summary)

    eval_cache[cache_key] = results
    return results
python
# Production configuration
PRODUCTION_CONFIG = {
    # Model
    "model": "gpt-5",
    "temperature": 0.7,
    "max_tokens": 500,

    # Evaluation
    "lenient_pass_ratio": 0.75,
    "lenient_average_threshold": 0.85,
    "max_optimization_retries": 3,

    # Monitoring
    "sample_rate": 0.10,
    "score_healthy": 0.85,
    "score_warning": 0.75,

    # Deployment
    "min_deploy_score": 0.85,
    "rollback_threshold": 0.75,
}

Based on OpenAI Cookbook - Bain & OpenAI Collaboration