from llama_index.schema import Document from datetime import datetime from pydantic import BaseModel, Field from typing import Optional import uuid class DocumentObject(BaseModel): id: str = Field(default_factory=lambda: str(uuid.uuid4()), alias="_id") knowledgeBaseId: str = Field(...) document : Document createdAt: Optional[datetime] = None updatedAt: Optional[datetime] = None deletedAt: Optional[datetime] = None
162 # `__tracebackhide__` tells pytest and some other tools to omit this function from tracebacks 163 __tracebackhide__ = True --> 164 __pydantic_self__.__pydantic_validator__.validate_python(data, self_instance=__pydantic_self__) TypeError: BaseModel.validate() takes 2 positional arguments but 3 were given
doc = Document(text="This is a test document") document = DocumentObject( knowledgeBaseId="123", document=doc)
from pydantic.v1 import BaseModel, Field