-
Notifications
You must be signed in to change notification settings - Fork 653
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
Add pydantic support in response_format #2647
base: main
Are you sure you want to change the base?
Conversation
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
As discussed, we'll have to see what we can do for this. Especially because |
Ok, note that this is mostly useful for the non-streaming case imo |
Big +1 on adding pydantic to both requests and responses. If HF becomes the gateway for many inference providers, it'd be super important to make the user experience with it as flawless as possible. To do so, I think both requests and responses objects should have very strict typing and validation that throw directly once the user makes a mistake => Pydantic is a must for this. E.g.:
Strict validation would also be very important here - otherwise people might waste quite some money on ill-formatted requests |
@patrickvonplaten could you open a separate issue for that topic please? @lhoestq's initial request is simply that the |
response_format
inInferenceClient.chat_completion
response.choices[0].message.parsed
(andresponse.choices[0].message.refusal
if the generation failed as in the openai client)close #2646