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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

PhilipMathieuIDEXX
Copy link

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
Author

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

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