-
Notifications
You must be signed in to change notification settings - Fork 15.9k
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[minor]: release 0.3 #29100
openai[minor]: release 0.3 #29100
Conversation
Merging into v0.3 branch
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Skipped Deployment
|
Should be accompanied by a minor bump Should we also set `strict=True` by default? --------- Co-authored-by: Bagatur <[email protected]> Co-authored-by: ccurme <[email protected]>
try: | ||
with context_manager as response: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wrapping this in try/except lets us catch errors from OpenAI SDK and make them more informative for langchain users
raise ValueError( | ||
"This model does not support OpenAI's structured output " | ||
"feature, which is the default method for " | ||
"`with_structured_output` as of langchain-openai==0.3. To use " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this can be raised without ever using with_structured_output
, but afaik that is the only existing usage pattern that will raise it (I expect that most users of with_structured_output
using default model will run into this).
Goal
Solve the following problems with
langchain-openai
:o1
breaks out of the box.with_structured_output
by default does not use OpenAI’s structured output feature.Breaking changes:
strict=True
.method="function_calling"
intowith_structured_output
.method="json_schema"
(e.g.,gpt-4
andgpt-3.5-turbo
, currently the default model for ChatOpenAI) will raise an error unlessmethod
is explicitly specified.method="function_calling"
intowith_structured_output
.BaseModel
that have fields with non-null defaults or metadata (like min/max constraints) will raise an error.method="function_calling"
intowith_structured_output
.strict
now defaults to False formethod="json_schema"
when schemas are specified via TypedDict or JSON schema.with_structured_output(schema, strict=True)
method="function_calling"
) unlessmethod
is explicitly specified.method="function_calling"
intowith_structured_output
.method="function_calling"
intowith_structured_output
.ChatOpenAI
orAzureChatOpenAI
withtemperature=0.7
.