skill_optimizer
skill_optimizer
¶
SkillOptimizer — per-skill DSPy/GEPA optimization wrapper (Plan 2A).
Buckets traces by skill name, runs the underlying optimizer on each skill's
bucket, and writes the result as a sidecar overlay file in
~/.diapason/learning/skills/<skill-name>/optimized.toml.
The actual DSPy/GEPA invocation is done in _run_dspy / _run_gepa,
which are isolated for easy mocking in tests. In Plan 2A these are
deliberately minimal — they call the existing optimizer modules and extract
the description + few-shot examples. Plan 2B will measure the impact via
benchmarks.
Classes¶
SkillOptimizationResult
dataclass
¶
SkillOptimizationResult(
skill_name: str,
status: str,
trace_count: int = 0,
overlay_path: Optional[Path] = None,
error: str = "",
)
Result of optimizing a single skill.
SkillOptimizer
¶
Per-skill optimization wrapper around DSPyAgentOptimizer / GEPA.
| PARAMETER | DESCRIPTION |
|---|---|
min_traces_per_skill
|
Minimum trace count for a skill to be eligible for optimization.
TYPE:
|
optimizer
|
TYPE:
|
Source code in src/diapason/learning/agents/skill_optimizer.py
Methods:¶
optimize
¶
optimize(
trace_store: Any,
skill_manager: SkillManager,
*,
overlay_dir: Optional[Path] = None,
) -> Dict[str, SkillOptimizationResult]
Run the per-skill optimization loop.
Returns a dict mapping skill name to result. Writes overlay TOML files for each skill that produced output.