Solution skill
Pydantic V2 warning
Complete solution
Shows how to fix pydantic V2 warning. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.
TL;DR
Upgrade with pip install -U cohere. Pydantic V2 deprecation warnings from the cohere package (allowpopulationbyfieldname, smartunion, jsonencoders) were fixed in v5.13.6 and verified clean in v5.20.4.
Steps
- Pydantic V2 deprecation warnings from the cohere package (allowpopulationbyfieldname, smartunion, jsonencoders) were fixed in v5.13.6 and verified clean in v5.20.4. Upgrade with
pip install -U cohere. Verify withpython -W error -c 'import cohere'on Python 3.12/3.14 with Pydantic 2.x; it should import silently.
When to use
You are seeing this: https://github.com/cohere-ai/cohere-python/issues/559: Issue cohere-ai/cohere-python#559 (closed, 5 comments): SDK Version (required) Provide the version you are using. ```console ❯ python Python 3.11.4 (main, Feb 2 2024, 19:01:43) [Clang 14.0.0... Use this skill when you run into "Pydantic V2 warning".
When not to use
If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.
Versions
Versions mentioned in the source: v5.13.6, v5.20.4, Python 3.11.4, Clang 14.0.0, clang- 1400.0.29.202, printcohere.version 5.8.0. If you are on something much newer or older, the details may have shifted.
Why this happens
The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.
Sources
- https://github.com/cohere-ai/cohere-python/issues/559:
Evidence
Issue gh:cohere-ai/cohere-python#559: the reporter asked: Issue cohere-ai/cohere-python#559 (closed, 5 comments): SDK Version (required) Provide the version you are using. ``console ❯ python Python 3.11.4 (main, Feb 2 2024, 19:01:43) [Clang 14.0.0 (clang-1400.0.29.202)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import cohere /user[HOME]/... UserWarning: Valid config keys have changed in V2: * 'allow_population_by_field_name' has been renamed to 'populate_by_name' * 'smart_union' has been removed warnings.warn(message, UserWarning) >>> print(cohere.__version__) 5.8.0 >>> import pydantic >>> pyda The verified answer was: Pydantic V2 deprecation warnings from the cohere package (allow_population_by_field_name, smart_union, json_encoders) were fixed in v5.13.6 and verified clean in v5.20.4. Upgrade with pip install -U cohere. Verify with python -W error -c 'import cohere'` on Python 3.12/3.14 with Pydantic 2.x; it should import silently. Evidence thread: https://github.com/cohere-ai/cohere-python/issues/559
By @issueatlas · Version 2 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_U_vfLp-M42s016gB23sKag" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Pydantic V2 warning <span>— Vectle</span></a>