litellm
litellm copied to clipboard
Clean up / Fix test warnings resulting from pydantic V2 migration
Created a PR to clean up warnings appearing during a pytest run:
========================================================================= warnings summary ==========================================================================
../../../../Library/Caches/pypoetry/virtualenvs/litellm-vO9t8ogX-py3.11/lib/python3.11/site-packages/pydantic/_internal/_config.py:272: 23 warnings
/Users/lj/Library/Caches/pypoetry/virtualenvs/litellm-vO9t8ogX-py3.11/lib/python3.11/site-packages/pydantic/_internal/_config.py:272: PydanticDeprecatedSince20: Support for class-based `config` is deprecated, use ConfigDict instead. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.6/migration/
warnings.warn(DEPRECATION_MESSAGE, DeprecationWarning)
../proxy/_types.py:219
/Users/lj/Documents/litellm/litellm/proxy/_types.py:219: PydanticDeprecatedSince20: Pydantic V1 style `@root_validator` validators are deprecated. You should migrate to Pydantic V2 style `@model_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.6/migration/
@root_validator(pre=True)
../proxy/_types.py:306
/Users/lj/Documents/litellm/litellm/proxy/_types.py:306: PydanticDeprecatedSince20: `pydantic.config.Extra` is deprecated, use literal values instead (e.g. `extra='allow'`). Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.6/migration/
extra = Extra.allow # Allow extra fields
../proxy/_types.py:309
/Users/lj/Documents/litellm/litellm/proxy/_types.py:309: PydanticDeprecatedSince20: Pydantic V1 style `@root_validator` validators are deprecated. You should migrate to Pydantic V2 style `@model_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.6/migration/
@root_validator(pre=True)
../proxy/_types.py:338
/Users/lj/Documents/litellm/litellm/proxy/_types.py:338: PydanticDeprecatedSince20: Pydantic V1 style `@root_validator` validators are deprecated. You should migrate to Pydantic V2 style `@model_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.6/migration/
@root_validator(pre=True)
../proxy/_types.py:385
/Users/lj/Documents/litellm/litellm/proxy/_types.py:385: PydanticDeprecatedSince20: Pydantic V1 style `@root_validator` validators are deprecated. You should migrate to Pydantic V2 style `@model_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.6/migration/
@root_validator(pre=True)
../proxy/_types.py:454
/Users/lj/Documents/litellm/litellm/proxy/_types.py:454: PydanticDeprecatedSince20: Pydantic V1 style `@root_validator` validators are deprecated. You should migrate to Pydantic V2 style `@model_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.6/migration/
@root_validator(pre=True)
../proxy/_types.py:466
/Users/lj/Documents/litellm/litellm/proxy/_types.py:466: PydanticDeprecatedSince20: Pydantic V1 style `@root_validator` validators are deprecated. You should migrate to Pydantic V2 style `@model_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.6/migration/
@root_validator(pre=True)
../proxy/_types.py:509
/Users/lj/Documents/litellm/litellm/proxy/_types.py:509: PydanticDeprecatedSince20: Pydantic V1 style `@root_validator` validators are deprecated. You should migrate to Pydantic V2 style `@model_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.6/migration/
@root_validator(pre=True)
../proxy/_types.py:546
/Users/lj/Documents/litellm/litellm/proxy/_types.py:546: PydanticDeprecatedSince20: Pydantic V1 style `@root_validator` validators are deprecated. You should migrate to Pydantic V2 style `@model_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.6/migration/
@root_validator(pre=True)
../proxy/_types.py:840
/Users/lj/Documents/litellm/litellm/proxy/_types.py:840: PydanticDeprecatedSince20: Pydantic V1 style `@root_validator` validators are deprecated. You should migrate to Pydantic V2 style `@model_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.6/migration/
@root_validator(pre=True)
../proxy/_types.py:867
/Users/lj/Documents/litellm/litellm/proxy/_types.py:867: PydanticDeprecatedSince20: Pydantic V1 style `@root_validator` validators are deprecated. You should migrate to Pydantic V2 style `@model_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.6/migration/
@root_validator(pre=True)
../proxy/_types.py:886
/Users/lj/Documents/litellm/litellm/proxy/_types.py:886: PydanticDeprecatedSince20: Pydantic V1 style `@root_validator` validators are deprecated. You should migrate to Pydantic V2 style `@model_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.6/migration/
@root_validator(pre=True)
../utils.py:39
/Users/lj/Documents/litellm/litellm/utils.py:39: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
import pkg_resources
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
====================================================================== short test summary info ======================================================================
ERROR test_azure_perf.py - openai.OpenAIError: Missing credentials. Please pass one of `api_key`, `azure_ad_token`, `azure_ad_token_provider`, or the `AZURE_OPENAI_API_KEY` or `AZURE_OPEN...
ERROR test_config.py - ValueError: api_base is required for Azure OpenAI. Set it on your config. Model - {'model_name': 'gpt-3.5-turbo', 'litellm_params': {'model': 'azure/chatgpt-v-2...
ERROR test_model_alias_map.py - Failed: Error occurred: AnyscaleException - Traceback (most recent call last):
ERROR test_multiple_deployments.py - Failed: An exception occurred: 'NoneType' object has no attribute '_response_ms'
ERROR test_register_model.py - Failed: An error occurred: OpenAIException - Traceback (most recent call last):
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 5 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
================================================================== 36 warnings, 5 errors in 2.68s ===================================================================
Can't confirm if anything broke as I do not have all the credentials to run the test suite properly.
this PR broke pydantic v1 support
worker-1 | File "/app/botbrains/core/llms.py", line 4, in <module>
worker-1 | import litellm
worker-1 | File "/usr/local/lib/python3.10/site-packages/ddtrace/internal/module.py", line 220, in _exec_module
worker-1 | self.loader.exec_module(module)
worker-1 | File "/usr/local/lib/python3.10/site-packages/litellm/__init__.py", line 17, in <module>
worker-1 | from litellm.proxy._types import (
worker-1 | File "/usr/local/lib/python3.10/site-packages/ddtrace/internal/module.py", line 220, in _exec_module
worker-1 | self.loader.exec_module(module)
worker-1 | File "/usr/local/lib/python3.10/site-packages/litellm/proxy/_types.py", line 1, in <module>
worker-1 | from pydantic import BaseModel, Extra, Field, model_validator, Json, ConfigDict
worker-1 | ImportError: cannot import name 'model_validator' from 'pydantic' (/usr/local/lib/python3.10/site-packages/pydantic/__init__.cpyt
Noting the PR updated the proxy requirements.txt not the pyproject.toml
fixing now
Here - https://github.com/BerriAI/litellm/pull/4151 @liamvdv
sorry for the issue caused. We were seeing a lot of errors trying to maintain compatibility across versions. Hope the bump resolves the issue on your end.
If not, let me know how we can help here