mitigate PydanticDeprecatedSince20 warnings (#17657)

When using litellm with a recent pydantic, the following deprecation warnings are shown

```
litellm/types/llms/anthropic.py:531: PydanticDeprecatedSince20: Support for class-based `config` is deprecated, use ConfigDict instead. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.12/migration/
  class AnthropicResponseContentBlockToolUse(BaseModel):
litellm/types/rag.py:181: PydanticDeprecatedSince20: Support for class-based `config` is deprecated, use ConfigDict instead. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.12/migration/
  class RAGIngestRequest(BaseModel):
```

This aligns with multiple existing places within the litellm codebase that uses ConfigDict to configure pydantic model behavior.
This commit is contained in:
Brian Caswell
2025-12-08 18:48:42 -08:00
committed by GitHub
parent e0a8f7435d
commit c9f88bf2c7
2 changed files with 4 additions and 6 deletions
+2 -3
View File
@@ -1,7 +1,7 @@
from enum import Enum
from typing import Any, Dict, Iterable, List, Optional, Union
from pydantic import BaseModel
from pydantic import BaseModel, ConfigDict
from typing_extensions import Literal, Required, TypedDict
from .openai import (
@@ -535,8 +535,7 @@ class AnthropicResponseContentBlockToolUse(BaseModel):
input: dict
provider_specific_fields: Optional[Dict[str, Any]] = None
class Config:
extra = "allow" # Allow provider_specific_fields
model_config = ConfigDict(extra="allow") # Allow provider_specific_fields
class AnthropicResponseContentBlockThinking(BaseModel):
+2 -3
View File
@@ -4,7 +4,7 @@ Type definitions for RAG (Retrieval Augmented Generation) Ingest API.
from typing import Any, Dict, List, Literal, Optional, Union
from pydantic import BaseModel
from pydantic import BaseModel, ConfigDict
from typing_extensions import TypedDict
@@ -185,6 +185,5 @@ class RAGIngestRequest(BaseModel):
file_id: Optional[str] = None # Existing file ID
ingest_options: Dict[str, Any] # RAGIngestOptions as dict for flexibility
class Config:
extra = "allow" # Allow additional fields
model_config = ConfigDict(extra="allow") # Allow additional fields