feat: expose to_strict_json_schema as public API#3196
Open
lrg913427-dot wants to merge 1 commit intoopenai:mainfrom
Open
feat: expose to_strict_json_schema as public API#3196lrg913427-dot wants to merge 1 commit intoopenai:mainfrom
lrg913427-dot wants to merge 1 commit intoopenai:mainfrom
Conversation
Expose the internal to_strict_json_schema function as a public API so users can generate strict JSON schemas from Pydantic models without relying on private module paths. Changes: - Add to_strict_json_schema export to openai.lib.__init__ - Add to_strict_json_schema export to openai.__init__ - Add test for public API accessibility Closes openai#2093
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Exposes the internal
to_strict_json_schemafunction as a public API so users can generate strict JSON schemas from Pydantic models without relying on private module paths (e.g.,openai.lib._pydantic).Changes
src/openai/lib/__init__.py- Addedto_strict_json_schemaexportsrc/openai/__init__.py- Addedto_strict_json_schemato top-level exports (accessible viaopenai.to_strict_json_schema)tests/lib/test_pydantic.py- Added test verifying public API accessibilityMotivation
Closes #2093. Users currently need to import from
openai.lib._pydantic(a private module) to accessto_strict_json_schema. This PR makes it a first-class public API, accessible asopenai.to_strict_json_schema, following the same pattern asopenai.pydantic_function_tool.