litellm icon indicating copy to clipboard operation
litellm copied to clipboard

[Bug]: Multiple Pydantic warnings, field `model_{id|name|info}` has conflict with protected namespace `model_`

Open nicovank opened this issue 1 year ago • 2 comments
trafficstars

What happened?

Similar bug to #2337. Latest release only has one of those warnings, master has three. These lines are the culprits: https://github.com/BerriAI/litellm/blob/dd14b8cbaa7f9bbcff572901532a98a4d09aedbd/litellm/utils.py#L232 https://github.com/BerriAI/litellm/blob/dd14b8cbaa7f9bbcff572901532a98a4d09aedbd/litellm/router.py#L100 https://github.com/BerriAI/litellm/blob/dd14b8cbaa7f9bbcff572901532a98a4d09aedbd/litellm/router.py#L102

% docker run -it ubuntu
% apt update
% apt install -y git python3 python3-pip

# pip install git+https://github.com/BerriAI/litellm.git
% pip install litellm

% python3 -c "import litellm"

Maybe it can be ignored in the same way as the fix for #2337, see #2343.

Relevant log output

/usr/local/lib/python3.10/dist-packages/pydantic/_internal/_fields.py:151: UserWarning: Field "model_id" has conflict with protected namespace "model_".

You may be able to resolve this warning by setting `model_config['protected_namespaces'] = ()`.
  warnings.warn(
/usr/local/lib/python3.10/dist-packages/pydantic/_internal/_fields.py:151: UserWarning: Field "model_name" has conflict with protected namespace "model_".

You may be able to resolve this warning by setting `model_config['protected_namespaces'] = ()`.
  warnings.warn(
/usr/local/lib/python3.10/dist-packages/pydantic/_internal/_fields.py:151: UserWarning: Field "model_info" has conflict with protected namespace "model_".

You may be able to resolve this warning by setting `model_config['protected_namespaces'] = ()`.
  warnings.warn(

Twitter / LinkedIn details

No response

nicovank avatar Apr 04 '24 12:04 nicovank

i have exactly the same warnings when i generate litellm prisma schema in postgresql database.

benahmedadel avatar Apr 07 '24 05:04 benahmedadel

I have submitted a pull request that fixes this issue.

You can find the pull request here: https://github.com/BerriAI/litellm/pull/2893

To test the fix, you can install the package directly from the pull request using pip:

pip install git+https://github.com/unclecode/litellm.git@main

Please let me know if you encounter any issues or have any feedback. Once the pull request is merged, the fix will be available in the next release of the package.

unclecode avatar Apr 08 '24 05:04 unclecode