cognee 0.2.2.dev1__py3-none-any.whl → 0.2.3.dev0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -58,7 +58,7 @@ class LoaderInterface(ABC):
58
58
  pass
59
59
 
60
60
  @abstractmethod
61
- async def load(self, file_path: str, file_stream: Optional[Any] = None, **kwargs):
61
+ async def load(self, file_path: str, **kwargs):
62
62
  """
63
63
  Load and process the file, returning standardized result.
64
64
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cognee
3
- Version: 0.2.2.dev1
3
+ Version: 0.2.3.dev0
4
4
  Summary: Cognee - is a library for enriching LLM context with a semantic layer for better understanding and reasoning.
5
5
  Project-URL: Homepage, https://www.cognee.ai
6
6
  Project-URL: Repository, https://github.com/topoteretes/cognee
@@ -230,8 +230,8 @@ Your contributions are at the core of making this a true open source project. An
230
230
 
231
231
  ## 📦 Installation
232
232
 
233
- You can install Cognee using either **pip**, **poetry**, **uv** or any other python package manager.
234
- Cognee supports Python 3.8 to 3.12
233
+ You can install Cognee using either **uv**, **pip**, **poetry** or any other python package manager.
234
+ Cognee supports Python 3.10 to 3.13
235
235
 
236
236
  ### With pip
237
237
 
@@ -241,7 +241,7 @@ pip install cognee
241
241
 
242
242
  ## Local Cognee installation
243
243
 
244
- You can install the local Cognee repo using **pip**, **poetry** and **uv**.
244
+ You can install the local Cognee repo using **uv**, **pip** and **poetry**.
245
245
  For local pip installation please make sure your pip version is above version 21.3.
246
246
 
247
247
  ### with UV with all optional dependencies
@@ -314,7 +314,7 @@ cognee/infrastructure/llm/tokenizer/Mistral/adapter.py,sha256=ZaAuCl9ka-ANzykzzH
314
314
  cognee/infrastructure/llm/tokenizer/TikToken/__init__.py,sha256=m1P0VJKiWAKiftLRLLDfEVSuufIxy-T24yMjVm4FsgY,39
315
315
  cognee/infrastructure/llm/tokenizer/TikToken/adapter.py,sha256=IDFWGQe5Z8PmhDu0bRoQLreYqicUtzGCEp-_9F4_amE,3581
316
316
  cognee/infrastructure/loaders/LoaderEngine.py,sha256=brNSioTh6Ya6yMWAnVhqX5G93iixSbyM16cUvbt5z5k,5064
317
- cognee/infrastructure/loaders/LoaderInterface.py,sha256=PKkmQRQ9RHyVyL8mwg1BCe5pcRl8JQYgayQLUJimlIM,1967
317
+ cognee/infrastructure/loaders/LoaderInterface.py,sha256=sJjcHAiEkzraBfKcgj9NoLi3WZnQqnf1H2qXewJwoxw,1932
318
318
  cognee/infrastructure/loaders/__init__.py,sha256=onz7sA9r6p5Vq28IsD12eOqF0JixUvB3WDBO4t8hY0g,643
319
319
  cognee/infrastructure/loaders/create_loader_engine.py,sha256=mgo1RlLJ4E3exdEE03CDsrpdeMoucwrOql-1hZ8Ko00,964
320
320
  cognee/infrastructure/loaders/get_loader_engine.py,sha256=cPJefAHFAWU1HXQoWqCpwh8vRtoz1poPSw6wKyECg8k,517
@@ -746,8 +746,25 @@ cognee/tests/unit/processing/chunks/chunk_by_sentence_test.py,sha256=j0zcTrGBe_s
746
746
  cognee/tests/unit/processing/chunks/chunk_by_word_test.py,sha256=tkZJgZMAIwyqqjc9aEeor4r4_1CD7PlyXQCCTiWw8U4,1177
747
747
  cognee/tests/unit/processing/chunks/test_input.py,sha256=T1TFdZWBuV7Mwm6kD-It2sMCRTozGjgP8YcMNgT7j_E,9463
748
748
  cognee/tests/unit/processing/utils/utils_test.py,sha256=VQ03g2r2thojM7dLnY7egtXXCpJuxcEcSxPtTZa4b0U,1503
749
- cognee-0.2.2.dev1.dist-info/METADATA,sha256=V7LPZ7zEEZGxPB45SaRiaYdICRmjFSEMiTMhjrK8vf0,14674
750
- cognee-0.2.2.dev1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
751
- cognee-0.2.2.dev1.dist-info/licenses/LICENSE,sha256=pHHjSQj1DD8SDppW88MMs04TPk7eAanL1c5xj8NY7NQ,11344
752
- cognee-0.2.2.dev1.dist-info/licenses/NOTICE.md,sha256=6L3saP3kSpcingOxDh-SGjMS8GY79Rlh2dBNLaO0o5c,339
753
- cognee-0.2.2.dev1.dist-info/RECORD,,
749
+ distributed/Dockerfile,sha256=co4eAKKe8wOWmvdrbvBP_S7aYQSho6SdDFgnYrLarX4,756
750
+ distributed/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
751
+ distributed/app.py,sha256=ZbnFimZvsgDuXWA6F-5o1KQJcJUGbJkuqS9MZbtdBSA,62
752
+ distributed/entrypoint.py,sha256=tLF8eEfW5oG6obyzBGhJsqy9SXm6xfr5HYU45sMtQEw,2221
753
+ distributed/entrypoint.sh,sha256=6j9Lu_6sxws7E-XGOdtfMWmdm8D3awjtGblB0JsL1I0,94
754
+ distributed/modal_image.py,sha256=TSS0mF8-bjTiMHzyQu2xgq3AX74MRnJKyDgFroHvwiQ,320
755
+ distributed/poetry.lock,sha256=KcXMRPszF6A1SKWSqp1Kwg0CFuq4yJ7nn3TUWJ8LNrA,952845
756
+ distributed/pyproject.toml,sha256=cAU_AZEkP3G2hCtqKFUMVkb2yXMrBn5ZAURlGUoYZjU,4990
757
+ distributed/queues.py,sha256=FF2nyfu1rsDTNKEEC2IAn_A0sULudt4JFxdffSyRPb0,212
758
+ distributed/test.py,sha256=NftfFht_2TP898KwdyJNE6FRYeaDGt4l_74KPVVsGJc,552
759
+ distributed/utils.py,sha256=rW2s7xkMPbh6IANFRVaXPI1pJf9SKRufUw4SfIFIFME,586
760
+ distributed/tasks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
761
+ distributed/tasks/queued_add_data_points.py,sha256=thOrQldx4NlEILPoftYtd4jKtYuio3AtugDUdzLPBB4,568
762
+ distributed/tasks/queued_add_edges.py,sha256=kz1DHE05y-kNHORQJjYWHUi6Q1QWUp_v3Dl13ymEZLM,452
763
+ distributed/tasks/queued_add_nodes.py,sha256=aqK4Ij--ADwUWknxYpiwbYrpa6CcvFfqHWbUZW4Kh3A,452
764
+ distributed/workers/data_point_saving_worker.py,sha256=jFmA0-P_0Ru2IUDrSug0wML-5goAKrGtlBm5BA5Ryw4,3229
765
+ distributed/workers/graph_saving_worker.py,sha256=oUYl99CdhlrPAIsUOHbHnS3d4XhGoV0_OIbCO8wYzRg,3648
766
+ cognee-0.2.3.dev0.dist-info/METADATA,sha256=w7q58QNsWxZWW1m8dlmAcISxg6Y4a_SJq0ix7b4fsKo,14675
767
+ cognee-0.2.3.dev0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
768
+ cognee-0.2.3.dev0.dist-info/licenses/LICENSE,sha256=pHHjSQj1DD8SDppW88MMs04TPk7eAanL1c5xj8NY7NQ,11344
769
+ cognee-0.2.3.dev0.dist-info/licenses/NOTICE.md,sha256=6L3saP3kSpcingOxDh-SGjMS8GY79Rlh2dBNLaO0o5c,339
770
+ cognee-0.2.3.dev0.dist-info/RECORD,,
distributed/Dockerfile ADDED
@@ -0,0 +1,34 @@
1
+ FROM python:3.11-slim
2
+
3
+ # Set environment variables
4
+ ENV PIP_NO_CACHE_DIR=true
5
+ ENV PATH="${PATH}:/root/.poetry/bin"
6
+ ENV PYTHONPATH=/app
7
+ ENV RUN_MODE=modal
8
+ ENV SKIP_MIGRATIONS=true
9
+ ENV COGNEE_DISTRIBUTED=true
10
+
11
+ # System dependencies
12
+ RUN apt-get update && apt-get install -y \
13
+ gcc \
14
+ libpq-dev \
15
+ git \
16
+ curl \
17
+ build-essential \
18
+ && rm -rf /var/lib/apt/lists/*
19
+
20
+ WORKDIR /app
21
+
22
+ COPY pyproject.toml poetry.lock README.md /app/
23
+
24
+ RUN pip install poetry
25
+
26
+ RUN poetry config virtualenvs.create false
27
+
28
+ RUN poetry install --extras neo4j --extras postgres --extras aws --extras distributed --no-root
29
+
30
+ COPY cognee/ /app/cognee
31
+ COPY distributed/ /app/distributed
32
+ RUN chmod +x /app/distributed/entrypoint.sh
33
+
34
+ ENTRYPOINT ["/app/distributed/entrypoint.sh"]
File without changes
distributed/app.py ADDED
@@ -0,0 +1,4 @@
1
+ from modal import App
2
+
3
+
4
+ app = App("cognee_modal_distributed")
@@ -0,0 +1,71 @@
1
+ import os
2
+ import asyncio
3
+
4
+ import cognee
5
+ from cognee.api.v1.prune import prune
6
+ from cognee.shared.logging_utils import get_logger
7
+ from cognee.modules.engine.operations.setup import setup
8
+
9
+ from distributed.app import app
10
+ from distributed.queues import add_nodes_and_edges_queue, add_data_points_queue
11
+ from distributed.workers.graph_saving_worker import graph_saving_worker
12
+ from distributed.workers.data_point_saving_worker import data_point_saving_worker
13
+
14
+ logger = get_logger()
15
+
16
+
17
+ os.environ["COGNEE_DISTRIBUTED"] = "True"
18
+
19
+
20
+ @app.local_entrypoint()
21
+ async def main():
22
+ # Clear queues
23
+ await add_nodes_and_edges_queue.clear.aio()
24
+ await add_data_points_queue.clear.aio()
25
+
26
+ number_of_graph_saving_workers = 1 # Total number of graph_saving_worker to spawn
27
+ number_of_data_point_saving_workers = 5 # Total number of graph_saving_worker to spawn
28
+
29
+ results = []
30
+ consumer_futures = []
31
+
32
+ # await prune.prune_data() # We don't want to delete files on s3
33
+ # Delete DBs and saved files from metastore
34
+ await prune.prune_system(metadata=True)
35
+
36
+ await setup()
37
+
38
+ # Start graph_saving_worker functions
39
+ for _ in range(number_of_graph_saving_workers):
40
+ worker_future = graph_saving_worker.spawn()
41
+ consumer_futures.append(worker_future)
42
+
43
+ # Start data_point_saving_worker functions
44
+ for _ in range(number_of_data_point_saving_workers):
45
+ worker_future = data_point_saving_worker.spawn()
46
+ consumer_futures.append(worker_future)
47
+
48
+ s3_bucket_path = os.getenv("S3_BUCKET_PATH")
49
+ s3_data_path = "s3://" + s3_bucket_path
50
+
51
+ await cognee.add(s3_data_path, dataset_name="s3-files")
52
+
53
+ await cognee.cognify(datasets=["s3-files"])
54
+
55
+ # Push empty tuple into the queue to signal the end of data.
56
+ await add_nodes_and_edges_queue.put.aio(())
57
+ await add_data_points_queue.put.aio(())
58
+
59
+ for consumer_future in consumer_futures:
60
+ try:
61
+ print("Finished but waiting for saving workers to finish.")
62
+ consumer_final = consumer_future.get()
63
+ print(f"All workers are done: {consumer_final}")
64
+ except Exception as e:
65
+ logger.error(e)
66
+
67
+ print(results)
68
+
69
+
70
+ if __name__ == "__main__":
71
+ asyncio.run(main())
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env bash
2
+
3
+ echo "$@"
4
+
5
+ exec "$@" # Runs the command passed to the entrypoint script.
@@ -0,0 +1,11 @@
1
+ import pathlib
2
+ from os import path
3
+ from modal import Image
4
+ from logging import getLogger
5
+
6
+ logger = getLogger("modal_image_creation")
7
+
8
+ image = Image.from_dockerfile(
9
+ path=pathlib.Path(path.join(path.dirname(__file__), "Dockerfile")).resolve(),
10
+ force_build=False,
11
+ ).add_local_python_source("cognee", "entrypoint")