Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

protected_namespaces warning fixed for model_name & model_info #3334

Merged
merged 4 commits into from
Apr 29, 2024

Conversation

CyanideByte
Copy link
Contributor

@CyanideByte CyanideByte commented Apr 27, 2024

This is a followup to #2893
In litellm 1.35.25 a few more instances of this warning appeared.

UserWarning: Field "model_name" has conflict with protected namespace "model_".
UserWarning: Field "model_config" has conflict with protected namespace "model_".
You may be able to resolve this warning by setting `model_config['protected_namespaces'] = ()`. warnings.warn(

I've resolved this warning by adding the changes to the new classes in the same manner as the previous PR.
Also added a pytest to detect this issue in the future.
EDIT: Merged _types.py from @edwinjosegeorge PR#3340 - Nice finds!

Copy link

vercel bot commented Apr 27, 2024

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 Apr 28, 2024 3:52am

Copy link
Contributor

@ishaan-jaff ishaan-jaff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing PR - @CyanideByte can you add some testing to ensure this warning never appears again ?

@CyanideByte
Copy link
Contributor Author

CyanideByte commented Apr 27, 2024

Amazing PR - @CyanideByte can you add some testing to ensure this warning never appears again ?

Thanks, I added a pytest to check if the warning happens when importing litellm.
Verified that it fails on the newest github version, but passes with my fork.

@edwinjosegeorge
Copy link
Contributor

Have a look at #3340 that covers couple more files with possible similar warnings

@CyanideByte
Copy link
Contributor Author

Have a look at #3340 that covers couple more files with possible similar warnings

Nice find, I merged the _types.py cases from your PR. It looks like we both had the ones from the other 2 files.

@zheyi911
Copy link

I encountered this error

E:\python3.11\Lib\site-packages\pydantic_internal_fields.py:160: 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(
E:\python3.11\Lib\site-packages\pydantic_internal_fields.py:160: 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(

@edwinjosegeorge
Copy link
Contributor

@zheyi911 This PR is not yet merged into the main branch. Could to check if you get the same results from https://github.com/CyanideByte/litellm/tree/main ? I think this PR is ready to merge

@ishaan-jaff

@krrishdholakia
Copy link
Contributor

Thanks @edwinjosegeorge @CyanideByte

LGTM!

@krrishdholakia krrishdholakia merged commit ffc6af0 into BerriAI:main Apr 29, 2024
1 check passed
@jtha
Copy link

jtha commented May 1, 2024

Seems like this should fix the issue I've been seeing. Is this fix also reflected in the latest docker image for the proxy server? Currently using ghcr.io/berriai/litellm:main-latest and I still see this warning message resulting in container continuously restarting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants