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

Pydantic Support & Separate Package for Responses API Models #2267

Open
1 task done
bbqiu opened this issue Mar 31, 2025 · 1 comment
Open
1 task done

Pydantic Support & Separate Package for Responses API Models #2267

bbqiu opened this issue Mar 31, 2025 · 1 comment

Comments

@bbqiu
Copy link

bbqiu commented Mar 31, 2025

Confirm this is a feature request for the Python library and not the underlying OpenAI API.

  • This is a feature request for the Python library

Describe the feature or improvement you're requesting

Hey team,

I’m a contributor to MLflow. We’re working to update MLflow’s standard agent authoring interface to be an extension on top of + compatible with the Responses API. However, we don’t want authoring an agent with MLflow to require using the OpenAI SDK, so we need to make a copy of all input/output classes (and maintain this copy) in order to enforce input/output schemas. There also seems to be quite a few input/output fields that look like they’re subject to continuous change (literals with preview models / tool names)

Would these two feature requests be possible?

  1. Pydantic classes for all input/output objects.
    a. We could replace the dict compatibility for inputs via a wrapper that will cast into Pydantic models. Might help save on maintenance cost of two copies of a lot of classes ex. ResponseOutputMessageParam and ResponseOutputMessage classes, one TypedDict and the other BaseModel.
  2. Publish a separate lightweight python package specifically for the Responses API Pydantic classes, so other OSS packages can easily build on top of them

Additional context

No response

@RobertCraigie
Copy link
Collaborator

Thanks for the request but I don't think we'll want to publish a separate package just for the types, that would be too much maintenance burden. If you really do not want to add this library as a dependency then I'd recommend coming up with a build script to copy the types and make them work for your use case.

Pydantic classes for all input/output objects.

out of curiosity, would using TypeAdapters be acceptable in your case? we've been trying to avoid duplicating all the params types to reduce naming confusion

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

2 participants