-
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
partners: replace deprecated .dict() with .model_dump() in openai base.py #16629
Conversation
using pydantic's new function. it produces the same result without throwing a warning console message
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
LangChain needs to be both pydantic 1 and 2 compatible for now. Running tests expecting the tests to fail. If they don't fail we should confirm why not. |
@eyurtsev The tests do fail as you suspected. I made an additional commit to satisfy both v1 and v2 (and 3) but also avoid the deprecation warnings. Local tests do not throw any errors on my end |
so no merge @baskaryan? 😔 |
When do we expect this to be solved, it is peppering our code with lots of warnings... |
btw, Ideally the PR should cover all instances of this problem (for example the embeddings module has the same issue) |
@eyurtsev i actually think any OpenAI-returned object, whether you've got pydantic v1 or v2 installed, should support model_dump https://github.com/openai/openai-python/blob/d231d1fa783967c1d3a1db3ba1b52647fff148ac/src/openai/_models.py#L150 |
great observation @baskaryan. they seem to be using .dict() under the hood here but through the model_dump() function name in case of pydantic v1. |
Ah if OpenAI already supports it we can just upgrade. Shall we just change to model_dump version? |
Closed by mistake, re-opened in #17404. Sorry 😢 |
…n (reopen #16629) (#17404) --------- Co-authored-by: Bagatur <[email protected]>
…n (reopen langchain-ai#16629) (langchain-ai#17404) --------- Co-authored-by: Bagatur <[email protected]>
.model_dump()
function. It produces the same result as.dict()
without throwing a deprecation warning message,dict
method is deprecated; usemodel_dump
instead [pydantic] #15997 ,Thanks :)