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

Type-guided generation #346

Closed
rlouf opened this issue Nov 10, 2023 · 0 comments · Fixed by #358
Closed

Type-guided generation #346

rlouf opened this issue Nov 10, 2023 · 0 comments · Fixed by #358

Comments

@rlouf
Copy link
Member

rlouf commented Nov 10, 2023

We currently support regex-guided generation, so that to return a date in the Python datetime format you would do:

import outlines.generate as generate

model = ...
result = generate.regex(model, "r'\s+(?=\d{2}(?:\d{2})?-\d{1,2}-\d{1,2}\b)'")

Instead we would like to be able to pass Python types:

from typing import List
import datetime

import outlines.generate as generate

model = ...
result = generate.type(model, datetime.datetime)
result = generate.type(model, List[str])
result = generate.type(model, int)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant