cognee 0.3.4.dev3__py3-none-any.whl → 0.3.4.dev4__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.
- cognee/modules/notebooks/methods/create_notebook.py +3 -1
- cognee/modules/notebooks/methods/get_notebooks.py +27 -1
- cognee/modules/users/methods/create_user.py +0 -2
- {cognee-0.3.4.dev3.dist-info → cognee-0.3.4.dev4.dist-info}/METADATA +1 -1
- {cognee-0.3.4.dev3.dist-info → cognee-0.3.4.dev4.dist-info}/RECORD +9 -9
- {cognee-0.3.4.dev3.dist-info → cognee-0.3.4.dev4.dist-info}/WHEEL +0 -0
- {cognee-0.3.4.dev3.dist-info → cognee-0.3.4.dev4.dist-info}/entry_points.txt +0 -0
- {cognee-0.3.4.dev3.dist-info → cognee-0.3.4.dev4.dist-info}/licenses/LICENSE +0 -0
- {cognee-0.3.4.dev3.dist-info → cognee-0.3.4.dev4.dist-info}/licenses/NOTICE.md +0 -0
|
@@ -6,6 +6,8 @@ from cognee.infrastructure.databases.relational import with_async_session
|
|
|
6
6
|
|
|
7
7
|
from ..models.Notebook import Notebook, NotebookCell
|
|
8
8
|
|
|
9
|
+
TUTORIAL_NOTEBOOK_NAME = "Python Development with Cognee Tutorial 🧠"
|
|
10
|
+
|
|
9
11
|
|
|
10
12
|
async def _create_tutorial_notebook(
|
|
11
13
|
user_id: UUID, session: AsyncSession, force_refresh: bool = False
|
|
@@ -24,7 +26,7 @@ async def _create_tutorial_notebook(
|
|
|
24
26
|
zip_url=TUTORIAL_ZIP_URL,
|
|
25
27
|
owner_id=user_id,
|
|
26
28
|
notebook_filename="tutorial.ipynb",
|
|
27
|
-
name=
|
|
29
|
+
name=TUTORIAL_NOTEBOOK_NAME,
|
|
28
30
|
deletable=False,
|
|
29
31
|
force=force_refresh,
|
|
30
32
|
)
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
from uuid import UUID
|
|
2
2
|
from typing import List
|
|
3
|
-
from sqlalchemy import select
|
|
3
|
+
from sqlalchemy import select, and_
|
|
4
4
|
from sqlalchemy.ext.asyncio import AsyncSession
|
|
5
5
|
|
|
6
6
|
from cognee.infrastructure.databases.relational import with_async_session
|
|
7
7
|
|
|
8
8
|
from ..models.Notebook import Notebook
|
|
9
|
+
from .create_notebook import _create_tutorial_notebook, TUTORIAL_NOTEBOOK_NAME
|
|
10
|
+
|
|
11
|
+
from cognee.shared.logging_utils import get_logger
|
|
12
|
+
|
|
13
|
+
logger = get_logger()
|
|
9
14
|
|
|
10
15
|
|
|
11
16
|
@with_async_session
|
|
@@ -13,6 +18,27 @@ async def get_notebooks(
|
|
|
13
18
|
user_id: UUID,
|
|
14
19
|
session: AsyncSession,
|
|
15
20
|
) -> List[Notebook]:
|
|
21
|
+
# Check if tutorial notebook already exists for this user
|
|
22
|
+
tutorial_query = select(Notebook).where(
|
|
23
|
+
and_(
|
|
24
|
+
Notebook.owner_id == user_id,
|
|
25
|
+
Notebook.name == TUTORIAL_NOTEBOOK_NAME,
|
|
26
|
+
~Notebook.deletable,
|
|
27
|
+
)
|
|
28
|
+
)
|
|
29
|
+
tutorial_result = await session.execute(tutorial_query)
|
|
30
|
+
tutorial_notebook = tutorial_result.scalar_one_or_none()
|
|
31
|
+
|
|
32
|
+
# If tutorial notebook doesn't exist, create it
|
|
33
|
+
if tutorial_notebook is None:
|
|
34
|
+
logger.info(f"Tutorial notebook not found for user {user_id}, creating it")
|
|
35
|
+
try:
|
|
36
|
+
await _create_tutorial_notebook(user_id, session, force_refresh=False)
|
|
37
|
+
except Exception as e:
|
|
38
|
+
# Log the error but continue to return existing notebooks
|
|
39
|
+
logger.error(f"Failed to create tutorial notebook for user {user_id}: {e}")
|
|
40
|
+
|
|
41
|
+
# Get all notebooks for the user
|
|
16
42
|
result = await session.execute(select(Notebook).where(Notebook.owner_id == user_id))
|
|
17
43
|
|
|
18
44
|
return list(result.scalars().all())
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cognee
|
|
3
|
-
Version: 0.3.4.
|
|
3
|
+
Version: 0.3.4.dev4
|
|
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
|
|
@@ -481,10 +481,10 @@ cognee/modules/memify/memify.py,sha256=EFPaFpUm6gCz4pV3E49gUeeiuRBf28EXSeytd-aPx
|
|
|
481
481
|
cognee/modules/metrics/operations/__init__.py,sha256=MZ3xbVdfEKqfLct8WnbyFVyZmkBfl-77GoBQgktilUM,63
|
|
482
482
|
cognee/modules/metrics/operations/get_pipeline_run_metrics.py,sha256=upIWnzKeJT1_XbL_ABdGxW-Ai7mO3AqMK35BNmItIQQ,2434
|
|
483
483
|
cognee/modules/notebooks/methods/__init__.py,sha256=IhY4fUVPJbuvS83QESsWzjZRC6oC1I-kJi5gr3kPTLk,215
|
|
484
|
-
cognee/modules/notebooks/methods/create_notebook.py,sha256=
|
|
484
|
+
cognee/modules/notebooks/methods/create_notebook.py,sha256=K-lWLWNG-Lh-aZYT6KBlCu2X6Ff3IW3okKLowupLJ04,1749
|
|
485
485
|
cognee/modules/notebooks/methods/delete_notebook.py,sha256=BKxoRlPzkwXvTYh5WcF-zo_iVmaXqEiptS42JwB0KQU,309
|
|
486
486
|
cognee/modules/notebooks/methods/get_notebook.py,sha256=IP4imsdt9X6GYd6i6WF6PlVhotGNH0i7XZpPqbtqMwo,554
|
|
487
|
-
cognee/modules/notebooks/methods/get_notebooks.py,sha256=
|
|
487
|
+
cognee/modules/notebooks/methods/get_notebooks.py,sha256=vxvhjiUh2quisDPv92N711ioODpCuSNyfH4jxbYF9GA,1523
|
|
488
488
|
cognee/modules/notebooks/methods/update_notebook.py,sha256=MnZbfh-WfEfH3ImNvyQNhDeNwpYeS7p8FPVwnmBvZVg,361
|
|
489
489
|
cognee/modules/notebooks/models/Notebook.py,sha256=jr25KxLuf-P679e4TrjIQNLPjv0W0MBeV_8YHRfwljw,9740
|
|
490
490
|
cognee/modules/notebooks/models/__init__.py,sha256=jldsDjwRvFMreGpe4wxxr5TlFXTZuU7rbsRkGQvTO5s,45
|
|
@@ -625,7 +625,7 @@ cognee/modules/users/exceptions/__init__.py,sha256=wDaNSgJtRXA8xMw3qhPX3FS8dFOz4
|
|
|
625
625
|
cognee/modules/users/exceptions/exceptions.py,sha256=J4xBeR0VtKMpr8sQwHD2BOWSzBfPdUn700Z0bFCBxwM,1639
|
|
626
626
|
cognee/modules/users/methods/__init__.py,sha256=1J0g3-WracmU-1wruczdFirpJuRmJdd-MNtMQl8tiSY,350
|
|
627
627
|
cognee/modules/users/methods/create_default_user.py,sha256=MRdbYof0NJZARO6t3wUr0hw6Kk0lJ_aE3kOvGy9HbW8,555
|
|
628
|
-
cognee/modules/users/methods/create_user.py,sha256=
|
|
628
|
+
cognee/modules/users/methods/create_user.py,sha256=kRMjd6WrjgwnO3zw9nlQIW6gswsQc6idusCmUwUzJYo,2717
|
|
629
629
|
cognee/modules/users/methods/delete_user.py,sha256=B7NJz_ar4jLhfr2QbNsruUg-LNSoT6MYYG6OF72GNcg,758
|
|
630
630
|
cognee/modules/users/methods/get_authenticated_user.py,sha256=V0WdCsUK7RAMfH46sthdyOZbTtoQ-0AHP0fh868NK7A,1554
|
|
631
631
|
cognee/modules/users/methods/get_default_user.py,sha256=UHxy5htJypsIQv37KrMtODiQrc-Cjp9ojzU1o8ThDRo,1771
|
|
@@ -891,9 +891,9 @@ distributed/tasks/queued_add_edges.py,sha256=kz1DHE05y-kNHORQJjYWHUi6Q1QWUp_v3Dl
|
|
|
891
891
|
distributed/tasks/queued_add_nodes.py,sha256=aqK4Ij--ADwUWknxYpiwbYrpa6CcvFfqHWbUZW4Kh3A,452
|
|
892
892
|
distributed/workers/data_point_saving_worker.py,sha256=jFmA0-P_0Ru2IUDrSug0wML-5goAKrGtlBm5BA5Ryw4,3229
|
|
893
893
|
distributed/workers/graph_saving_worker.py,sha256=oUYl99CdhlrPAIsUOHbHnS3d4XhGoV0_OIbCO8wYzRg,3648
|
|
894
|
-
cognee-0.3.4.
|
|
895
|
-
cognee-0.3.4.
|
|
896
|
-
cognee-0.3.4.
|
|
897
|
-
cognee-0.3.4.
|
|
898
|
-
cognee-0.3.4.
|
|
899
|
-
cognee-0.3.4.
|
|
894
|
+
cognee-0.3.4.dev4.dist-info/METADATA,sha256=pdKJriwhqmBgPKKCPeChX6EC0uxxMxeNGF7cLOEZoxI,15135
|
|
895
|
+
cognee-0.3.4.dev4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
896
|
+
cognee-0.3.4.dev4.dist-info/entry_points.txt,sha256=GCCTsNg8gzOJkolq7dR7OK1VlIAO202dGDnMI8nm8oQ,55
|
|
897
|
+
cognee-0.3.4.dev4.dist-info/licenses/LICENSE,sha256=pHHjSQj1DD8SDppW88MMs04TPk7eAanL1c5xj8NY7NQ,11344
|
|
898
|
+
cognee-0.3.4.dev4.dist-info/licenses/NOTICE.md,sha256=6L3saP3kSpcingOxDh-SGjMS8GY79Rlh2dBNLaO0o5c,339
|
|
899
|
+
cognee-0.3.4.dev4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|