Signature
gepa.proposer.reflective_mutation.base.Signature() dataclass
Attributes
prompt_template: str class-attribute
input_keys: list[str] class-attribute
output_keys: list[str] class-attribute
adapter: SignatureAdapter | None = None class-attribute
Methods:
prompt_renderer(input_dict: Mapping[str, Any]) -> str | list[dict[str, Any]] classmethod
Source code in gepa/proposer/reflective_mutation/base.py
text
@classmethod
def prompt_renderer(cls, input_dict: Mapping[str, Any]) -> str | list[dict[str, Any]]:
raise NotImplementedErroroutput_extractor(lm_out: str) -> dict[str, str] classmethod
Source code in gepa/proposer/reflective_mutation/base.py
text
@classmethod
def output_extractor(cls, lm_out: str) -> dict[str, str]:
raise NotImplementedErrorrun(lm: LanguageModel, input_dict: Mapping[str, Any]) -> dict[str, str] classmethod
Source code in gepa/proposer/reflective_mutation/base.py
text
@classmethod
def run(cls, lm: LanguageModel, input_dict: Mapping[str, Any]) -> dict[str, str]:
full_prompt = cls._render(input_dict)
lm_res = lm(full_prompt)
lm_out = lm_res.strip()
return cls._parse(lm_out)run_with_metadata(lm: LanguageModel, input_dict: Mapping[str, Any]) -> tuple[dict[str, str], str | list[dict[str, Any]], str] classmethod
Like run(), but also returns the rendered prompt and raw LM output.
Returns:
| Type | Description |
|---|---|
| `tuple[dict[str, str], str | list[dict[str, Any]], str]` |
Source code in gepa/proposer/reflective_mutation/base.py
text
@classmethod
def run_with_metadata(
cls, lm: LanguageModel, input_dict: Mapping[str, Any]
) -> tuple[dict[str, str], str | list[dict[str, Any]], str]:
"""Like ``run()``, but also returns the rendered prompt and raw LM output.
Returns:
A tuple of (extracted_output, rendered_prompt, raw_lm_output).
"""
full_prompt = cls._render(input_dict)
lm_res = lm(full_prompt)
lm_out = lm_res.strip()
return cls._parse(lm_out), full_prompt, lm_out