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

Allow passing in a "raw" JSON Schema rather than a pydantic model #108

Open
dmwyatt opened this issue Jan 2, 2024 · 1 comment
Open
Labels
enhancement New feature or request

Comments

@dmwyatt
Copy link
Contributor

dmwyatt commented Jan 2, 2024

Using an instance of a pydantic model isn't always feasible because of some limitations.

For example, I want to dynamically change the enum values of a field. A Literal type can't have its values sourced dynamically. When not using simpleaichat I create my pydantic model, generate a json schema from it, update the schema with my enum values, and then pass that on to openai.

One solution would be to allow output_schema to take in a dict OR a pydantic model and branch accordingly. Another would be to have a separate kwarg for pydantic models and regular json schemas.

@minimaxir
Copy link
Owner

This shouldn't hurt.

@minimaxir minimaxir added the enhancement New feature or request label Jan 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants