Skip to content

Commit

Permalink
Fix to the task
Browse files Browse the repository at this point in the history
  • Loading branch information
Vasilije1990 committed Aug 6, 2024
1 parent 64f54a3 commit 82ac9fc
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
11 changes: 0 additions & 11 deletions cognee/api/v1/tasks/graph_ontology/graph_ontology.py

This file was deleted.

22 changes: 22 additions & 0 deletions cognee/tasks/graph_ontology/graph_ontology.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from typing import Type
from pydantic import BaseModel

from cognee.modules.data.processing.chunk_types.DocumentChunk import DocumentChunk
from cognee.shared.data_models import KnowledgeGraph
from cognee.infrastructure.databases.graph import get_graph_engine
from cognee.modules.data.extraction.knowledge_graph.add_model_class_to_graph import add_model_class_to_graph


async def establish_graph_topology(data_chunks: list[DocumentChunk], topology_model: Type[BaseModel]):
if topology_model == KnowledgeGraph:
return data_chunks

graph_engine = await get_graph_engine()

await add_model_class_to_graph(topology_model, graph_engine)

return data_chunks


def generate_node_id(node_id: str) -> str:
return node_id.upper().replace(" ", "_").replace("'", "")

0 comments on commit 82ac9fc

Please sign in to comment.