mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-11-03 00:07:47 +00:00
feat(core): Upgrade pydantic to 2.x (#1428)
This commit is contained in:
@@ -4,9 +4,9 @@ import math
|
||||
import time
|
||||
from abc import ABC, abstractmethod
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
from typing import Any, List, Optional
|
||||
from typing import Any, Dict, List, Optional
|
||||
|
||||
from dbgpt._private.pydantic import BaseModel, Field
|
||||
from dbgpt._private.pydantic import BaseModel, ConfigDict, Field, model_to_dict
|
||||
from dbgpt.core import Chunk, Embeddings
|
||||
from dbgpt.core.awel.flow import Parameter
|
||||
from dbgpt.storage.vector_store.filters import MetadataFilters
|
||||
@@ -87,10 +87,7 @@ _COMMON_PARAMETERS = [
|
||||
class VectorStoreConfig(BaseModel):
|
||||
"""Vector store config."""
|
||||
|
||||
class Config:
|
||||
"""Config for BaseModel."""
|
||||
|
||||
arbitrary_types_allowed = True
|
||||
model_config = ConfigDict(arbitrary_types_allowed=True)
|
||||
|
||||
name: str = Field(
|
||||
default="dbgpt_collection",
|
||||
@@ -122,6 +119,10 @@ class VectorStoreConfig(BaseModel):
|
||||
"bigger than 1, please make sure your vector store is thread-safe.",
|
||||
)
|
||||
|
||||
def to_dict(self, **kwargs) -> Dict[str, Any]:
|
||||
"""Convert to dict."""
|
||||
return model_to_dict(self, **kwargs)
|
||||
|
||||
|
||||
class VectorStoreBase(ABC):
|
||||
"""Vector store base class."""
|
||||
|
||||
Reference in New Issue
Block a user