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

Make grammar initializer prettier #2

Open
crimson-knight opened this issue Jul 23, 2024 · 1 comment
Open

Make grammar initializer prettier #2

crimson-knight opened this issue Jul 23, 2024 · 1 comment

Comments

@crimson-knight
Copy link
Owner

Currently grammars use from_json()

This is not as pretty or convenient as new.
Maybe a macro for defining properties would work better and could write the initializer.

@crimson-knight
Copy link
Owner Author

A cleaner implementation will allow provider just the class and then handles creating the instance to return, like the following

# The `response` here is now an instance of MyStructuredResponse
response = DEFAULT_MODEL.chat(prompt, grammar_class: MyStructuredResponse)

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