Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

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

Ishaan Jaff3a5039e284ad
diff --git a/litellm/rerank_api/types.py b/litellm/rerank_api/types.py
index dae79f87533..b4765c0e6a4 100644
--- a/litellm/rerank_api/types.py
+++ b/litellm/rerank_api/types.py
@@ -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]