mirror of
https://github.com/tiennm99/litellm.git
synced 2026-08-21 08:26:34 +00:00
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:
@@ -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):
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user