Add PydanticFieldGEPA: Per-Field Description Evolution for Data Extraction#18
Add PydanticFieldGEPA: Per-Field Description Evolution for Data Extraction#18mango-panther wants to merge 6 commits into
Conversation
|
@TomeHirata Could you also review this one when you get time |
| ] | ||
|
|
||
|
|
||
| def __getattr__(name): |
There was a problem hiding this comment.
This shouldn't be necessary if we import them lazily where needed. Where does the circular import occur?
There was a problem hiding this comment.
- dspy/teleprompt/init.py imports from .gepa.gepa import GEPA
- This triggers loading of dspy/teleprompt/gepa/init.py first (package init)
- With eager imports, it loads pydantic_field which uses dspy.LM in type hints
- But dspy isn't fully loaded yet → circular import
|
Can we make the Pydantic field evolution another mode of the existing GEPA optimiser instead of introducing PydanticFieldGEPA? We can add a new argument to GEPA and switch the GEPA adapter class used internally based on the argument. |
Made these change. I have also upated PR description based on this new implementation. |
|
@TomeHirata, can you review this again? I have incorporated all suggested changes. |
closes #12
Adds Pydantic field description evolution as a mode within the existing
GEPAoptimizer. When apydantic_modelis provided,GEPAtreats each field description as a separate evolvable component instead of evolving predictor instructions.Usage:
New GEPA Parameters:
pydantic_model:Pydantic model defining extraction schema (triggers pydantic mode)evolvable_fields:"all", list of field names, or None for seed_prompt onlyfield_scorers:Optional per-field scorer functionsfield_weights:Optional weights for field score aggregationinput_field_name,output_field_name,base_instruction:Extraction configuration