-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
64f54a3
commit 82ac9fc
Showing
2 changed files
with
22 additions
and
11 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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("'", "") |