Skip to content

Fix predict usage tracking #8146

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 1, 2025

Conversation

chenmoneygithub
Copy link
Collaborator

@chenmoneygithub chenmoneygithub commented Apr 30, 2025

fix #8145

It actually indicates a bigger problem that our dspy.Predict's __call__ is not using the Module.__call__. We override the __call__ in dspy.Predict to disallow positional args, but it should still utilize the parent's __call__.

We also improve the error message on users passing positional args to dspy.Predict.

Before:

TypeError: Predict.__call__() takes 1 positional argument but 2 were given

After:

ValueError: Positional arguments are not allowed when calling `dspy.Predict`, must use keyword arguments that match your signature input fields. For example: dspy.Predict('question -> answer')(question='What is the capital of France?')

@chenmoneygithub chenmoneygithub requested a review from okhat April 30, 2025 23:05
@okhat okhat merged commit d47db83 into stanfordnlp:main May 1, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] Usage tracking does not work with Predict
2 participants