refactor: As neo4j can't support dictionaries, add foreign metadata as string
This commit is contained in:
parent
49ad292592
commit
ab8d95cc30
2 changed files with 3 additions and 0 deletions
|
|
@ -7,6 +7,7 @@ from cognee.infrastructure.engine import DataPoint
|
||||||
class Document(DataPoint):
|
class Document(DataPoint):
|
||||||
name: str
|
name: str
|
||||||
raw_data_location: str
|
raw_data_location: str
|
||||||
|
foreign_metadata: Optional[str]
|
||||||
mime_type: str
|
mime_type: str
|
||||||
_metadata: dict = {"index_fields": ["name"], "type": "Document"}
|
_metadata: dict = {"index_fields": ["name"], "type": "Document"}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
from cognee.modules.data.models import Data
|
from cognee.modules.data.models import Data
|
||||||
|
import json
|
||||||
from cognee.modules.data.processing.document_types import (
|
from cognee.modules.data.processing.document_types import (
|
||||||
Document,
|
Document,
|
||||||
PdfDocument,
|
PdfDocument,
|
||||||
|
|
@ -57,6 +58,7 @@ async def classify_documents(data_documents: list[Data]) -> list[Document]:
|
||||||
raw_data_location=data_item.raw_data_location,
|
raw_data_location=data_item.raw_data_location,
|
||||||
name=data_item.name,
|
name=data_item.name,
|
||||||
mime_type=data_item.mime_type,
|
mime_type=data_item.mime_type,
|
||||||
|
foreign_metadata=json.dumps(data_item.foreign_metadata, indent=4),
|
||||||
)
|
)
|
||||||
documents.append(document)
|
documents.append(document)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue