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

[Bug]: Valid config keys have changed in V2 #7560

Open
juliuslipp opened this issue Jan 5, 2025 · 3 comments · May be fixed by #7583
Open

[Bug]: Valid config keys have changed in V2 #7560

juliuslipp opened this issue Jan 5, 2025 · 3 comments · May be fixed by #7583
Labels
bug Something isn't working

Comments

@juliuslipp
Copy link

juliuslipp commented Jan 5, 2025

What happened?

An annoying pydantic warning triggered by:

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

@lsorber
Copy link

lsorber commented Jan 5, 2025

I suspect this is caused by the changes introduced in v1.56.2 with #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},
        }

@gouzhuang
Copy link

gouzhuang commented Jan 6, 2025

same issue. reverted back to 1.55.12 as a workaround.

SmartManoj added a commit to SmartManoj/litellm that referenced this issue Jan 6, 2025
Fixes BerriAI#7560

Remove the `Config` class from the `UserAPIKeyLabelValues` class in `litellm/types/integrations/prometheus.py`.

* Remove the `fields` key in the `Config` class which was causing the pydantic warning.
* Ensure the `UserAPIKeyLabelValues` class no longer uses the `Config` class.
* Fix the pydantic warning related to the 'fields' config key removed in V2.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/BerriAI/litellm/issues/7560?shareId=XXXX-XXXX-XXXX-XXXX).
@SmartManoj SmartManoj linked a pull request Jan 6, 2025 that will close this issue
@nbrosse
Copy link

nbrosse commented Jan 7, 2025

Same issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants