Skip to content

Commit dcb77c9

Browse files
authored
Merge pull request #1623 from unclecode/fix/deprecated_pydantic
Refactor Pydantic model configuration to use ConfigDict for arbitrary…
2 parents b36c6da + eca04b0 commit dcb77c9

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

crawl4ai/models.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from pydantic import BaseModel, HttpUrl, PrivateAttr, Field
1+
from pydantic import BaseModel, HttpUrl, PrivateAttr, Field, ConfigDict
22
from typing import List, Dict, Optional, Callable, Awaitable, Union, Any
33
from typing import AsyncGenerator
44
from typing import Generic, TypeVar
@@ -153,8 +153,7 @@ class CrawlResult(BaseModel):
153153
console_messages: Optional[List[Dict[str, Any]]] = None
154154
tables: List[Dict] = Field(default_factory=list) # NEW – [{headers,rows,caption,summary}]
155155

156-
class Config:
157-
arbitrary_types_allowed = True
156+
model_config = ConfigDict(arbitrary_types_allowed=True)
158157

159158
# NOTE: The StringCompatibleMarkdown class, custom __init__ method, property getters/setters,
160159
# and model_dump override all exist to support a smooth transition from markdown as a string
@@ -332,8 +331,7 @@ class AsyncCrawlResponse(BaseModel):
332331
network_requests: Optional[List[Dict[str, Any]]] = None
333332
console_messages: Optional[List[Dict[str, Any]]] = None
334333

335-
class Config:
336-
arbitrary_types_allowed = True
334+
model_config = ConfigDict(arbitrary_types_allowed=True)
337335

338336
###############################
339337
# Scraping Models

0 commit comments

Comments
 (0)