Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

### Changed
- Upgraded GEPA dependency from `gepa==0.0.22` to `gepa==0.1.4`.
CodeOptiX continues to use GEPA's `InstructionProposalSignature` for reflective
prompt proposals. GEPA 0.1.x renames default template placeholders to
`<curr_param>` and `<side_info>` (from `<curr_instructions>` /
`<inputs_outputs_feedback>`). Custom `prompt_template` configs must use the
new placeholders. The MinimalGEPAProposer LLM wrapper now accepts both string
prompts and multimodal message lists to match GEPA 0.1.x LanguageModel.

### Deprecated

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ dependencies = [
"numpy>=1.24.0",
"litellm>=1.80.0",
"tenacity>=8.0.0",
"gepa==0.0.22",
"gepa==0.1.4",
"agent-client-protocol>=0.7.0",
]

Expand Down
27 changes: 19 additions & 8 deletions src/codeoptix/evolution/gepa_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@

Note: This is NOT a full GEPA framework integration. We're using GEPA's proven
instruction proposal mechanism rather than the complete GEPA optimization engine.

GEPA 0.1.x notes:
- InstructionProposalSignature placeholders are ``<curr_param>`` and ``<side_info>``
(renamed from ``<curr_instructions>`` / ``<inputs_outputs_feedback>`` in 0.0.x).
- Custom ``prompt_template`` values must include those 0.1.x placeholders.
- LanguageModel may receive either a string prompt or a multimodal messages list;
CodeOptiX only feeds text feedback today, so the string path is the common case.
"""

from typing import Any
Expand All @@ -25,7 +32,8 @@ def __init__(self, llm_client, config: dict[str, Any] | None = None):

Args:
llm_client: LLM client compatible with GEPA's LanguageModel interface
config: Configuration dictionary
config: Configuration dictionary. Optional ``prompt_template`` must use
GEPA 0.1.x placeholders ``<curr_param>`` and ``<side_info>``.
"""
self.llm_client = llm_client
self.config = config or {}
Expand Down Expand Up @@ -118,8 +126,7 @@ def _wrap_llm_client(self):
"""
Wrap CodeOptiX LLM client to GEPA's LanguageModel interface.

GEPA expects a LanguageModel Protocol with a __call__ method that takes
a prompt string and returns a string response.
GEPA 0.1.x LanguageModel accepts ``str | list[dict]`` and returns a string.
"""

class GEPALLMWrapper:
Expand All @@ -130,16 +137,20 @@ def __init__(self, llm_client):
if hasattr(llm_client, "config") and isinstance(llm_client.config, dict):
self.default_model = llm_client.config.get("model", self.default_model)

def __call__(self, prompt: str) -> str:
def __call__(self, prompt: str | list[dict[str, Any]]) -> str:
"""
Generate response using CodeOptiX LLM client.

This implements GEPA's LanguageModel Protocol:
- Takes a prompt string
- Returns a string response
Implements GEPA's LanguageModel Protocol for both string prompts
and OpenAI-style multimodal message lists.
"""
if isinstance(prompt, str):
messages: list[dict[str, Any]] = [{"role": "user", "content": prompt}]
else:
messages = prompt

response = self.llm_client.chat_completion(
messages=[{"role": "user", "content": prompt}],
messages=messages,
model=self.default_model,
temperature=0.7,
)
Expand Down
12 changes: 6 additions & 6 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading