-
-
Notifications
You must be signed in to change notification settings - Fork 724
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
Feature Request: Support for Python Built-in Types as Response Models in Instructor #446
Comments
I agree but I'm run into two issues I'd love your opinion on
We could say for all non basemodel types. Do you want partial and steaming? What about response_model=Annotated[bool, Field(description=...)] Just to get you some prompting power. |
take a look at #447 |
should be available now! |
Sorry about the delay getting back to you, I must say though you executed the implementation of the feature flawlessly. Tried the feature and it works great, even my example code of desired feature works exactly as it is written. Excellent job! |
mind writing something up? can just copy and simplify https://jxnl.github.io/instructor/concepts/types |
Is your feature request related to a problem? Please describe.
Defining a Pydantic model for responses that could be directly represented by Python built-in types is cumbersome. This issue is evident when dealing with simple boolean queries about the presence of certain conditions in a text, such as detecting emotions.
Describe the solution you'd like
Enable the use of Python built-in types, like
bool
, as theresponse_model
in Instructor. This enhancement would simplify scenarios where the expected response is a straightforward yes/no or true/false.Example Code for Desired Feature:
Current Workaround with Pydantic Model:
Currently, to achieve a boolean response, I need to define a Pydantic model specifically for this purpose, which feels unnecessarily complex for such a simple task.
Describe alternatives you've considered
The alternative involves manually parsing the response outside of Instructor, which negates the benefits of streamlined data handling and validation provided by Instructor.
The text was updated successfully, but these errors were encountered: