Skip to content

Python API

The reference below is generated from the installed package. Start with the first optimization for task-oriented guidance.

Public package

pydantic_gepa

CandidateComponentError

Bases: PydanticGEPAError

Raised when a candidate component cannot be encoded or decoded.

Source code in src/pydantic_gepa/errors.py
8
9
class CandidateComponentError(PydanticGEPAError):
    """Raised when a candidate component cannot be encoded or decoded."""

CandidateInjectionError

Bases: PydanticGEPAError

Raised when a candidate cannot be injected into a target system.

Source code in src/pydantic_gepa/errors.py
12
13
class CandidateInjectionError(PydanticGEPAError):
    """Raised when a candidate cannot be injected into a target system."""

EvaluationHarnessError

Bases: PydanticGEPAError

Raised when a Pydantic Evals harness cannot run a batch.

Source code in src/pydantic_gepa/errors.py
16
17
class EvaluationHarnessError(PydanticGEPAError):
    """Raised when a Pydantic Evals harness cannot run a batch."""

EvidenceEncodingError

Bases: PydanticGEPAError

Raised when runtime evidence cannot be encoded safely.

Source code in src/pydantic_gepa/errors.py
20
21
class EvidenceEncodingError(PydanticGEPAError):
    """Raised when runtime evidence cannot be encoded safely."""

InfrastructureError

Bases: PydanticGEPAError

Raised when evaluation infrastructure fails outside task or evaluator logic.

Source code in src/pydantic_gepa/errors.py
24
25
class InfrastructureError(PydanticGEPAError):
    """Raised when evaluation infrastructure fails outside task or evaluator logic."""

InvalidScoreError

Bases: PydanticGEPAError

Raised when an evaluator produces an invalid optimization score.

Source code in src/pydantic_gepa/errors.py
28
29
class InvalidScoreError(PydanticGEPAError):
    """Raised when an evaluator produces an invalid optimization score."""

OptimizationDependencyError

Bases: PydanticGEPAError

Raised when an optional optimization dependency is unavailable.

Source code in src/pydantic_gepa/errors.py
32
33
class OptimizationDependencyError(PydanticGEPAError):
    """Raised when an optional optimization dependency is unavailable."""

PlanError

Bases: PydanticGEPAError

Raised when an optimization plan or stage violates its contract.

Source code in src/pydantic_gepa/errors.py
36
37
class PlanError(PydanticGEPAError):
    """Raised when an optimization plan or stage violates its contract."""

PydanticGEPAError

Bases: Exception

Base exception for pydantic-gepa failures.

Source code in src/pydantic_gepa/errors.py
4
5
class PydanticGEPAError(Exception):
    """Base exception for pydantic-gepa failures."""

RunStoreError

Bases: PydanticGEPAError

Raised when durable optimization state is unsafe or incompatible.

Source code in src/pydantic_gepa/errors.py
40
41
class RunStoreError(PydanticGEPAError):
    """Raised when durable optimization state is unsafe or incompatible."""

Configuration

pydantic_gepa.configuration

ConfigurationError

Bases: PydanticGEPAError

Raised when typed GEPA settings conflict or cannot be migrated.

Source code in src/pydantic_gepa/configuration/models.py
27
28
class ConfigurationError(PydanticGEPAError):
    """Raised when typed GEPA settings conflict or cannot be migrated."""

Evaluation

pydantic_gepa.evaluation

Orchestration

pydantic_gepa.orchestration

Pydantic AI integration

pydantic_gepa.integrations.pydantic_ai

Optimize Anything experimental API

pydantic_gepa.experimental.optimize_anything