-
Notifications
You must be signed in to change notification settings - Fork 19
new sampling strategies #65
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
Conversation
… can only be set by `.copy_and_repair(...)`. The templates are updated to accommodate the new field.
def copy_and_repair(self, repair_string: str) -> Instruction: | ||
"""Creates a copy of the instruction and adds/overwrites the repair string.""" | ||
res = deepcopy(self) | ||
res._repair_string = repair_string | ||
return res |
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.
Did you end up utilizing this copy_and_repair function anywhere? It looks like you opted for communicating the failed requirements as messages instead. If so, can you please remove the _repair
changes to instructions and their templates?
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.
I probably have to add an example of using this during a repair. Right now we only have "try again" without alteration and the agentic way..
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.
lgtm; left one comment about repair / sampling strats longterm and the tests don't technically fit our format, but they seem to work.
context.insert_turn(ContextTurn(past_actions[-1], past_results[-1])) | ||
|
||
last_failed_reqs: list[Requirement] = [s[0] for s in past_val[-1] if not s[1]] | ||
last_failed_reqs_str = "* " + "\n* ".join( | ||
[str(r.description) for r in last_failed_reqs] | ||
) | ||
# TODO: what to do with checks ?? | ||
|
||
next_action = Message( | ||
role="user", | ||
content=f"The following requirements have not been met: \n{last_failed_reqs_str}\n Please try again to fulfill the requirements.", | ||
) |
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.
I'm uncertain about having repair strategies modify the context directly. I guess it has to be done this way to support different repair strategies. It seems like this might be overly limiting though.
For instance, what if a repair strategy wants to offer up two possible future actions or two possible versions of the context to run against?
Maybe that just becomes a new sampling strategy with a new repair function signature.
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.
The solution for most complex Strategies would be to inherit from SamplingStrategy and not from BaseSamplingStrategy.
.. based on full access to a copy of the context.
allows: