fix: Resolve issue with parameter caching for engine creation
This commit is contained in:
parent
2c29868f9a
commit
e24707c8da
2 changed files with 52 additions and 2 deletions
|
|
@ -24,7 +24,6 @@ async def get_graph_engine() -> GraphDBInterface:
|
||||||
return graph_client
|
return graph_client
|
||||||
|
|
||||||
|
|
||||||
@lru_cache
|
|
||||||
def create_graph_engine(
|
def create_graph_engine(
|
||||||
graph_database_provider,
|
graph_database_provider,
|
||||||
graph_file_path,
|
graph_file_path,
|
||||||
|
|
@ -35,6 +34,35 @@ def create_graph_engine(
|
||||||
graph_database_port="",
|
graph_database_port="",
|
||||||
graph_database_key="",
|
graph_database_key="",
|
||||||
graph_dataset_database_handler="",
|
graph_dataset_database_handler="",
|
||||||
|
):
|
||||||
|
"""
|
||||||
|
Wrapper function to call create graph engine with caching.
|
||||||
|
For a detailed description, see _create_graph_engine.
|
||||||
|
"""
|
||||||
|
return _create_graph_engine(
|
||||||
|
graph_database_provider,
|
||||||
|
graph_file_path,
|
||||||
|
graph_database_url,
|
||||||
|
graph_database_name,
|
||||||
|
graph_database_username,
|
||||||
|
graph_database_password,
|
||||||
|
graph_database_port,
|
||||||
|
graph_database_key,
|
||||||
|
graph_dataset_database_handler,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@lru_cache
|
||||||
|
def _create_graph_engine(
|
||||||
|
graph_database_provider,
|
||||||
|
graph_file_path,
|
||||||
|
graph_database_url="",
|
||||||
|
graph_database_name="",
|
||||||
|
graph_database_username="",
|
||||||
|
graph_database_password="",
|
||||||
|
graph_database_port="",
|
||||||
|
graph_database_key="",
|
||||||
|
graph_dataset_database_handler="",
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
Create a graph engine based on the specified provider type.
|
Create a graph engine based on the specified provider type.
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@ from cognee.infrastructure.databases.graph.config import get_graph_context_confi
|
||||||
from functools import lru_cache
|
from functools import lru_cache
|
||||||
|
|
||||||
|
|
||||||
@lru_cache
|
|
||||||
def create_vector_engine(
|
def create_vector_engine(
|
||||||
vector_db_provider: str,
|
vector_db_provider: str,
|
||||||
vector_db_url: str,
|
vector_db_url: str,
|
||||||
|
|
@ -15,6 +14,29 @@ def create_vector_engine(
|
||||||
vector_db_port: str = "",
|
vector_db_port: str = "",
|
||||||
vector_db_key: str = "",
|
vector_db_key: str = "",
|
||||||
vector_dataset_database_handler: str = "",
|
vector_dataset_database_handler: str = "",
|
||||||
|
):
|
||||||
|
"""
|
||||||
|
Wrapper function to call create vector engine with caching.
|
||||||
|
For a detailed description, see _create_vector_engine.
|
||||||
|
"""
|
||||||
|
return _create_vector_engine(
|
||||||
|
vector_db_provider,
|
||||||
|
vector_db_url,
|
||||||
|
vector_db_name,
|
||||||
|
vector_db_port,
|
||||||
|
vector_db_key,
|
||||||
|
vector_dataset_database_handler,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@lru_cache
|
||||||
|
def _create_vector_engine(
|
||||||
|
vector_db_provider: str,
|
||||||
|
vector_db_url: str,
|
||||||
|
vector_db_name: str,
|
||||||
|
vector_db_port: str = "",
|
||||||
|
vector_db_key: str = "",
|
||||||
|
vector_dataset_database_handler: str = "",
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
Create a vector database engine based on the specified provider.
|
Create a vector database engine based on the specified provider.
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue