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

Conditional stopping condition for the regex generator #1163

Open
LouSalaun opened this issue Sep 19, 2024 · 0 comments
Open

Conditional stopping condition for the regex generator #1163

LouSalaun opened this issue Sep 19, 2024 · 0 comments

Comments

@LouSalaun
Copy link

This feature was recently discussed with @alonsosilvaallende and @rlouf.

Presentation of the new feature

Add an optional argument to the regex generator representing a conditional stopping condition. This stopping condition is a regular expression. The generation terminates whenever the output matches the condition.

For example, when using this regex "A:[\s\S]{50,700}The answer is [1-9][0-9]{0,9}\." for structured generation (see this blogpost), the output might contain several sentences of the form "The answer is". It may be useful to stop generation whenever the LLM produces an output containing one instance of "The answer is [1-9][0-9]{0,9}\.".

Where does it fit in Outlines?

Adding an optional argument stopping_regex (of type str) to the regex generator.

Are you willing to open a PR?

I haven't looked at all the details, but yes.

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

No branches or pull requests

1 participant