litellm
litellm copied to clipboard
Fix warnings from pydantic
Attempt to fix pydantic warnings.
before:
poetry run pytest . | grep warning
Configuration file exists at /Users/lj/Library/Preferences/pypoetry, reusing this directory.
Consider moving TOML configuration files to /Users/lj/Library/Application Support/pypoetry, as support for the legacy directory will be removed in an upcoming release.
=============================== warnings summary ===============================
../../../../Library/Caches/pypoetry/virtualenvs/litellm-vO9t8ogX-py3.11/lib/python3.11/site-packages/pydantic/_internal/_config.py:284: 25 warnings
warnings.warn(DEPRECATION_MESSAGE, DeprecationWarning)
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
======================== 39 warnings, 4 errors in 2.37s ========================
after:
poetry run pytest . | grep warning
Configuration file exists at /Users/lj/Library/Preferences/pypoetry, reusing this directory.
Consider moving TOML configuration files to /Users/lj/Library/Application Support/pypoetry, as support for the legacy directory will be removed in an upcoming release.
=============================== warnings summary ===============================
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
========================= 1 warning, 4 errors in 2.04s =========================
running same test as #3600:
poetry run pytest litellm/tests/test_proxy_server.py
Configuration file exists at /Users/lj/Library/Preferences/pypoetry, reusing this directory.
Consider moving TOML configuration files to /Users/lj/Library/Application Support/pypoetry, as support for the legacy directory will be removed in an upcoming release.
================================================================== test session starts ==================================================================
platform darwin -- Python 3.11.3, pytest-7.4.4, pluggy-1.5.0
rootdir: /Users/lj/Documents/litellm
plugins: anyio-4.3.0, asyncio-0.23.6, mock-3.14.0
asyncio: mode=Mode.STRICT
collected 12 items
litellm/tests/test_proxy_server.py s..........s [100%]
=================================================================== warnings summary ====================================================================
litellm/utils.py:59
/Users/lj/Documents/litellm/litellm/utils.py:59: DeprecationWarning: open_text is deprecated. Use files() instead. Refer to https://importlib-resources.readthedocs.io/en/latest/using.html#migrating-from-legacy for migration advice.
with resources.open_text("litellm.llms.tokenizers", "anthropic_tokenizer.json") as f:
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
======================================================= 10 passed, 2 skipped, 1 warning in 7.84s ========================================================
Not fixing the import lib warning as it is not explicitly related to pydantic.
Regarding pydantic v1 compatibility https://github.com/BerriAI/litellm/pull/3600#discussion_r1598686881
Openai (1.25.1) is using pydantic v2 https://github.com/openai/openai-python/blob/aed1e43745cd6358b4bafd3a39b3dfeee5e31a03/requirements.lock#L40
Relevant issues
Fixes #3417 #3600 #3664
Type
๐ Bug Fix ๐งน Refactoring
The latest updates on your projects. Learn more about Vercel for Git โ๏ธ
| Name | Status | Preview | Comments | Updated (UTC) |
|---|---|---|---|---|
| litellm | โ Ready (Inspect) | Visit Preview | ๐ฌ Add feedback | May 31, 2024 3:39am |
Thanks for this @lj-wego,
Can you confirm it passes on the list of tests the previous PR attempting to address this failed on - https://github.com/BerriAI/litellm/pull/3664
- tests/test_ratelimit.py
- test_organizations.py/test_organization_new
- Failed linting on types/completion.py, types/router.py, types.embedding.py
- tests/test_ratelimit.py
test_organizations.py/test_organization_new
took awhile to figure out what needed to be ran but managed to set up a local docker postgres, prisma migrate and ran the server, and then the test.
results
Failed linting on types/completion.py, types/router.py, types.embedding.py
i believe this fixes this https://github.com/BerriAI/litellm/pull/3670#discussion_r1604283980
@krrishdholakia can confirm it works on my machine.
Thanks! This is really cogging our CI logs. :(
Merged new changes and updated one pesky class Config that was introduced.
Hands tied here for the CI since: a. i don't have most of the services API keys to properly run the full test/lint suite b. i don't use circle ci so can't reproduce the testing workflow.
Merging in - i'll let you know if there's any issues on ci/cd @lj-wego
Thank you again for your help here!
@krrishdholakia i notice the CI failing and this might be the issue.
installs older pydantic
https://github.com/BerriAI/litellm/blob/deb87f71e330dcaf56574a477d9457d589754cd3/.circleci/requirements.txt#L10
Added a PR here to address this. Unless this is reverted ๐