mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-06 02:48:13 +00:00
ci: test linting change for pydantic v1
This commit is contained in:
parent
e1d65366b8
commit
4f3c7752f9
1 changed files with 12 additions and 2 deletions
|
|
@ -1,10 +1,15 @@
|
|||
from typing import List, Optional, Union, Iterable
|
||||
|
||||
from pydantic import ConfigDict, BaseModel, validator
|
||||
from pydantic import ConfigDict, BaseModel, validator, VERSION
|
||||
|
||||
from typing_extensions import Literal, Required, TypedDict
|
||||
|
||||
|
||||
# Function to get Pydantic version
|
||||
def is_pydantic_v2() -> int:
|
||||
return int(VERSION.split(".")[0])
|
||||
|
||||
|
||||
class ChatCompletionSystemMessageParam(TypedDict, total=False):
|
||||
content: Required[str]
|
||||
"""The contents of the system message."""
|
||||
|
|
@ -190,4 +195,9 @@ class CompletionRequest(BaseModel):
|
|||
api_version: Optional[str] = None
|
||||
api_key: Optional[str] = None
|
||||
model_list: Optional[List[str]] = None
|
||||
model_config = ConfigDict(extra="allow", protected_namespaces=())
|
||||
|
||||
# Version-specific configuration
|
||||
if is_pydantic_v2() >= 2:
|
||||
model_config = ConfigDict(extra="allow", protected_namespaces=())
|
||||
else:
|
||||
model_config = ConfigDict(extra="allow") # No protected_namespaces for v1
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue