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

Example to generate dating app profiles- combines prompt templating with JSON generation #287

Merged
merged 6 commits into from
Sep 24, 2023

Conversation

veezbo
Copy link
Contributor

@veezbo veezbo commented Sep 18, 2023

Let me know if there's any additional information you'd like me to add.

I figure this practical example will be useful to demonstrate more complex JSON generation alongside prompt templating (which is more useful the more complex the JSON structure becomes).

@rlouf
Copy link
Member

rlouf commented Sep 19, 2023

Awesome example! I noticed a comment mentioning that constr makes the compilation slow. Would you mind opening an issue so we track this?#272 should help with this.

Also you'll need to run pre-commit locally to fix the formatting issues!

@veezbo
Copy link
Contributor Author

veezbo commented Sep 21, 2023

@rlouf Thanks! I went ahead and ran the pre-commit hook and it passes now. One note on that which I also made in a comment in the code: mypy seems to have some outstanding issues with constrained pydantic typing. See the issue here: pydantic/pydantic#975

Unfortunately, that means in order to pass the pre-commit hook I had to add a type: ignore comment in my code.

As a sanity check, I also ran the pre-commit hook on the example in the README but unfortunately this failed the pre-commit hook for the same reason and requires a type: ignore comment to pass.

I'll also create an issue soon for constr increasing runtime and reference this PR.

@brandonwillard brandonwillard added the examples Linked to usage examples label Sep 21, 2023
Copy link
Contributor

@brandonwillard brandonwillard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is such a great example!

@veezbo
Copy link
Contributor Author

veezbo commented Sep 21, 2023

Created the issue here: #292

@veezbo
Copy link
Contributor Author

veezbo commented Sep 21, 2023

Thanks @brandonwillard! I'm a big fan of your guys' work on this, and see a lot of potential.

I wanted to try JSON generation with a more complex JSON that would benefit from doing joint generation of multiple fields. Dating profiles (relevant to my day job) seemed to fit the bill.

@rlouf rlouf merged commit 52b105e into outlines-dev:main Sep 24, 2023
3 checks passed
@veezbo veezbo deleted the dating_profile_generator_example branch September 24, 2023 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
examples Linked to usage examples
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants