From 6b57bfc4cb50c550a3ff650ee0d5068212399655 Mon Sep 17 00:00:00 2001 From: Igor Ilic Date: Thu, 9 Jan 2025 16:41:18 +0100 Subject: [PATCH] feat: Add ability to change graph database configuration through cognee --- cognee/api/v1/config/config.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/cognee/api/v1/config/config.py b/cognee/api/v1/config/config.py index da58cf581..2f7b406a8 100644 --- a/cognee/api/v1/config/config.py +++ b/cognee/api/v1/config/config.py @@ -131,6 +131,18 @@ class config: message=f"'{key}' is not a valid attribute of the config." ) + @staticmethod + def set_graph_db_config(config_dict: dict) -> None: + """ + Updates the graph db config with values from config_dict. + """ + graph_db_config = get_graph_config() + for key, value in config_dict.items(): + if hasattr(graph_db_config, key): + object.__setattr__(graph_db_config, key, value) + else: + raise AttributeError(message=f"'{key}' is not a valid attribute of the config.") + @staticmethod def set_vector_db_config(config_dict: dict): """