Warning fix for Pydantic 2.0 (#5679) (#5707)

* Fixed UserWarning: Valid config keys have changed in V2 underscore_attrs_are_private

* Trying different method

Co-authored-by: CyanideByte <cyanidebyte@hotmail.com>
This commit is contained in:
Ishaan Jaff 2024-09-16 11:24:12 -07:00 committed by GitHub
parent aa64c34ce6
commit 3a5039e284
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -6,7 +6,7 @@ https://docs.cohere.com/reference/rerank
from typing import List, Optional, Union
from pydantic import BaseModel
from pydantic import BaseModel, PrivateAttr
class RerankRequest(BaseModel):
@ -23,7 +23,9 @@ class RerankResponse(BaseModel):
id: str
results: List[dict] # Contains index and relevance_score
meta: dict # Contains api_version and billed_units
_hidden_params: dict = {}
# Define private attributes using PrivateAttr
_hidden_params: dict = PrivateAttr(default_factory=dict)
def __getitem__(self, key):
return self.__dict__[key]