-
Notifications
You must be signed in to change notification settings - Fork 3
Integrating Doctest #544
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
base: master
Are you sure you want to change the base?
Integrating Doctest #544
Conversation
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.
This is neat, but I'm not sure it makes sense to use doctests in the way that's proposed in this PR (or even my original issue #433), because it departs from the semantics they have for ordinary Python functions.
Instead, there are two cases where it would be more natural to incorporate doctests as semantic constraints on Templates, which may only be useful if the doctests are stripped from the prompt during the constraint satisfaction step so that it cannot simply memorize them:
- When implementing
Templates using ordinary tool-calling, the doctests should induce a prefix to the conversation in which the LLM learns to satisfy the semantic constraints in the doctests. This only needs to happen once perTemplatedefinition, rather than once per call, and should be thought of as augmenting the system prompt associated with thatTemplate. - When generating and executing code to implement a
Template(as in #526), the generated code should be required to pass the doctests to be valid. This needs to happen once per code generation step, which could either happen once perTemplatedefinition or once perTemplatecall.
|
Thanks, that seems more comprehensive and useful towards our intended use cases! I'm implementing the following:
|
|
These ideas make sense at a high level, but I think this feature could use some additional design discussion sometime this week before we invest a lot more time into the implementation. We probably also want to resolve other open issues #497 #513 #541 #548 #549 first in order for this functionality to be useful in practice. |
|
Got it. I drafted some implementation, but I think they can/will better if we have more tools on message manipulating. Will check if I can take any of the above. |
Attempting to close #433 . Current implementation captures the template docstring at
__apply__time and add it to the synthesized function's docstring and run it.