fix: metrics test
This commit is contained in:
parent
df05d26577
commit
78f72c7f1d
1 changed files with 28 additions and 6 deletions
|
|
@ -1,9 +1,5 @@
|
||||||
from cognee.tests.unit.interfaces.graph.get_graph_from_model_test import (
|
from typing import List
|
||||||
Document,
|
from cognee.infrastructure.engine import DataPoint
|
||||||
DocumentChunk,
|
|
||||||
Entity,
|
|
||||||
EntityType,
|
|
||||||
)
|
|
||||||
from cognee.tasks.storage.add_data_points import add_data_points
|
from cognee.tasks.storage.add_data_points import add_data_points
|
||||||
from cognee.infrastructure.databases.graph.get_graph_engine import create_graph_engine
|
from cognee.infrastructure.databases.graph.get_graph_engine import create_graph_engine
|
||||||
import cognee
|
import cognee
|
||||||
|
|
@ -12,6 +8,32 @@ import json
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
|
||||||
|
class Document(DataPoint):
|
||||||
|
path: str
|
||||||
|
metadata: dict = {"index_fields": []}
|
||||||
|
|
||||||
|
|
||||||
|
class DocumentChunk(DataPoint):
|
||||||
|
part_of: Document
|
||||||
|
text: str
|
||||||
|
contains: List["Entity"] = None
|
||||||
|
metadata: dict = {"index_fields": ["text"]}
|
||||||
|
|
||||||
|
|
||||||
|
class EntityType(DataPoint):
|
||||||
|
name: str
|
||||||
|
metadata: dict = {"index_fields": ["name"]}
|
||||||
|
|
||||||
|
|
||||||
|
class Entity(DataPoint):
|
||||||
|
name: str
|
||||||
|
is_type: EntityType
|
||||||
|
metadata: dict = {"index_fields": ["name"]}
|
||||||
|
|
||||||
|
|
||||||
|
DocumentChunk.model_rebuild()
|
||||||
|
|
||||||
|
|
||||||
async def create_disconnected_test_graph():
|
async def create_disconnected_test_graph():
|
||||||
doc = Document(path="test/path")
|
doc = Document(path="test/path")
|
||||||
doc_chunk = DocumentChunk(part_of=doc, text="This is a chunk of text", contains=[])
|
doc_chunk = DocumentChunk(part_of=doc, text="This is a chunk of text", contains=[])
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue