# Configuration & Thresholds

Key constants and configuration values used across the optimization pipeline.

## Model Distribution (`core/shared/optimizer_config.py`)

- `MAX_OPTIMIZER_CALLS = 6` — maximum parallel optimization calls
- `MAX_OPTIMIZER_LP_CALLS = 7` — maximum line profiler optimization calls
- Distribution formula: `claude_calls = (total - 1) // 2`, `gpt_calls = total - claude_calls`
- Example: 6 total → 4 OpenAI + 2 Anthropic

## Default Request Values

- `OptimizeSchema.n_candidates = 5` — default optimization candidates
- `OptimizeSchemaLP.n_candidates = 6` — default line profiler candidates
- `OptimizeSchema.language = "python"` — default language

## LLM Model Costs (USD per 1M tokens)

| Model | Input | Cached Input | Output |
|-------|-------|-------------|--------|
| GPT-4.1 | $2.00 | $0.50 | $8.00 |
| GPT-5-mini | $0.25 | $0.03 | $2.00 |
| Claude Sonnet 4.5 | $3.00 | — | $15.00 |
| Claude Haiku 4.5 | $1.00 | — | $5.00 |

## Model Assignments

| Purpose | Primary | Fallback |
|---------|---------|----------|
| Optimization | GPT-5-mini | Claude Sonnet 4.5 |
| Explanation | GPT-5-mini | Claude Sonnet 4.5 |
| Planning | GPT-5-mini | Claude Sonnet 4.5 |
| Execution | GPT-5-mini | Claude Sonnet 4.5 |
| Ranking | GPT-5-mini | Claude Sonnet 4.5 |
| Refinement | Claude Sonnet 4.5 | GPT-5-mini |
| Code Repair | Claude Sonnet 4.5 | GPT-5-mini |
| Explanations | Claude Sonnet 4.5 | GPT-5-mini |
| Optimization Review | Claude Sonnet 4.5 | GPT-5-mini |
| Adaptive Optimize | Claude Sonnet 4.5 | GPT-5-mini |
| Cost-effective (testgen) | Claude Haiku 4.5 | GPT-5-mini |

## Ruff Configuration (`pyproject.toml`)

- `line-length = 120`
- `select = ["ALL"]` with specific ignores (see `tool.ruff.lint.ignore`)
- `fix = true`, `show-fixes = true`
- Runtime-evaluated base classes: `pydantic.BaseModel`, `ninja.Schema`, `typing.TypedDict`
- Excluded paths: `core/languages/python/testgen/tests`, `core/languages/python/testgen/sqlalchemy`
