-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
What happened?
I am getting unexpected type checker errors for my GEPA objective functions:
voss@porkpie [~] uv run pyright repro.py
/Users/voss/sources/dspy-bug/repro.py
/Users/voss/sources/dspy-bug/repro.py:9:12 - error: Argument of type "(gold: Unknown, pred: Unknown, trace: Unknown | None = None, pred_name: Unknown | None = None, pred_trace: Unknown | None = None) -> float" cannot be assigned to parameter "metric" of type "GEPAFeedbackMetric" in function "__init__"
"FunctionType" is incompatible with protocol "GEPAFeedbackMetric"
Could not bind method "__call__" because "FunctionType" is not assignable to parameter "gold"
"FunctionType" is not assignable to "Example" (reportArgumentType)
1 error, 0 warnings, 0 informationsI believe that my function is correct, and the the error reported here is a false positive. Test file is below.
Steps to reproduce
View this test file in vscode, or run the type checker as shown above: repro.py.
Note that the problem does not occur for version 3.0.4. Sadly the reason for this is not that the problem has been fixed, but instead the new @experimental(version="3.0.0") decorator on GEPAFeedbackMetric (file "teleprompt/gepa/gepa.py") confuses the type checker.
DSPy version
3.0.3
Copilot and TomeHirata
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working