refactor: As neo4j can't support dictionaries, add foreign metadata as string

This commit is contained in:
Igor Ilic 2025-01-20 17:28:14 +01:00
parent 49ad292592
commit ab8d95cc30
2 changed files with 3 additions and 0 deletions

View file

@ -7,6 +7,7 @@ from cognee.infrastructure.engine import DataPoint
class Document(DataPoint):
name: str
raw_data_location: str
foreign_metadata: Optional[str]
mime_type: str
_metadata: dict = {"index_fields": ["name"], "type": "Document"}

View file

@ -1,4 +1,5 @@
from cognee.modules.data.models import Data
import json
from cognee.modules.data.processing.document_types import (
Document,
PdfDocument,
@ -57,6 +58,7 @@ async def classify_documents(data_documents: list[Data]) -> list[Document]:
raw_data_location=data_item.raw_data_location,
name=data_item.name,
mime_type=data_item.mime_type,
foreign_metadata=json.dumps(data_item.foreign_metadata, indent=4),
)
documents.append(document)