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

openai[patch]: accept json schema response format directly #27623

Merged
merged 5 commits into from
Oct 24, 2024

Conversation

baskaryan
Copy link
Collaborator

fix #25460

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@baskaryan baskaryan requested a review from efriis October 24, 2024 17:33
Copy link

vercel bot commented Oct 24, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
langchain ⬜️ Ignored (Inspect) Visit Preview Oct 24, 2024 6:17pm

@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. 🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature labels Oct 24, 2024
assert actual == response_format

actual = _convert_to_openai_response_format(response_format["json_schema"])
assert actual == response_format
Copy link
Contributor

Choose a reason for hiding this comment

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

should we add a test that expects strict to be passed in

) -> Union[Dict, TypeBaseModel]:
if isinstance(schema, type) and is_basemodel_subclass(schema):
return schema
elif "json_schema" in schema and schema.get("type") == "json_schema":
Copy link
Contributor

Choose a reason for hiding this comment

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

might be worth adding a check to confirm that passed in strict and schema strict agree and throw error if not

baskaryan and others added 4 commits October 24, 2024 10:38
Co-authored-by: Erick Friis <erick@langchain.dev>
fmt
@baskaryan baskaryan enabled auto-merge (squash) October 24, 2024 18:17
@baskaryan baskaryan merged commit 655ced8 into master Oct 24, 2024
28 checks passed
@baskaryan baskaryan deleted the bagatur/fix_25460 branch October 24, 2024 18:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature size:M This PR changes 30-99 lines, ignoring generated files.
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

convert_to_openai_function does not support the OpenAI structured output schema
2 participants