Skip to content
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

Introduce dspy.Refine, dspy.BestOfN and fix thread safety for dspy.ChainOfThoughtWithHint #1959

Merged
merged 5 commits into from
Feb 24, 2025

Conversation

chenmoneygithub
Copy link
Collaborator

dspy.Refine is a new API we are adding to support feedback-based retry. More details coming soon.

@chenmoneygithub chenmoneygithub changed the title dspy.Refine [WIP] dspy.Refine Dec 19, 2024
@younes-io
Copy link

I'm really interested in this... I mean in terms of specs!

@chenmoneygithub chenmoneygithub deleted the dspy-refine branch December 27, 2024 22:02
@chenmoneygithub chenmoneygithub restored the dspy-refine branch December 27, 2024 22:02
Copy link
Contributor

@zbambergerNLP zbambergerNLP left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really cool PR!

A project I am working on used to leverage the dspy.Suggest/Assert functionality (before the recent deprecation), and this looks like an amazing substitute.

I added some comments/feedback/questions, which I hope will help in building this. Let me know if I can be of service :D

@chenmoneygithub
Copy link
Collaborator Author

@zbambergerNLP Thanks for your comments!

Usually we don't recommend community dropping comments on PR, a much better way to contribute is trying this API out in your workflow, and let us know what's good/bad (ideally with a colab link for reproducing). We will have this API merged and released in 1-2 weeks, stay tuned!

@chenmoneygithub chenmoneygithub requested review from zbambergerNLP and okhat and removed request for zbambergerNLP February 1, 2025 19:45
@okhat
Copy link
Collaborator

okhat commented Feb 3, 2025

Thanks a lot @zbambergerNLP !

@chenmoneygithub , @zbambergerNLP is not just a community member, he's been building some cool things in the broader team :D

# last_trace.
predict.forward = MethodType(partial_forward, predict)

def _undo_patch_predict_call_with_feedback(self, named_predicts):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah this is not thread safe

@okhat okhat changed the title [WIP] dspy.Refine Introduce dspy.Refine, dspy.BestOfN and fix thread safety for dspy.ChainOfThoughtWithHint Feb 24, 2025
@okhat okhat merged commit 4f2d2f8 into stanfordnlp:main Feb 24, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants