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

Add support for OpenAI structured outputs with json_schema #40

Merged
merged 2 commits into from
Jan 8, 2025

Conversation

PhilipMathieuIDEXX
Copy link
Contributor

Implements a "json_schema" mode in ChatDatabricks to allow passing a JSON schema to models. Enhances existing options (function calling, JSON mode). Includes updates to test cases to reflect currently-available models and to test the new functionality. (And passes all unit tests.)

This approach is slightly less sophisticated than what the OpenAI integration uses (see https://github.com/langchain-ai/langchain/blob/ff675c11f6814e88aa338dc3668aa84d1ade3d19/libs/partners/openai/langchain_openai/chat_models/base.py#L1142). I personally don't think that the complexity makes sense right now (i.e., when enforced json schemas are not utilized by other Databricks models) but would be willing to implement it if desired by the project maintainers.

@prithvikannan happy to take feedback or comments

Copy link
Collaborator

@prithvikannan prithvikannan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for the contribution @PhilipMathieuIDEXX !

@PhilipMathieuIDEXX
Copy link
Contributor Author

@prithvikannan I fixed the linting error, should be good to go now

@prithvikannan prithvikannan merged commit d9dbbdd into databricks:main Jan 8, 2025
5 checks passed
leonbi100 pushed a commit to leonbi100/databricks-ai-bridge that referenced this pull request Jan 10, 2025
…s#40)

* Add support for OpenAI structured outputs with json_schema

* Fix linting
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

Successfully merging this pull request may close these issues.

2 participants