From 0a330683de5007c2d31a865024f02a4f699e9a71 Mon Sep 17 00:00:00 2001 From: P-FardeenMalik Date: Mon, 11 Aug 2025 13:48:37 +0530 Subject: [PATCH 01/14] Extend CodeGraph pipeline for multi-language support (closes #1160) --- cognee/api/v1/cognify/code_graph_pipeline.py | 7 +- cognee/shared/CodeGraphEntities.py | 1 + .../repo_processor/get_local_dependencies.py | 2 + .../get_repo_file_dependencies.py | 125 ++++++++++++------ 4 files changed, 95 insertions(+), 40 deletions(-) diff --git a/cognee/api/v1/cognify/code_graph_pipeline.py b/cognee/api/v1/cognify/code_graph_pipeline.py index 00a0d3dc9..299c8732c 100644 --- a/cognee/api/v1/cognify/code_graph_pipeline.py +++ b/cognee/api/v1/cognify/code_graph_pipeline.py @@ -40,8 +40,13 @@ async def run_code_graph_pipeline(repo_path, include_docs=False): user = await get_default_user() detailed_extraction = True + + # Multi-language support: allow passing supported_languages + supported_languages = [ + 'python', 'javascript', 'typescript', 'java', 'csharp', 'go', 'rust', 'cpp' + ] tasks = [ - Task(get_repo_file_dependencies, detailed_extraction=detailed_extraction), + Task(get_repo_file_dependencies, detailed_extraction=detailed_extraction, supported_languages=supported_languages), # Task(summarize_code, task_config={"batch_size": 500}), # This task takes a long time to complete Task(add_data_points, task_config={"batch_size": 30}), ] diff --git a/cognee/shared/CodeGraphEntities.py b/cognee/shared/CodeGraphEntities.py index 9d44c5604..784ad8f88 100644 --- a/cognee/shared/CodeGraphEntities.py +++ b/cognee/shared/CodeGraphEntities.py @@ -36,6 +36,7 @@ class ClassDefinition(DataPoint): class CodeFile(DataPoint): name: str file_path: str + language: Optional[str] = None # e.g., 'python', 'javascript', 'java', etc. source_code: Optional[str] = None part_of: Optional[Repository] = None depends_on: Optional[List["ImportStatement"]] = [] diff --git a/cognee/tasks/repo_processor/get_local_dependencies.py b/cognee/tasks/repo_processor/get_local_dependencies.py index ed8e4e14b..f691d4a3e 100644 --- a/cognee/tasks/repo_processor/get_local_dependencies.py +++ b/cognee/tasks/repo_processor/get_local_dependencies.py @@ -180,6 +180,7 @@ async def get_local_script_dependencies( name=file_path_relative_to_repo, source_code=source_code, file_path=script_path, + language="python", ) return code_file_node @@ -188,6 +189,7 @@ async def get_local_script_dependencies( name=file_path_relative_to_repo, source_code=None, file_path=script_path, + language="python", ) async for part in extract_code_parts(source_code_tree.root_node, script_path=script_path): diff --git a/cognee/tasks/repo_processor/get_repo_file_dependencies.py b/cognee/tasks/repo_processor/get_repo_file_dependencies.py index 232850936..c9e148741 100644 --- a/cognee/tasks/repo_processor/get_repo_file_dependencies.py +++ b/cognee/tasks/repo_processor/get_repo_file_dependencies.py @@ -12,46 +12,58 @@ from cognee.shared.CodeGraphEntities import CodeFile, Repository async def get_source_code_files(repo_path): """ - Retrieve Python source code files from the specified repository path. - - This function scans the given repository path for files that have the .py extension - while excluding test files and files within a virtual environment. It returns a list of - absolute paths to the source code files that are not empty. + Retrieve source code files from the specified repository path for multiple languages. Parameters: ----------- - - - repo_path: The file path to the repository to search for Python source files. + - repo_path: The file path to the repository to search for source files. + - language_config: dict mapping language names to file extensions, e.g., + {'python': ['.py'], 'javascript': ['.js', '.jsx'], ...} Returns: -------- - - A list of absolute paths to .py files that contain source code, excluding empty - files, test files, and files from a virtual environment. + A list of (absolute_path, language) tuples for source code files. """ - if not os.path.exists(repo_path): - return {} + def _get_language_from_extension(file, language_config): + for lang, exts in language_config.items(): + for ext in exts: + if file.endswith(ext): + return lang + return None - py_files_paths = ( - os.path.join(root, file) - for root, _, files in os.walk(repo_path) - for file in files - if ( - file.endswith(".py") - and not file.startswith("test_") - and not file.endswith("_test") - and ".venv" not in file - ) - ) + # Default config if not provided + import inspect + frame = inspect.currentframe() + args, _, _, values = inspect.getargvalues(frame) + language_config = values.get('language_config', None) + if language_config is None: + language_config = { + 'python': ['.py'], + 'javascript': ['.js', '.jsx'], + 'typescript': ['.ts', '.tsx'], + 'java': ['.java'], + 'csharp': ['.cs'], + 'go': ['.go'], + 'rust': ['.rs'], + 'cpp': ['.cpp', '.c', '.h', '.hpp'], + } + + if not os.path.exists(repo_path): + return [] source_code_files = set() - for file_path in py_files_paths: - file_path = os.path.abspath(file_path) - - if os.path.getsize(file_path) == 0: - continue - - source_code_files.add(file_path) + for root, _, files in os.walk(repo_path): + for file in files: + lang = _get_language_from_extension(file, language_config) + if lang is None: + continue + # Exclude test files and venv for all languages + if file.startswith("test_") or file.endswith("_test") or ".venv" in file: + continue + file_path = os.path.abspath(os.path.join(root, file)) + if os.path.getsize(file_path) == 0: + continue + source_code_files.add((file_path, lang)) return list(source_code_files) @@ -85,7 +97,7 @@ def run_coroutine(coroutine_func, *args, **kwargs): async def get_repo_file_dependencies( - repo_path: str, detailed_extraction: bool = False + repo_path: str, detailed_extraction: bool = False, supported_languages: list = None ) -> AsyncGenerator[DataPoint, None]: """ Generate a dependency graph for Python files in the given repository path. @@ -106,7 +118,23 @@ async def get_repo_file_dependencies( if not os.path.exists(repo_path): raise FileNotFoundError(f"Repository path {repo_path} does not exist.") - source_code_files = await get_source_code_files(repo_path) + # Build language config from supported_languages + default_language_config = { + 'python': ['.py'], + 'javascript': ['.js', '.jsx'], + 'typescript': ['.ts', '.tsx'], + 'java': ['.java'], + 'csharp': ['.cs'], + 'go': ['.go'], + 'rust': ['.rs'], + 'cpp': ['.cpp', '.c', '.h', '.hpp'], + } + if supported_languages is not None: + language_config = {k: v for k, v in default_language_config.items() if k in supported_languages} + else: + language_config = default_language_config + + source_code_files = await get_source_code_files(repo_path, language_config=language_config) repo = Repository( id=uuid5(NAMESPACE_OID, repo_path), @@ -125,19 +153,38 @@ async def get_repo_file_dependencies( for chunk_number in range(number_of_chunks) ] - # Codegraph dependencies are not installed by default, so we import where we use them. + # Import dependency extractors for each language (Python for now, extend later) from cognee.tasks.repo_processor.get_local_dependencies import get_local_script_dependencies + # TODO: Add other language extractors here for start_range, end_range in chunk_ranges: - # with ProcessPoolExecutor(max_workers=12) as executor: - tasks = [ - get_local_script_dependencies(repo_path, file_path, detailed_extraction) - for file_path in source_code_files[start_range : end_range + 1] - ] + tasks = [] + for file_path, lang in source_code_files[start_range : end_range + 1]: + # For now, only Python is supported; extend with other languages + if lang == 'python': + tasks.append(get_local_script_dependencies(repo_path, file_path, detailed_extraction)) + else: + # Placeholder: create a minimal CodeFile for other languages + from cognee.shared.CodeGraphEntities import CodeFile + import aiofiles + async def make_codefile_stub(): + async with aiofiles.open(file_path, "r", encoding="utf-8") as f: + source = await f.read() + return CodeFile( + id=uuid5(NAMESPACE_OID, file_path), + name=os.path.relpath(file_path, repo_path), + file_path=file_path, + language=lang, + source_code=source, + ) + tasks.append(make_codefile_stub()) results: list[CodeFile] = await asyncio.gather(*tasks) for source_code_file in results: source_code_file.part_of = repo - + if not hasattr(source_code_file, 'language') or source_code_file.language is None: + # Set language for python files if not set + if source_code_file.file_path.endswith('.py'): + source_code_file.language = 'python' yield source_code_file From 0bc02a522ab92f762c6c99132fb7467b6656678e Mon Sep 17 00:00:00 2001 From: vasilije Date: Mon, 18 Aug 2025 17:12:26 +0200 Subject: [PATCH 02/14] added fix --- cognee-mcp/src/server.py | 44 ++++++++++++++-------------------------- 1 file changed, 15 insertions(+), 29 deletions(-) diff --git a/cognee-mcp/src/server.py b/cognee-mcp/src/server.py index a657225f5..a7b260e1c 100755 --- a/cognee-mcp/src/server.py +++ b/cognee-mcp/src/server.py @@ -21,16 +21,16 @@ from cognee.shared.data_models import KnowledgeGraph from cognee.modules.storage.utils import JSONEncoder -try: - from codingagents.coding_rule_associations import ( - add_rule_associations, - get_existing_rules, - ) -except ModuleNotFoundError: - from .codingagents.coding_rule_associations import ( - add_rule_associations, - get_existing_rules, - ) +# try: +# from codingagents.coding_rule_associations import ( +# add_rule_associations, +# get_existing_rules, +# ) +# except ModuleNotFoundError: +# from .codingagents.coding_rule_associations import ( +# add_rule_associations, +# get_existing_rules, +# ) mcp = FastMCP("Cognee") @@ -221,14 +221,6 @@ async def cognify(data: str, graph_model_file: str = None, graph_model_name: str - The actual cognify process may take significant time depending on text length - Use the cognify_status tool to check the progress of the operation - Raises - ------ - InvalidValueError - If LLM_API_KEY is not set - ValueError - If chunks exceed max token limits (reduce chunk_size) - DatabaseNotCreatedError - If databases are not properly initialized """ async def cognify_task( @@ -306,7 +298,7 @@ async def save_interaction(data: str) -> list: logger.info("Save interaction process finished.") logger.info("Generating associated rules from interaction data.") - await add_rule_associations(data=data, rules_nodeset_name="coding_agent_rules") + # await add_rule_associations(data=data, rules_nodeset_name="coding_agent_rules") logger.info("Associated rules generated from interaction data.") @@ -512,14 +504,6 @@ async def search(search_query: str, search_type: str) -> list: - Different search types produce different output formats - The function handles the conversion between Cognee's internal result format and MCP's output format - Raises - ------ - InvalidValueError - If LLM_API_KEY is not set (for LLM-based search types) - ValueError - If query_text is empty or search parameters are invalid - NoDataError - If no relevant data found for the search query """ async def search_task(search_query: str, search_type: str) -> str: @@ -576,8 +560,10 @@ async def get_developer_rules() -> list: async def fetch_rules_from_cognee() -> str: """Collect all developer rules from Cognee""" with redirect_stdout(sys.stderr): - developer_rules = await get_existing_rules(rules_nodeset_name="coding_agent_rules") - return developer_rules + note = "This is broken in 0.2.2" + return note + # developer_rules = await get_existing_rules(rules_nodeset_name="coding_agent_rules") + # return developer_rules rules_text = await fetch_rules_from_cognee() From 3223737a2d578145861e5741ad727ea0c1e866bc Mon Sep 17 00:00:00 2001 From: vasilije Date: Mon, 18 Aug 2025 17:53:20 +0200 Subject: [PATCH 03/14] add fix --- poetry.lock | 40 +++++++++++++++++++++++----------------- pyproject.toml | 4 ++-- 2 files changed, 25 insertions(+), 19 deletions(-) diff --git a/poetry.lock b/poetry.lock index 0e2faaa88..81c035e67 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 2.1.3 and should not be changed by hand. +# This file is automatically @generated by Poetry 2.1.2 and should not be changed by hand. [[package]] name = "aiobotocore" @@ -4002,6 +4002,8 @@ python-versions = "*" groups = ["main"] files = [ {file = "jsonpath-ng-1.7.0.tar.gz", hash = "sha256:f6f5f7fd4e5ff79c785f1573b394043b39849fb2bb47bcead935d12b00beab3c"}, + {file = "jsonpath_ng-1.7.0-py2-none-any.whl", hash = "sha256:898c93fc173f0c336784a3fa63d7434297544b7198124a68f9a3ef9597b0ae6e"}, + {file = "jsonpath_ng-1.7.0-py3-none-any.whl", hash = "sha256:f3d7f9e848cba1b6da28c55b1c26ff915dc9e0b1ba7e752a53d6da8d5cbd00b6"}, ] [package.dependencies] @@ -4649,20 +4651,20 @@ typing-extensions = ">=4.7" [[package]] name = "langchain-openai" -version = "0.3.30" +version = "0.3.29" description = "An integration package connecting OpenAI and LangChain" optional = true python-versions = ">=3.9" groups = ["main"] markers = "extra == \"deepeval\"" files = [ - {file = "langchain_openai-0.3.30-py3-none-any.whl", hash = "sha256:280f1f31004393228e3f75ff8353b1aae86bbc282abc7890a05beb5f43b89923"}, - {file = "langchain_openai-0.3.30.tar.gz", hash = "sha256:90df37509b2dcf5e057f491326fcbf78cf2a71caff5103a5a7de560320171842"}, + {file = "langchain_openai-0.3.29-py3-none-any.whl", hash = "sha256:71ae6791b3e017ec892a8062f993edc882c6665fd8385aa66e9dc3bff8205996"}, + {file = "langchain_openai-0.3.29.tar.gz", hash = "sha256:83a0455f8ce874aa1806131ca3b4db08e482be037b7457a9b3ca21a213d2ab47"}, ] [package.dependencies] langchain-core = ">=0.3.74,<1.0.0" -openai = ">=1.99.9,<2.0.0" +openai = ">=1.86.0,<2.0.0" tiktoken = ">=0.7,<1" [[package]] @@ -4805,32 +4807,35 @@ valkey = ["valkey (>=6)"] [[package]] name = "litellm" -version = "1.70.4" +version = "1.75.8" description = "Library to easily interface with LLM API providers" optional = false python-versions = "!=2.7.*,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,!=3.7.*,>=3.8" groups = ["main"] files = [ - {file = "litellm-1.70.4-py3-none-any.whl", hash = "sha256:4d14d04bf5e2bd49336b4abc59193352c731ff371022e4fcf590208f41f644f7"}, - {file = "litellm-1.70.4.tar.gz", hash = "sha256:ef6749a091faaaf88313afe4111cdd95736e1e60f21ba894e74f7c5bab2870bd"}, + {file = "litellm-1.75.8-py3-none-any.whl", hash = "sha256:0bf004488df8506381ec6e35e1486e2870e8d578a7c3f2427cd497558ce07a2e"}, + {file = "litellm-1.75.8.tar.gz", hash = "sha256:92061bd263ff8c33c8fff70ba92cd046adb7ea041a605826a915d108742fe59e"}, ] [package.dependencies] -aiohttp = "*" +aiohttp = ">=3.10" click = "*" httpx = ">=0.23.0" importlib-metadata = ">=6.8.0" jinja2 = ">=3.1.2,<4.0.0" jsonschema = ">=4.22.0,<5.0.0" -openai = ">=1.68.2" -pydantic = ">=2.0.0,<3.0.0" +openai = ">=1.99.5" +pydantic = ">=2.5.0,<3.0.0" python-dotenv = ">=0.2.0" tiktoken = ">=0.7.0" tokenizers = "*" [package.extras] -extra-proxy = ["azure-identity (>=1.15.0,<2.0.0)", "azure-keyvault-secrets (>=4.8.0,<5.0.0)", "google-cloud-kms (>=2.21.3,<3.0.0)", "prisma (==0.11.0)", "redisvl (>=0.4.1,<0.5.0) ; python_version >= \"3.9\" and python_version < \"3.14\"", "resend (>=0.8.0,<0.9.0)"] -proxy = ["PyJWT (>=2.8.0,<3.0.0)", "apscheduler (>=3.10.4,<4.0.0)", "backoff", "boto3 (==1.34.34)", "cryptography (>=43.0.1,<44.0.0)", "fastapi (>=0.115.5,<0.116.0)", "fastapi-sso (>=0.16.0,<0.17.0)", "gunicorn (>=23.0.0,<24.0.0)", "litellm-enterprise (==0.1.5)", "litellm-proxy-extras (==0.1.21)", "mcp (==1.5.0) ; python_version >= \"3.10\"", "orjson (>=3.9.7,<4.0.0)", "pynacl (>=1.5.0,<2.0.0)", "python-multipart (>=0.0.18,<0.0.19)", "pyyaml (>=6.0.1,<7.0.0)", "rich (==13.7.1)", "rq", "uvicorn (>=0.29.0,<0.30.0)", "uvloop (>=0.21.0,<0.22.0) ; sys_platform != \"win32\"", "websockets (>=13.1.0,<14.0.0)"] +caching = ["diskcache (>=5.6.1,<6.0.0)"] +extra-proxy = ["azure-identity (>=1.15.0,<2.0.0)", "azure-keyvault-secrets (>=4.8.0,<5.0.0)", "google-cloud-iam (>=2.19.1,<3.0.0)", "google-cloud-kms (>=2.21.3,<3.0.0)", "prisma (==0.11.0)", "redisvl (>=0.4.1,<0.5.0) ; python_version >= \"3.9\" and python_version < \"3.14\"", "resend (>=0.8.0,<0.9.0)"] +mlflow = ["mlflow (>3.1.4) ; python_version >= \"3.10\""] +proxy = ["PyJWT (>=2.8.0,<3.0.0)", "apscheduler (>=3.10.4,<4.0.0)", "azure-identity (>=1.15.0,<2.0.0)", "azure-storage-blob (>=12.25.1,<13.0.0)", "backoff", "boto3 (==1.36.0)", "cryptography (>=43.0.1,<44.0.0)", "fastapi (>=0.115.5,<0.116.0)", "fastapi-sso (>=0.16.0,<0.17.0)", "gunicorn (>=23.0.0,<24.0.0)", "litellm-enterprise (==0.1.19)", "litellm-proxy-extras (==0.2.17)", "mcp (>=1.10.0,<2.0.0) ; python_version >= \"3.10\"", "orjson (>=3.9.7,<4.0.0)", "polars (>=1.31.0,<2.0.0) ; python_version >= \"3.10\"", "pynacl (>=1.5.0,<2.0.0)", "python-multipart (>=0.0.18,<0.0.19)", "pyyaml (>=6.0.1,<7.0.0)", "rich (==13.7.1)", "rq", "uvicorn (>=0.29.0,<0.30.0)", "uvloop (>=0.21.0,<0.22.0) ; sys_platform != \"win32\"", "websockets (>=13.1.0,<14.0.0)"] +semantic-router = ["semantic-router ; python_version >= \"3.9\""] utils = ["numpydoc"] [[package]] @@ -6841,14 +6846,14 @@ sympy = "*" [[package]] name = "openai" -version = "1.99.9" +version = "1.99.8" description = "The official Python library for the openai API" optional = false python-versions = ">=3.8" groups = ["main"] files = [ - {file = "openai-1.99.9-py3-none-any.whl", hash = "sha256:9dbcdb425553bae1ac5d947147bebbd630d91bbfc7788394d4c4f3a35682ab3a"}, - {file = "openai-1.99.9.tar.gz", hash = "sha256:f2082d155b1ad22e83247c3de3958eb4255b20ccf4a1de2e6681b6957b554e92"}, + {file = "openai-1.99.8-py3-none-any.whl", hash = "sha256:426b981079cffde6dd54868b9b84761ffa291cde77010f051b96433e1835b47d"}, + {file = "openai-1.99.8.tar.gz", hash = "sha256:4b49845983eb4d5ffae9bae5d98bd5c0bd3a709a30f8b994fc8f316961b6d566"}, ] [package.dependencies] @@ -7966,6 +7971,7 @@ files = [ {file = "psycopg2_binary-2.9.10-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:bb89f0a835bcfc1d42ccd5f41f04870c1b936d8507c6df12b7737febc40f0909"}, {file = "psycopg2_binary-2.9.10-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:f0c2d907a1e102526dd2986df638343388b94c33860ff3bbe1384130828714b1"}, {file = "psycopg2_binary-2.9.10-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:f8157bed2f51db683f31306aa497311b560f2265998122abe1dce6428bd86567"}, + {file = "psycopg2_binary-2.9.10-cp313-cp313-win_amd64.whl", hash = "sha256:27422aa5f11fbcd9b18da48373eb67081243662f9b46e6fd07c3eb46e4535142"}, {file = "psycopg2_binary-2.9.10-cp38-cp38-macosx_12_0_x86_64.whl", hash = "sha256:eb09aa7f9cecb45027683bb55aebaaf45a0df8bf6de68801a6afdc7947bb09d4"}, {file = "psycopg2_binary-2.9.10-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b73d6d7f0ccdad7bc43e6d34273f70d587ef62f824d7261c4ae9b8b1b6af90e8"}, {file = "psycopg2_binary-2.9.10-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ce5ab4bf46a211a8e924d307c1b1fcda82368586a19d0a24f8ae166f5c784864"}, @@ -12470,4 +12476,4 @@ posthog = ["posthog"] [metadata] lock-version = "2.1" python-versions = ">=3.10,<=3.13" -content-hash = "7682898d3c726a0b1e3d08560ceb26180e1841e89a4a417377ee876b55878a9b" +content-hash = "7363d5497ee6fe961440d73ef9a1d1eb2410eeb7fd01761d89fc9ac668216261" diff --git a/pyproject.toml b/pyproject.toml index 095349ff3..302f70f08 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,7 +20,7 @@ classifiers = [ "Operating System :: Microsoft :: Windows", ] dependencies = [ - "openai>=1.80.1,<2", + "openai>=1.80.1,<1.99.9", "python-dotenv>=1.0.1,<2.0.0", "pydantic>=2.10.5,<3.0.0", "pydantic-settings>=2.2.1,<3", @@ -34,7 +34,7 @@ dependencies = [ "sqlalchemy>=2.0.39,<3.0.0", "aiosqlite>=0.20.0,<1.0.0", "tiktoken>=0.8.0,<1.0.0", - "litellm>=1.57.4, <1.71.0", + "litellm>=1.71.0, <2.0.0", "instructor>=1.9.1,<2.0.0", "langfuse>=2.32.0,<3", "filetype>=1.2.0,<2.0.0", From 6de749b39a1e04286c6adf4c8bf1e0d08b0cb238 Mon Sep 17 00:00:00 2001 From: P-FardeenMalik Date: Mon, 18 Aug 2025 21:49:55 +0530 Subject: [PATCH 04/14] Fix bot review issues: update function signature, tighten filters, remove inspect hack --- cognee/api/v1/cognify/code_graph_pipeline.py | 4 +- .../get_repo_file_dependencies.py | 43 ++++++++++--------- 2 files changed, 23 insertions(+), 24 deletions(-) diff --git a/cognee/api/v1/cognify/code_graph_pipeline.py b/cognee/api/v1/cognify/code_graph_pipeline.py index 11c90cd1a..446526042 100644 --- a/cognee/api/v1/cognify/code_graph_pipeline.py +++ b/cognee/api/v1/cognify/code_graph_pipeline.py @@ -42,9 +42,7 @@ async def run_code_graph_pipeline(repo_path, include_docs=False): # Multi-language support: allow passing supported_languages - supported_languages = [ - 'python', 'javascript', 'typescript', 'java', 'csharp', 'go', 'rust', 'cpp' - ] + supported_languages = None # defer to task defaults tasks = [ Task(get_repo_file_dependencies, detailed_extraction=detailed_extraction, supported_languages=supported_languages), # Task(summarize_code, task_config={"batch_size": 500}), # This task takes a long time to complete diff --git a/cognee/tasks/repo_processor/get_repo_file_dependencies.py b/cognee/tasks/repo_processor/get_repo_file_dependencies.py index de9a227d2..26dd8cf42 100644 --- a/cognee/tasks/repo_processor/get_repo_file_dependencies.py +++ b/cognee/tasks/repo_processor/get_repo_file_dependencies.py @@ -10,7 +10,7 @@ from cognee.infrastructure.engine import DataPoint from cognee.shared.CodeGraphEntities import CodeFile, Repository -async def get_source_code_files(repo_path): +async def get_source_code_files(repo_path, language_config: dict[str, list[str]] | None = None): """ Retrieve source code files from the specified repository path for multiple languages. @@ -32,10 +32,6 @@ async def get_source_code_files(repo_path): return None # Default config if not provided - import inspect - frame = inspect.currentframe() - args, _, _, values = inspect.getargvalues(frame) - language_config = values.get('language_config', None) if language_config is None: language_config = { 'python': ['.py'], @@ -57,15 +53,22 @@ async def get_source_code_files(repo_path): lang = _get_language_from_extension(file, language_config) if lang is None: continue - # Exclude test files and venv for all languages - if file.startswith("test_") or file.endswith("_test") or ".venv" in file: + #Exclude common test files and virtual/env folders + if ( + file.startswith("test_") + or file.endswith("_test") + or ".test." in file + or ".spec." in file + or any(x in root for x in (".venv", "venv", "env", ".env", "site-packages")) + or any(x in root for x in ("node_modules", "dist", "build", ".git")) + ): continue file_path = os.path.abspath(os.path.join(root, file)) if os.path.getsize(file_path) == 0: continue source_code_files.add((file_path, lang)) - return list(source_code_files) + return sorted(list(source_code_files)) def run_coroutine(coroutine_func, *args, **kwargs): @@ -100,19 +103,20 @@ async def get_repo_file_dependencies( repo_path: str, detailed_extraction: bool = False, supported_languages: list = None ) -> AsyncGenerator[DataPoint, None]: """ - Generate a dependency graph for Python files in the given repository path. + Generate a dependency graph for source files (multi-language) in the given repository path. Check the validity of the repository path and yield a repository object followed by the - dependencies of Python files within that repository. Raise a FileNotFoundError if the + dependencies of source files within that repository. Raise a FileNotFoundError if the provided path does not exist. The extraction of detailed dependencies can be controlled - via the `detailed_extraction` argument. + via the `detailed_extraction` argument. Languages considered can be restricted via + the `supported_languages` argument. Parameters: ----------- - - repo_path (str): The file path to the repository where Python files are located. - - detailed_extraction (bool): A flag indicating whether to perform a detailed - extraction of dependencies (default is False). (default False) + - repo_path (str): The file path to the repository to process. + - detailed_extraction (bool): Whether to perform a detailed extraction of code parts. + - supported_languages (list | None): Subset of languages to include; if None, use defaults. """ if isinstance(repo_path, list) and len(repo_path) == 1: @@ -158,6 +162,7 @@ async def get_repo_file_dependencies( # Import dependency extractors for each language (Python for now, extend later) from cognee.tasks.repo_processor.get_local_dependencies import get_local_script_dependencies + import aiofiles # TODO: Add other language extractors here for start_range, end_range in chunk_ranges: @@ -168,9 +173,7 @@ async def get_repo_file_dependencies( tasks.append(get_local_script_dependencies(repo_path, file_path, detailed_extraction)) else: # Placeholder: create a minimal CodeFile for other languages - from cognee.shared.CodeGraphEntities import CodeFile - import aiofiles - async def make_codefile_stub(): + async def make_codefile_stub(file_path=file_path, lang=lang): async with aiofiles.open(file_path, "r", encoding="utf-8") as f: source = await f.read() return CodeFile( @@ -186,8 +189,6 @@ async def get_repo_file_dependencies( for source_code_file in results: source_code_file.part_of = repo - if not hasattr(source_code_file, 'language') or source_code_file.language is None: - # Set language for python files if not set - if source_code_file.file_path.endswith('.py'): - source_code_file.language = 'python' + if (getattr(source_code_file, 'language', None) is None and source_code_file.file_path.endswith('.py')): + source_code_file.language = 'python' yield source_code_file From 6ab00f2953d9368ab2aa3ebb7733622d973b59ab Mon Sep 17 00:00:00 2001 From: vasilije Date: Mon, 18 Aug 2025 18:30:42 +0200 Subject: [PATCH 05/14] added openai fix --- pyproject.toml | 2 +- uv.lock | 51 +++++++++++++++++++++++++------------------------- 2 files changed, 26 insertions(+), 27 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 302f70f08..61076e86b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "cognee" -version = "0.2.2" +version = "0.2.3" description = "Cognee - is a library for enriching LLM context with a semantic layer for better understanding and reasoning." authors = [ { name = "Vasilije Markovic" }, diff --git a/uv.lock b/uv.lock index 8ffae982b..137263188 100644 --- a/uv.lock +++ b/uv.lock @@ -1,5 +1,5 @@ version = 1 -revision = 2 +revision = 3 requires-python = ">=3.10, <=3.13" resolution-markers = [ "python_full_version >= '3.13' and platform_python_implementation != 'PyPy' and sys_platform != 'emscripten'", @@ -65,7 +65,6 @@ dependencies = [ { name = "aiohappyeyeballs" }, { name = "aiosignal" }, { name = "async-timeout", version = "4.0.3", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" }, - { name = "async-timeout", version = "5.0.1", source = { registry = "https://pypi.org/simple" }, marker = "python_version < '0'" }, { name = "attrs" }, { name = "frozenlist" }, { name = "multidict" }, @@ -870,7 +869,7 @@ wheels = [ [[package]] name = "cognee" -version = "0.2.2.dev0" +version = "0.2.3" source = { editable = "." } dependencies = [ { name = "aiofiles" }, @@ -1061,7 +1060,7 @@ requires-dist = [ { name = "langfuse", specifier = ">=2.32.0,<3" }, { name = "langsmith", marker = "extra == 'langchain'", specifier = ">=0.2.3,<1.0.0" }, { name = "limits", specifier = ">=4.4.1,<5" }, - { name = "litellm", specifier = ">=1.57.4,<1.71.0" }, + { name = "litellm", specifier = ">=1.71.0,<2.0.0" }, { name = "llama-index-core", marker = "extra == 'llama-index'", specifier = ">=0.12.11,<0.13" }, { name = "matplotlib", specifier = ">=3.8.3,<4" }, { name = "mistral-common", marker = "extra == 'mistral'", specifier = ">=1.5.2,<2" }, @@ -1077,7 +1076,7 @@ requires-dist = [ { name = "notebook", marker = "extra == 'notebook'", specifier = ">=7.1.0,<8" }, { name = "numpy", specifier = ">=1.26.4,<=4.0.0" }, { name = "onnxruntime", specifier = ">=1.0.0,<2.0.0" }, - { name = "openai", specifier = ">=1.80.1,<2" }, + { name = "openai", specifier = ">=1.80.1,<1.99.9" }, { name = "pandas", specifier = ">=2.2.2,<3.0.0" }, { name = "pgvector", marker = "extra == 'postgres'", specifier = ">=0.3.5,<0.4" }, { name = "pgvector", marker = "extra == 'postgres-binary'", specifier = ">=0.3.5,<0.4" }, @@ -1862,17 +1861,17 @@ name = "fastembed" version = "0.6.0" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "huggingface-hub" }, - { name = "loguru" }, - { name = "mmh3" }, + { name = "huggingface-hub", marker = "python_full_version < '3.13'" }, + { name = "loguru", marker = "python_full_version < '3.13'" }, + { name = "mmh3", marker = "python_full_version < '3.13'" }, { name = "numpy", version = "1.26.4", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.12'" }, - { name = "numpy", version = "2.3.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.12'" }, - { name = "onnxruntime" }, - { name = "pillow" }, - { name = "py-rust-stemmers" }, - { name = "requests" }, - { name = "tokenizers" }, - { name = "tqdm" }, + { name = "numpy", version = "2.3.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.12.*'" }, + { name = "onnxruntime", marker = "python_full_version < '3.13'" }, + { name = "pillow", marker = "python_full_version < '3.13'" }, + { name = "py-rust-stemmers", marker = "python_full_version < '3.13'" }, + { name = "requests", marker = "python_full_version < '3.13'" }, + { name = "tokenizers", marker = "python_full_version < '3.13'" }, + { name = "tqdm", marker = "python_full_version < '3.13'" }, ] sdist = { url = "https://files.pythonhosted.org/packages/c6/f4/036a656c605f63dc25f11284f60f69900a54a19c513e1ae60d21d6977e75/fastembed-0.6.0.tar.gz", hash = "sha256:5c9ead25f23449535b07243bbe1f370b820dcc77ec2931e61674e3fe7ff24733", size = 50731, upload-time = "2025-02-26T13:50:33.031Z" } wheels = [ @@ -3458,16 +3457,16 @@ wheels = [ [[package]] name = "langchain-openai" -version = "0.3.30" +version = "0.3.29" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "langchain-core" }, { name = "openai" }, { name = "tiktoken" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/ad/21/6b2024cdd907812d33d31d42c05baa6a3fc6b341d76f7a982730b6985501/langchain_openai-0.3.30.tar.gz", hash = "sha256:90df37509b2dcf5e057f491326fcbf78cf2a71caff5103a5a7de560320171842", size = 766426, upload-time = "2025-08-12T17:05:55.587Z" } +sdist = { url = "https://files.pythonhosted.org/packages/5b/56/2e2010d15118ac52760f92ebf6ce75b3508e7a1023107ea04233fd6263e0/langchain_openai-0.3.29.tar.gz", hash = "sha256:83a0455f8ce874aa1806131ca3b4db08e482be037b7457a9b3ca21a213d2ab47", size = 766499, upload-time = "2025-08-08T15:12:32.402Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/23/36/cd370071243ae321c22bfafbf75fef1601dd22d0baeeedb71835954ed0ad/langchain_openai-0.3.30-py3-none-any.whl", hash = "sha256:280f1f31004393228e3f75ff8353b1aae86bbc282abc7890a05beb5f43b89923", size = 74362, upload-time = "2025-08-12T17:05:54.415Z" }, + { url = "https://files.pythonhosted.org/packages/ac/f2/a6a73beec15e90605e6a24c4498a8592d79a72c8e81c18ed0f5e9b7308e9/langchain_openai-0.3.29-py3-none-any.whl", hash = "sha256:71ae6791b3e017ec892a8062f993edc882c6665fd8385aa66e9dc3bff8205996", size = 74316, upload-time = "2025-08-08T15:12:30.794Z" }, ] [[package]] @@ -3553,7 +3552,7 @@ wheels = [ [[package]] name = "litellm" -version = "1.70.4" +version = "1.75.8" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "aiohttp" }, @@ -3568,9 +3567,9 @@ dependencies = [ { name = "tiktoken" }, { name = "tokenizers" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/60/d7/d0d76ba896a1e8978550dcc76157d1c50910ba9ade4ef3981a34f01f4fa6/litellm-1.70.4.tar.gz", hash = "sha256:ef6749a091faaaf88313afe4111cdd95736e1e60f21ba894e74f7c5bab2870bd", size = 7813817, upload-time = "2025-05-23T00:05:24.47Z" } +sdist = { url = "https://files.pythonhosted.org/packages/8d/4e/48e3d6de19afe713223e3bc7009a2003501420de2a5d823c569cefbd9731/litellm-1.75.8.tar.gz", hash = "sha256:92061bd263ff8c33c8fff70ba92cd046adb7ea041a605826a915d108742fe59e", size = 10140384, upload-time = "2025-08-16T21:42:24.23Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/cc/8f/0b26ecb08b8282ae0fdfa2223b5df8263579c9e3c75ca96bb7fb7cbc632c/litellm-1.70.4-py3-none-any.whl", hash = "sha256:4d14d04bf5e2bd49336b4abc59193352c731ff371022e4fcf590208f41f644f7", size = 7903749, upload-time = "2025-05-23T00:05:21.017Z" }, + { url = "https://files.pythonhosted.org/packages/5e/82/c4d00fbeafd93c00dab6ea03f33cadd6a97adeb720ba1d89fc319e5cb10b/litellm-1.75.8-py3-none-any.whl", hash = "sha256:0bf004488df8506381ec6e35e1486e2870e8d578a7c3f2427cd497558ce07a2e", size = 8916305, upload-time = "2025-08-16T21:42:21.387Z" }, ] [[package]] @@ -3849,8 +3848,8 @@ name = "loguru" version = "0.7.3" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "colorama", marker = "sys_platform == 'win32'" }, - { name = "win32-setctime", marker = "sys_platform == 'win32'" }, + { name = "colorama", marker = "python_full_version < '3.13' and sys_platform == 'win32'" }, + { name = "win32-setctime", marker = "python_full_version < '3.13' and sys_platform == 'win32'" }, ] sdist = { url = "https://files.pythonhosted.org/packages/3a/05/a1dae3dffd1116099471c643b8924f5aa6524411dc6c63fdae648c4f1aca/loguru-0.7.3.tar.gz", hash = "sha256:19480589e77d47b8d85b2c827ad95d49bf31b0dcde16593892eb51dd18706eb6", size = 63559, upload-time = "2024-12-06T11:20:56.608Z" } wheels = [ @@ -5021,7 +5020,7 @@ wheels = [ [[package]] name = "openai" -version = "1.99.9" +version = "1.99.8" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "anyio" }, @@ -5033,9 +5032,9 @@ dependencies = [ { name = "tqdm" }, { name = "typing-extensions" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/8a/d2/ef89c6f3f36b13b06e271d3cc984ddd2f62508a0972c1cbcc8485a6644ff/openai-1.99.9.tar.gz", hash = "sha256:f2082d155b1ad22e83247c3de3958eb4255b20ccf4a1de2e6681b6957b554e92", size = 506992, upload-time = "2025-08-12T02:31:10.054Z" } +sdist = { url = "https://files.pythonhosted.org/packages/4b/81/288157471c43975cc849bc8779b8c7209aec6da5d7cbcd87a982912a19e5/openai-1.99.8.tar.gz", hash = "sha256:4b49845983eb4d5ffae9bae5d98bd5c0bd3a709a30f8b994fc8f316961b6d566", size = 506953, upload-time = "2025-08-11T20:19:02.312Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/e8/fb/df274ca10698ee77b07bff952f302ea627cc12dac6b85289485dd77db6de/openai-1.99.9-py3-none-any.whl", hash = "sha256:9dbcdb425553bae1ac5d947147bebbd630d91bbfc7788394d4c4f3a35682ab3a", size = 786816, upload-time = "2025-08-12T02:31:08.34Z" }, + { url = "https://files.pythonhosted.org/packages/36/b6/3940f037aa33e6d5aa00707fd02843a1cac06ee0e106f39cfb71d0653d23/openai-1.99.8-py3-none-any.whl", hash = "sha256:426b981079cffde6dd54868b9b84761ffa291cde77010f051b96433e1835b47d", size = 786821, upload-time = "2025-08-11T20:18:59.943Z" }, ] [[package]] From fdb0c8292a805a2d090d20b64fbd3409e748fab7 Mon Sep 17 00:00:00 2001 From: Fardeen Malik <109298234+P-FardeenMalik@users.noreply.github.com> Date: Mon, 18 Aug 2025 22:04:47 +0530 Subject: [PATCH 06/14] Update cognee/tasks/repo_processor/get_repo_file_dependencies.py Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- .../repo_processor/get_repo_file_dependencies.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/cognee/tasks/repo_processor/get_repo_file_dependencies.py b/cognee/tasks/repo_processor/get_repo_file_dependencies.py index 26dd8cf42..2bd3c3a4a 100644 --- a/cognee/tasks/repo_processor/get_repo_file_dependencies.py +++ b/cognee/tasks/repo_processor/get_repo_file_dependencies.py @@ -53,14 +53,20 @@ async def get_source_code_files(repo_path, language_config: dict[str, list[str]] lang = _get_language_from_extension(file, language_config) if lang is None: continue - #Exclude common test files and virtual/env folders + # Exclude tests and common build/venv directories + excluded_dirs = { + ".venv", "venv", "env", ".env", "site-packages", + "node_modules", "dist", "build", ".git", + "tests", "test", + } + root_parts = set(os.path.normpath(root).split(os.sep)) + base_name, _ext = os.path.splitext(file) if ( - file.startswith("test_") - or file.endswith("_test") + base_name.startswith("test_") + or base_name.endswith("_test") # catches Go's *_test.go and similar or ".test." in file or ".spec." in file - or any(x in root for x in (".venv", "venv", "env", ".env", "site-packages")) - or any(x in root for x in ("node_modules", "dist", "build", ".git")) + or (excluded_dirs & root_parts) ): continue file_path = os.path.abspath(os.path.join(root, file)) From 03d3e13850d492b08750f67bf60aa3dbfe1270f6 Mon Sep 17 00:00:00 2001 From: Fardeen Malik <109298234+P-FardeenMalik@users.noreply.github.com> Date: Mon, 18 Aug 2025 22:05:39 +0530 Subject: [PATCH 07/14] Update cognee/tasks/repo_processor/get_repo_file_dependencies.py Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- cognee/tasks/repo_processor/get_repo_file_dependencies.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cognee/tasks/repo_processor/get_repo_file_dependencies.py b/cognee/tasks/repo_processor/get_repo_file_dependencies.py index 2bd3c3a4a..82f547915 100644 --- a/cognee/tasks/repo_processor/get_repo_file_dependencies.py +++ b/cognee/tasks/repo_processor/get_repo_file_dependencies.py @@ -180,7 +180,7 @@ async def get_repo_file_dependencies( else: # Placeholder: create a minimal CodeFile for other languages async def make_codefile_stub(file_path=file_path, lang=lang): - async with aiofiles.open(file_path, "r", encoding="utf-8") as f: + async with aiofiles.open(file_path, "r", encoding="utf-8", errors="replace") as f: source = await f.read() return CodeFile( id=uuid5(NAMESPACE_OID, file_path), From 1b88459a413fa44730b0c2cff6f91eef8e9a2b88 Mon Sep 17 00:00:00 2001 From: vasilije Date: Tue, 19 Aug 2025 13:31:33 +0200 Subject: [PATCH 08/14] Add project fix --- cognee-mcp/pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cognee-mcp/pyproject.toml b/cognee-mcp/pyproject.toml index a90457457..a8596615b 100644 --- a/cognee-mcp/pyproject.toml +++ b/cognee-mcp/pyproject.toml @@ -8,7 +8,7 @@ requires-python = ">=3.10" dependencies = [ # For local cognee repo usage remove comment bellow and add absolute path to cognee. Then run `uv sync --reinstall` in the mcp folder on local cognee changes. # "cognee[postgres,codegraph,gemini,huggingface,docs,neo4j] @ file:/Users/vasilije/Projects/tiktok/cognee", - "cognee[postgres,codegraph,gemini,huggingface,docs,neo4j]==0.2.2", + "cognee[postgres,codegraph,gemini,huggingface,docs,neo4j]==0.2.3", "fastmcp>=2.10.0,<3.0.0", "mcp>=1.12.0,<2.0.0", "uv>=0.6.3,<1.0.0", From b1bf8fb2419861da1fbb1fd85d6e9c8b3904842b Mon Sep 17 00:00:00 2001 From: Daulet Amirkhanov Date: Wed, 20 Aug 2025 12:06:08 +0100 Subject: [PATCH 09/14] Update README.md to clarify Docker usage and transport mode configuration --- cognee-mcp/README.md | 191 ++++++++++++++++++++++++++++++++----------- 1 file changed, 145 insertions(+), 46 deletions(-) diff --git a/cognee-mcp/README.md b/cognee-mcp/README.md index ffd46dd6e..f511810f4 100644 --- a/cognee-mcp/README.md +++ b/cognee-mcp/README.md @@ -103,23 +103,159 @@ If you’d rather run cognee-mcp in a container, you have two options: 3. Run it: ```bash # For HTTP transport (recommended for web deployments) - docker run --env-file ./.env -p 8000:8000 --rm -it cognee/cognee-mcp:main --transport http + docker run -e TRANSPORT_MODE=http --env-file ./.env -p 8000:8000 --rm -it cognee/cognee-mcp:main # For SSE transport - docker run --env-file ./.env -p 8000:8000 --rm -it cognee/cognee-mcp:main --transport sse + docker run -e TRANSPORT_MODE=sse --env-file ./.env -p 8000:8000 --rm -it cognee/cognee-mcp:main # For stdio transport (default) - docker run --env-file ./.env --rm -it cognee/cognee-mcp:main + docker run -e TRANSPORT_MODE=stdio --env-file ./.env --rm -it cognee/cognee-mcp:main ``` 2. **Pull from Docker Hub** (no build required): ```bash # With HTTP transport (recommended for web deployments) - docker run --env-file ./.env -p 8000:8000 --rm -it cognee/cognee-mcp:main --transport http + docker run -e TRANSPORT_MODE=http --env-file ./.env -p 8000:8000 --rm -it cognee/cognee-mcp:main # With SSE transport - docker run --env-file ./.env -p 8000:8000 --rm -it cognee/cognee-mcp:main --transport sse + docker run -e TRANSPORT_MODE=sse --env-file ./.env -p 8000:8000 --rm -it cognee/cognee-mcp:main # With stdio transport (default) - docker run --env-file ./.env --rm -it cognee/cognee-mcp:main + docker run -e TRANSPORT_MODE=stdio --env-file ./.env --rm -it cognee/cognee-mcp:main + ``` + +### **Important: Docker vs Direct Usage** +**Docker uses environment variables**, not command line arguments: +- ✅ Docker: `-e TRANSPORT_MODE=http` +- ❌ Docker: `--transport http` (won't work) + +**Direct Python usage** uses command line arguments: +- ✅ Direct: `python src/server.py --transport http` +- ❌ Direct: `-e TRANSPORT_MODE=http` (won't work) -## 💻 Basic Usage +## 🔗 MCP Client Configuration + +After starting your Cognee MCP server with Docker, you need to configure your MCP client to connect to it. + +### **SSE Transport Configuration** (Recommended) + +**Start the server with SSE transport:** +```bash +docker run -e TRANSPORT_MODE=sse --env-file ./.env -p 8000:8000 --rm -it cognee/cognee-mcp:main +``` + +**Configure your MCP client:** + +#### **Claude CLI (Easiest)** +```bash +claude mcp add cognee-sse -t sse http://localhost:8000/sse +``` + +**Verify the connection:** +```bash +claude mcp list +``` + +You should see your server connected: +``` +Checking MCP server health... + +cognee-sse: http://localhost:8000/sse (SSE) - ✓ Connected +``` + +#### **Manual Configuration** + +**Claude (`~/.claude.json`)** +```json +{ + "mcpServers": { + "cognee": { + "type": "sse", + "url": "http://localhost:8000/sse" + } + } +} +``` + +**Cursor (`~/.cursor/mcp.json`)** +```json +{ + "mcpServers": { + "cognee-sse": { + "url": "http://localhost:8000/sse" + } + } +} +``` + +### **HTTP Transport Configuration** (Alternative) + +**Start the server with HTTP transport:** +```bash +docker run -e TRANSPORT_MODE=http --env-file ./.env -p 8000:8000 --rm -it cognee/cognee-mcp:main +``` + +**Configure your MCP client:** + +#### **Claude CLI (Easiest)** +```bash +claude mcp add cognee-http -t http http://localhost:8000/mcp +``` + +**Verify the connection:** +```bash +claude mcp list +``` + +You should see your server connected: +``` +Checking MCP server health... + +cognee-http: http://localhost:8000/mcp (HTTP) - ✓ Connected +``` + +#### **Manual Configuration** + +**Claude (`~/.claude.json`)** +```json +{ + "mcpServers": { + "cognee": { + "type": "http", + "url": "http://localhost:8000/mcp" + } + } +} +``` + +**Cursor (`~/.cursor/mcp.json`)** +```json +{ + "mcpServers": { + "cognee-http": { + "url": "http://localhost:8000/mcp" + } + } +} +``` + +### **Dual Configuration Example** +You can configure both transports simultaneously for testing: + +```json +{ + "mcpServers": { + "cognee-sse": { + "type": "sse", + "url": "http://localhost:8000/sse" + }, + "cognee-http": { + "type": "http", + "url": "http://localhost:8000/mcp" + } + } +} +``` + +**Note:** Only enable the server you're actually running to avoid connection errors. + +## 💻 Basic Usage The MCP server exposes its functionality through tools. Call them from any MCP client (Cursor, Claude Desktop, Cline, Roo and more). @@ -155,44 +291,7 @@ delete(data_id="data-uuid", dataset_id="dataset-uuid", mode="soft") delete(data_id="data-uuid", dataset_id="dataset-uuid", mode="hard") ``` -Remember – use the CODE search type to query your code graph. For huge repos, run codify on modules incrementally and cache results. - -### IDE Example: Cursor - -1. After you run the server as described in the [Quick Start](#-quickstart), create a run script for cognee. Here is a simple example: - ``` - #!/bin/bash - export ENV=local - export TOKENIZERS_PARALLELISM=false - export EMBEDDING_PROVIDER="fastembed" - export EMBEDDING_MODEL="sentence-transformers/all-MiniLM-L6-v2" - export EMBEDDING_DIMENSIONS=384 - export EMBEDDING_MAX_TOKENS=256 - export LLM_API_KEY=your-OpenAI-API-key - uv --directory /{cognee_root_path}/cognee-mcp run cognee - ``` - Remember to replace *your-OpenAI-API-key* and *{cognee_root_path}* with correct values. - -2. Install Cursor and navigate to Settings → MCP Tools → New MCP Server - -3. Cursor will open *mcp.json* file in a new tab. Configure your cognee MCP server by copy-pasting the following: - ``` - { - "mcpServers": { - "cognee": { - "command": "sh", - "args": [ - "/{path-to-your-script}/run-cognee.sh" - ] - } - } - } - ``` - Remember to replace *{path-to-your-script}* with the correct value of the path of the script you created in the first step. - - That's it! You can refresh the server from the toggle next to your new cognee server. Check the green dot and the available tools to verify your server is running. - - Now you can open your Cursor Agent and start using cognee tools from it via prompting. +Remember – use the CODE search type to query your code graph. For huge repos, run codify on modules incrementally and cache results. ## Development and Debugging @@ -211,7 +310,7 @@ Open inspector with timeout passed: To apply new changes while developing cognee you need to do: -1. `poetry lock` in cognee folder +1. Update dependencies in cognee folder if needed 2. `uv sync --dev --all-extras --reinstall` 3. `mcp dev src/server.py` From 05295f32775a7d229e0c6c9091e7c67124289911 Mon Sep 17 00:00:00 2001 From: Daulet Amirkhanov Date: Wed, 20 Aug 2025 12:12:42 +0100 Subject: [PATCH 10/14] Remove redundant instructions --- cognee-mcp/README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/cognee-mcp/README.md b/cognee-mcp/README.md index f511810f4..8d973725b 100644 --- a/cognee-mcp/README.md +++ b/cognee-mcp/README.md @@ -291,8 +291,6 @@ delete(data_id="data-uuid", dataset_id="dataset-uuid", mode="soft") delete(data_id="data-uuid", dataset_id="dataset-uuid", mode="hard") ``` -Remember – use the CODE search type to query your code graph. For huge repos, run codify on modules incrementally and cache results. - ## Development and Debugging From 6696d37951c679a97f93c77b0413c50d4ff5f125 Mon Sep 17 00:00:00 2001 From: hajdul88 <52442977+hajdul88@users.noreply.github.com> Date: Mon, 25 Aug 2025 11:38:42 +0200 Subject: [PATCH 11/14] fix: updates notebook cognee version to 0.2.3 + deleting cell outputs --- notebooks/cognee_simple_demo.ipynb | 91 ++---------------------------- 1 file changed, 6 insertions(+), 85 deletions(-) diff --git a/notebooks/cognee_simple_demo.ipynb b/notebooks/cognee_simple_demo.ipynb index 432ef9eb3..c97b9f1f7 100644 --- a/notebooks/cognee_simple_demo.ipynb +++ b/notebooks/cognee_simple_demo.ipynb @@ -10,19 +10,11 @@ }, { "cell_type": "code", - "execution_count": 1, "id": "982b897a29a26f7d", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "zsh:1: command not found: pip\n" - ] - } - ], - "source": "!pip install cognee==0.2.0" + "source": "!pip install cognee==0.2.3", + "outputs": [], + "execution_count": null }, { "cell_type": "markdown", @@ -86,85 +78,14 @@ { "cell_type": "code", "id": "875763366723ee48", - "metadata": { - "ExecuteTime": { - "end_time": "2025-06-30T12:08:34.629436Z", - "start_time": "2025-06-30T12:08:24.800887Z" - } - }, + "metadata": {}, "source": [ "import cognee\n", "await cognee.add(file_path)\n", "await cognee.cognify()" ], - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "/Users/vasilije/cognee/.venv/lib/python3.11/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n", - " from .autonotebook import tqdm as notebook_tqdm\n" - ] - }, - { - "ename": "OperationalError", - "evalue": "(sqlite3.OperationalError) database is locked\n[SQL: \nCREATE TABLE data (\n\tid UUID NOT NULL, \n\tname VARCHAR, \n\textension VARCHAR, \n\tmime_type VARCHAR, \n\traw_data_location VARCHAR, \n\towner_id UUID, \n\tcontent_hash VARCHAR, \n\texternal_metadata JSON, \n\tnode_set JSON, \n\ttoken_count INTEGER, \n\tcreated_at DATETIME, \n\tupdated_at DATETIME, \n\tPRIMARY KEY (id)\n)\n\n]\n(Background on this error at: https://sqlalche.me/e/20/e3q8)", - "output_type": "error", - "traceback": [ - "\u001B[31m---------------------------------------------------------------------------\u001B[39m", - "\u001B[31mOperationalError\u001B[39m Traceback (most recent call last)", - "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py:1964\u001B[39m, in \u001B[36mConnection._exec_single_context\u001B[39m\u001B[34m(self, dialect, context, statement, parameters)\u001B[39m\n\u001B[32m 1963\u001B[39m \u001B[38;5;28;01mif\u001B[39;00m \u001B[38;5;129;01mnot\u001B[39;00m evt_handled:\n\u001B[32m-> \u001B[39m\u001B[32m1964\u001B[39m \u001B[38;5;28;43mself\u001B[39;49m\u001B[43m.\u001B[49m\u001B[43mdialect\u001B[49m\u001B[43m.\u001B[49m\u001B[43mdo_execute\u001B[49m\u001B[43m(\u001B[49m\n\u001B[32m 1965\u001B[39m \u001B[43m \u001B[49m\u001B[43mcursor\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mstr_statement\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43meffective_parameters\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mcontext\u001B[49m\n\u001B[32m 1966\u001B[39m \u001B[43m \u001B[49m\u001B[43m)\u001B[49m\n\u001B[32m 1968\u001B[39m \u001B[38;5;28;01mif\u001B[39;00m \u001B[38;5;28mself\u001B[39m._has_events \u001B[38;5;129;01mor\u001B[39;00m \u001B[38;5;28mself\u001B[39m.engine._has_events:\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/engine/default.py:942\u001B[39m, in \u001B[36mDefaultDialect.do_execute\u001B[39m\u001B[34m(self, cursor, statement, parameters, context)\u001B[39m\n\u001B[32m 941\u001B[39m \u001B[38;5;28;01mdef\u001B[39;00m\u001B[38;5;250m \u001B[39m\u001B[34mdo_execute\u001B[39m(\u001B[38;5;28mself\u001B[39m, cursor, statement, parameters, context=\u001B[38;5;28;01mNone\u001B[39;00m):\n\u001B[32m--> \u001B[39m\u001B[32m942\u001B[39m \u001B[43mcursor\u001B[49m\u001B[43m.\u001B[49m\u001B[43mexecute\u001B[49m\u001B[43m(\u001B[49m\u001B[43mstatement\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mparameters\u001B[49m\u001B[43m)\u001B[49m\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/dialects/sqlite/aiosqlite.py:172\u001B[39m, in \u001B[36mAsyncAdapt_aiosqlite_cursor.execute\u001B[39m\u001B[34m(self, operation, parameters)\u001B[39m\n\u001B[32m 171\u001B[39m \u001B[38;5;28;01mexcept\u001B[39;00m \u001B[38;5;167;01mException\u001B[39;00m \u001B[38;5;28;01mas\u001B[39;00m error:\n\u001B[32m--> \u001B[39m\u001B[32m172\u001B[39m \u001B[38;5;28;43mself\u001B[39;49m\u001B[43m.\u001B[49m\u001B[43m_adapt_connection\u001B[49m\u001B[43m.\u001B[49m\u001B[43m_handle_exception\u001B[49m\u001B[43m(\u001B[49m\u001B[43merror\u001B[49m\u001B[43m)\u001B[49m\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/dialects/sqlite/aiosqlite.py:323\u001B[39m, in \u001B[36mAsyncAdapt_aiosqlite_connection._handle_exception\u001B[39m\u001B[34m(self, error)\u001B[39m\n\u001B[32m 322\u001B[39m \u001B[38;5;28;01melse\u001B[39;00m:\n\u001B[32m--> \u001B[39m\u001B[32m323\u001B[39m \u001B[38;5;28;01mraise\u001B[39;00m error\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/dialects/sqlite/aiosqlite.py:154\u001B[39m, in \u001B[36mAsyncAdapt_aiosqlite_cursor.execute\u001B[39m\u001B[34m(self, operation, parameters)\u001B[39m\n\u001B[32m 153\u001B[39m \u001B[38;5;28;01melse\u001B[39;00m:\n\u001B[32m--> \u001B[39m\u001B[32m154\u001B[39m \u001B[38;5;28;43mself\u001B[39;49m\u001B[43m.\u001B[49m\u001B[43mawait_\u001B[49m\u001B[43m(\u001B[49m\u001B[43m_cursor\u001B[49m\u001B[43m.\u001B[49m\u001B[43mexecute\u001B[49m\u001B[43m(\u001B[49m\u001B[43moperation\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mparameters\u001B[49m\u001B[43m)\u001B[49m\u001B[43m)\u001B[49m\n\u001B[32m 156\u001B[39m \u001B[38;5;28;01mif\u001B[39;00m _cursor.description:\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/util/_concurrency_py3k.py:132\u001B[39m, in \u001B[36mawait_only\u001B[39m\u001B[34m(awaitable)\u001B[39m\n\u001B[32m 128\u001B[39m \u001B[38;5;66;03m# returns the control to the driver greenlet passing it\u001B[39;00m\n\u001B[32m 129\u001B[39m \u001B[38;5;66;03m# a coroutine to run. Once the awaitable is done, the driver greenlet\u001B[39;00m\n\u001B[32m 130\u001B[39m \u001B[38;5;66;03m# switches back to this greenlet with the result of awaitable that is\u001B[39;00m\n\u001B[32m 131\u001B[39m \u001B[38;5;66;03m# then returned to the caller (or raised as error)\u001B[39;00m\n\u001B[32m--> \u001B[39m\u001B[32m132\u001B[39m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[43mcurrent\u001B[49m\u001B[43m.\u001B[49m\u001B[43mparent\u001B[49m\u001B[43m.\u001B[49m\u001B[43mswitch\u001B[49m\u001B[43m(\u001B[49m\u001B[43mawaitable\u001B[49m\u001B[43m)\u001B[49m\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/util/_concurrency_py3k.py:196\u001B[39m, in \u001B[36mgreenlet_spawn\u001B[39m\u001B[34m(fn, _require_await, *args, **kwargs)\u001B[39m\n\u001B[32m 193\u001B[39m \u001B[38;5;28;01mtry\u001B[39;00m:\n\u001B[32m 194\u001B[39m \u001B[38;5;66;03m# wait for a coroutine from await_only and then return its\u001B[39;00m\n\u001B[32m 195\u001B[39m \u001B[38;5;66;03m# result back to it.\u001B[39;00m\n\u001B[32m--> \u001B[39m\u001B[32m196\u001B[39m value = \u001B[38;5;28;01mawait\u001B[39;00m result\n\u001B[32m 197\u001B[39m \u001B[38;5;28;01mexcept\u001B[39;00m \u001B[38;5;167;01mBaseException\u001B[39;00m:\n\u001B[32m 198\u001B[39m \u001B[38;5;66;03m# this allows an exception to be raised within\u001B[39;00m\n\u001B[32m 199\u001B[39m \u001B[38;5;66;03m# the moderated greenlet so that it can continue\u001B[39;00m\n\u001B[32m 200\u001B[39m \u001B[38;5;66;03m# its expected flow.\u001B[39;00m\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/aiosqlite/cursor.py:48\u001B[39m, in \u001B[36mCursor.execute\u001B[39m\u001B[34m(self, sql, parameters)\u001B[39m\n\u001B[32m 47\u001B[39m parameters = []\n\u001B[32m---> \u001B[39m\u001B[32m48\u001B[39m \u001B[38;5;28;01mawait\u001B[39;00m \u001B[38;5;28mself\u001B[39m._execute(\u001B[38;5;28mself\u001B[39m._cursor.execute, sql, parameters)\n\u001B[32m 49\u001B[39m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[38;5;28mself\u001B[39m\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/aiosqlite/cursor.py:40\u001B[39m, in \u001B[36mCursor._execute\u001B[39m\u001B[34m(self, fn, *args, **kwargs)\u001B[39m\n\u001B[32m 39\u001B[39m \u001B[38;5;250m\u001B[39m\u001B[33;03m\"\"\"Execute the given function on the shared connection's thread.\"\"\"\u001B[39;00m\n\u001B[32m---> \u001B[39m\u001B[32m40\u001B[39m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[38;5;28;01mawait\u001B[39;00m \u001B[38;5;28mself\u001B[39m._conn._execute(fn, *args, **kwargs)\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/aiosqlite/core.py:132\u001B[39m, in \u001B[36mConnection._execute\u001B[39m\u001B[34m(self, fn, *args, **kwargs)\u001B[39m\n\u001B[32m 130\u001B[39m \u001B[38;5;28mself\u001B[39m._tx.put_nowait((future, function))\n\u001B[32m--> \u001B[39m\u001B[32m132\u001B[39m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[38;5;28;01mawait\u001B[39;00m future\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/aiosqlite/core.py:115\u001B[39m, in \u001B[36mConnection.run\u001B[39m\u001B[34m(self)\u001B[39m\n\u001B[32m 114\u001B[39m LOG.debug(\u001B[33m\"\u001B[39m\u001B[33mexecuting \u001B[39m\u001B[38;5;132;01m%s\u001B[39;00m\u001B[33m\"\u001B[39m, function)\n\u001B[32m--> \u001B[39m\u001B[32m115\u001B[39m result = \u001B[43mfunction\u001B[49m\u001B[43m(\u001B[49m\u001B[43m)\u001B[49m\n\u001B[32m 116\u001B[39m LOG.debug(\u001B[33m\"\u001B[39m\u001B[33moperation \u001B[39m\u001B[38;5;132;01m%s\u001B[39;00m\u001B[33m completed\u001B[39m\u001B[33m\"\u001B[39m, function)\n", - "\u001B[31mOperationalError\u001B[39m: database is locked", - "\nThe above exception was the direct cause of the following exception:\n", - "\u001B[31mOperationalError\u001B[39m Traceback (most recent call last)", - "\u001B[36mCell\u001B[39m\u001B[36m \u001B[39m\u001B[32mIn[3]\u001B[39m\u001B[32m, line 2\u001B[39m\n\u001B[32m 1\u001B[39m \u001B[38;5;28;01mimport\u001B[39;00m\u001B[38;5;250m \u001B[39m\u001B[34;01mcognee\u001B[39;00m\n\u001B[32m----> \u001B[39m\u001B[32m2\u001B[39m \u001B[38;5;28;01mawait\u001B[39;00m cognee.add(file_path)\n\u001B[32m 3\u001B[39m \u001B[38;5;28;01mawait\u001B[39;00m cognee.cognify()\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/Projects/release_test/cognee/cognee/api/v1/add/add.py:26\u001B[39m, in \u001B[36madd\u001B[39m\u001B[34m(data, dataset_name, user, node_set, vector_db_config, graph_db_config, dataset_id)\u001B[39m\n\u001B[32m 19\u001B[39m tasks = [\n\u001B[32m 20\u001B[39m Task(resolve_data_directories),\n\u001B[32m 21\u001B[39m Task(ingest_data, dataset_name, user, node_set, dataset_id),\n\u001B[32m 22\u001B[39m ]\n\u001B[32m 24\u001B[39m pipeline_run_info = \u001B[38;5;28;01mNone\u001B[39;00m\n\u001B[32m---> \u001B[39m\u001B[32m26\u001B[39m \u001B[38;5;28;01masync\u001B[39;00m \u001B[38;5;28;01mfor\u001B[39;00m run_info \u001B[38;5;129;01min\u001B[39;00m cognee_pipeline(\n\u001B[32m 27\u001B[39m tasks=tasks,\n\u001B[32m 28\u001B[39m datasets=dataset_id \u001B[38;5;28;01mif\u001B[39;00m dataset_id \u001B[38;5;28;01melse\u001B[39;00m dataset_name,\n\u001B[32m 29\u001B[39m data=data,\n\u001B[32m 30\u001B[39m user=user,\n\u001B[32m 31\u001B[39m pipeline_name=\u001B[33m\"\u001B[39m\u001B[33madd_pipeline\u001B[39m\u001B[33m\"\u001B[39m,\n\u001B[32m 32\u001B[39m vector_db_config=vector_db_config,\n\u001B[32m 33\u001B[39m graph_db_config=graph_db_config,\n\u001B[32m 34\u001B[39m ):\n\u001B[32m 35\u001B[39m pipeline_run_info = run_info\n\u001B[32m 37\u001B[39m \u001B[38;5;28;01mreturn\u001B[39;00m pipeline_run_info\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/Projects/release_test/cognee/cognee/modules/pipelines/operations/pipeline.py:63\u001B[39m, in \u001B[36mcognee_pipeline\u001B[39m\u001B[34m(tasks, data, datasets, user, pipeline_name, vector_db_config, graph_db_config)\u001B[39m\n\u001B[32m 60\u001B[39m context_graph_db_config.set(graph_db_config)\n\u001B[32m 62\u001B[39m \u001B[38;5;66;03m# Create tables for databases\u001B[39;00m\n\u001B[32m---> \u001B[39m\u001B[32m63\u001B[39m \u001B[38;5;28;01mawait\u001B[39;00m create_relational_db_and_tables()\n\u001B[32m 64\u001B[39m \u001B[38;5;28;01mawait\u001B[39;00m create_pgvector_db_and_tables()\n\u001B[32m 66\u001B[39m \u001B[38;5;66;03m# Initialize first_run attribute if it doesn't exist\u001B[39;00m\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/Projects/release_test/cognee/cognee/infrastructure/databases/relational/create_db_and_tables.py:13\u001B[39m, in \u001B[36mcreate_db_and_tables\u001B[39m\u001B[34m()\u001B[39m\n\u001B[32m 5\u001B[39m \u001B[38;5;250m\u001B[39m\u001B[33;03m\"\"\"\u001B[39;00m\n\u001B[32m 6\u001B[39m \u001B[33;03mCreate a database and its tables.\u001B[39;00m\n\u001B[32m 7\u001B[39m \n\u001B[32m 8\u001B[39m \u001B[33;03mThis asynchronous function retrieves the relational engine and calls its method to\u001B[39;00m\n\u001B[32m 9\u001B[39m \u001B[33;03mcreate a database.\u001B[39;00m\n\u001B[32m 10\u001B[39m \u001B[33;03m\"\"\"\u001B[39;00m\n\u001B[32m 11\u001B[39m relational_engine = get_relational_engine()\n\u001B[32m---> \u001B[39m\u001B[32m13\u001B[39m \u001B[38;5;28;01mawait\u001B[39;00m relational_engine.create_database()\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/.pyenv/versions/3.11.0/lib/python3.11/contextlib.py:222\u001B[39m, in \u001B[36m_AsyncGeneratorContextManager.__aexit__\u001B[39m\u001B[34m(self, typ, value, traceback)\u001B[39m\n\u001B[32m 220\u001B[39m value = typ()\n\u001B[32m 221\u001B[39m \u001B[38;5;28;01mtry\u001B[39;00m:\n\u001B[32m--> \u001B[39m\u001B[32m222\u001B[39m \u001B[38;5;28;01mawait\u001B[39;00m \u001B[38;5;28mself\u001B[39m.gen.athrow(typ, value, traceback)\n\u001B[32m 223\u001B[39m \u001B[38;5;28;01mexcept\u001B[39;00m \u001B[38;5;167;01mStopAsyncIteration\u001B[39;00m \u001B[38;5;28;01mas\u001B[39;00m exc:\n\u001B[32m 224\u001B[39m \u001B[38;5;66;03m# Suppress StopIteration *unless* it's the same exception that\u001B[39;00m\n\u001B[32m 225\u001B[39m \u001B[38;5;66;03m# was passed to throw(). This prevents a StopIteration\u001B[39;00m\n\u001B[32m 226\u001B[39m \u001B[38;5;66;03m# raised inside the \"with\" statement from being suppressed.\u001B[39;00m\n\u001B[32m 227\u001B[39m \u001B[38;5;28;01mreturn\u001B[39;00m exc \u001B[38;5;129;01mis\u001B[39;00m \u001B[38;5;129;01mnot\u001B[39;00m value\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/ext/asyncio/engine.py:1066\u001B[39m, in \u001B[36mAsyncEngine.begin\u001B[39m\u001B[34m(self)\u001B[39m\n\u001B[32m 1064\u001B[39m \u001B[38;5;28;01masync\u001B[39;00m \u001B[38;5;28;01mwith\u001B[39;00m conn:\n\u001B[32m 1065\u001B[39m \u001B[38;5;28;01masync\u001B[39;00m \u001B[38;5;28;01mwith\u001B[39;00m conn.begin():\n\u001B[32m-> \u001B[39m\u001B[32m1066\u001B[39m \u001B[38;5;28;01myield\u001B[39;00m conn\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/Projects/release_test/cognee/cognee/infrastructure/databases/relational/sqlalchemy/SqlAlchemyAdapter.py:445\u001B[39m, in \u001B[36mSQLAlchemyAdapter.create_database\u001B[39m\u001B[34m(self)\u001B[39m\n\u001B[32m 443\u001B[39m \u001B[38;5;28;01masync\u001B[39;00m \u001B[38;5;28;01mwith\u001B[39;00m \u001B[38;5;28mself\u001B[39m.engine.begin() \u001B[38;5;28;01mas\u001B[39;00m connection:\n\u001B[32m 444\u001B[39m \u001B[38;5;28;01mif\u001B[39;00m \u001B[38;5;28mlen\u001B[39m(Base.metadata.tables.keys()) > \u001B[32m0\u001B[39m:\n\u001B[32m--> \u001B[39m\u001B[32m445\u001B[39m \u001B[38;5;28;01mawait\u001B[39;00m connection.run_sync(Base.metadata.create_all)\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/ext/asyncio/engine.py:887\u001B[39m, in \u001B[36mAsyncConnection.run_sync\u001B[39m\u001B[34m(self, fn, *arg, **kw)\u001B[39m\n\u001B[32m 819\u001B[39m \u001B[38;5;28;01masync\u001B[39;00m \u001B[38;5;28;01mdef\u001B[39;00m\u001B[38;5;250m \u001B[39m\u001B[34mrun_sync\u001B[39m(\n\u001B[32m 820\u001B[39m \u001B[38;5;28mself\u001B[39m,\n\u001B[32m 821\u001B[39m fn: Callable[Concatenate[Connection, _P], _T],\n\u001B[32m 822\u001B[39m *arg: _P.args,\n\u001B[32m 823\u001B[39m **kw: _P.kwargs,\n\u001B[32m 824\u001B[39m ) -> _T:\n\u001B[32m 825\u001B[39m \u001B[38;5;250m \u001B[39m\u001B[33;03m'''Invoke the given synchronous (i.e. not async) callable,\u001B[39;00m\n\u001B[32m 826\u001B[39m \u001B[33;03m passing a synchronous-style :class:`_engine.Connection` as the first\u001B[39;00m\n\u001B[32m 827\u001B[39m \u001B[33;03m argument.\u001B[39;00m\n\u001B[32m (...)\u001B[39m\u001B[32m 884\u001B[39m \n\u001B[32m 885\u001B[39m \u001B[33;03m '''\u001B[39;00m \u001B[38;5;66;03m# noqa: E501\u001B[39;00m\n\u001B[32m--> \u001B[39m\u001B[32m887\u001B[39m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[38;5;28;01mawait\u001B[39;00m greenlet_spawn(\n\u001B[32m 888\u001B[39m fn, \u001B[38;5;28mself\u001B[39m._proxied, *arg, _require_await=\u001B[38;5;28;01mFalse\u001B[39;00m, **kw\n\u001B[32m 889\u001B[39m )\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/util/_concurrency_py3k.py:201\u001B[39m, in \u001B[36mgreenlet_spawn\u001B[39m\u001B[34m(fn, _require_await, *args, **kwargs)\u001B[39m\n\u001B[32m 196\u001B[39m value = \u001B[38;5;28;01mawait\u001B[39;00m result\n\u001B[32m 197\u001B[39m \u001B[38;5;28;01mexcept\u001B[39;00m \u001B[38;5;167;01mBaseException\u001B[39;00m:\n\u001B[32m 198\u001B[39m \u001B[38;5;66;03m# this allows an exception to be raised within\u001B[39;00m\n\u001B[32m 199\u001B[39m \u001B[38;5;66;03m# the moderated greenlet so that it can continue\u001B[39;00m\n\u001B[32m 200\u001B[39m \u001B[38;5;66;03m# its expected flow.\u001B[39;00m\n\u001B[32m--> \u001B[39m\u001B[32m201\u001B[39m result = \u001B[43mcontext\u001B[49m\u001B[43m.\u001B[49m\u001B[43mthrow\u001B[49m\u001B[43m(\u001B[49m\u001B[43m*\u001B[49m\u001B[43msys\u001B[49m\u001B[43m.\u001B[49m\u001B[43mexc_info\u001B[49m\u001B[43m(\u001B[49m\u001B[43m)\u001B[49m\u001B[43m)\u001B[49m\n\u001B[32m 202\u001B[39m \u001B[38;5;28;01melse\u001B[39;00m:\n\u001B[32m 203\u001B[39m result = context.switch(value)\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/sql/schema.py:5907\u001B[39m, in \u001B[36mMetaData.create_all\u001B[39m\u001B[34m(self, bind, tables, checkfirst)\u001B[39m\n\u001B[32m 5883\u001B[39m \u001B[38;5;28;01mdef\u001B[39;00m\u001B[38;5;250m \u001B[39m\u001B[34mcreate_all\u001B[39m(\n\u001B[32m 5884\u001B[39m \u001B[38;5;28mself\u001B[39m,\n\u001B[32m 5885\u001B[39m bind: _CreateDropBind,\n\u001B[32m 5886\u001B[39m tables: Optional[_typing_Sequence[Table]] = \u001B[38;5;28;01mNone\u001B[39;00m,\n\u001B[32m 5887\u001B[39m checkfirst: \u001B[38;5;28mbool\u001B[39m = \u001B[38;5;28;01mTrue\u001B[39;00m,\n\u001B[32m 5888\u001B[39m ) -> \u001B[38;5;28;01mNone\u001B[39;00m:\n\u001B[32m 5889\u001B[39m \u001B[38;5;250m \u001B[39m\u001B[33;03m\"\"\"Create all tables stored in this metadata.\u001B[39;00m\n\u001B[32m 5890\u001B[39m \n\u001B[32m 5891\u001B[39m \u001B[33;03m Conditional by default, will not attempt to recreate tables already\u001B[39;00m\n\u001B[32m (...)\u001B[39m\u001B[32m 5905\u001B[39m \n\u001B[32m 5906\u001B[39m \u001B[33;03m \"\"\"\u001B[39;00m\n\u001B[32m-> \u001B[39m\u001B[32m5907\u001B[39m \u001B[43mbind\u001B[49m\u001B[43m.\u001B[49m\u001B[43m_run_ddl_visitor\u001B[49m\u001B[43m(\u001B[49m\n\u001B[32m 5908\u001B[39m \u001B[43m \u001B[49m\u001B[43mddl\u001B[49m\u001B[43m.\u001B[49m\u001B[43mSchemaGenerator\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[38;5;28;43mself\u001B[39;49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mcheckfirst\u001B[49m\u001B[43m=\u001B[49m\u001B[43mcheckfirst\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mtables\u001B[49m\u001B[43m=\u001B[49m\u001B[43mtables\u001B[49m\n\u001B[32m 5909\u001B[39m \u001B[43m \u001B[49m\u001B[43m)\u001B[49m\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py:2456\u001B[39m, in \u001B[36mConnection._run_ddl_visitor\u001B[39m\u001B[34m(self, visitorcallable, element, **kwargs)\u001B[39m\n\u001B[32m 2444\u001B[39m \u001B[38;5;28;01mdef\u001B[39;00m\u001B[38;5;250m \u001B[39m\u001B[34m_run_ddl_visitor\u001B[39m(\n\u001B[32m 2445\u001B[39m \u001B[38;5;28mself\u001B[39m,\n\u001B[32m 2446\u001B[39m visitorcallable: Type[Union[SchemaGenerator, SchemaDropper]],\n\u001B[32m 2447\u001B[39m element: SchemaItem,\n\u001B[32m 2448\u001B[39m **kwargs: Any,\n\u001B[32m 2449\u001B[39m ) -> \u001B[38;5;28;01mNone\u001B[39;00m:\n\u001B[32m 2450\u001B[39m \u001B[38;5;250m \u001B[39m\u001B[33;03m\"\"\"run a DDL visitor.\u001B[39;00m\n\u001B[32m 2451\u001B[39m \n\u001B[32m 2452\u001B[39m \u001B[33;03m This method is only here so that the MockConnection can change the\u001B[39;00m\n\u001B[32m 2453\u001B[39m \u001B[33;03m options given to the visitor so that \"checkfirst\" is skipped.\u001B[39;00m\n\u001B[32m 2454\u001B[39m \n\u001B[32m 2455\u001B[39m \u001B[33;03m \"\"\"\u001B[39;00m\n\u001B[32m-> \u001B[39m\u001B[32m2456\u001B[39m \u001B[43mvisitorcallable\u001B[49m\u001B[43m(\u001B[49m\u001B[38;5;28;43mself\u001B[39;49m\u001B[43m.\u001B[49m\u001B[43mdialect\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[38;5;28;43mself\u001B[39;49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43m*\u001B[49m\u001B[43m*\u001B[49m\u001B[43mkwargs\u001B[49m\u001B[43m)\u001B[49m\u001B[43m.\u001B[49m\u001B[43mtraverse_single\u001B[49m\u001B[43m(\u001B[49m\u001B[43melement\u001B[49m\u001B[43m)\u001B[49m\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/sql/visitors.py:664\u001B[39m, in \u001B[36mExternalTraversal.traverse_single\u001B[39m\u001B[34m(self, obj, **kw)\u001B[39m\n\u001B[32m 662\u001B[39m meth = \u001B[38;5;28mgetattr\u001B[39m(v, \u001B[33m\"\u001B[39m\u001B[33mvisit_\u001B[39m\u001B[38;5;132;01m%s\u001B[39;00m\u001B[33m\"\u001B[39m % obj.__visit_name__, \u001B[38;5;28;01mNone\u001B[39;00m)\n\u001B[32m 663\u001B[39m \u001B[38;5;28;01mif\u001B[39;00m meth:\n\u001B[32m--> \u001B[39m\u001B[32m664\u001B[39m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[43mmeth\u001B[49m\u001B[43m(\u001B[49m\u001B[43mobj\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43m*\u001B[49m\u001B[43m*\u001B[49m\u001B[43mkw\u001B[49m\u001B[43m)\u001B[49m\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/sql/ddl.py:978\u001B[39m, in \u001B[36mSchemaGenerator.visit_metadata\u001B[39m\u001B[34m(self, metadata)\u001B[39m\n\u001B[32m 976\u001B[39m \u001B[38;5;28;01mfor\u001B[39;00m table, fkcs \u001B[38;5;129;01min\u001B[39;00m collection:\n\u001B[32m 977\u001B[39m \u001B[38;5;28;01mif\u001B[39;00m table \u001B[38;5;129;01mis\u001B[39;00m \u001B[38;5;129;01mnot\u001B[39;00m \u001B[38;5;28;01mNone\u001B[39;00m:\n\u001B[32m--> \u001B[39m\u001B[32m978\u001B[39m \u001B[38;5;28;43mself\u001B[39;49m\u001B[43m.\u001B[49m\u001B[43mtraverse_single\u001B[49m\u001B[43m(\u001B[49m\n\u001B[32m 979\u001B[39m \u001B[43m \u001B[49m\u001B[43mtable\u001B[49m\u001B[43m,\u001B[49m\n\u001B[32m 980\u001B[39m \u001B[43m \u001B[49m\u001B[43mcreate_ok\u001B[49m\u001B[43m=\u001B[49m\u001B[38;5;28;43;01mTrue\u001B[39;49;00m\u001B[43m,\u001B[49m\n\u001B[32m 981\u001B[39m \u001B[43m \u001B[49m\u001B[43minclude_foreign_key_constraints\u001B[49m\u001B[43m=\u001B[49m\u001B[43mfkcs\u001B[49m\u001B[43m,\u001B[49m\n\u001B[32m 982\u001B[39m \u001B[43m \u001B[49m\u001B[43m_is_metadata_operation\u001B[49m\u001B[43m=\u001B[49m\u001B[38;5;28;43;01mTrue\u001B[39;49;00m\u001B[43m,\u001B[49m\n\u001B[32m 983\u001B[39m \u001B[43m \u001B[49m\u001B[43m)\u001B[49m\n\u001B[32m 984\u001B[39m \u001B[38;5;28;01melse\u001B[39;00m:\n\u001B[32m 985\u001B[39m \u001B[38;5;28;01mfor\u001B[39;00m fkc \u001B[38;5;129;01min\u001B[39;00m fkcs:\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/sql/visitors.py:664\u001B[39m, in \u001B[36mExternalTraversal.traverse_single\u001B[39m\u001B[34m(self, obj, **kw)\u001B[39m\n\u001B[32m 662\u001B[39m meth = \u001B[38;5;28mgetattr\u001B[39m(v, \u001B[33m\"\u001B[39m\u001B[33mvisit_\u001B[39m\u001B[38;5;132;01m%s\u001B[39;00m\u001B[33m\"\u001B[39m % obj.__visit_name__, \u001B[38;5;28;01mNone\u001B[39;00m)\n\u001B[32m 663\u001B[39m \u001B[38;5;28;01mif\u001B[39;00m meth:\n\u001B[32m--> \u001B[39m\u001B[32m664\u001B[39m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[43mmeth\u001B[49m\u001B[43m(\u001B[49m\u001B[43mobj\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43m*\u001B[49m\u001B[43m*\u001B[49m\u001B[43mkw\u001B[49m\u001B[43m)\u001B[49m\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/sql/ddl.py:1016\u001B[39m, in \u001B[36mSchemaGenerator.visit_table\u001B[39m\u001B[34m(self, table, create_ok, include_foreign_key_constraints, _is_metadata_operation)\u001B[39m\n\u001B[32m 1007\u001B[39m \u001B[38;5;28;01mif\u001B[39;00m \u001B[38;5;129;01mnot\u001B[39;00m \u001B[38;5;28mself\u001B[39m.dialect.supports_alter:\n\u001B[32m 1008\u001B[39m \u001B[38;5;66;03m# e.g., don't omit any foreign key constraints\u001B[39;00m\n\u001B[32m 1009\u001B[39m include_foreign_key_constraints = \u001B[38;5;28;01mNone\u001B[39;00m\n\u001B[32m 1011\u001B[39m \u001B[43mCreateTable\u001B[49m\u001B[43m(\u001B[49m\n\u001B[32m 1012\u001B[39m \u001B[43m \u001B[49m\u001B[43mtable\u001B[49m\u001B[43m,\u001B[49m\n\u001B[32m 1013\u001B[39m \u001B[43m \u001B[49m\u001B[43minclude_foreign_key_constraints\u001B[49m\u001B[43m=\u001B[49m\u001B[43m(\u001B[49m\n\u001B[32m 1014\u001B[39m \u001B[43m \u001B[49m\u001B[43minclude_foreign_key_constraints\u001B[49m\n\u001B[32m 1015\u001B[39m \u001B[43m \u001B[49m\u001B[43m)\u001B[49m\u001B[43m,\u001B[49m\n\u001B[32m-> \u001B[39m\u001B[32m1016\u001B[39m \u001B[43m\u001B[49m\u001B[43m)\u001B[49m\u001B[43m.\u001B[49m\u001B[43m_invoke_with\u001B[49m\u001B[43m(\u001B[49m\u001B[38;5;28;43mself\u001B[39;49m\u001B[43m.\u001B[49m\u001B[43mconnection\u001B[49m\u001B[43m)\u001B[49m\n\u001B[32m 1018\u001B[39m \u001B[38;5;28;01mif\u001B[39;00m \u001B[38;5;28mhasattr\u001B[39m(table, \u001B[33m\"\u001B[39m\u001B[33mindexes\u001B[39m\u001B[33m\"\u001B[39m):\n\u001B[32m 1019\u001B[39m \u001B[38;5;28;01mfor\u001B[39;00m index \u001B[38;5;129;01min\u001B[39;00m table.indexes:\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/sql/ddl.py:314\u001B[39m, in \u001B[36mExecutableDDLElement._invoke_with\u001B[39m\u001B[34m(self, bind)\u001B[39m\n\u001B[32m 312\u001B[39m \u001B[38;5;28;01mdef\u001B[39;00m\u001B[38;5;250m \u001B[39m\u001B[34m_invoke_with\u001B[39m(\u001B[38;5;28mself\u001B[39m, bind):\n\u001B[32m 313\u001B[39m \u001B[38;5;28;01mif\u001B[39;00m \u001B[38;5;28mself\u001B[39m._should_execute(\u001B[38;5;28mself\u001B[39m.target, bind):\n\u001B[32m--> \u001B[39m\u001B[32m314\u001B[39m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[43mbind\u001B[49m\u001B[43m.\u001B[49m\u001B[43mexecute\u001B[49m\u001B[43m(\u001B[49m\u001B[38;5;28;43mself\u001B[39;49m\u001B[43m)\u001B[49m\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py:1416\u001B[39m, in \u001B[36mConnection.execute\u001B[39m\u001B[34m(self, statement, parameters, execution_options)\u001B[39m\n\u001B[32m 1414\u001B[39m \u001B[38;5;28;01mraise\u001B[39;00m exc.ObjectNotExecutableError(statement) \u001B[38;5;28;01mfrom\u001B[39;00m\u001B[38;5;250m \u001B[39m\u001B[34;01merr\u001B[39;00m\n\u001B[32m 1415\u001B[39m \u001B[38;5;28;01melse\u001B[39;00m:\n\u001B[32m-> \u001B[39m\u001B[32m1416\u001B[39m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[43mmeth\u001B[49m\u001B[43m(\u001B[49m\n\u001B[32m 1417\u001B[39m \u001B[43m \u001B[49m\u001B[38;5;28;43mself\u001B[39;49m\u001B[43m,\u001B[49m\n\u001B[32m 1418\u001B[39m \u001B[43m \u001B[49m\u001B[43mdistilled_parameters\u001B[49m\u001B[43m,\u001B[49m\n\u001B[32m 1419\u001B[39m \u001B[43m \u001B[49m\u001B[43mexecution_options\u001B[49m\u001B[43m \u001B[49m\u001B[38;5;129;43;01mor\u001B[39;49;00m\u001B[43m \u001B[49m\u001B[43mNO_OPTIONS\u001B[49m\u001B[43m,\u001B[49m\n\u001B[32m 1420\u001B[39m \u001B[43m \u001B[49m\u001B[43m)\u001B[49m\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/sql/ddl.py:180\u001B[39m, in \u001B[36mExecutableDDLElement._execute_on_connection\u001B[39m\u001B[34m(self, connection, distilled_params, execution_options)\u001B[39m\n\u001B[32m 177\u001B[39m \u001B[38;5;28;01mdef\u001B[39;00m\u001B[38;5;250m \u001B[39m\u001B[34m_execute_on_connection\u001B[39m(\n\u001B[32m 178\u001B[39m \u001B[38;5;28mself\u001B[39m, connection, distilled_params, execution_options\n\u001B[32m 179\u001B[39m ):\n\u001B[32m--> \u001B[39m\u001B[32m180\u001B[39m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[43mconnection\u001B[49m\u001B[43m.\u001B[49m\u001B[43m_execute_ddl\u001B[49m\u001B[43m(\u001B[49m\n\u001B[32m 181\u001B[39m \u001B[43m \u001B[49m\u001B[38;5;28;43mself\u001B[39;49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mdistilled_params\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mexecution_options\u001B[49m\n\u001B[32m 182\u001B[39m \u001B[43m \u001B[49m\u001B[43m)\u001B[49m\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py:1527\u001B[39m, in \u001B[36mConnection._execute_ddl\u001B[39m\u001B[34m(self, ddl, distilled_parameters, execution_options)\u001B[39m\n\u001B[32m 1522\u001B[39m dialect = \u001B[38;5;28mself\u001B[39m.dialect\n\u001B[32m 1524\u001B[39m compiled = ddl.compile(\n\u001B[32m 1525\u001B[39m dialect=dialect, schema_translate_map=schema_translate_map\n\u001B[32m 1526\u001B[39m )\n\u001B[32m-> \u001B[39m\u001B[32m1527\u001B[39m ret = \u001B[38;5;28;43mself\u001B[39;49m\u001B[43m.\u001B[49m\u001B[43m_execute_context\u001B[49m\u001B[43m(\u001B[49m\n\u001B[32m 1528\u001B[39m \u001B[43m \u001B[49m\u001B[43mdialect\u001B[49m\u001B[43m,\u001B[49m\n\u001B[32m 1529\u001B[39m \u001B[43m \u001B[49m\u001B[43mdialect\u001B[49m\u001B[43m.\u001B[49m\u001B[43mexecution_ctx_cls\u001B[49m\u001B[43m.\u001B[49m\u001B[43m_init_ddl\u001B[49m\u001B[43m,\u001B[49m\n\u001B[32m 1530\u001B[39m \u001B[43m \u001B[49m\u001B[43mcompiled\u001B[49m\u001B[43m,\u001B[49m\n\u001B[32m 1531\u001B[39m \u001B[43m \u001B[49m\u001B[38;5;28;43;01mNone\u001B[39;49;00m\u001B[43m,\u001B[49m\n\u001B[32m 1532\u001B[39m \u001B[43m \u001B[49m\u001B[43mexec_opts\u001B[49m\u001B[43m,\u001B[49m\n\u001B[32m 1533\u001B[39m \u001B[43m \u001B[49m\u001B[43mcompiled\u001B[49m\u001B[43m,\u001B[49m\n\u001B[32m 1534\u001B[39m \u001B[43m\u001B[49m\u001B[43m)\u001B[49m\n\u001B[32m 1535\u001B[39m \u001B[38;5;28;01mif\u001B[39;00m \u001B[38;5;28mself\u001B[39m._has_events \u001B[38;5;129;01mor\u001B[39;00m \u001B[38;5;28mself\u001B[39m.engine._has_events:\n\u001B[32m 1536\u001B[39m \u001B[38;5;28mself\u001B[39m.dispatch.after_execute(\n\u001B[32m 1537\u001B[39m \u001B[38;5;28mself\u001B[39m,\n\u001B[32m 1538\u001B[39m ddl,\n\u001B[32m (...)\u001B[39m\u001B[32m 1542\u001B[39m ret,\n\u001B[32m 1543\u001B[39m )\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py:1843\u001B[39m, in \u001B[36mConnection._execute_context\u001B[39m\u001B[34m(self, dialect, constructor, statement, parameters, execution_options, *args, **kw)\u001B[39m\n\u001B[32m 1841\u001B[39m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[38;5;28mself\u001B[39m._exec_insertmany_context(dialect, context)\n\u001B[32m 1842\u001B[39m \u001B[38;5;28;01melse\u001B[39;00m:\n\u001B[32m-> \u001B[39m\u001B[32m1843\u001B[39m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[38;5;28;43mself\u001B[39;49m\u001B[43m.\u001B[49m\u001B[43m_exec_single_context\u001B[49m\u001B[43m(\u001B[49m\n\u001B[32m 1844\u001B[39m \u001B[43m \u001B[49m\u001B[43mdialect\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mcontext\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mstatement\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mparameters\u001B[49m\n\u001B[32m 1845\u001B[39m \u001B[43m \u001B[49m\u001B[43m)\u001B[49m\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py:1983\u001B[39m, in \u001B[36mConnection._exec_single_context\u001B[39m\u001B[34m(self, dialect, context, statement, parameters)\u001B[39m\n\u001B[32m 1980\u001B[39m result = context._setup_result_proxy()\n\u001B[32m 1982\u001B[39m \u001B[38;5;28;01mexcept\u001B[39;00m \u001B[38;5;167;01mBaseException\u001B[39;00m \u001B[38;5;28;01mas\u001B[39;00m e:\n\u001B[32m-> \u001B[39m\u001B[32m1983\u001B[39m \u001B[38;5;28;43mself\u001B[39;49m\u001B[43m.\u001B[49m\u001B[43m_handle_dbapi_exception\u001B[49m\u001B[43m(\u001B[49m\n\u001B[32m 1984\u001B[39m \u001B[43m \u001B[49m\u001B[43me\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mstr_statement\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43meffective_parameters\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mcursor\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mcontext\u001B[49m\n\u001B[32m 1985\u001B[39m \u001B[43m \u001B[49m\u001B[43m)\u001B[49m\n\u001B[32m 1987\u001B[39m \u001B[38;5;28;01mreturn\u001B[39;00m result\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py:2352\u001B[39m, in \u001B[36mConnection._handle_dbapi_exception\u001B[39m\u001B[34m(self, e, statement, parameters, cursor, context, is_sub_exec)\u001B[39m\n\u001B[32m 2350\u001B[39m \u001B[38;5;28;01melif\u001B[39;00m should_wrap:\n\u001B[32m 2351\u001B[39m \u001B[38;5;28;01massert\u001B[39;00m sqlalchemy_exception \u001B[38;5;129;01mis\u001B[39;00m \u001B[38;5;129;01mnot\u001B[39;00m \u001B[38;5;28;01mNone\u001B[39;00m\n\u001B[32m-> \u001B[39m\u001B[32m2352\u001B[39m \u001B[38;5;28;01mraise\u001B[39;00m sqlalchemy_exception.with_traceback(exc_info[\u001B[32m2\u001B[39m]) \u001B[38;5;28;01mfrom\u001B[39;00m\u001B[38;5;250m \u001B[39m\u001B[34;01me\u001B[39;00m\n\u001B[32m 2353\u001B[39m \u001B[38;5;28;01melse\u001B[39;00m:\n\u001B[32m 2354\u001B[39m \u001B[38;5;28;01massert\u001B[39;00m exc_info[\u001B[32m1\u001B[39m] \u001B[38;5;129;01mis\u001B[39;00m \u001B[38;5;129;01mnot\u001B[39;00m \u001B[38;5;28;01mNone\u001B[39;00m\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py:1964\u001B[39m, in \u001B[36mConnection._exec_single_context\u001B[39m\u001B[34m(self, dialect, context, statement, parameters)\u001B[39m\n\u001B[32m 1962\u001B[39m \u001B[38;5;28;01mbreak\u001B[39;00m\n\u001B[32m 1963\u001B[39m \u001B[38;5;28;01mif\u001B[39;00m \u001B[38;5;129;01mnot\u001B[39;00m evt_handled:\n\u001B[32m-> \u001B[39m\u001B[32m1964\u001B[39m \u001B[38;5;28;43mself\u001B[39;49m\u001B[43m.\u001B[49m\u001B[43mdialect\u001B[49m\u001B[43m.\u001B[49m\u001B[43mdo_execute\u001B[49m\u001B[43m(\u001B[49m\n\u001B[32m 1965\u001B[39m \u001B[43m \u001B[49m\u001B[43mcursor\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mstr_statement\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43meffective_parameters\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mcontext\u001B[49m\n\u001B[32m 1966\u001B[39m \u001B[43m \u001B[49m\u001B[43m)\u001B[49m\n\u001B[32m 1968\u001B[39m \u001B[38;5;28;01mif\u001B[39;00m \u001B[38;5;28mself\u001B[39m._has_events \u001B[38;5;129;01mor\u001B[39;00m \u001B[38;5;28mself\u001B[39m.engine._has_events:\n\u001B[32m 1969\u001B[39m \u001B[38;5;28mself\u001B[39m.dispatch.after_cursor_execute(\n\u001B[32m 1970\u001B[39m \u001B[38;5;28mself\u001B[39m,\n\u001B[32m 1971\u001B[39m cursor,\n\u001B[32m (...)\u001B[39m\u001B[32m 1975\u001B[39m context.executemany,\n\u001B[32m 1976\u001B[39m )\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/engine/default.py:942\u001B[39m, in \u001B[36mDefaultDialect.do_execute\u001B[39m\u001B[34m(self, cursor, statement, parameters, context)\u001B[39m\n\u001B[32m 941\u001B[39m \u001B[38;5;28;01mdef\u001B[39;00m\u001B[38;5;250m \u001B[39m\u001B[34mdo_execute\u001B[39m(\u001B[38;5;28mself\u001B[39m, cursor, statement, parameters, context=\u001B[38;5;28;01mNone\u001B[39;00m):\n\u001B[32m--> \u001B[39m\u001B[32m942\u001B[39m \u001B[43mcursor\u001B[49m\u001B[43m.\u001B[49m\u001B[43mexecute\u001B[49m\u001B[43m(\u001B[49m\u001B[43mstatement\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mparameters\u001B[49m\u001B[43m)\u001B[49m\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/dialects/sqlite/aiosqlite.py:172\u001B[39m, in \u001B[36mAsyncAdapt_aiosqlite_cursor.execute\u001B[39m\u001B[34m(self, operation, parameters)\u001B[39m\n\u001B[32m 170\u001B[39m \u001B[38;5;28mself\u001B[39m._cursor = _cursor\n\u001B[32m 171\u001B[39m \u001B[38;5;28;01mexcept\u001B[39;00m \u001B[38;5;167;01mException\u001B[39;00m \u001B[38;5;28;01mas\u001B[39;00m error:\n\u001B[32m--> \u001B[39m\u001B[32m172\u001B[39m \u001B[38;5;28;43mself\u001B[39;49m\u001B[43m.\u001B[49m\u001B[43m_adapt_connection\u001B[49m\u001B[43m.\u001B[49m\u001B[43m_handle_exception\u001B[49m\u001B[43m(\u001B[49m\u001B[43merror\u001B[49m\u001B[43m)\u001B[49m\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/dialects/sqlite/aiosqlite.py:323\u001B[39m, in \u001B[36mAsyncAdapt_aiosqlite_connection._handle_exception\u001B[39m\u001B[34m(self, error)\u001B[39m\n\u001B[32m 319\u001B[39m \u001B[38;5;28;01mraise\u001B[39;00m \u001B[38;5;28mself\u001B[39m.dbapi.sqlite.OperationalError(\n\u001B[32m 320\u001B[39m \u001B[33m\"\u001B[39m\u001B[33mno active connection\u001B[39m\u001B[33m\"\u001B[39m\n\u001B[32m 321\u001B[39m ) \u001B[38;5;28;01mfrom\u001B[39;00m\u001B[38;5;250m \u001B[39m\u001B[34;01merror\u001B[39;00m\n\u001B[32m 322\u001B[39m \u001B[38;5;28;01melse\u001B[39;00m:\n\u001B[32m--> \u001B[39m\u001B[32m323\u001B[39m \u001B[38;5;28;01mraise\u001B[39;00m error\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/dialects/sqlite/aiosqlite.py:154\u001B[39m, in \u001B[36mAsyncAdapt_aiosqlite_cursor.execute\u001B[39m\u001B[34m(self, operation, parameters)\u001B[39m\n\u001B[32m 152\u001B[39m \u001B[38;5;28mself\u001B[39m.await_(_cursor.execute(operation))\n\u001B[32m 153\u001B[39m \u001B[38;5;28;01melse\u001B[39;00m:\n\u001B[32m--> \u001B[39m\u001B[32m154\u001B[39m \u001B[38;5;28;43mself\u001B[39;49m\u001B[43m.\u001B[49m\u001B[43mawait_\u001B[49m\u001B[43m(\u001B[49m\u001B[43m_cursor\u001B[49m\u001B[43m.\u001B[49m\u001B[43mexecute\u001B[49m\u001B[43m(\u001B[49m\u001B[43moperation\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mparameters\u001B[49m\u001B[43m)\u001B[49m\u001B[43m)\u001B[49m\n\u001B[32m 156\u001B[39m \u001B[38;5;28;01mif\u001B[39;00m _cursor.description:\n\u001B[32m 157\u001B[39m \u001B[38;5;28mself\u001B[39m.description = _cursor.description\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/util/_concurrency_py3k.py:132\u001B[39m, in \u001B[36mawait_only\u001B[39m\u001B[34m(awaitable)\u001B[39m\n\u001B[32m 123\u001B[39m \u001B[38;5;28;01mraise\u001B[39;00m exc.MissingGreenlet(\n\u001B[32m 124\u001B[39m \u001B[33m\"\u001B[39m\u001B[33mgreenlet_spawn has not been called; can\u001B[39m\u001B[33m'\u001B[39m\u001B[33mt call await_only() \u001B[39m\u001B[33m\"\u001B[39m\n\u001B[32m 125\u001B[39m \u001B[33m\"\u001B[39m\u001B[33mhere. Was IO attempted in an unexpected place?\u001B[39m\u001B[33m\"\u001B[39m\n\u001B[32m 126\u001B[39m )\n\u001B[32m 128\u001B[39m \u001B[38;5;66;03m# returns the control to the driver greenlet passing it\u001B[39;00m\n\u001B[32m 129\u001B[39m \u001B[38;5;66;03m# a coroutine to run. Once the awaitable is done, the driver greenlet\u001B[39;00m\n\u001B[32m 130\u001B[39m \u001B[38;5;66;03m# switches back to this greenlet with the result of awaitable that is\u001B[39;00m\n\u001B[32m 131\u001B[39m \u001B[38;5;66;03m# then returned to the caller (or raised as error)\u001B[39;00m\n\u001B[32m--> \u001B[39m\u001B[32m132\u001B[39m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[43mcurrent\u001B[49m\u001B[43m.\u001B[49m\u001B[43mparent\u001B[49m\u001B[43m.\u001B[49m\u001B[43mswitch\u001B[49m\u001B[43m(\u001B[49m\u001B[43mawaitable\u001B[49m\u001B[43m)\u001B[49m\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/util/_concurrency_py3k.py:196\u001B[39m, in \u001B[36mgreenlet_spawn\u001B[39m\u001B[34m(fn, _require_await, *args, **kwargs)\u001B[39m\n\u001B[32m 192\u001B[39m switch_occurred = \u001B[38;5;28;01mTrue\u001B[39;00m\n\u001B[32m 193\u001B[39m \u001B[38;5;28;01mtry\u001B[39;00m:\n\u001B[32m 194\u001B[39m \u001B[38;5;66;03m# wait for a coroutine from await_only and then return its\u001B[39;00m\n\u001B[32m 195\u001B[39m \u001B[38;5;66;03m# result back to it.\u001B[39;00m\n\u001B[32m--> \u001B[39m\u001B[32m196\u001B[39m value = \u001B[38;5;28;01mawait\u001B[39;00m result\n\u001B[32m 197\u001B[39m \u001B[38;5;28;01mexcept\u001B[39;00m \u001B[38;5;167;01mBaseException\u001B[39;00m:\n\u001B[32m 198\u001B[39m \u001B[38;5;66;03m# this allows an exception to be raised within\u001B[39;00m\n\u001B[32m 199\u001B[39m \u001B[38;5;66;03m# the moderated greenlet so that it can continue\u001B[39;00m\n\u001B[32m 200\u001B[39m \u001B[38;5;66;03m# its expected flow.\u001B[39;00m\n\u001B[32m 201\u001B[39m result = context.throw(*sys.exc_info())\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/aiosqlite/cursor.py:48\u001B[39m, in \u001B[36mCursor.execute\u001B[39m\u001B[34m(self, sql, parameters)\u001B[39m\n\u001B[32m 46\u001B[39m \u001B[38;5;28;01mif\u001B[39;00m parameters \u001B[38;5;129;01mis\u001B[39;00m \u001B[38;5;28;01mNone\u001B[39;00m:\n\u001B[32m 47\u001B[39m parameters = []\n\u001B[32m---> \u001B[39m\u001B[32m48\u001B[39m \u001B[38;5;28;01mawait\u001B[39;00m \u001B[38;5;28mself\u001B[39m._execute(\u001B[38;5;28mself\u001B[39m._cursor.execute, sql, parameters)\n\u001B[32m 49\u001B[39m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[38;5;28mself\u001B[39m\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/aiosqlite/cursor.py:40\u001B[39m, in \u001B[36mCursor._execute\u001B[39m\u001B[34m(self, fn, *args, **kwargs)\u001B[39m\n\u001B[32m 38\u001B[39m \u001B[38;5;28;01masync\u001B[39;00m \u001B[38;5;28;01mdef\u001B[39;00m\u001B[38;5;250m \u001B[39m\u001B[34m_execute\u001B[39m(\u001B[38;5;28mself\u001B[39m, fn, *args, **kwargs):\n\u001B[32m 39\u001B[39m \u001B[38;5;250m \u001B[39m\u001B[33;03m\"\"\"Execute the given function on the shared connection's thread.\"\"\"\u001B[39;00m\n\u001B[32m---> \u001B[39m\u001B[32m40\u001B[39m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[38;5;28;01mawait\u001B[39;00m \u001B[38;5;28mself\u001B[39m._conn._execute(fn, *args, **kwargs)\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/aiosqlite/core.py:132\u001B[39m, in \u001B[36mConnection._execute\u001B[39m\u001B[34m(self, fn, *args, **kwargs)\u001B[39m\n\u001B[32m 128\u001B[39m future = asyncio.get_event_loop().create_future()\n\u001B[32m 130\u001B[39m \u001B[38;5;28mself\u001B[39m._tx.put_nowait((future, function))\n\u001B[32m--> \u001B[39m\u001B[32m132\u001B[39m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[38;5;28;01mawait\u001B[39;00m future\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/aiosqlite/core.py:115\u001B[39m, in \u001B[36mConnection.run\u001B[39m\u001B[34m(self)\u001B[39m\n\u001B[32m 113\u001B[39m \u001B[38;5;28;01mtry\u001B[39;00m:\n\u001B[32m 114\u001B[39m LOG.debug(\u001B[33m\"\u001B[39m\u001B[33mexecuting \u001B[39m\u001B[38;5;132;01m%s\u001B[39;00m\u001B[33m\"\u001B[39m, function)\n\u001B[32m--> \u001B[39m\u001B[32m115\u001B[39m result = \u001B[43mfunction\u001B[49m\u001B[43m(\u001B[49m\u001B[43m)\u001B[49m\n\u001B[32m 116\u001B[39m LOG.debug(\u001B[33m\"\u001B[39m\u001B[33moperation \u001B[39m\u001B[38;5;132;01m%s\u001B[39;00m\u001B[33m completed\u001B[39m\u001B[33m\"\u001B[39m, function)\n\u001B[32m 117\u001B[39m future.get_loop().call_soon_threadsafe(set_result, future, result)\n", - "\u001B[31mOperationalError\u001B[39m: (sqlite3.OperationalError) database is locked\n[SQL: \nCREATE TABLE data (\n\tid UUID NOT NULL, \n\tname VARCHAR, \n\textension VARCHAR, \n\tmime_type VARCHAR, \n\traw_data_location VARCHAR, \n\towner_id UUID, \n\tcontent_hash VARCHAR, \n\texternal_metadata JSON, \n\tnode_set JSON, \n\ttoken_count INTEGER, \n\tcreated_at DATETIME, \n\tupdated_at DATETIME, \n\tPRIMARY KEY (id)\n)\n\n]\n(Background on this error at: https://sqlalche.me/e/20/e3q8)" - ] - } - ], - "execution_count": 3 + "outputs": [], + "execution_count": null }, { "cell_type": "markdown", From 5d402899aae7065ef3e7a75b163a66cfd55fb847 Mon Sep 17 00:00:00 2001 From: hajdul88 <52442977+hajdul88@users.noreply.github.com> Date: Mon, 25 Aug 2025 11:52:54 +0200 Subject: [PATCH 12/14] chore deleting empty notebook from cognee --- .../github_analysis_step_by_step.ipynb | 37 ------------------- 1 file changed, 37 deletions(-) delete mode 100644 cognee/notebooks/github_analysis_step_by_step.ipynb diff --git a/cognee/notebooks/github_analysis_step_by_step.ipynb b/cognee/notebooks/github_analysis_step_by_step.ipynb deleted file mode 100644 index 54f657bb0..000000000 --- a/cognee/notebooks/github_analysis_step_by_step.ipynb +++ /dev/null @@ -1,37 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": null, - "id": "initial_id", - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [ - "" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.6" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} From f07e0be1ae57c9988add8ee6b25447583d321a72 Mon Sep 17 00:00:00 2001 From: hajdul88 <52442977+hajdul88@users.noreply.github.com> Date: Mon, 25 Aug 2025 11:56:44 +0200 Subject: [PATCH 13/14] chore: removes cell output --- notebooks/cognee_multimedia_demo.ipynb | 84 +------------------------- 1 file changed, 3 insertions(+), 81 deletions(-) diff --git a/notebooks/cognee_multimedia_demo.ipynb b/notebooks/cognee_multimedia_demo.ipynb index eeb6c156d..235426c80 100644 --- a/notebooks/cognee_multimedia_demo.ipynb +++ b/notebooks/cognee_multimedia_demo.ipynb @@ -106,12 +106,7 @@ }, { "cell_type": "code", - "metadata": { - "ExecuteTime": { - "end_time": "2025-06-30T11:55:01.959946Z", - "start_time": "2025-06-30T11:54:50.569659Z" - } - }, + "metadata": {}, "source": [ "import cognee\n", "\n", @@ -125,74 +120,8 @@ "# Create knowledge graph with cognee\n", "await cognee.cognify()" ], - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "/Users/vasilije/cognee/.venv/lib/python3.11/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n", - " from .autonotebook import tqdm as notebook_tqdm\n" - ] - }, - { - "ename": "OperationalError", - "evalue": "(sqlite3.OperationalError) database is locked\n[SQL: \nCREATE TABLE data (\n\tid UUID NOT NULL, \n\tname VARCHAR, \n\textension VARCHAR, \n\tmime_type VARCHAR, \n\traw_data_location VARCHAR, \n\towner_id UUID, \n\tcontent_hash VARCHAR, \n\texternal_metadata JSON, \n\tnode_set JSON, \n\ttoken_count INTEGER, \n\tcreated_at DATETIME, \n\tupdated_at DATETIME, \n\tPRIMARY KEY (id)\n)\n\n]\n(Background on this error at: https://sqlalche.me/e/20/e3q8)", - "output_type": "error", - "traceback": [ - "\u001B[31m---------------------------------------------------------------------------\u001B[39m", - "\u001B[31mOperationalError\u001B[39m Traceback (most recent call last)", - "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py:1964\u001B[39m, in \u001B[36mConnection._exec_single_context\u001B[39m\u001B[34m(self, dialect, context, statement, parameters)\u001B[39m\n\u001B[32m 1963\u001B[39m \u001B[38;5;28;01mif\u001B[39;00m \u001B[38;5;129;01mnot\u001B[39;00m evt_handled:\n\u001B[32m-> \u001B[39m\u001B[32m1964\u001B[39m \u001B[38;5;28;43mself\u001B[39;49m\u001B[43m.\u001B[49m\u001B[43mdialect\u001B[49m\u001B[43m.\u001B[49m\u001B[43mdo_execute\u001B[49m\u001B[43m(\u001B[49m\n\u001B[32m 1965\u001B[39m \u001B[43m \u001B[49m\u001B[43mcursor\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mstr_statement\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43meffective_parameters\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mcontext\u001B[49m\n\u001B[32m 1966\u001B[39m \u001B[43m \u001B[49m\u001B[43m)\u001B[49m\n\u001B[32m 1968\u001B[39m \u001B[38;5;28;01mif\u001B[39;00m \u001B[38;5;28mself\u001B[39m._has_events \u001B[38;5;129;01mor\u001B[39;00m \u001B[38;5;28mself\u001B[39m.engine._has_events:\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/engine/default.py:942\u001B[39m, in \u001B[36mDefaultDialect.do_execute\u001B[39m\u001B[34m(self, cursor, statement, parameters, context)\u001B[39m\n\u001B[32m 941\u001B[39m \u001B[38;5;28;01mdef\u001B[39;00m\u001B[38;5;250m \u001B[39m\u001B[34mdo_execute\u001B[39m(\u001B[38;5;28mself\u001B[39m, cursor, statement, parameters, context=\u001B[38;5;28;01mNone\u001B[39;00m):\n\u001B[32m--> \u001B[39m\u001B[32m942\u001B[39m \u001B[43mcursor\u001B[49m\u001B[43m.\u001B[49m\u001B[43mexecute\u001B[49m\u001B[43m(\u001B[49m\u001B[43mstatement\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mparameters\u001B[49m\u001B[43m)\u001B[49m\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/dialects/sqlite/aiosqlite.py:172\u001B[39m, in \u001B[36mAsyncAdapt_aiosqlite_cursor.execute\u001B[39m\u001B[34m(self, operation, parameters)\u001B[39m\n\u001B[32m 171\u001B[39m \u001B[38;5;28;01mexcept\u001B[39;00m \u001B[38;5;167;01mException\u001B[39;00m \u001B[38;5;28;01mas\u001B[39;00m error:\n\u001B[32m--> \u001B[39m\u001B[32m172\u001B[39m \u001B[38;5;28;43mself\u001B[39;49m\u001B[43m.\u001B[49m\u001B[43m_adapt_connection\u001B[49m\u001B[43m.\u001B[49m\u001B[43m_handle_exception\u001B[49m\u001B[43m(\u001B[49m\u001B[43merror\u001B[49m\u001B[43m)\u001B[49m\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/dialects/sqlite/aiosqlite.py:323\u001B[39m, in \u001B[36mAsyncAdapt_aiosqlite_connection._handle_exception\u001B[39m\u001B[34m(self, error)\u001B[39m\n\u001B[32m 322\u001B[39m \u001B[38;5;28;01melse\u001B[39;00m:\n\u001B[32m--> \u001B[39m\u001B[32m323\u001B[39m \u001B[38;5;28;01mraise\u001B[39;00m error\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/dialects/sqlite/aiosqlite.py:154\u001B[39m, in \u001B[36mAsyncAdapt_aiosqlite_cursor.execute\u001B[39m\u001B[34m(self, operation, parameters)\u001B[39m\n\u001B[32m 153\u001B[39m \u001B[38;5;28;01melse\u001B[39;00m:\n\u001B[32m--> \u001B[39m\u001B[32m154\u001B[39m \u001B[38;5;28;43mself\u001B[39;49m\u001B[43m.\u001B[49m\u001B[43mawait_\u001B[49m\u001B[43m(\u001B[49m\u001B[43m_cursor\u001B[49m\u001B[43m.\u001B[49m\u001B[43mexecute\u001B[49m\u001B[43m(\u001B[49m\u001B[43moperation\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mparameters\u001B[49m\u001B[43m)\u001B[49m\u001B[43m)\u001B[49m\n\u001B[32m 156\u001B[39m \u001B[38;5;28;01mif\u001B[39;00m _cursor.description:\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/util/_concurrency_py3k.py:132\u001B[39m, in \u001B[36mawait_only\u001B[39m\u001B[34m(awaitable)\u001B[39m\n\u001B[32m 128\u001B[39m \u001B[38;5;66;03m# returns the control to the driver greenlet passing it\u001B[39;00m\n\u001B[32m 129\u001B[39m \u001B[38;5;66;03m# a coroutine to run. Once the awaitable is done, the driver greenlet\u001B[39;00m\n\u001B[32m 130\u001B[39m \u001B[38;5;66;03m# switches back to this greenlet with the result of awaitable that is\u001B[39;00m\n\u001B[32m 131\u001B[39m \u001B[38;5;66;03m# then returned to the caller (or raised as error)\u001B[39;00m\n\u001B[32m--> \u001B[39m\u001B[32m132\u001B[39m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[43mcurrent\u001B[49m\u001B[43m.\u001B[49m\u001B[43mparent\u001B[49m\u001B[43m.\u001B[49m\u001B[43mswitch\u001B[49m\u001B[43m(\u001B[49m\u001B[43mawaitable\u001B[49m\u001B[43m)\u001B[49m\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/util/_concurrency_py3k.py:196\u001B[39m, in \u001B[36mgreenlet_spawn\u001B[39m\u001B[34m(fn, _require_await, *args, **kwargs)\u001B[39m\n\u001B[32m 193\u001B[39m \u001B[38;5;28;01mtry\u001B[39;00m:\n\u001B[32m 194\u001B[39m \u001B[38;5;66;03m# wait for a coroutine from await_only and then return its\u001B[39;00m\n\u001B[32m 195\u001B[39m \u001B[38;5;66;03m# result back to it.\u001B[39;00m\n\u001B[32m--> \u001B[39m\u001B[32m196\u001B[39m value = \u001B[38;5;28;01mawait\u001B[39;00m result\n\u001B[32m 197\u001B[39m \u001B[38;5;28;01mexcept\u001B[39;00m \u001B[38;5;167;01mBaseException\u001B[39;00m:\n\u001B[32m 198\u001B[39m \u001B[38;5;66;03m# this allows an exception to be raised within\u001B[39;00m\n\u001B[32m 199\u001B[39m \u001B[38;5;66;03m# the moderated greenlet so that it can continue\u001B[39;00m\n\u001B[32m 200\u001B[39m \u001B[38;5;66;03m# its expected flow.\u001B[39;00m\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/aiosqlite/cursor.py:48\u001B[39m, in \u001B[36mCursor.execute\u001B[39m\u001B[34m(self, sql, parameters)\u001B[39m\n\u001B[32m 47\u001B[39m parameters = []\n\u001B[32m---> \u001B[39m\u001B[32m48\u001B[39m \u001B[38;5;28;01mawait\u001B[39;00m \u001B[38;5;28mself\u001B[39m._execute(\u001B[38;5;28mself\u001B[39m._cursor.execute, sql, parameters)\n\u001B[32m 49\u001B[39m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[38;5;28mself\u001B[39m\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/aiosqlite/cursor.py:40\u001B[39m, in \u001B[36mCursor._execute\u001B[39m\u001B[34m(self, fn, *args, **kwargs)\u001B[39m\n\u001B[32m 39\u001B[39m \u001B[38;5;250m\u001B[39m\u001B[33;03m\"\"\"Execute the given function on the shared connection's thread.\"\"\"\u001B[39;00m\n\u001B[32m---> \u001B[39m\u001B[32m40\u001B[39m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[38;5;28;01mawait\u001B[39;00m \u001B[38;5;28mself\u001B[39m._conn._execute(fn, *args, **kwargs)\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/aiosqlite/core.py:132\u001B[39m, in \u001B[36mConnection._execute\u001B[39m\u001B[34m(self, fn, *args, **kwargs)\u001B[39m\n\u001B[32m 130\u001B[39m \u001B[38;5;28mself\u001B[39m._tx.put_nowait((future, function))\n\u001B[32m--> \u001B[39m\u001B[32m132\u001B[39m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[38;5;28;01mawait\u001B[39;00m future\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/aiosqlite/core.py:115\u001B[39m, in \u001B[36mConnection.run\u001B[39m\u001B[34m(self)\u001B[39m\n\u001B[32m 114\u001B[39m LOG.debug(\u001B[33m\"\u001B[39m\u001B[33mexecuting \u001B[39m\u001B[38;5;132;01m%s\u001B[39;00m\u001B[33m\"\u001B[39m, function)\n\u001B[32m--> \u001B[39m\u001B[32m115\u001B[39m result = \u001B[43mfunction\u001B[49m\u001B[43m(\u001B[49m\u001B[43m)\u001B[49m\n\u001B[32m 116\u001B[39m LOG.debug(\u001B[33m\"\u001B[39m\u001B[33moperation \u001B[39m\u001B[38;5;132;01m%s\u001B[39;00m\u001B[33m completed\u001B[39m\u001B[33m\"\u001B[39m, function)\n", - "\u001B[31mOperationalError\u001B[39m: database is locked", - "\nThe above exception was the direct cause of the following exception:\n", - "\u001B[31mOperationalError\u001B[39m Traceback (most recent call last)", - "\u001B[36mCell\u001B[39m\u001B[36m \u001B[39m\u001B[32mIn[3]\u001B[39m\u001B[32m, line 8\u001B[39m\n\u001B[32m 5\u001B[39m \u001B[38;5;28;01mawait\u001B[39;00m cognee.prune.prune_system(metadata=\u001B[38;5;28;01mTrue\u001B[39;00m)\n\u001B[32m 7\u001B[39m \u001B[38;5;66;03m# Add multimedia files and make them available for cognify\u001B[39;00m\n\u001B[32m----> \u001B[39m\u001B[32m8\u001B[39m \u001B[38;5;28;01mawait\u001B[39;00m cognee.add([mp3_file_path, png_file_path])\n\u001B[32m 10\u001B[39m \u001B[38;5;66;03m# Create knowledge graph with cognee\u001B[39;00m\n\u001B[32m 11\u001B[39m \u001B[38;5;28;01mawait\u001B[39;00m cognee.cognify()\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/Projects/release_test/cognee/cognee/api/v1/add/add.py:26\u001B[39m, in \u001B[36madd\u001B[39m\u001B[34m(data, dataset_name, user, node_set, vector_db_config, graph_db_config, dataset_id)\u001B[39m\n\u001B[32m 19\u001B[39m tasks = [\n\u001B[32m 20\u001B[39m Task(resolve_data_directories),\n\u001B[32m 21\u001B[39m Task(ingest_data, dataset_name, user, node_set, dataset_id),\n\u001B[32m 22\u001B[39m ]\n\u001B[32m 24\u001B[39m pipeline_run_info = \u001B[38;5;28;01mNone\u001B[39;00m\n\u001B[32m---> \u001B[39m\u001B[32m26\u001B[39m \u001B[38;5;28;01masync\u001B[39;00m \u001B[38;5;28;01mfor\u001B[39;00m run_info \u001B[38;5;129;01min\u001B[39;00m cognee_pipeline(\n\u001B[32m 27\u001B[39m tasks=tasks,\n\u001B[32m 28\u001B[39m datasets=dataset_id \u001B[38;5;28;01mif\u001B[39;00m dataset_id \u001B[38;5;28;01melse\u001B[39;00m dataset_name,\n\u001B[32m 29\u001B[39m data=data,\n\u001B[32m 30\u001B[39m user=user,\n\u001B[32m 31\u001B[39m pipeline_name=\u001B[33m\"\u001B[39m\u001B[33madd_pipeline\u001B[39m\u001B[33m\"\u001B[39m,\n\u001B[32m 32\u001B[39m vector_db_config=vector_db_config,\n\u001B[32m 33\u001B[39m graph_db_config=graph_db_config,\n\u001B[32m 34\u001B[39m ):\n\u001B[32m 35\u001B[39m pipeline_run_info = run_info\n\u001B[32m 37\u001B[39m \u001B[38;5;28;01mreturn\u001B[39;00m pipeline_run_info\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/Projects/release_test/cognee/cognee/modules/pipelines/operations/pipeline.py:63\u001B[39m, in \u001B[36mcognee_pipeline\u001B[39m\u001B[34m(tasks, data, datasets, user, pipeline_name, vector_db_config, graph_db_config)\u001B[39m\n\u001B[32m 60\u001B[39m context_graph_db_config.set(graph_db_config)\n\u001B[32m 62\u001B[39m \u001B[38;5;66;03m# Create tables for databases\u001B[39;00m\n\u001B[32m---> \u001B[39m\u001B[32m63\u001B[39m \u001B[38;5;28;01mawait\u001B[39;00m create_relational_db_and_tables()\n\u001B[32m 64\u001B[39m \u001B[38;5;28;01mawait\u001B[39;00m create_pgvector_db_and_tables()\n\u001B[32m 66\u001B[39m \u001B[38;5;66;03m# Initialize first_run attribute if it doesn't exist\u001B[39;00m\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/Projects/release_test/cognee/cognee/infrastructure/databases/relational/create_db_and_tables.py:13\u001B[39m, in \u001B[36mcreate_db_and_tables\u001B[39m\u001B[34m()\u001B[39m\n\u001B[32m 5\u001B[39m \u001B[38;5;250m\u001B[39m\u001B[33;03m\"\"\"\u001B[39;00m\n\u001B[32m 6\u001B[39m \u001B[33;03mCreate a database and its tables.\u001B[39;00m\n\u001B[32m 7\u001B[39m \n\u001B[32m 8\u001B[39m \u001B[33;03mThis asynchronous function retrieves the relational engine and calls its method to\u001B[39;00m\n\u001B[32m 9\u001B[39m \u001B[33;03mcreate a database.\u001B[39;00m\n\u001B[32m 10\u001B[39m \u001B[33;03m\"\"\"\u001B[39;00m\n\u001B[32m 11\u001B[39m relational_engine = get_relational_engine()\n\u001B[32m---> \u001B[39m\u001B[32m13\u001B[39m \u001B[38;5;28;01mawait\u001B[39;00m relational_engine.create_database()\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/.pyenv/versions/3.11.0/lib/python3.11/contextlib.py:222\u001B[39m, in \u001B[36m_AsyncGeneratorContextManager.__aexit__\u001B[39m\u001B[34m(self, typ, value, traceback)\u001B[39m\n\u001B[32m 220\u001B[39m value = typ()\n\u001B[32m 221\u001B[39m \u001B[38;5;28;01mtry\u001B[39;00m:\n\u001B[32m--> \u001B[39m\u001B[32m222\u001B[39m \u001B[38;5;28;01mawait\u001B[39;00m \u001B[38;5;28mself\u001B[39m.gen.athrow(typ, value, traceback)\n\u001B[32m 223\u001B[39m \u001B[38;5;28;01mexcept\u001B[39;00m \u001B[38;5;167;01mStopAsyncIteration\u001B[39;00m \u001B[38;5;28;01mas\u001B[39;00m exc:\n\u001B[32m 224\u001B[39m \u001B[38;5;66;03m# Suppress StopIteration *unless* it's the same exception that\u001B[39;00m\n\u001B[32m 225\u001B[39m \u001B[38;5;66;03m# was passed to throw(). This prevents a StopIteration\u001B[39;00m\n\u001B[32m 226\u001B[39m \u001B[38;5;66;03m# raised inside the \"with\" statement from being suppressed.\u001B[39;00m\n\u001B[32m 227\u001B[39m \u001B[38;5;28;01mreturn\u001B[39;00m exc \u001B[38;5;129;01mis\u001B[39;00m \u001B[38;5;129;01mnot\u001B[39;00m value\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/ext/asyncio/engine.py:1066\u001B[39m, in \u001B[36mAsyncEngine.begin\u001B[39m\u001B[34m(self)\u001B[39m\n\u001B[32m 1064\u001B[39m \u001B[38;5;28;01masync\u001B[39;00m \u001B[38;5;28;01mwith\u001B[39;00m conn:\n\u001B[32m 1065\u001B[39m \u001B[38;5;28;01masync\u001B[39;00m \u001B[38;5;28;01mwith\u001B[39;00m conn.begin():\n\u001B[32m-> \u001B[39m\u001B[32m1066\u001B[39m \u001B[38;5;28;01myield\u001B[39;00m conn\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/Projects/release_test/cognee/cognee/infrastructure/databases/relational/sqlalchemy/SqlAlchemyAdapter.py:445\u001B[39m, in \u001B[36mSQLAlchemyAdapter.create_database\u001B[39m\u001B[34m(self)\u001B[39m\n\u001B[32m 443\u001B[39m \u001B[38;5;28;01masync\u001B[39;00m \u001B[38;5;28;01mwith\u001B[39;00m \u001B[38;5;28mself\u001B[39m.engine.begin() \u001B[38;5;28;01mas\u001B[39;00m connection:\n\u001B[32m 444\u001B[39m \u001B[38;5;28;01mif\u001B[39;00m \u001B[38;5;28mlen\u001B[39m(Base.metadata.tables.keys()) > \u001B[32m0\u001B[39m:\n\u001B[32m--> \u001B[39m\u001B[32m445\u001B[39m \u001B[38;5;28;01mawait\u001B[39;00m connection.run_sync(Base.metadata.create_all)\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/ext/asyncio/engine.py:887\u001B[39m, in \u001B[36mAsyncConnection.run_sync\u001B[39m\u001B[34m(self, fn, *arg, **kw)\u001B[39m\n\u001B[32m 819\u001B[39m \u001B[38;5;28;01masync\u001B[39;00m \u001B[38;5;28;01mdef\u001B[39;00m\u001B[38;5;250m \u001B[39m\u001B[34mrun_sync\u001B[39m(\n\u001B[32m 820\u001B[39m \u001B[38;5;28mself\u001B[39m,\n\u001B[32m 821\u001B[39m fn: Callable[Concatenate[Connection, _P], _T],\n\u001B[32m 822\u001B[39m *arg: _P.args,\n\u001B[32m 823\u001B[39m **kw: _P.kwargs,\n\u001B[32m 824\u001B[39m ) -> _T:\n\u001B[32m 825\u001B[39m \u001B[38;5;250m \u001B[39m\u001B[33;03m'''Invoke the given synchronous (i.e. not async) callable,\u001B[39;00m\n\u001B[32m 826\u001B[39m \u001B[33;03m passing a synchronous-style :class:`_engine.Connection` as the first\u001B[39;00m\n\u001B[32m 827\u001B[39m \u001B[33;03m argument.\u001B[39;00m\n\u001B[32m (...)\u001B[39m\u001B[32m 884\u001B[39m \n\u001B[32m 885\u001B[39m \u001B[33;03m '''\u001B[39;00m \u001B[38;5;66;03m# noqa: E501\u001B[39;00m\n\u001B[32m--> \u001B[39m\u001B[32m887\u001B[39m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[38;5;28;01mawait\u001B[39;00m greenlet_spawn(\n\u001B[32m 888\u001B[39m fn, \u001B[38;5;28mself\u001B[39m._proxied, *arg, _require_await=\u001B[38;5;28;01mFalse\u001B[39;00m, **kw\n\u001B[32m 889\u001B[39m )\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/util/_concurrency_py3k.py:201\u001B[39m, in \u001B[36mgreenlet_spawn\u001B[39m\u001B[34m(fn, _require_await, *args, **kwargs)\u001B[39m\n\u001B[32m 196\u001B[39m value = \u001B[38;5;28;01mawait\u001B[39;00m result\n\u001B[32m 197\u001B[39m \u001B[38;5;28;01mexcept\u001B[39;00m \u001B[38;5;167;01mBaseException\u001B[39;00m:\n\u001B[32m 198\u001B[39m \u001B[38;5;66;03m# this allows an exception to be raised within\u001B[39;00m\n\u001B[32m 199\u001B[39m \u001B[38;5;66;03m# the moderated greenlet so that it can continue\u001B[39;00m\n\u001B[32m 200\u001B[39m \u001B[38;5;66;03m# its expected flow.\u001B[39;00m\n\u001B[32m--> \u001B[39m\u001B[32m201\u001B[39m result = \u001B[43mcontext\u001B[49m\u001B[43m.\u001B[49m\u001B[43mthrow\u001B[49m\u001B[43m(\u001B[49m\u001B[43m*\u001B[49m\u001B[43msys\u001B[49m\u001B[43m.\u001B[49m\u001B[43mexc_info\u001B[49m\u001B[43m(\u001B[49m\u001B[43m)\u001B[49m\u001B[43m)\u001B[49m\n\u001B[32m 202\u001B[39m \u001B[38;5;28;01melse\u001B[39;00m:\n\u001B[32m 203\u001B[39m result = context.switch(value)\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/sql/schema.py:5907\u001B[39m, in \u001B[36mMetaData.create_all\u001B[39m\u001B[34m(self, bind, tables, checkfirst)\u001B[39m\n\u001B[32m 5883\u001B[39m \u001B[38;5;28;01mdef\u001B[39;00m\u001B[38;5;250m \u001B[39m\u001B[34mcreate_all\u001B[39m(\n\u001B[32m 5884\u001B[39m \u001B[38;5;28mself\u001B[39m,\n\u001B[32m 5885\u001B[39m bind: _CreateDropBind,\n\u001B[32m 5886\u001B[39m tables: Optional[_typing_Sequence[Table]] = \u001B[38;5;28;01mNone\u001B[39;00m,\n\u001B[32m 5887\u001B[39m checkfirst: \u001B[38;5;28mbool\u001B[39m = \u001B[38;5;28;01mTrue\u001B[39;00m,\n\u001B[32m 5888\u001B[39m ) -> \u001B[38;5;28;01mNone\u001B[39;00m:\n\u001B[32m 5889\u001B[39m \u001B[38;5;250m \u001B[39m\u001B[33;03m\"\"\"Create all tables stored in this metadata.\u001B[39;00m\n\u001B[32m 5890\u001B[39m \n\u001B[32m 5891\u001B[39m \u001B[33;03m Conditional by default, will not attempt to recreate tables already\u001B[39;00m\n\u001B[32m (...)\u001B[39m\u001B[32m 5905\u001B[39m \n\u001B[32m 5906\u001B[39m \u001B[33;03m \"\"\"\u001B[39;00m\n\u001B[32m-> \u001B[39m\u001B[32m5907\u001B[39m \u001B[43mbind\u001B[49m\u001B[43m.\u001B[49m\u001B[43m_run_ddl_visitor\u001B[49m\u001B[43m(\u001B[49m\n\u001B[32m 5908\u001B[39m \u001B[43m \u001B[49m\u001B[43mddl\u001B[49m\u001B[43m.\u001B[49m\u001B[43mSchemaGenerator\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[38;5;28;43mself\u001B[39;49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mcheckfirst\u001B[49m\u001B[43m=\u001B[49m\u001B[43mcheckfirst\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mtables\u001B[49m\u001B[43m=\u001B[49m\u001B[43mtables\u001B[49m\n\u001B[32m 5909\u001B[39m \u001B[43m \u001B[49m\u001B[43m)\u001B[49m\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py:2456\u001B[39m, in \u001B[36mConnection._run_ddl_visitor\u001B[39m\u001B[34m(self, visitorcallable, element, **kwargs)\u001B[39m\n\u001B[32m 2444\u001B[39m \u001B[38;5;28;01mdef\u001B[39;00m\u001B[38;5;250m \u001B[39m\u001B[34m_run_ddl_visitor\u001B[39m(\n\u001B[32m 2445\u001B[39m \u001B[38;5;28mself\u001B[39m,\n\u001B[32m 2446\u001B[39m visitorcallable: Type[Union[SchemaGenerator, SchemaDropper]],\n\u001B[32m 2447\u001B[39m element: SchemaItem,\n\u001B[32m 2448\u001B[39m **kwargs: Any,\n\u001B[32m 2449\u001B[39m ) -> \u001B[38;5;28;01mNone\u001B[39;00m:\n\u001B[32m 2450\u001B[39m \u001B[38;5;250m \u001B[39m\u001B[33;03m\"\"\"run a DDL visitor.\u001B[39;00m\n\u001B[32m 2451\u001B[39m \n\u001B[32m 2452\u001B[39m \u001B[33;03m This method is only here so that the MockConnection can change the\u001B[39;00m\n\u001B[32m 2453\u001B[39m \u001B[33;03m options given to the visitor so that \"checkfirst\" is skipped.\u001B[39;00m\n\u001B[32m 2454\u001B[39m \n\u001B[32m 2455\u001B[39m \u001B[33;03m \"\"\"\u001B[39;00m\n\u001B[32m-> \u001B[39m\u001B[32m2456\u001B[39m \u001B[43mvisitorcallable\u001B[49m\u001B[43m(\u001B[49m\u001B[38;5;28;43mself\u001B[39;49m\u001B[43m.\u001B[49m\u001B[43mdialect\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[38;5;28;43mself\u001B[39;49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43m*\u001B[49m\u001B[43m*\u001B[49m\u001B[43mkwargs\u001B[49m\u001B[43m)\u001B[49m\u001B[43m.\u001B[49m\u001B[43mtraverse_single\u001B[49m\u001B[43m(\u001B[49m\u001B[43melement\u001B[49m\u001B[43m)\u001B[49m\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/sql/visitors.py:664\u001B[39m, in \u001B[36mExternalTraversal.traverse_single\u001B[39m\u001B[34m(self, obj, **kw)\u001B[39m\n\u001B[32m 662\u001B[39m meth = \u001B[38;5;28mgetattr\u001B[39m(v, \u001B[33m\"\u001B[39m\u001B[33mvisit_\u001B[39m\u001B[38;5;132;01m%s\u001B[39;00m\u001B[33m\"\u001B[39m % obj.__visit_name__, \u001B[38;5;28;01mNone\u001B[39;00m)\n\u001B[32m 663\u001B[39m \u001B[38;5;28;01mif\u001B[39;00m meth:\n\u001B[32m--> \u001B[39m\u001B[32m664\u001B[39m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[43mmeth\u001B[49m\u001B[43m(\u001B[49m\u001B[43mobj\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43m*\u001B[49m\u001B[43m*\u001B[49m\u001B[43mkw\u001B[49m\u001B[43m)\u001B[49m\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/sql/ddl.py:978\u001B[39m, in \u001B[36mSchemaGenerator.visit_metadata\u001B[39m\u001B[34m(self, metadata)\u001B[39m\n\u001B[32m 976\u001B[39m \u001B[38;5;28;01mfor\u001B[39;00m table, fkcs \u001B[38;5;129;01min\u001B[39;00m collection:\n\u001B[32m 977\u001B[39m \u001B[38;5;28;01mif\u001B[39;00m table \u001B[38;5;129;01mis\u001B[39;00m \u001B[38;5;129;01mnot\u001B[39;00m \u001B[38;5;28;01mNone\u001B[39;00m:\n\u001B[32m--> \u001B[39m\u001B[32m978\u001B[39m \u001B[38;5;28;43mself\u001B[39;49m\u001B[43m.\u001B[49m\u001B[43mtraverse_single\u001B[49m\u001B[43m(\u001B[49m\n\u001B[32m 979\u001B[39m \u001B[43m \u001B[49m\u001B[43mtable\u001B[49m\u001B[43m,\u001B[49m\n\u001B[32m 980\u001B[39m \u001B[43m \u001B[49m\u001B[43mcreate_ok\u001B[49m\u001B[43m=\u001B[49m\u001B[38;5;28;43;01mTrue\u001B[39;49;00m\u001B[43m,\u001B[49m\n\u001B[32m 981\u001B[39m \u001B[43m \u001B[49m\u001B[43minclude_foreign_key_constraints\u001B[49m\u001B[43m=\u001B[49m\u001B[43mfkcs\u001B[49m\u001B[43m,\u001B[49m\n\u001B[32m 982\u001B[39m \u001B[43m \u001B[49m\u001B[43m_is_metadata_operation\u001B[49m\u001B[43m=\u001B[49m\u001B[38;5;28;43;01mTrue\u001B[39;49;00m\u001B[43m,\u001B[49m\n\u001B[32m 983\u001B[39m \u001B[43m \u001B[49m\u001B[43m)\u001B[49m\n\u001B[32m 984\u001B[39m \u001B[38;5;28;01melse\u001B[39;00m:\n\u001B[32m 985\u001B[39m \u001B[38;5;28;01mfor\u001B[39;00m fkc \u001B[38;5;129;01min\u001B[39;00m fkcs:\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/sql/visitors.py:664\u001B[39m, in \u001B[36mExternalTraversal.traverse_single\u001B[39m\u001B[34m(self, obj, **kw)\u001B[39m\n\u001B[32m 662\u001B[39m meth = \u001B[38;5;28mgetattr\u001B[39m(v, \u001B[33m\"\u001B[39m\u001B[33mvisit_\u001B[39m\u001B[38;5;132;01m%s\u001B[39;00m\u001B[33m\"\u001B[39m % obj.__visit_name__, \u001B[38;5;28;01mNone\u001B[39;00m)\n\u001B[32m 663\u001B[39m \u001B[38;5;28;01mif\u001B[39;00m meth:\n\u001B[32m--> \u001B[39m\u001B[32m664\u001B[39m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[43mmeth\u001B[49m\u001B[43m(\u001B[49m\u001B[43mobj\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43m*\u001B[49m\u001B[43m*\u001B[49m\u001B[43mkw\u001B[49m\u001B[43m)\u001B[49m\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/sql/ddl.py:1016\u001B[39m, in \u001B[36mSchemaGenerator.visit_table\u001B[39m\u001B[34m(self, table, create_ok, include_foreign_key_constraints, _is_metadata_operation)\u001B[39m\n\u001B[32m 1007\u001B[39m \u001B[38;5;28;01mif\u001B[39;00m \u001B[38;5;129;01mnot\u001B[39;00m \u001B[38;5;28mself\u001B[39m.dialect.supports_alter:\n\u001B[32m 1008\u001B[39m \u001B[38;5;66;03m# e.g., don't omit any foreign key constraints\u001B[39;00m\n\u001B[32m 1009\u001B[39m include_foreign_key_constraints = \u001B[38;5;28;01mNone\u001B[39;00m\n\u001B[32m 1011\u001B[39m \u001B[43mCreateTable\u001B[49m\u001B[43m(\u001B[49m\n\u001B[32m 1012\u001B[39m \u001B[43m \u001B[49m\u001B[43mtable\u001B[49m\u001B[43m,\u001B[49m\n\u001B[32m 1013\u001B[39m \u001B[43m \u001B[49m\u001B[43minclude_foreign_key_constraints\u001B[49m\u001B[43m=\u001B[49m\u001B[43m(\u001B[49m\n\u001B[32m 1014\u001B[39m \u001B[43m \u001B[49m\u001B[43minclude_foreign_key_constraints\u001B[49m\n\u001B[32m 1015\u001B[39m \u001B[43m \u001B[49m\u001B[43m)\u001B[49m\u001B[43m,\u001B[49m\n\u001B[32m-> \u001B[39m\u001B[32m1016\u001B[39m \u001B[43m\u001B[49m\u001B[43m)\u001B[49m\u001B[43m.\u001B[49m\u001B[43m_invoke_with\u001B[49m\u001B[43m(\u001B[49m\u001B[38;5;28;43mself\u001B[39;49m\u001B[43m.\u001B[49m\u001B[43mconnection\u001B[49m\u001B[43m)\u001B[49m\n\u001B[32m 1018\u001B[39m \u001B[38;5;28;01mif\u001B[39;00m \u001B[38;5;28mhasattr\u001B[39m(table, \u001B[33m\"\u001B[39m\u001B[33mindexes\u001B[39m\u001B[33m\"\u001B[39m):\n\u001B[32m 1019\u001B[39m \u001B[38;5;28;01mfor\u001B[39;00m index \u001B[38;5;129;01min\u001B[39;00m table.indexes:\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/sql/ddl.py:314\u001B[39m, in \u001B[36mExecutableDDLElement._invoke_with\u001B[39m\u001B[34m(self, bind)\u001B[39m\n\u001B[32m 312\u001B[39m \u001B[38;5;28;01mdef\u001B[39;00m\u001B[38;5;250m \u001B[39m\u001B[34m_invoke_with\u001B[39m(\u001B[38;5;28mself\u001B[39m, bind):\n\u001B[32m 313\u001B[39m \u001B[38;5;28;01mif\u001B[39;00m \u001B[38;5;28mself\u001B[39m._should_execute(\u001B[38;5;28mself\u001B[39m.target, bind):\n\u001B[32m--> \u001B[39m\u001B[32m314\u001B[39m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[43mbind\u001B[49m\u001B[43m.\u001B[49m\u001B[43mexecute\u001B[49m\u001B[43m(\u001B[49m\u001B[38;5;28;43mself\u001B[39;49m\u001B[43m)\u001B[49m\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py:1416\u001B[39m, in \u001B[36mConnection.execute\u001B[39m\u001B[34m(self, statement, parameters, execution_options)\u001B[39m\n\u001B[32m 1414\u001B[39m \u001B[38;5;28;01mraise\u001B[39;00m exc.ObjectNotExecutableError(statement) \u001B[38;5;28;01mfrom\u001B[39;00m\u001B[38;5;250m \u001B[39m\u001B[34;01merr\u001B[39;00m\n\u001B[32m 1415\u001B[39m \u001B[38;5;28;01melse\u001B[39;00m:\n\u001B[32m-> \u001B[39m\u001B[32m1416\u001B[39m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[43mmeth\u001B[49m\u001B[43m(\u001B[49m\n\u001B[32m 1417\u001B[39m \u001B[43m \u001B[49m\u001B[38;5;28;43mself\u001B[39;49m\u001B[43m,\u001B[49m\n\u001B[32m 1418\u001B[39m \u001B[43m \u001B[49m\u001B[43mdistilled_parameters\u001B[49m\u001B[43m,\u001B[49m\n\u001B[32m 1419\u001B[39m \u001B[43m \u001B[49m\u001B[43mexecution_options\u001B[49m\u001B[43m \u001B[49m\u001B[38;5;129;43;01mor\u001B[39;49;00m\u001B[43m \u001B[49m\u001B[43mNO_OPTIONS\u001B[49m\u001B[43m,\u001B[49m\n\u001B[32m 1420\u001B[39m \u001B[43m \u001B[49m\u001B[43m)\u001B[49m\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/sql/ddl.py:180\u001B[39m, in \u001B[36mExecutableDDLElement._execute_on_connection\u001B[39m\u001B[34m(self, connection, distilled_params, execution_options)\u001B[39m\n\u001B[32m 177\u001B[39m \u001B[38;5;28;01mdef\u001B[39;00m\u001B[38;5;250m \u001B[39m\u001B[34m_execute_on_connection\u001B[39m(\n\u001B[32m 178\u001B[39m \u001B[38;5;28mself\u001B[39m, connection, distilled_params, execution_options\n\u001B[32m 179\u001B[39m ):\n\u001B[32m--> \u001B[39m\u001B[32m180\u001B[39m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[43mconnection\u001B[49m\u001B[43m.\u001B[49m\u001B[43m_execute_ddl\u001B[49m\u001B[43m(\u001B[49m\n\u001B[32m 181\u001B[39m \u001B[43m \u001B[49m\u001B[38;5;28;43mself\u001B[39;49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mdistilled_params\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mexecution_options\u001B[49m\n\u001B[32m 182\u001B[39m \u001B[43m \u001B[49m\u001B[43m)\u001B[49m\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py:1527\u001B[39m, in \u001B[36mConnection._execute_ddl\u001B[39m\u001B[34m(self, ddl, distilled_parameters, execution_options)\u001B[39m\n\u001B[32m 1522\u001B[39m dialect = \u001B[38;5;28mself\u001B[39m.dialect\n\u001B[32m 1524\u001B[39m compiled = ddl.compile(\n\u001B[32m 1525\u001B[39m dialect=dialect, schema_translate_map=schema_translate_map\n\u001B[32m 1526\u001B[39m )\n\u001B[32m-> \u001B[39m\u001B[32m1527\u001B[39m ret = \u001B[38;5;28;43mself\u001B[39;49m\u001B[43m.\u001B[49m\u001B[43m_execute_context\u001B[49m\u001B[43m(\u001B[49m\n\u001B[32m 1528\u001B[39m \u001B[43m \u001B[49m\u001B[43mdialect\u001B[49m\u001B[43m,\u001B[49m\n\u001B[32m 1529\u001B[39m \u001B[43m \u001B[49m\u001B[43mdialect\u001B[49m\u001B[43m.\u001B[49m\u001B[43mexecution_ctx_cls\u001B[49m\u001B[43m.\u001B[49m\u001B[43m_init_ddl\u001B[49m\u001B[43m,\u001B[49m\n\u001B[32m 1530\u001B[39m \u001B[43m \u001B[49m\u001B[43mcompiled\u001B[49m\u001B[43m,\u001B[49m\n\u001B[32m 1531\u001B[39m \u001B[43m \u001B[49m\u001B[38;5;28;43;01mNone\u001B[39;49;00m\u001B[43m,\u001B[49m\n\u001B[32m 1532\u001B[39m \u001B[43m \u001B[49m\u001B[43mexec_opts\u001B[49m\u001B[43m,\u001B[49m\n\u001B[32m 1533\u001B[39m \u001B[43m \u001B[49m\u001B[43mcompiled\u001B[49m\u001B[43m,\u001B[49m\n\u001B[32m 1534\u001B[39m \u001B[43m\u001B[49m\u001B[43m)\u001B[49m\n\u001B[32m 1535\u001B[39m \u001B[38;5;28;01mif\u001B[39;00m \u001B[38;5;28mself\u001B[39m._has_events \u001B[38;5;129;01mor\u001B[39;00m \u001B[38;5;28mself\u001B[39m.engine._has_events:\n\u001B[32m 1536\u001B[39m \u001B[38;5;28mself\u001B[39m.dispatch.after_execute(\n\u001B[32m 1537\u001B[39m \u001B[38;5;28mself\u001B[39m,\n\u001B[32m 1538\u001B[39m ddl,\n\u001B[32m (...)\u001B[39m\u001B[32m 1542\u001B[39m ret,\n\u001B[32m 1543\u001B[39m )\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py:1843\u001B[39m, in \u001B[36mConnection._execute_context\u001B[39m\u001B[34m(self, dialect, constructor, statement, parameters, execution_options, *args, **kw)\u001B[39m\n\u001B[32m 1841\u001B[39m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[38;5;28mself\u001B[39m._exec_insertmany_context(dialect, context)\n\u001B[32m 1842\u001B[39m \u001B[38;5;28;01melse\u001B[39;00m:\n\u001B[32m-> \u001B[39m\u001B[32m1843\u001B[39m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[38;5;28;43mself\u001B[39;49m\u001B[43m.\u001B[49m\u001B[43m_exec_single_context\u001B[49m\u001B[43m(\u001B[49m\n\u001B[32m 1844\u001B[39m \u001B[43m \u001B[49m\u001B[43mdialect\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mcontext\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mstatement\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mparameters\u001B[49m\n\u001B[32m 1845\u001B[39m \u001B[43m \u001B[49m\u001B[43m)\u001B[49m\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py:1983\u001B[39m, in \u001B[36mConnection._exec_single_context\u001B[39m\u001B[34m(self, dialect, context, statement, parameters)\u001B[39m\n\u001B[32m 1980\u001B[39m result = context._setup_result_proxy()\n\u001B[32m 1982\u001B[39m \u001B[38;5;28;01mexcept\u001B[39;00m \u001B[38;5;167;01mBaseException\u001B[39;00m \u001B[38;5;28;01mas\u001B[39;00m e:\n\u001B[32m-> \u001B[39m\u001B[32m1983\u001B[39m \u001B[38;5;28;43mself\u001B[39;49m\u001B[43m.\u001B[49m\u001B[43m_handle_dbapi_exception\u001B[49m\u001B[43m(\u001B[49m\n\u001B[32m 1984\u001B[39m \u001B[43m \u001B[49m\u001B[43me\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mstr_statement\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43meffective_parameters\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mcursor\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mcontext\u001B[49m\n\u001B[32m 1985\u001B[39m \u001B[43m \u001B[49m\u001B[43m)\u001B[49m\n\u001B[32m 1987\u001B[39m \u001B[38;5;28;01mreturn\u001B[39;00m result\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py:2352\u001B[39m, in \u001B[36mConnection._handle_dbapi_exception\u001B[39m\u001B[34m(self, e, statement, parameters, cursor, context, is_sub_exec)\u001B[39m\n\u001B[32m 2350\u001B[39m \u001B[38;5;28;01melif\u001B[39;00m should_wrap:\n\u001B[32m 2351\u001B[39m \u001B[38;5;28;01massert\u001B[39;00m sqlalchemy_exception \u001B[38;5;129;01mis\u001B[39;00m \u001B[38;5;129;01mnot\u001B[39;00m \u001B[38;5;28;01mNone\u001B[39;00m\n\u001B[32m-> \u001B[39m\u001B[32m2352\u001B[39m \u001B[38;5;28;01mraise\u001B[39;00m sqlalchemy_exception.with_traceback(exc_info[\u001B[32m2\u001B[39m]) \u001B[38;5;28;01mfrom\u001B[39;00m\u001B[38;5;250m \u001B[39m\u001B[34;01me\u001B[39;00m\n\u001B[32m 2353\u001B[39m \u001B[38;5;28;01melse\u001B[39;00m:\n\u001B[32m 2354\u001B[39m \u001B[38;5;28;01massert\u001B[39;00m exc_info[\u001B[32m1\u001B[39m] \u001B[38;5;129;01mis\u001B[39;00m \u001B[38;5;129;01mnot\u001B[39;00m \u001B[38;5;28;01mNone\u001B[39;00m\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py:1964\u001B[39m, in \u001B[36mConnection._exec_single_context\u001B[39m\u001B[34m(self, dialect, context, statement, parameters)\u001B[39m\n\u001B[32m 1962\u001B[39m \u001B[38;5;28;01mbreak\u001B[39;00m\n\u001B[32m 1963\u001B[39m \u001B[38;5;28;01mif\u001B[39;00m \u001B[38;5;129;01mnot\u001B[39;00m evt_handled:\n\u001B[32m-> \u001B[39m\u001B[32m1964\u001B[39m \u001B[38;5;28;43mself\u001B[39;49m\u001B[43m.\u001B[49m\u001B[43mdialect\u001B[49m\u001B[43m.\u001B[49m\u001B[43mdo_execute\u001B[49m\u001B[43m(\u001B[49m\n\u001B[32m 1965\u001B[39m \u001B[43m \u001B[49m\u001B[43mcursor\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mstr_statement\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43meffective_parameters\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mcontext\u001B[49m\n\u001B[32m 1966\u001B[39m \u001B[43m \u001B[49m\u001B[43m)\u001B[49m\n\u001B[32m 1968\u001B[39m \u001B[38;5;28;01mif\u001B[39;00m \u001B[38;5;28mself\u001B[39m._has_events \u001B[38;5;129;01mor\u001B[39;00m \u001B[38;5;28mself\u001B[39m.engine._has_events:\n\u001B[32m 1969\u001B[39m \u001B[38;5;28mself\u001B[39m.dispatch.after_cursor_execute(\n\u001B[32m 1970\u001B[39m \u001B[38;5;28mself\u001B[39m,\n\u001B[32m 1971\u001B[39m cursor,\n\u001B[32m (...)\u001B[39m\u001B[32m 1975\u001B[39m context.executemany,\n\u001B[32m 1976\u001B[39m )\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/engine/default.py:942\u001B[39m, in \u001B[36mDefaultDialect.do_execute\u001B[39m\u001B[34m(self, cursor, statement, parameters, context)\u001B[39m\n\u001B[32m 941\u001B[39m \u001B[38;5;28;01mdef\u001B[39;00m\u001B[38;5;250m \u001B[39m\u001B[34mdo_execute\u001B[39m(\u001B[38;5;28mself\u001B[39m, cursor, statement, parameters, context=\u001B[38;5;28;01mNone\u001B[39;00m):\n\u001B[32m--> \u001B[39m\u001B[32m942\u001B[39m \u001B[43mcursor\u001B[49m\u001B[43m.\u001B[49m\u001B[43mexecute\u001B[49m\u001B[43m(\u001B[49m\u001B[43mstatement\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mparameters\u001B[49m\u001B[43m)\u001B[49m\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/dialects/sqlite/aiosqlite.py:172\u001B[39m, in \u001B[36mAsyncAdapt_aiosqlite_cursor.execute\u001B[39m\u001B[34m(self, operation, parameters)\u001B[39m\n\u001B[32m 170\u001B[39m \u001B[38;5;28mself\u001B[39m._cursor = _cursor\n\u001B[32m 171\u001B[39m \u001B[38;5;28;01mexcept\u001B[39;00m \u001B[38;5;167;01mException\u001B[39;00m \u001B[38;5;28;01mas\u001B[39;00m error:\n\u001B[32m--> \u001B[39m\u001B[32m172\u001B[39m \u001B[38;5;28;43mself\u001B[39;49m\u001B[43m.\u001B[49m\u001B[43m_adapt_connection\u001B[49m\u001B[43m.\u001B[49m\u001B[43m_handle_exception\u001B[49m\u001B[43m(\u001B[49m\u001B[43merror\u001B[49m\u001B[43m)\u001B[49m\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/dialects/sqlite/aiosqlite.py:323\u001B[39m, in \u001B[36mAsyncAdapt_aiosqlite_connection._handle_exception\u001B[39m\u001B[34m(self, error)\u001B[39m\n\u001B[32m 319\u001B[39m \u001B[38;5;28;01mraise\u001B[39;00m \u001B[38;5;28mself\u001B[39m.dbapi.sqlite.OperationalError(\n\u001B[32m 320\u001B[39m \u001B[33m\"\u001B[39m\u001B[33mno active connection\u001B[39m\u001B[33m\"\u001B[39m\n\u001B[32m 321\u001B[39m ) \u001B[38;5;28;01mfrom\u001B[39;00m\u001B[38;5;250m \u001B[39m\u001B[34;01merror\u001B[39;00m\n\u001B[32m 322\u001B[39m \u001B[38;5;28;01melse\u001B[39;00m:\n\u001B[32m--> \u001B[39m\u001B[32m323\u001B[39m \u001B[38;5;28;01mraise\u001B[39;00m error\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/dialects/sqlite/aiosqlite.py:154\u001B[39m, in \u001B[36mAsyncAdapt_aiosqlite_cursor.execute\u001B[39m\u001B[34m(self, operation, parameters)\u001B[39m\n\u001B[32m 152\u001B[39m \u001B[38;5;28mself\u001B[39m.await_(_cursor.execute(operation))\n\u001B[32m 153\u001B[39m \u001B[38;5;28;01melse\u001B[39;00m:\n\u001B[32m--> \u001B[39m\u001B[32m154\u001B[39m \u001B[38;5;28;43mself\u001B[39;49m\u001B[43m.\u001B[49m\u001B[43mawait_\u001B[49m\u001B[43m(\u001B[49m\u001B[43m_cursor\u001B[49m\u001B[43m.\u001B[49m\u001B[43mexecute\u001B[49m\u001B[43m(\u001B[49m\u001B[43moperation\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mparameters\u001B[49m\u001B[43m)\u001B[49m\u001B[43m)\u001B[49m\n\u001B[32m 156\u001B[39m \u001B[38;5;28;01mif\u001B[39;00m _cursor.description:\n\u001B[32m 157\u001B[39m \u001B[38;5;28mself\u001B[39m.description = _cursor.description\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/util/_concurrency_py3k.py:132\u001B[39m, in \u001B[36mawait_only\u001B[39m\u001B[34m(awaitable)\u001B[39m\n\u001B[32m 123\u001B[39m \u001B[38;5;28;01mraise\u001B[39;00m exc.MissingGreenlet(\n\u001B[32m 124\u001B[39m \u001B[33m\"\u001B[39m\u001B[33mgreenlet_spawn has not been called; can\u001B[39m\u001B[33m'\u001B[39m\u001B[33mt call await_only() \u001B[39m\u001B[33m\"\u001B[39m\n\u001B[32m 125\u001B[39m \u001B[33m\"\u001B[39m\u001B[33mhere. Was IO attempted in an unexpected place?\u001B[39m\u001B[33m\"\u001B[39m\n\u001B[32m 126\u001B[39m )\n\u001B[32m 128\u001B[39m \u001B[38;5;66;03m# returns the control to the driver greenlet passing it\u001B[39;00m\n\u001B[32m 129\u001B[39m \u001B[38;5;66;03m# a coroutine to run. Once the awaitable is done, the driver greenlet\u001B[39;00m\n\u001B[32m 130\u001B[39m \u001B[38;5;66;03m# switches back to this greenlet with the result of awaitable that is\u001B[39;00m\n\u001B[32m 131\u001B[39m \u001B[38;5;66;03m# then returned to the caller (or raised as error)\u001B[39;00m\n\u001B[32m--> \u001B[39m\u001B[32m132\u001B[39m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[43mcurrent\u001B[49m\u001B[43m.\u001B[49m\u001B[43mparent\u001B[49m\u001B[43m.\u001B[49m\u001B[43mswitch\u001B[49m\u001B[43m(\u001B[49m\u001B[43mawaitable\u001B[49m\u001B[43m)\u001B[49m\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/sqlalchemy/util/_concurrency_py3k.py:196\u001B[39m, in \u001B[36mgreenlet_spawn\u001B[39m\u001B[34m(fn, _require_await, *args, **kwargs)\u001B[39m\n\u001B[32m 192\u001B[39m switch_occurred = \u001B[38;5;28;01mTrue\u001B[39;00m\n\u001B[32m 193\u001B[39m \u001B[38;5;28;01mtry\u001B[39;00m:\n\u001B[32m 194\u001B[39m \u001B[38;5;66;03m# wait for a coroutine from await_only and then return its\u001B[39;00m\n\u001B[32m 195\u001B[39m \u001B[38;5;66;03m# result back to it.\u001B[39;00m\n\u001B[32m--> \u001B[39m\u001B[32m196\u001B[39m value = \u001B[38;5;28;01mawait\u001B[39;00m result\n\u001B[32m 197\u001B[39m \u001B[38;5;28;01mexcept\u001B[39;00m \u001B[38;5;167;01mBaseException\u001B[39;00m:\n\u001B[32m 198\u001B[39m \u001B[38;5;66;03m# this allows an exception to be raised within\u001B[39;00m\n\u001B[32m 199\u001B[39m \u001B[38;5;66;03m# the moderated greenlet so that it can continue\u001B[39;00m\n\u001B[32m 200\u001B[39m \u001B[38;5;66;03m# its expected flow.\u001B[39;00m\n\u001B[32m 201\u001B[39m result = context.throw(*sys.exc_info())\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/aiosqlite/cursor.py:48\u001B[39m, in \u001B[36mCursor.execute\u001B[39m\u001B[34m(self, sql, parameters)\u001B[39m\n\u001B[32m 46\u001B[39m \u001B[38;5;28;01mif\u001B[39;00m parameters \u001B[38;5;129;01mis\u001B[39;00m \u001B[38;5;28;01mNone\u001B[39;00m:\n\u001B[32m 47\u001B[39m parameters = []\n\u001B[32m---> \u001B[39m\u001B[32m48\u001B[39m \u001B[38;5;28;01mawait\u001B[39;00m \u001B[38;5;28mself\u001B[39m._execute(\u001B[38;5;28mself\u001B[39m._cursor.execute, sql, parameters)\n\u001B[32m 49\u001B[39m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[38;5;28mself\u001B[39m\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/aiosqlite/cursor.py:40\u001B[39m, in \u001B[36mCursor._execute\u001B[39m\u001B[34m(self, fn, *args, **kwargs)\u001B[39m\n\u001B[32m 38\u001B[39m \u001B[38;5;28;01masync\u001B[39;00m \u001B[38;5;28;01mdef\u001B[39;00m\u001B[38;5;250m \u001B[39m\u001B[34m_execute\u001B[39m(\u001B[38;5;28mself\u001B[39m, fn, *args, **kwargs):\n\u001B[32m 39\u001B[39m \u001B[38;5;250m \u001B[39m\u001B[33;03m\"\"\"Execute the given function on the shared connection's thread.\"\"\"\u001B[39;00m\n\u001B[32m---> \u001B[39m\u001B[32m40\u001B[39m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[38;5;28;01mawait\u001B[39;00m \u001B[38;5;28mself\u001B[39m._conn._execute(fn, *args, **kwargs)\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/aiosqlite/core.py:132\u001B[39m, in \u001B[36mConnection._execute\u001B[39m\u001B[34m(self, fn, *args, **kwargs)\u001B[39m\n\u001B[32m 128\u001B[39m future = asyncio.get_event_loop().create_future()\n\u001B[32m 130\u001B[39m \u001B[38;5;28mself\u001B[39m._tx.put_nowait((future, function))\n\u001B[32m--> \u001B[39m\u001B[32m132\u001B[39m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[38;5;28;01mawait\u001B[39;00m future\n", - "\u001B[36mFile \u001B[39m\u001B[32m~/cognee/.venv/lib/python3.11/site-packages/aiosqlite/core.py:115\u001B[39m, in \u001B[36mConnection.run\u001B[39m\u001B[34m(self)\u001B[39m\n\u001B[32m 113\u001B[39m \u001B[38;5;28;01mtry\u001B[39;00m:\n\u001B[32m 114\u001B[39m LOG.debug(\u001B[33m\"\u001B[39m\u001B[33mexecuting \u001B[39m\u001B[38;5;132;01m%s\u001B[39;00m\u001B[33m\"\u001B[39m, function)\n\u001B[32m--> \u001B[39m\u001B[32m115\u001B[39m result = \u001B[43mfunction\u001B[49m\u001B[43m(\u001B[49m\u001B[43m)\u001B[49m\n\u001B[32m 116\u001B[39m LOG.debug(\u001B[33m\"\u001B[39m\u001B[33moperation \u001B[39m\u001B[38;5;132;01m%s\u001B[39;00m\u001B[33m completed\u001B[39m\u001B[33m\"\u001B[39m, function)\n\u001B[32m 117\u001B[39m future.get_loop().call_soon_threadsafe(set_result, future, result)\n", - "\u001B[31mOperationalError\u001B[39m: (sqlite3.OperationalError) database is locked\n[SQL: \nCREATE TABLE data (\n\tid UUID NOT NULL, \n\tname VARCHAR, \n\textension VARCHAR, \n\tmime_type VARCHAR, \n\traw_data_location VARCHAR, \n\towner_id UUID, \n\tcontent_hash VARCHAR, \n\texternal_metadata JSON, \n\tnode_set JSON, \n\ttoken_count INTEGER, \n\tcreated_at DATETIME, \n\tupdated_at DATETIME, \n\tPRIMARY KEY (id)\n)\n\n]\n(Background on this error at: https://sqlalche.me/e/20/e3q8)" - ] - } - ], - "execution_count": 3 + "outputs": [], + "execution_count": null }, { "cell_type": "markdown", @@ -233,13 +162,6 @@ } ], "execution_count": 5 - }, - { - "metadata": {}, - "cell_type": "code", - "outputs": [], - "execution_count": null, - "source": "" } ], "metadata": { From 6ca46f1e53fdbf66469a6a77041cad0f70a11d52 Mon Sep 17 00:00:00 2001 From: Igor Ilic Date: Wed, 27 Aug 2025 14:23:53 +0200 Subject: [PATCH 14/14] refactor: ruff format --- cognee/api/v1/cognify/code_graph_pipeline.py | 9 ++- .../get_repo_file_dependencies.py | 68 ++++++++++++------- 2 files changed, 49 insertions(+), 28 deletions(-) diff --git a/cognee/api/v1/cognify/code_graph_pipeline.py b/cognee/api/v1/cognify/code_graph_pipeline.py index 446526042..19d194b26 100644 --- a/cognee/api/v1/cognify/code_graph_pipeline.py +++ b/cognee/api/v1/cognify/code_graph_pipeline.py @@ -40,11 +40,14 @@ async def run_code_graph_pipeline(repo_path, include_docs=False): user = await get_default_user() detailed_extraction = True - # Multi-language support: allow passing supported_languages - supported_languages = None # defer to task defaults + supported_languages = None # defer to task defaults tasks = [ - Task(get_repo_file_dependencies, detailed_extraction=detailed_extraction, supported_languages=supported_languages), + Task( + get_repo_file_dependencies, + detailed_extraction=detailed_extraction, + supported_languages=supported_languages, + ), # Task(summarize_code, task_config={"batch_size": 500}), # This task takes a long time to complete Task(add_data_points, task_config={"batch_size": 30}), ] diff --git a/cognee/tasks/repo_processor/get_repo_file_dependencies.py b/cognee/tasks/repo_processor/get_repo_file_dependencies.py index 82f547915..4ff79523f 100644 --- a/cognee/tasks/repo_processor/get_repo_file_dependencies.py +++ b/cognee/tasks/repo_processor/get_repo_file_dependencies.py @@ -24,6 +24,7 @@ async def get_source_code_files(repo_path, language_config: dict[str, list[str]] -------- A list of (absolute_path, language) tuples for source code files. """ + def _get_language_from_extension(file, language_config): for lang, exts in language_config.items(): for ext in exts: @@ -34,14 +35,14 @@ async def get_source_code_files(repo_path, language_config: dict[str, list[str]] # Default config if not provided if language_config is None: language_config = { - 'python': ['.py'], - 'javascript': ['.js', '.jsx'], - 'typescript': ['.ts', '.tsx'], - 'java': ['.java'], - 'csharp': ['.cs'], - 'go': ['.go'], - 'rust': ['.rs'], - 'cpp': ['.cpp', '.c', '.h', '.hpp'], + "python": [".py"], + "javascript": [".js", ".jsx"], + "typescript": [".ts", ".tsx"], + "java": [".java"], + "csharp": [".cs"], + "go": [".go"], + "rust": [".rs"], + "cpp": [".cpp", ".c", ".h", ".hpp"], } if not os.path.exists(repo_path): @@ -55,9 +56,17 @@ async def get_source_code_files(repo_path, language_config: dict[str, list[str]] continue # Exclude tests and common build/venv directories excluded_dirs = { - ".venv", "venv", "env", ".env", "site-packages", - "node_modules", "dist", "build", ".git", - "tests", "test", + ".venv", + "venv", + "env", + ".env", + "site-packages", + "node_modules", + "dist", + "build", + ".git", + "tests", + "test", } root_parts = set(os.path.normpath(root).split(os.sep)) base_name, _ext = os.path.splitext(file) @@ -133,17 +142,19 @@ async def get_repo_file_dependencies( # Build language config from supported_languages default_language_config = { - 'python': ['.py'], - 'javascript': ['.js', '.jsx'], - 'typescript': ['.ts', '.tsx'], - 'java': ['.java'], - 'csharp': ['.cs'], - 'go': ['.go'], - 'rust': ['.rs'], - 'cpp': ['.cpp', '.c', '.h', '.hpp'], + "python": [".py"], + "javascript": [".js", ".jsx"], + "typescript": [".ts", ".tsx"], + "java": [".java"], + "csharp": [".cs"], + "go": [".go"], + "rust": [".rs"], + "cpp": [".cpp", ".c", ".h", ".hpp"], } if supported_languages is not None: - language_config = {k: v for k, v in default_language_config.items() if k in supported_languages} + language_config = { + k: v for k, v in default_language_config.items() if k in supported_languages + } else: language_config = default_language_config @@ -175,12 +186,16 @@ async def get_repo_file_dependencies( tasks = [] for file_path, lang in source_code_files[start_range : end_range + 1]: # For now, only Python is supported; extend with other languages - if lang == 'python': - tasks.append(get_local_script_dependencies(repo_path, file_path, detailed_extraction)) + if lang == "python": + tasks.append( + get_local_script_dependencies(repo_path, file_path, detailed_extraction) + ) else: # Placeholder: create a minimal CodeFile for other languages async def make_codefile_stub(file_path=file_path, lang=lang): - async with aiofiles.open(file_path, "r", encoding="utf-8", errors="replace") as f: + async with aiofiles.open( + file_path, "r", encoding="utf-8", errors="replace" + ) as f: source = await f.read() return CodeFile( id=uuid5(NAMESPACE_OID, file_path), @@ -189,12 +204,15 @@ async def get_repo_file_dependencies( language=lang, source_code=source, ) + tasks.append(make_codefile_stub()) results: list[CodeFile] = await asyncio.gather(*tasks) for source_code_file in results: source_code_file.part_of = repo - if (getattr(source_code_file, 'language', None) is None and source_code_file.file_path.endswith('.py')): - source_code_file.language = 'python' + if getattr( + source_code_file, "language", None + ) is None and source_code_file.file_path.endswith(".py"): + source_code_file.language = "python" yield source_code_file