litellm icon indicating copy to clipboard operation
litellm copied to clipboard

[Bug]: Valid config keys have changed in V2

Open juliuslipp opened this issue 11 months ago • 15 comments

What happened?

An annoying pydantic warning triggered by: https://github.com/BerriAI/litellm/blob/f1540ceeab9a8ca1335a49b84be95e27ea7b89de/litellm/types/integrations/prometheus.py#L224

Would be amazing if you could fix this.

Relevant log output

/pydantic/_internal/_config.py:345: UserWarning: Valid config keys have changed in V2:
* 'fields' has been removed
  warnings.warn(message, UserWarning)

Are you a ML Ops Team?

No

What LiteLLM version are you on ?

latest

Twitter / LinkedIn details

No response

juliuslipp avatar Jan 05 '25 02:01 juliuslipp

I suspect this is caused by the changes introduced in v1.56.2 with https://github.com/BerriAI/litellm/pull/7421, where you can see the following in litellm/types/integrations/prometheus.py:

class UserAPIKeyLabelValues(BaseModel):
    end_user: Optional[str] = None
    user: Optional[str] = None
    hashed_api_key: Optional[str] = None
    api_key_alias: Optional[str] = None
    team: Optional[str] = None
    team_alias: Optional[str] = None
    requested_model: Optional[str] = None
    model: Optional[str] = None
    litellm_model_name: Optional[str] = None
    tags: List[str] = []
    model_id: Optional[str] = None
    api_base: Optional[str] = None
    api_provider: Optional[str] = None
    exception_status: Optional[str] = None
    exception_class: Optional[str] = None
    status_code: Optional[str] = None

    class Config:
        fields = {
            "end_user": {"alias": UserAPIKeyLabelNames.END_USER},
            "user": {"alias": UserAPIKeyLabelNames.USER},
            "hashed_api_key": {"alias": UserAPIKeyLabelNames.API_KEY_HASH},
            "api_key_alias": {"alias": UserAPIKeyLabelNames.API_KEY_ALIAS},
            "team": {"alias": UserAPIKeyLabelNames.TEAM},
            "team_alias": {"alias": UserAPIKeyLabelNames.TEAM_ALIAS},
            "requested_model": {"alias": UserAPIKeyLabelNames.REQUESTED_MODEL},
            "model": {"alias": UserAPIKeyLabelNames.v1_LITELLM_MODEL_NAME},
            "litellm_model_name": {"alias": UserAPIKeyLabelNames.v2_LITELLM_MODEL_NAME},
            "model_id": {"alias": UserAPIKeyLabelNames.MODEL_ID},
            "api_base": {"alias": UserAPIKeyLabelNames.API_BASE},
            "api_provider": {"alias": UserAPIKeyLabelNames.API_PROVIDER},
            "exception_status": {"alias": UserAPIKeyLabelNames.EXCEPTION_STATUS},
            "exception_class": {"alias": UserAPIKeyLabelNames.EXCEPTION_CLASS},
            "status_code": {"alias": UserAPIKeyLabelNames.STATUS_CODE},
        }

lsorber avatar Jan 05 '25 20:01 lsorber

same issue. reverted back to 1.55.12 as a workaround.

gouzhuang avatar Jan 06 '25 08:01 gouzhuang

Same issue.

nbrosse avatar Jan 07 '25 13:01 nbrosse

Yup

ryanpeach avatar Jan 08 '25 17:01 ryanpeach

getting this same issue working with Raglite

cauchymike avatar Jan 11 '25 16:01 cauchymike

It is extremely annoying to get that warning on each run, is there a simple way to somehow disable this specific single warning?

johann-petrak avatar Jan 12 '25 12:01 johann-petrak

Temporary workaround, not a good idea, but works for now

import warnings

# TODO: Remove after https://github.com/BerriAI/litellm/issues/7560 is fixed
warnings.filterwarnings("ignore", category=UserWarning, module="pydantic._internal._config")

Strajk avatar Jan 21 '25 13:01 Strajk

My datapoint: I've integrated litellm in Hugging Face smolagents, it creates a very cumbersome warning in my lib. Please fix it!

aymeric-roucher avatar Jan 21 '25 16:01 aymeric-roucher

same issue

wm-ek avatar Jan 23 '25 16:01 wm-ek

I'm experiencing the issue too.

qymab avatar Jan 25 '25 08:01 qymab

same here

yigitkonur avatar Jan 29 '25 02:01 yigitkonur

Submitted a fix here https://github.com/BerriAI/litellm/pull/8088

chrisgoddard avatar Jan 29 '25 17:01 chrisgoddard

Thank you everyone the work on this. Running @chrisgoddard's PR through ci/cd - will work on making sure it's on main by EOD

@SmartManoj your test for catching these issues was quite good. I'll try and add that in as well

krrishdholakia avatar Jan 30 '25 02:01 krrishdholakia

I think this issue should be closed as fixed by:

  • #8096

albertvillanova avatar Mar 14 '25 08:03 albertvillanova

It is in fact fixed

guvkay20 avatar Mar 14 '25 16:03 guvkay20

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

github-actions[bot] avatar Jun 13 '25 00:06 github-actions[bot]