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] get output_type when using with_structured_output #26307

Merged
merged 10 commits into from
Sep 13, 2024

Conversation

liuhetian
Copy link
Contributor

@liuhetian liuhetian commented Sep 11, 2024

  • This allows pydantic to correctly resolve annotations necessary when using openai new param json_schema

Resolves issue: #26250

@efriis efriis added the partner label Sep 11, 2024
@efriis efriis self-assigned this Sep 11, 2024
@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Sep 11, 2024
Copy link

vercel bot commented Sep 11, 2024

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

Name Status Preview Comments Updated (UTC)
langchain ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 13, 2024 6:45pm

@dosubot dosubot bot added the 🤖:nit Small modifications/deletions, fixes, deps or improvements to existing code or docs label Sep 11, 2024
@eyurtsev eyurtsev assigned eyurtsev and unassigned efriis Sep 11, 2024
@efriis efriis self-assigned this Sep 11, 2024
@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. and removed size:XS This PR changes 0-9 lines, ignoring generated files. labels Sep 11, 2024
@dosubot dosubot bot added the lgtm PR looks good. Use to confirm that a PR is ready for merging. label Sep 11, 2024
@eyurtsev
Copy link
Collaborator

Would need to take a more careful look to see if that's the appropriate place to set the output_type... current code seems to ignore the possibility that the schema is a dict

@eyurtsev
Copy link
Collaborator

@baskaryan tagging you in case this is a quick fix for you

Copy link
Collaborator

@baskaryan baskaryan left a comment

Choose a reason for hiding this comment

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

awesome, thank you!

Fix type checking errors by declaring that the schema is a Pydantic BaseModel at this point.
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:S This PR changes 10-29 lines, ignoring generated files. labels Sep 13, 2024
@baskaryan baskaryan merged commit 7fc9e99 into langchain-ai:master Sep 13, 2024
22 of 23 checks passed
Sheepsta300 pushed a commit to Sheepsta300/langchain that referenced this pull request Oct 1, 2024
…gchain-ai#26307)

- This allows pydantic to correctly resolve annotations necessary when
using openai new param `json_schema`

Resolves issue: langchain-ai#26250

---------

Co-authored-by: Eugene Yurtsev <eyurtsev@gmail.com>
Co-authored-by: Bagatur <baskaryan@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm PR looks good. Use to confirm that a PR is ready for merging. 🤖:nit Small modifications/deletions, fixes, deps or improvements to existing code or docs partner 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.

4 participants