Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix: create community adapter if exists
  • Loading branch information
borisarzentar committed May 30, 2025
commit 211b8fc40fcc5da2f898044cccf18f306965515f
11 changes: 11 additions & 0 deletions cognee/infrastructure/databases/graph/get_graph_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

from functools import lru_cache


from .config import get_graph_config
from .graph_db_interface import GraphDBInterface
from .supported_databases import supported_databases


async def get_graph_engine() -> GraphDBInterface:
Expand Down Expand Up @@ -74,6 +76,15 @@ def create_graph_engine(
specified.
"""

if graph_database_provider in supported_databases:
adapter = supported_databases[graph_database_provider]

return adapter(
graph_database_url=graph_database_url,
graph_database_username=graph_database_username,
graph_database_password=graph_database_password,
)

if graph_database_provider == "neo4j":
if not (graph_database_url and graph_database_username and graph_database_password):
raise EnvironmentError("Missing required Neo4j credentials.")
Expand Down
10 changes: 10 additions & 0 deletions cognee/infrastructure/databases/vector/create_vector_engine.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from .supported_databases import supported_databases
from .embeddings import get_embedding_engine

from functools import lru_cache
Expand Down Expand Up @@ -38,6 +39,15 @@ def create_vector_engine(
"""
embedding_engine = get_embedding_engine()

if vector_db_provider in supported_databases:
adapter = supported_databases[vector_db_provider]

return adapter(
utl=vector_db_url,
api_key=vector_db_key,
embedding_engine=embedding_engine,
)

if vector_db_provider == "weaviate":
from .weaviate_db import WeaviateAdapter

Expand Down
Loading