`PydanticDeprecatedSince20: The `dict` method is deprecated; use `model_dump` instead. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.12/migration/`

Saw this message in my console after upgrading the dependencies. What’s the source of the message and how to fix it?

~/rag-agent/.venv/lib/python3.13/site-packages/langsmith/_internal/_serde.py:103: PydanticDeprecatedSince20: The `dict` method is deprecated; use `model_dump` instead. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.12/migration/
  response = method(**kwargs)

@kheth can you please share your code which raising this warning? Would be able to better help you out then..

That’s problem. I don’t know which line of code and whether it is my code which causes the issue. I can’t post a URL of my repository here.

@khteh can you then share the langchain package versions of your environment by running the following command:
python -m langchain_core.sys_info

System Information
------------------
> OS:  Linux
> OS Version:  #20-Ubuntu SMP PREEMPT_DYNAMIC Fri Mar 13 20:07:29 UTC 2026
> Python Version:  3.13.7 (main, Mar  3 2026, 12:19:54) [GCC 15.2.0]

Package Information
-------------------
> langchain_core: 0.3.45
> langchain: 0.3.20
> langchain_community: 0.3.19
> langsmith: 0.3.15
> langchain_google_genai: 2.1.0
> langchain_google_vertexai: 2.0.15
> langchain_openai: 0.3.8
> langchain_text_splitters: 0.3.6
> langgraph_api: 0.2.38
> langgraph_cli: 0.2.10
> langgraph_license: Installed. No version info available.
> langgraph_runtime: Installed. No version info available.
> langgraph_runtime_inmem: 0.2.0
> langgraph_sdk: 0.1.70

Optional packages not installed
-------------------------------
> langserve

Other Dependencies
------------------
> aiohttp<4.0.0,>=3.8.3: Installed. No version info available.
> anthropic[vertexai]: Installed. No version info available.
> async-timeout<5.0.0,>=4.0.0;: Installed. No version info available.
> blockbuster<2.0.0,>=1.5.24: Installed. No version info available.
> click: 8.1.8
> cloudpickle>=3.0.0: Installed. No version info available.
> cryptography<45.0,>=42.0.0: Installed. No version info available.
> dataclasses-json<0.7,>=0.5.7: Installed. No version info available.
> filetype: 1.2.0
> google-ai-generativelanguage: 0.6.16
> google-cloud-aiplatform: 1.84.0
> google-cloud-storage: 2.19.0
> httpx: 0.28.1
> httpx-sse: 0.4.0
> httpx-sse<1.0.0,>=0.4.0: Installed. No version info available.
> httpx>=0.25.0: Installed. No version info available.
> httpx>=0.25.2: Installed. No version info available.
> jsonpatch<2.0,>=1.33: Installed. No version info available.
> jsonschema-rs<0.30,>=0.20.0: Installed. No version info available.
> langchain-anthropic;: Installed. No version info available.
> langchain-aws;: Installed. No version info available.
> langchain-cohere;: Installed. No version info available.
> langchain-community;: Installed. No version info available.
> langchain-core<1.0.0,>=0.3.34: Installed. No version info available.
> langchain-core<1.0.0,>=0.3.41: Installed. No version info available.
> langchain-core<1.0.0,>=0.3.42: Installed. No version info available.
> langchain-core>=0.2.38: Installed. No version info available.
> langchain-deepseek;: Installed. No version info available.
> langchain-fireworks;: Installed. No version info available.
> langchain-google-genai;: Installed. No version info available.
> langchain-google-vertexai;: Installed. No version info available.
> langchain-groq;: Installed. No version info available.
> langchain-huggingface;: Installed. No version info available.
> langchain-mistralai: Installed. No version info available.
> langchain-mistralai;: Installed. No version info available.
> langchain-ollama;: Installed. No version info available.
> langchain-openai;: Installed. No version info available.
> langchain-text-splitters<1.0.0,>=0.3.6: Installed. No version info available.
> langchain-together;: Installed. No version info available.
> langchain-xai;: Installed. No version info available.
> langchain<1.0.0,>=0.3.20: Installed. No version info available.
> langgraph-checkpoint>=2.0.23: Installed. No version info available.
> langgraph-checkpoint>=2.0.25: Installed. No version info available.
> langgraph-runtime-inmem<0.3,>=0.2.0: Installed. No version info available.
> langgraph-sdk>=0.1.66: Installed. No version info available.
> langgraph>=0.2: Installed. No version info available.
> langgraph>=0.3.27: Installed. No version info available.
> langsmith-pyo3: Installed. No version info available.
> langsmith<0.4,>=0.1.125: Installed. No version info available.
> langsmith<0.4,>=0.1.17: Installed. No version info available.
> langsmith>=0.1.112: Installed. No version info available.
> numpy<3,>=1.26.2: Installed. No version info available.
> openai-agents: Installed. No version info available.
> openai<2.0.0,>=1.58.1: Installed. No version info available.
> orjson: 3.10.15
> orjson>=3.10.1: Installed. No version info available.
> orjson>=3.9.7: Installed. No version info available.
> packaging: 24.2
> packaging<25,>=23.2: Installed. No version info available.
> pydantic: 2.10.6
> pydantic-settings<3.0.0,>=2.4.0: Installed. No version info available.
> pydantic<3.0.0,>=2.5.2;: Installed. No version info available.
> pydantic<3.0.0,>=2.7.4: Installed. No version info available.
> pydantic<3.0.0,>=2.7.4;: Installed. No version info available.
> pyjwt>=2.9.0: Installed. No version info available.
> pytest: Installed. No version info available.
> python-dotenv: 1.0.1
> PyYAML>=5.3: Installed. No version info available.
> requests: 2.32.3
> requests-toolbelt: 1.0.0
> requests<3,>=2: Installed. No version info available.
> rich: 13.9.4
> SQLAlchemy<3,>=1.4: Installed. No version info available.
> sse-starlette<2.2.0,>=2.1.0: Installed. No version info available.
> sse-starlette>=2: Installed. No version info available.
> starlette>=0.37: Installed. No version info available.
> starlette>=0.38.6: Installed. No version info available.
> structlog<26,>=24.1.0: Installed. No version info available.
> structlog>23: Installed. No version info available.
> tenacity!=8.4.0,<10,>=8.1.0: Installed. No version info available.
> tenacity!=8.4.0,<10.0.0,>=8.1.0: Installed. No version info available.
> tenacity>=8.0.0: Installed. No version info available.
> tiktoken<1,>=0.7: Installed. No version info available.
> truststore>=0.1: Installed. No version info available.
> typing-extensions>=4.7: Installed. No version info available.
> uvicorn>=0.26.0: Installed. No version info available.
> watchfiles>=0.13: Installed. No version info available.
> zstandard: 0.23.0

Please update to latest version of langchain and langchain_core:

  • langchain → 1.2.15
  • langchain_core → 1.2.26

You need to update your pyproject.toml e.g "langchain>=1.2.15", this will ensure langchain is at a minimum of v1.2.15 and then run uv sync –upgrade so your environment get’s updated.

I don’t specifically have only langchain in pyproject.toml Even when I uv add langchain it is not added at all.

To no avail. I have upgraded to the latest langchain versions but the warning message still shows up.

System Information
------------------
> OS:  Linux
> OS Version:  #20-Ubuntu SMP PREEMPT_DYNAMIC Fri Mar 13 20:07:29 UTC 2026
> Python Version:  3.13.7 (main, Mar  3 2026, 12:19:54) [GCC 15.2.0]

Package Information
-------------------
> langchain_core: 1.2.26
> langchain: 1.2.15
> langchain_community: 0.4.1
> langsmith: 0.7.25
> deepagents: 0.4.12
> langchain_anthropic: 1.4.0
> langchain_classic: 1.0.3
> langchain_google_genai: 4.2.1
> langchain_neo4j: 0.9.0
> langchain_ollama: 1.0.1
> langchain_openai: 1.1.12
> langchain_postgres: 0.0.17
> langchain_text_splitters: 1.1.1
> langgraph_api: 0.7.27
> langgraph_cli: 0.4.19
> langgraph_runtime_inmem: 0.24.1
> langgraph_sdk: 0.3.12

Optional packages not installed
-------------------------------
> deepagents-cli

Other Dependencies
------------------
> aiohttp: 3.13.5
> anthropic: 0.89.0
> asyncpg: 0.31.0
> blockbuster: 1.5.26
> click: 8.3.2
> cloudpickle: 3.1.2
> croniter: 6.2.2
> cryptography: 46.0.6
> dataclasses-json: 0.6.7
> filetype: 1.2.0
> google-genai: 1.70.0
> grpcio: 1.80.0
> grpcio-health-checking: 1.80.0
> grpcio-tools: 1.75.1
> httpx: 0.28.1
> httpx-sse: 0.4.3
> jsonpatch: 1.33
> jsonschema-rs: 0.29.1
> langgraph: 1.1.6
> langgraph-checkpoint: 4.0.1
> neo4j: 6.1.0
> neo4j-graphrag: 1.14.1
> numpy: 2.4.4
> ollama: 0.6.1
> openai: 2.30.0
> opentelemetry-api: 1.40.0
> opentelemetry-exporter-otlp-proto-http: 1.40.0
> opentelemetry-sdk: 1.40.0
> orjson: 3.11.8
> packaging: 26.0
> pgvector: 0.3.6
> protobuf: 6.33.6
> psycopg: 3.3.3
> psycopg-pool: 3.3.0
> pydantic: 2.12.5
> pydantic-settings: 2.13.1
> pyjwt: 2.12.1
> pytest: 9.0.2
> python-dotenv: 1.2.2
> pyyaml: 6.0.3
> PyYAML: 6.0.3
> requests: 2.33.1
> requests-toolbelt: 1.0.0
> SQLAlchemy: 2.0.49
> sqlalchemy: 2.0.49
> sse-starlette: 2.1.3
> starlette: 1.0.0
> structlog: 25.5.0
> tenacity: 9.1.4
> tiktoken: 0.12.0
> truststore: 0.10.4
> typing-extensions: 4.15.0
> uuid-utils: 0.14.1
> uvicorn: 0.43.0
> watchfiles: 1.1.1
> wcmatch: 10.1
> websockets: 16.0
> xxhash: 3.6.0
> zstandard: 0.25.0

@kheth, thank you for trying it out. Could you now please post the stack trace of the warning so I can see the exact place where it might be coming from?
Just copy and paste the stack trace from the CLI for this warning.

There is no stack trace. Only message!

@khteh Yes but when you get the warning on the CLI, it should be pointing towards the location, e.g:

/Users/mohtashim/caire-backend/.venv/lib/python3.13/site-packages/pydantic/fields.py:1093: PydanticDeprecatedSince20: Using extra keyword arguments on `Field` is deprecated and will be removed. Use `json_schema_extra` instead. (Extra keys: 'example'). Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.11/migration/

If you can post that, then it will be helpful for me.

Isn’t it in the subject title of this topic?

Oh Yes, I missed that thanks for pointing it out.
Since the warning is originating from langsmith package itself, can you try updating the package to latest version

I do NOT have this direct dependency in my pyproject.toml

Can you try adding it and then update it to latest version.

Why is that necessary? This is curing the symtom but the the root cause.

Langsmith latest version langsmith/_internal/_serde.py:103, fallbacks to calling dict for some objects if serialisation fails.
I want to make sure both Pydantic and all Langchain-related packages are on the latest version, so we are not falling back to deprecated methods for any pydantic objects that goes through langsmith.

If this still gives warning, then most likely one of the object that that langsmith tries to serialise fails and falls back to dict, for example:


import numpy as np
from pydantic import BaseModel
class EmbeddingOutput(BaseModel):
    model_config = {"arbitrary_types_allowed": True}
    text: str
    vector: np.ndarray  # Pydantic V2 has no built-in JSON serializer for this
output = EmbeddingOutput(text="hello", vector=np.array([0.1, 0.2, 0.3]))
# LangSmith tries:
output.model_dump(exclude_none=True, mode="json")
# ↑ Raises PydanticSerializationError:
#   "Unable to serialize unknown type: <class 'numpy.ndarray'>"
# Falls through to:
output.dict()
# → {"text": "hello", "vector": array([0.1, 0.2, 0.3])}
# orjson then handles np.ndarray via OPT_SERIALIZE_NUMPY

And to identify which object the culprit is, that fails to serialise with model_dump, further investigation will be required, and for that, if you can share your langsmith trace for this run as well, it will be helpful.

1 Like

Thank you for opening the issue. Hopefully the fix will be patched soon.