-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Easier api for transforming modules with assertions #354
Conversation
That’s so cool! Can we also shorten that function’s name? Or even make it a module method? program.activate_assertions() |
Great advice! Now we can do: a = Program()
a.activate_assertions()
# now a can backtrack and self-refine or teleprompter.compile(student=Program().activate_assertions()) |
Amazing! Before I merge, will this break existing code? is it an in-place or new-value method? either one is fine just checking |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
activate_assertions
is nice!
to clarify, longformqa_with_assertions = assert_transform_module(LongFormQAWithAssertions().map_named_predictors(Retry), backtrack_handler)
would look something like this now?
longformqa_with_assertions = LongFormQAWithAssertions().activate_assertions()
Yes. And it shouldn't break any existing code! Could you double check both the old and new api works @arnavsinghvi11? |
Arnav’s answer implies it is NOT in place, just to be sure right? |
Thanks! Pushed a fix. Both should work now |
Looks good @Shangyint ! Just a small issue which relies on this change to be merged for |
Now, it is possible to write
assert_transform_module(module)
to transform a module to handle suggestions and assertions. The default behavior is implemented by thebacktrack_handler
, which automatically backtracks for failing assertions and suggestions.