cognee 0.3.3__py3-none-any.whl → 0.3.4.dev1__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/api/v1/cognify/routers/get_cognify_router.py +2 -1
- cognee/api/v1/search/search.py +1 -1
- cognee/infrastructure/databases/relational/ModelBase.py +2 -1
- cognee/infrastructure/databases/vector/chromadb/ChromaDBAdapter.py +2 -6
- cognee/infrastructure/databases/vector/embeddings/OllamaEmbeddingEngine.py +2 -4
- cognee/infrastructure/files/utils/get_file_metadata.py +6 -1
- cognee/infrastructure/llm/structured_output_framework/litellm_instructor/llm/anthropic/adapter.py +4 -2
- cognee/modules/pipelines/models/PipelineRunInfo.py +7 -2
- cognee/modules/search/methods/get_search_type_tools.py +7 -0
- cognee/modules/search/methods/search.py +12 -13
- cognee/modules/search/utils/prepare_search_result.py +28 -6
- cognee/modules/search/utils/transform_context_to_graph.py +1 -1
- cognee/modules/search/utils/transform_insights_to_graph.py +28 -0
- cognee/modules/users/permissions/methods/get_all_user_permission_datasets.py +9 -2
- cognee/tasks/temporal_graph/models.py +11 -6
- cognee/tests/cli_tests/cli_unit_tests/test_cli_main.py +5 -5
- cognee/tests/test_cognee_server_start.py +4 -4
- cognee/tests/test_temporal_graph.py +6 -34
- {cognee-0.3.3.dist-info → cognee-0.3.4.dev1.dist-info}/METADATA +17 -5
- {cognee-0.3.3.dist-info → cognee-0.3.4.dev1.dist-info}/RECORD +24 -24
- cognee/modules/notebooks/methods/create_tutorial_notebook.py +0 -92
- {cognee-0.3.3.dist-info → cognee-0.3.4.dev1.dist-info}/WHEEL +0 -0
- {cognee-0.3.3.dist-info → cognee-0.3.4.dev1.dist-info}/entry_points.txt +0 -0
- {cognee-0.3.3.dist-info → cognee-0.3.4.dev1.dist-info}/licenses/LICENSE +0 -0
- {cognee-0.3.3.dist-info → cognee-0.3.4.dev1.dist-info}/licenses/NOTICE.md +0 -0
|
@@ -3,6 +3,7 @@ import asyncio
|
|
|
3
3
|
from uuid import UUID
|
|
4
4
|
from pydantic import Field
|
|
5
5
|
from typing import List, Optional
|
|
6
|
+
from fastapi.encoders import jsonable_encoder
|
|
6
7
|
from fastapi.responses import JSONResponse
|
|
7
8
|
from fastapi import APIRouter, WebSocket, Depends, WebSocketDisconnect
|
|
8
9
|
from starlette.status import WS_1000_NORMAL_CLOSURE, WS_1008_POLICY_VIOLATION
|
|
@@ -119,7 +120,7 @@ def get_cognify_router() -> APIRouter:
|
|
|
119
120
|
|
|
120
121
|
# If any cognify run errored return JSONResponse with proper error status code
|
|
121
122
|
if any(isinstance(v, PipelineRunErrored) for v in cognify_run.values()):
|
|
122
|
-
return JSONResponse(status_code=420, content=cognify_run)
|
|
123
|
+
return JSONResponse(status_code=420, content=jsonable_encoder(cognify_run))
|
|
123
124
|
return cognify_run
|
|
124
125
|
except Exception as error:
|
|
125
126
|
return JSONResponse(status_code=409, content={"error": str(error)})
|
cognee/api/v1/search/search.py
CHANGED
|
@@ -22,7 +22,7 @@ async def search(
|
|
|
22
22
|
node_type: Optional[Type] = NodeSet,
|
|
23
23
|
node_name: Optional[List[str]] = None,
|
|
24
24
|
save_interaction: bool = False,
|
|
25
|
-
last_k: Optional[int] =
|
|
25
|
+
last_k: Optional[int] = 1,
|
|
26
26
|
only_context: bool = False,
|
|
27
27
|
use_combined_context: bool = False,
|
|
28
28
|
) -> Union[List[SearchResult], CombinedSearchResult]:
|
|
@@ -83,7 +83,7 @@ def process_data_for_chroma(data):
|
|
|
83
83
|
elif isinstance(value, list):
|
|
84
84
|
# Store lists as JSON strings with special prefix
|
|
85
85
|
processed_data[f"{key}__list"] = json.dumps(value)
|
|
86
|
-
elif isinstance(value, (str, int, float, bool))
|
|
86
|
+
elif isinstance(value, (str, int, float, bool)):
|
|
87
87
|
processed_data[key] = value
|
|
88
88
|
else:
|
|
89
89
|
processed_data[key] = str(value)
|
|
@@ -553,8 +553,4 @@ class ChromaDBAdapter(VectorDBInterface):
|
|
|
553
553
|
Returns a list of collection names.
|
|
554
554
|
"""
|
|
555
555
|
client = await self.get_connection()
|
|
556
|
-
|
|
557
|
-
return [
|
|
558
|
-
collection.name if hasattr(collection, "name") else collection["name"]
|
|
559
|
-
for collection in collections
|
|
560
|
-
]
|
|
556
|
+
return await client.list_collections()
|
|
@@ -94,10 +94,8 @@ class OllamaEmbeddingEngine(EmbeddingEngine):
|
|
|
94
94
|
"""
|
|
95
95
|
Internal method to call the Ollama embeddings endpoint for a single prompt.
|
|
96
96
|
"""
|
|
97
|
-
payload = {
|
|
98
|
-
|
|
99
|
-
"prompt": prompt,
|
|
100
|
-
}
|
|
97
|
+
payload = {"model": self.model, "prompt": prompt, "input": prompt}
|
|
98
|
+
|
|
101
99
|
headers = {}
|
|
102
100
|
api_key = os.getenv("LLM_API_KEY")
|
|
103
101
|
if api_key:
|
|
@@ -56,7 +56,12 @@ async def get_file_metadata(file: BinaryIO) -> FileMetadata:
|
|
|
56
56
|
file_type = guess_file_type(file)
|
|
57
57
|
|
|
58
58
|
file_path = getattr(file, "name", None) or getattr(file, "full_name", None)
|
|
59
|
-
|
|
59
|
+
|
|
60
|
+
if isinstance(file_path, str):
|
|
61
|
+
file_name = Path(file_path).stem if file_path else None
|
|
62
|
+
else:
|
|
63
|
+
# In case file_path does not exist or is a integer return None
|
|
64
|
+
file_name = None
|
|
60
65
|
|
|
61
66
|
# Get file size
|
|
62
67
|
pos = file.tell() # remember current pointer
|
cognee/infrastructure/llm/structured_output_framework/litellm_instructor/llm/anthropic/adapter.py
CHANGED
|
@@ -12,6 +12,7 @@ from cognee.infrastructure.llm.structured_output_framework.litellm_instructor.ll
|
|
|
12
12
|
)
|
|
13
13
|
|
|
14
14
|
from cognee.infrastructure.llm.LLMGateway import LLMGateway
|
|
15
|
+
from cognee.infrastructure.llm.config import get_llm_config
|
|
15
16
|
|
|
16
17
|
|
|
17
18
|
class AnthropicAdapter(LLMInterface):
|
|
@@ -27,7 +28,8 @@ class AnthropicAdapter(LLMInterface):
|
|
|
27
28
|
import anthropic
|
|
28
29
|
|
|
29
30
|
self.aclient = instructor.patch(
|
|
30
|
-
create=anthropic.AsyncAnthropic().messages.create,
|
|
31
|
+
create=anthropic.AsyncAnthropic(api_key=get_llm_config().llm_api_key).messages.create,
|
|
32
|
+
mode=instructor.Mode.ANTHROPIC_TOOLS,
|
|
31
33
|
)
|
|
32
34
|
|
|
33
35
|
self.model = model
|
|
@@ -57,7 +59,7 @@ class AnthropicAdapter(LLMInterface):
|
|
|
57
59
|
|
|
58
60
|
return await self.aclient(
|
|
59
61
|
model=self.model,
|
|
60
|
-
|
|
62
|
+
max_tokens=4096,
|
|
61
63
|
max_retries=5,
|
|
62
64
|
messages=[
|
|
63
65
|
{
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
from typing import Any, Optional
|
|
1
|
+
from typing import Any, Optional, List, Union
|
|
2
2
|
from uuid import UUID
|
|
3
3
|
from pydantic import BaseModel
|
|
4
|
+
from cognee.modules.data.models.Data import Data
|
|
4
5
|
|
|
5
6
|
|
|
6
7
|
class PipelineRunInfo(BaseModel):
|
|
@@ -8,11 +9,15 @@ class PipelineRunInfo(BaseModel):
|
|
|
8
9
|
pipeline_run_id: UUID
|
|
9
10
|
dataset_id: UUID
|
|
10
11
|
dataset_name: str
|
|
11
|
-
|
|
12
|
+
# Data must be mentioned in typing to allow custom encoders for Data to be activated
|
|
13
|
+
payload: Optional[Union[Any, List[Data]]] = None
|
|
12
14
|
data_ingestion_info: Optional[list] = None
|
|
13
15
|
|
|
14
16
|
model_config = {
|
|
15
17
|
"arbitrary_types_allowed": True,
|
|
18
|
+
"from_attributes": True,
|
|
19
|
+
# Add custom encoding handler for Data ORM model
|
|
20
|
+
"json_encoders": {Data: lambda d: d.to_json()},
|
|
16
21
|
}
|
|
17
22
|
|
|
18
23
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import os
|
|
1
2
|
from typing import Callable, List, Optional, Type
|
|
2
3
|
|
|
3
4
|
from cognee.modules.engine.models.node_set import NodeSet
|
|
@@ -160,6 +161,12 @@ async def get_search_type_tools(
|
|
|
160
161
|
if query_type is SearchType.FEELING_LUCKY:
|
|
161
162
|
query_type = await select_search_type(query_text)
|
|
162
163
|
|
|
164
|
+
if (
|
|
165
|
+
query_type in [SearchType.CYPHER, SearchType.NATURAL_LANGUAGE]
|
|
166
|
+
and os.getenv("ALLOW_CYPHER_QUERY", "true").lower() == "false"
|
|
167
|
+
):
|
|
168
|
+
raise UnsupportedSearchTypeError("Cypher query search types are disabled.")
|
|
169
|
+
|
|
163
170
|
search_type_tools = search_tasks.get(query_type)
|
|
164
171
|
|
|
165
172
|
if not search_type_tools:
|
|
@@ -136,12 +136,19 @@ async def search(
|
|
|
136
136
|
if os.getenv("ENABLE_BACKEND_ACCESS_CONTROL", "false").lower() == "true":
|
|
137
137
|
return_value = []
|
|
138
138
|
for search_result in search_results:
|
|
139
|
-
|
|
139
|
+
prepared_search_results = await prepare_search_result(search_result)
|
|
140
|
+
|
|
141
|
+
result = prepared_search_results["result"]
|
|
142
|
+
graphs = prepared_search_results["graphs"]
|
|
143
|
+
context = prepared_search_results["context"]
|
|
144
|
+
datasets = prepared_search_results["datasets"]
|
|
145
|
+
|
|
140
146
|
return_value.append(
|
|
141
147
|
{
|
|
142
|
-
"search_result": result,
|
|
148
|
+
"search_result": [result] if result else None,
|
|
143
149
|
"dataset_id": datasets[0].id,
|
|
144
150
|
"dataset_name": datasets[0].name,
|
|
151
|
+
"graphs": graphs,
|
|
145
152
|
}
|
|
146
153
|
)
|
|
147
154
|
return return_value
|
|
@@ -155,14 +162,6 @@ async def search(
|
|
|
155
162
|
return return_value[0]
|
|
156
163
|
else:
|
|
157
164
|
return return_value
|
|
158
|
-
# return [
|
|
159
|
-
# SearchResult(
|
|
160
|
-
# search_result=result,
|
|
161
|
-
# dataset_id=datasets[min(index, len(datasets) - 1)].id if datasets else None,
|
|
162
|
-
# dataset_name=datasets[min(index, len(datasets) - 1)].name if datasets else None,
|
|
163
|
-
# )
|
|
164
|
-
# for index, (result, _, datasets) in enumerate(search_results)
|
|
165
|
-
# ]
|
|
166
165
|
|
|
167
166
|
|
|
168
167
|
async def authorized_search(
|
|
@@ -208,11 +207,11 @@ async def authorized_search(
|
|
|
208
207
|
context = {}
|
|
209
208
|
datasets: List[Dataset] = []
|
|
210
209
|
|
|
211
|
-
for _, search_context,
|
|
212
|
-
for dataset in
|
|
210
|
+
for _, search_context, search_datasets in search_responses:
|
|
211
|
+
for dataset in search_datasets:
|
|
213
212
|
context[str(dataset.id)] = search_context
|
|
214
213
|
|
|
215
|
-
datasets.extend(
|
|
214
|
+
datasets.extend(search_datasets)
|
|
216
215
|
|
|
217
216
|
specific_search_tools = await get_search_type_tools(
|
|
218
217
|
query_type=query_type,
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
from typing import List, cast
|
|
2
|
+
from uuid import uuid5, NAMESPACE_OID
|
|
2
3
|
|
|
3
4
|
from cognee.modules.graph.utils import resolve_edges_to_text
|
|
4
5
|
from cognee.modules.graph.cognee_graph.CogneeGraphElements import Edge
|
|
6
|
+
from cognee.modules.search.types.SearchResult import SearchResultDataset
|
|
5
7
|
from cognee.modules.search.utils.transform_context_to_graph import transform_context_to_graph
|
|
8
|
+
from cognee.modules.search.utils.transform_insights_to_graph import transform_insights_to_graph
|
|
6
9
|
|
|
7
10
|
|
|
8
11
|
async def prepare_search_result(search_result):
|
|
@@ -12,29 +15,48 @@ async def prepare_search_result(search_result):
|
|
|
12
15
|
result_graph = None
|
|
13
16
|
context_texts = {}
|
|
14
17
|
|
|
15
|
-
if isinstance(
|
|
18
|
+
if isinstance(datasets, list) and len(datasets) == 0:
|
|
19
|
+
datasets = [
|
|
20
|
+
SearchResultDataset(
|
|
21
|
+
id=uuid5(NAMESPACE_OID, "*"),
|
|
22
|
+
name="all available datasets",
|
|
23
|
+
)
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
if (
|
|
27
|
+
isinstance(context, List)
|
|
28
|
+
and len(context) > 0
|
|
29
|
+
and isinstance(context[0], tuple)
|
|
30
|
+
and context[0][1].get("relationship_name")
|
|
31
|
+
):
|
|
32
|
+
context_graph = transform_insights_to_graph(context)
|
|
33
|
+
graphs = {
|
|
34
|
+
", ".join([dataset.name for dataset in datasets]): context_graph,
|
|
35
|
+
}
|
|
36
|
+
results = None
|
|
37
|
+
elif isinstance(context, List) and len(context) > 0 and isinstance(context[0], Edge):
|
|
16
38
|
context_graph = transform_context_to_graph(context)
|
|
17
39
|
|
|
18
40
|
graphs = {
|
|
19
|
-
"
|
|
41
|
+
", ".join([dataset.name for dataset in datasets]): context_graph,
|
|
20
42
|
}
|
|
21
43
|
context_texts = {
|
|
22
|
-
"
|
|
44
|
+
", ".join([dataset.name for dataset in datasets]): await resolve_edges_to_text(context),
|
|
23
45
|
}
|
|
24
46
|
elif isinstance(context, str):
|
|
25
47
|
context_texts = {
|
|
26
|
-
"
|
|
48
|
+
", ".join([dataset.name for dataset in datasets]): context,
|
|
27
49
|
}
|
|
28
50
|
elif isinstance(context, List) and len(context) > 0 and isinstance(context[0], str):
|
|
29
51
|
context_texts = {
|
|
30
|
-
"
|
|
52
|
+
", ".join([dataset.name for dataset in datasets]): "\n".join(cast(List[str], context)),
|
|
31
53
|
}
|
|
32
54
|
|
|
33
55
|
if isinstance(results, List) and len(results) > 0 and isinstance(results[0], Edge):
|
|
34
56
|
result_graph = transform_context_to_graph(results)
|
|
35
57
|
|
|
36
58
|
return {
|
|
37
|
-
"result": result_graph or results[0] if len(results) == 1 else results,
|
|
59
|
+
"result": result_graph or results[0] if results and len(results) == 1 else results,
|
|
38
60
|
"graphs": graphs,
|
|
39
61
|
"context": context_texts,
|
|
40
62
|
"datasets": datasets,
|
|
@@ -14,7 +14,7 @@ def transform_context_to_graph(context: List[Edge]):
|
|
|
14
14
|
if "name" in triplet.node1.attributes
|
|
15
15
|
else triplet.node1.id,
|
|
16
16
|
"type": triplet.node1.attributes["type"],
|
|
17
|
-
"attributes": triplet.
|
|
17
|
+
"attributes": triplet.node1.attributes,
|
|
18
18
|
}
|
|
19
19
|
nodes[triplet.node2.id] = {
|
|
20
20
|
"id": triplet.node2.id,
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
from typing import Dict, List, Tuple
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def transform_insights_to_graph(context: List[Tuple[Dict, Dict, Dict]]):
|
|
5
|
+
nodes = {}
|
|
6
|
+
edges = {}
|
|
7
|
+
|
|
8
|
+
for triplet in context:
|
|
9
|
+
nodes[triplet[0]["id"]] = {
|
|
10
|
+
"id": triplet[0]["id"],
|
|
11
|
+
"label": triplet[0]["name"] if "name" in triplet[0] else triplet[0]["id"],
|
|
12
|
+
"type": triplet[0]["type"],
|
|
13
|
+
}
|
|
14
|
+
nodes[triplet[2]["id"]] = {
|
|
15
|
+
"id": triplet[2]["id"],
|
|
16
|
+
"label": triplet[2]["name"] if "name" in triplet[2] else triplet[2]["id"],
|
|
17
|
+
"type": triplet[2]["type"],
|
|
18
|
+
}
|
|
19
|
+
edges[f"{triplet[0]['id']}_{triplet[1]['relationship_name']}_{triplet[2]['id']}"] = {
|
|
20
|
+
"source": triplet[0]["id"],
|
|
21
|
+
"target": triplet[2]["id"],
|
|
22
|
+
"label": triplet[1]["relationship_name"],
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return {
|
|
26
|
+
"nodes": list(nodes.values()),
|
|
27
|
+
"edges": list(edges.values()),
|
|
28
|
+
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
from types import SimpleNamespace
|
|
2
|
+
|
|
1
3
|
from cognee.shared.logging_utils import get_logger
|
|
2
4
|
|
|
3
5
|
from ...models.User import User
|
|
@@ -17,9 +19,14 @@ async def get_all_user_permission_datasets(user: User, permission_type: str) ->
|
|
|
17
19
|
# Get all datasets all tenants have access to
|
|
18
20
|
tenant = await get_tenant(user.tenant_id)
|
|
19
21
|
datasets.extend(await get_principal_datasets(tenant, permission_type))
|
|
22
|
+
|
|
20
23
|
# Get all datasets Users roles have access to
|
|
21
|
-
|
|
22
|
-
|
|
24
|
+
if isinstance(user, SimpleNamespace):
|
|
25
|
+
# If simple namespace use roles defined in user
|
|
26
|
+
roles = user.roles
|
|
27
|
+
else:
|
|
28
|
+
roles = await user.awaitable_attrs.roles
|
|
29
|
+
for role in roles:
|
|
23
30
|
datasets.extend(await get_principal_datasets(role, permission_type))
|
|
24
31
|
|
|
25
32
|
# Deduplicate datasets with same ID
|
|
@@ -3,12 +3,17 @@ from pydantic import BaseModel, Field
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
class Timestamp(BaseModel):
|
|
6
|
-
year: int = Field(
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
year: int = Field(
|
|
7
|
+
...,
|
|
8
|
+
ge=1,
|
|
9
|
+
le=9999,
|
|
10
|
+
description="Always required. If only a year is known, use it.",
|
|
11
|
+
)
|
|
12
|
+
month: int = Field(1, ge=1, le=12, description="If unknown, default to 1")
|
|
13
|
+
day: int = Field(1, ge=1, le=31, description="If unknown, default to 1")
|
|
14
|
+
hour: int = Field(0, ge=0, le=23, description="If unknown, default to 0")
|
|
15
|
+
minute: int = Field(0, ge=0, le=59, description="If unknown, default to 0")
|
|
16
|
+
second: int = Field(0, ge=0, le=59, description="If unknown, default to 0")
|
|
12
17
|
|
|
13
18
|
|
|
14
19
|
class Interval(BaseModel):
|
|
@@ -49,7 +49,7 @@ class TestCliMain:
|
|
|
49
49
|
def test_main_no_command(self, mock_create_parser):
|
|
50
50
|
"""Test main function when no command is provided"""
|
|
51
51
|
mock_parser = MagicMock()
|
|
52
|
-
mock_parser.parse_args.return_value = MagicMock(command=None)
|
|
52
|
+
mock_parser.parse_args.return_value = MagicMock(command=None, spec={})
|
|
53
53
|
mock_create_parser.return_value = (mock_parser, {})
|
|
54
54
|
|
|
55
55
|
result = main()
|
|
@@ -64,7 +64,7 @@ class TestCliMain:
|
|
|
64
64
|
mock_command.execute.return_value = None
|
|
65
65
|
|
|
66
66
|
mock_parser = MagicMock()
|
|
67
|
-
mock_args = MagicMock(command="test")
|
|
67
|
+
mock_args = MagicMock(command="test", spec={})
|
|
68
68
|
mock_parser.parse_args.return_value = mock_args
|
|
69
69
|
|
|
70
70
|
mock_create_parser.return_value = (mock_parser, {"test": mock_command})
|
|
@@ -84,7 +84,7 @@ class TestCliMain:
|
|
|
84
84
|
mock_command.execute.side_effect = CliCommandException("Test error", error_code=2)
|
|
85
85
|
|
|
86
86
|
mock_parser = MagicMock()
|
|
87
|
-
mock_args = MagicMock(command="test")
|
|
87
|
+
mock_args = MagicMock(command="test", spec={})
|
|
88
88
|
mock_parser.parse_args.return_value = mock_args
|
|
89
89
|
|
|
90
90
|
mock_create_parser.return_value = (mock_parser, {"test": mock_command})
|
|
@@ -103,7 +103,7 @@ class TestCliMain:
|
|
|
103
103
|
mock_command.execute.side_effect = Exception("Generic error")
|
|
104
104
|
|
|
105
105
|
mock_parser = MagicMock()
|
|
106
|
-
mock_args = MagicMock(command="test")
|
|
106
|
+
mock_args = MagicMock(command="test", spec={})
|
|
107
107
|
mock_parser.parse_args.return_value = mock_args
|
|
108
108
|
|
|
109
109
|
mock_create_parser.return_value = (mock_parser, {"test": mock_command})
|
|
@@ -126,7 +126,7 @@ class TestCliMain:
|
|
|
126
126
|
mock_command.execute.side_effect = test_exception
|
|
127
127
|
|
|
128
128
|
mock_parser = MagicMock()
|
|
129
|
-
mock_args = MagicMock(command="test")
|
|
129
|
+
mock_args = MagicMock(command="test", spec={})
|
|
130
130
|
mock_parser.parse_args.return_value = mock_args
|
|
131
131
|
|
|
132
132
|
mock_create_parser.return_value = (mock_parser, {"test": mock_command})
|
|
@@ -48,7 +48,7 @@ class TestCogneeServerStart(unittest.TestCase):
|
|
|
48
48
|
"""Test that the server is running and can accept connections."""
|
|
49
49
|
# Test health endpoint
|
|
50
50
|
health_response = requests.get("http://localhost:8000/health", timeout=15)
|
|
51
|
-
self.assertIn(health_response.status_code, [200
|
|
51
|
+
self.assertIn(health_response.status_code, [200])
|
|
52
52
|
|
|
53
53
|
# Test root endpoint
|
|
54
54
|
root_response = requests.get("http://localhost:8000/", timeout=15)
|
|
@@ -88,7 +88,7 @@ class TestCogneeServerStart(unittest.TestCase):
|
|
|
88
88
|
payload = {"datasets": [dataset_name]}
|
|
89
89
|
|
|
90
90
|
add_response = requests.post(url, headers=headers, data=form_data, files=file, timeout=50)
|
|
91
|
-
if add_response.status_code not in [200, 201
|
|
91
|
+
if add_response.status_code not in [200, 201]:
|
|
92
92
|
add_response.raise_for_status()
|
|
93
93
|
|
|
94
94
|
# Cognify request
|
|
@@ -99,7 +99,7 @@ class TestCogneeServerStart(unittest.TestCase):
|
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
cognify_response = requests.post(url, headers=headers, json=payload, timeout=150)
|
|
102
|
-
if cognify_response.status_code not in [200, 201
|
|
102
|
+
if cognify_response.status_code not in [200, 201]:
|
|
103
103
|
cognify_response.raise_for_status()
|
|
104
104
|
|
|
105
105
|
# TODO: Add test to verify cognify pipeline is complete before testing search
|
|
@@ -115,7 +115,7 @@ class TestCogneeServerStart(unittest.TestCase):
|
|
|
115
115
|
payload = {"searchType": "GRAPH_COMPLETION", "query": "What's in the document?"}
|
|
116
116
|
|
|
117
117
|
search_response = requests.post(url, headers=headers, json=payload, timeout=50)
|
|
118
|
-
if search_response.status_code not in [200, 201
|
|
118
|
+
if search_response.status_code not in [200, 201]:
|
|
119
119
|
search_response.raise_for_status()
|
|
120
120
|
|
|
121
121
|
|
|
@@ -97,7 +97,7 @@ async def main():
|
|
|
97
97
|
f"Expected exactly one DocumentChunk, but found {type_counts.get('DocumentChunk', 0)}"
|
|
98
98
|
)
|
|
99
99
|
|
|
100
|
-
assert type_counts.get("Entity", 0) >=
|
|
100
|
+
assert type_counts.get("Entity", 0) >= 10, (
|
|
101
101
|
f"Expected multiple entities (assert is set to 20), but found {type_counts.get('Entity', 0)}"
|
|
102
102
|
)
|
|
103
103
|
|
|
@@ -105,52 +105,24 @@ async def main():
|
|
|
105
105
|
f"Expected multiple entity types, but found {type_counts.get('EntityType', 0)}"
|
|
106
106
|
)
|
|
107
107
|
|
|
108
|
-
assert type_counts.get("Event", 0) >=
|
|
108
|
+
assert type_counts.get("Event", 0) >= 10, (
|
|
109
109
|
f"Expected multiple events (assert is set to 20), but found {type_counts.get('Event', 0)}"
|
|
110
110
|
)
|
|
111
111
|
|
|
112
|
-
assert type_counts.get("Timestamp", 0) >=
|
|
113
|
-
f"Expected multiple timestamps (assert is set to
|
|
112
|
+
assert type_counts.get("Timestamp", 0) >= 10, (
|
|
113
|
+
f"Expected multiple timestamps (assert is set to 10), but found {type_counts.get('Timestamp', 0)}"
|
|
114
114
|
)
|
|
115
115
|
|
|
116
|
-
assert
|
|
117
|
-
f"Expected multiple intervals, but found {type_counts.get('Interval', 0)}"
|
|
118
|
-
)
|
|
119
|
-
|
|
120
|
-
assert edge_type_counts.get("contains", 0) >= 20, (
|
|
116
|
+
assert edge_type_counts.get("contains", 0) >= 10, (
|
|
121
117
|
f"Expected multiple 'contains' edge, but found {edge_type_counts.get('contains', 0)}"
|
|
122
118
|
)
|
|
123
119
|
|
|
124
|
-
assert edge_type_counts.get("is_a", 0) >=
|
|
120
|
+
assert edge_type_counts.get("is_a", 0) >= 10, (
|
|
125
121
|
f"Expected multiple 'is_a' edge, but found {edge_type_counts.get('is_a', 0)}"
|
|
126
122
|
)
|
|
127
123
|
|
|
128
|
-
assert edge_type_counts.get("during", 0) == type_counts.get("Interval", 0), (
|
|
129
|
-
"Expected the same amount of during and interval objects in the graph"
|
|
130
|
-
)
|
|
131
|
-
|
|
132
|
-
assert edge_type_counts.get("during", 0) == type_counts.get("Interval", 0), (
|
|
133
|
-
"Expected the same amount of during and interval objects in the graph"
|
|
134
|
-
)
|
|
135
|
-
|
|
136
|
-
assert edge_type_counts.get("time_from", 0) == type_counts.get("Interval", 0), (
|
|
137
|
-
"Expected the same amount of time_from and interval objects in the graph"
|
|
138
|
-
)
|
|
139
|
-
|
|
140
|
-
assert edge_type_counts.get("time_to", 0) == type_counts.get("Interval", 0), (
|
|
141
|
-
"Expected the same amount of time_to and interval objects in the graph"
|
|
142
|
-
)
|
|
143
|
-
|
|
144
124
|
retriever = TemporalRetriever()
|
|
145
125
|
|
|
146
|
-
result_before = await retriever.extract_time_from_query("What happened before 1890?")
|
|
147
|
-
|
|
148
|
-
assert result_before[0] is None
|
|
149
|
-
|
|
150
|
-
result_after = await retriever.extract_time_from_query("What happened after 1891?")
|
|
151
|
-
|
|
152
|
-
assert result_after[1] is None
|
|
153
|
-
|
|
154
126
|
result_between = await retriever.extract_time_from_query("What happened between 1890 and 1900?")
|
|
155
127
|
|
|
156
128
|
assert result_between[1]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cognee
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.4.dev1
|
|
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
|
|
@@ -57,7 +57,7 @@ Requires-Dist: structlog<26,>=25.2.0
|
|
|
57
57
|
Requires-Dist: tiktoken<1.0.0,>=0.8.0
|
|
58
58
|
Requires-Dist: typing-extensions<5.0.0,>=4.12.2
|
|
59
59
|
Provides-Extra: anthropic
|
|
60
|
-
Requires-Dist: anthropic
|
|
60
|
+
Requires-Dist: anthropic>=0.27; extra == 'anthropic'
|
|
61
61
|
Provides-Extra: api
|
|
62
62
|
Requires-Dist: gunicorn<24,>=20.1.0; extra == 'api'
|
|
63
63
|
Requires-Dist: uvicorn<1.0.0,>=0.34.0; extra == 'api'
|
|
@@ -65,8 +65,8 @@ Requires-Dist: websockets<16.0.0,>=15.0.1; extra == 'api'
|
|
|
65
65
|
Provides-Extra: aws
|
|
66
66
|
Requires-Dist: s3fs[boto3]==2025.3.2; extra == 'aws'
|
|
67
67
|
Provides-Extra: chromadb
|
|
68
|
-
Requires-Dist: chromadb<0.7,>=0.
|
|
69
|
-
Requires-Dist: pypika==0.48.
|
|
68
|
+
Requires-Dist: chromadb<0.7,>=0.6; extra == 'chromadb'
|
|
69
|
+
Requires-Dist: pypika==0.48.9; extra == 'chromadb'
|
|
70
70
|
Provides-Extra: codegraph
|
|
71
71
|
Requires-Dist: fastembed<=0.6.0; (python_version < '3.13') and extra == 'codegraph'
|
|
72
72
|
Requires-Dist: transformers<5,>=4.46.3; extra == 'codegraph'
|
|
@@ -316,7 +316,19 @@ You can also cognify your files and query using cognee UI.
|
|
|
316
316
|
|
|
317
317
|
<img src="assets/cognee-new-ui.webp" width="100%" alt="Cognee UI 2"></a>
|
|
318
318
|
|
|
319
|
-
|
|
319
|
+
### Installation for UI
|
|
320
|
+
|
|
321
|
+
To use the cognee UI with full functionality, you need to install cognee with API dependencies:
|
|
322
|
+
|
|
323
|
+
```bash
|
|
324
|
+
pip install 'cognee[api]'
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
The UI requires backend server functionality (uvicorn and other API dependencies) which are not included in the default cognee installation to keep it lightweight.
|
|
328
|
+
|
|
329
|
+
### Running the UI
|
|
330
|
+
|
|
331
|
+
Try cognee UI by running ``` cognee-cli -ui ``` command on your terminal.
|
|
320
332
|
|
|
321
333
|
## Understand our architecture
|
|
322
334
|
|
|
@@ -24,7 +24,7 @@ cognee/api/v1/cognify/code_graph_pipeline.py,sha256=gRU0GSTyYSNg-jT84pDbSH3alkFG
|
|
|
24
24
|
cognee/api/v1/cognify/cognify.py,sha256=gLLkcw1WQ1awdfoyZCdV_UzYSIaRHIBP0ltaR2W5y_w,12053
|
|
25
25
|
cognee/api/v1/cognify/routers/__init__.py,sha256=wiPpOoQbSKje-SfbRQ7HPao0bn8FckRvIv0ipKW5Y90,114
|
|
26
26
|
cognee/api/v1/cognify/routers/get_code_pipeline_router.py,sha256=uO5KzjXYYkZaxzCYxe8-zKYZwXZLUPsJ5sJY9h7dYtw,2974
|
|
27
|
-
cognee/api/v1/cognify/routers/get_cognify_router.py,sha256=
|
|
27
|
+
cognee/api/v1/cognify/routers/get_cognify_router.py,sha256=fYsXZZL2gPcFWkngc8_dU3XHDusBwD6QyntyCmGesNk,8233
|
|
28
28
|
cognee/api/v1/config/__init__.py,sha256=D_bzXVg_vtSAW6U7S3qUDSqHU1Lf-cFpVt2rXrpBdnc,27
|
|
29
29
|
cognee/api/v1/config/config.py,sha256=ckyX0euGNYNXK0tFq5b_OouE6x4VDKFG3uXgMDNUbfk,6522
|
|
30
30
|
cognee/api/v1/datasets/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -54,7 +54,7 @@ cognee/api/v1/responses/routers/__init__.py,sha256=X2qishwGRVFXawnvkZ5bv420PuPRL
|
|
|
54
54
|
cognee/api/v1/responses/routers/default_tools.py,sha256=9qqzEZhrt3_YMKzUA06ke8P-2WeLXhYpKgVW6mLHlzw,3004
|
|
55
55
|
cognee/api/v1/responses/routers/get_responses_router.py,sha256=ggbLhY9IXaInCgIs5TUuOCkFW64xmTKZQsc2ENq2Ocs,5979
|
|
56
56
|
cognee/api/v1/search/__init__.py,sha256=Sqw60DcOj4Bnvt-EWFknT31sPcvROIRKCWLr5pbkFr4,39
|
|
57
|
-
cognee/api/v1/search/search.py,sha256=
|
|
57
|
+
cognee/api/v1/search/search.py,sha256=WhBtj90nW9ulas_dm8lX72VYGMmWVdcrC7nAfxcQgso,8821
|
|
58
58
|
cognee/api/v1/search/routers/__init__.py,sha256=6RebeLX_2NTRxIMPH_mGuLztPxnGnMJK1y_O93CtRm8,49
|
|
59
59
|
cognee/api/v1/search/routers/get_search_router.py,sha256=-5GLgHipflEblYAwl3uiPAZ2i3TgrLEjDuiO_cCqcB8,6252
|
|
60
60
|
cognee/api/v1/settings/routers/__init__.py,sha256=wj_UYAXNMPCkn6Mo1YB01dCBiV9DQwTIf6OWjnGRpf8,53
|
|
@@ -172,7 +172,7 @@ cognee/infrastructure/databases/graph/neptune_driver/neptune_utils.py,sha256=n9i
|
|
|
172
172
|
cognee/infrastructure/databases/hybrid/falkordb/FalkorDBAdapter.py,sha256=C8S81Xz_uWlyWkpZlSE9sYlMizcE6efPwcc1O-L-QSQ,41886
|
|
173
173
|
cognee/infrastructure/databases/hybrid/neptune_analytics/NeptuneAnalyticsAdapter.py,sha256=Y-P1YoajimqIc0T0YoN3xjTbW3zEdlir4zsTAcnBE7A,17617
|
|
174
174
|
cognee/infrastructure/databases/hybrid/neptune_analytics/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
175
|
-
cognee/infrastructure/databases/relational/ModelBase.py,sha256
|
|
175
|
+
cognee/infrastructure/databases/relational/ModelBase.py,sha256=-zau90uq4nDbM5GBdlxnU0oOko1NtYpcZdp_2DfEweQ,362
|
|
176
176
|
cognee/infrastructure/databases/relational/__init__.py,sha256=dkP-wkByc3BpClP1RWRmkxtayOorMrMzRw-pJtDHPkE,400
|
|
177
177
|
cognee/infrastructure/databases/relational/config.py,sha256=iYIkMBKdZVgpdfwQCU9M0-zz-_ThnhczkUXn9VABaDk,4722
|
|
178
178
|
cognee/infrastructure/databases/relational/create_db_and_tables.py,sha256=sldlFgE4uFdVBdXGqls6YAYX0QGExO2FHalfH58xiRE,353
|
|
@@ -193,12 +193,12 @@ cognee/infrastructure/databases/vector/supported_databases.py,sha256=0UIYcQ15p7-
|
|
|
193
193
|
cognee/infrastructure/databases/vector/use_vector_adapter.py,sha256=ab2x6-sxVDu_tf4zWChN_ngqv8LaLYk2VCtBjZEyjaM,174
|
|
194
194
|
cognee/infrastructure/databases/vector/utils.py,sha256=WHPSMFsN2XK72uURvCl_jlzQa-N3XKPhrDnB6GKmBtM,1224
|
|
195
195
|
cognee/infrastructure/databases/vector/vector_db_interface.py,sha256=EUpRVyMyS0MOQwFEgxwRa_9MY1vYotCyO6CONM81r94,7118
|
|
196
|
-
cognee/infrastructure/databases/vector/chromadb/ChromaDBAdapter.py,sha256=
|
|
196
|
+
cognee/infrastructure/databases/vector/chromadb/ChromaDBAdapter.py,sha256=c8oREW4EcX_TL2i-JdCRsi5EOtPxrtxpYkaUzc8IolU,18775
|
|
197
197
|
cognee/infrastructure/databases/vector/chromadb/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
198
198
|
cognee/infrastructure/databases/vector/embeddings/EmbeddingEngine.py,sha256=boNJ55dxJQ_ImW1_DDjToQa0Hos9mkeRYwfCI7UPLn0,983
|
|
199
199
|
cognee/infrastructure/databases/vector/embeddings/FastembedEmbeddingEngine.py,sha256=_R3yIuDaMN2lz9JhMy6SNpZeeCRZxHA9hmSB3gOxKkA,3823
|
|
200
200
|
cognee/infrastructure/databases/vector/embeddings/LiteLLMEmbeddingEngine.py,sha256=XUZnVftE57qWlAebr99aOEg-FynMKB7IS-kmBBT8E5Y,7544
|
|
201
|
-
cognee/infrastructure/databases/vector/embeddings/OllamaEmbeddingEngine.py,sha256=
|
|
201
|
+
cognee/infrastructure/databases/vector/embeddings/OllamaEmbeddingEngine.py,sha256=uR9ItOYN0ySsnPrmHGaoLGjiKJcFF-88KMwbtH6j0DU,4173
|
|
202
202
|
cognee/infrastructure/databases/vector/embeddings/__init__.py,sha256=Akv-ShdXjHw-BE00Gw55GgGxIMr0SZ9FHi3RlpsJmiE,55
|
|
203
203
|
cognee/infrastructure/databases/vector/embeddings/config.py,sha256=s9acnhn1DLFggCNJMVcN9AxruMf3J00O_R--JVGqMNs,2221
|
|
204
204
|
cognee/infrastructure/databases/vector/embeddings/embedding_rate_limiter.py,sha256=TyCoo_SipQ6JNy5eqXY2shrZnhb2JVjt9xOsJltOCdw,17598
|
|
@@ -240,7 +240,7 @@ cognee/infrastructure/files/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeR
|
|
|
240
240
|
cognee/infrastructure/files/utils/extract_text_from_file.py,sha256=-v0uvK6nXP6Q2Ia0GjIi97WntPFX6sWZQXO_Fg9TrCc,1112
|
|
241
241
|
cognee/infrastructure/files/utils/get_data_file_path.py,sha256=Xz9anl6yYxK6wETKhVeK4f3ahjw58Aj8YkyJkJONOvc,1549
|
|
242
242
|
cognee/infrastructure/files/utils/get_file_content_hash.py,sha256=0L_wgsRF8zqmtisFWcp4agDs7WovvBjiVWNQ_NCPKwo,1338
|
|
243
|
-
cognee/infrastructure/files/utils/get_file_metadata.py,sha256=
|
|
243
|
+
cognee/infrastructure/files/utils/get_file_metadata.py,sha256=WpyOTUf2CPFT8ZlxOWuchg34xu8HVrsMP7cpahsFX7g,2292
|
|
244
244
|
cognee/infrastructure/files/utils/guess_file_type.py,sha256=5d7qBd23O5BgcxEYan21kTWW7xISNhiH1SLaE4Nx8Co,3120
|
|
245
245
|
cognee/infrastructure/files/utils/is_text_content.py,sha256=iNZWCECNLMjlQfOQAujVQis7prA1cqsscRRSQsxccZo,1316
|
|
246
246
|
cognee/infrastructure/files/utils/open_data_file.py,sha256=CO654MXgbDXQFAJzrKXxS7csJGi3BEOR7F5Oljh4x2I,2369
|
|
@@ -330,7 +330,7 @@ cognee/infrastructure/llm/structured_output_framework/litellm_instructor/llm/get
|
|
|
330
330
|
cognee/infrastructure/llm/structured_output_framework/litellm_instructor/llm/llm_interface.py,sha256=126jfQhTEAbmsVsc4wyf20dK-C2AFJQ0sVmNPZFEet0,2194
|
|
331
331
|
cognee/infrastructure/llm/structured_output_framework/litellm_instructor/llm/rate_limiter.py,sha256=ie_zMYnUzMcW4okP4P41mEC31EML2ztdU7bEQQdg99U,16763
|
|
332
332
|
cognee/infrastructure/llm/structured_output_framework/litellm_instructor/llm/anthropic/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
333
|
-
cognee/infrastructure/llm/structured_output_framework/litellm_instructor/llm/anthropic/adapter.py,sha256=
|
|
333
|
+
cognee/infrastructure/llm/structured_output_framework/litellm_instructor/llm/anthropic/adapter.py,sha256=8KTFmFm9uLagIDTSsZMYjuyhXtmFkbm-YMWVDhrn7qw,3249
|
|
334
334
|
cognee/infrastructure/llm/structured_output_framework/litellm_instructor/llm/gemini/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
335
335
|
cognee/infrastructure/llm/structured_output_framework/litellm_instructor/llm/gemini/adapter.py,sha256=maSHU7nEZiR68ZeZW896LhXPm9b1f0rmEYQ6kB4CZMM,5089
|
|
336
336
|
cognee/infrastructure/llm/structured_output_framework/litellm_instructor/llm/generic_llm_api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -482,7 +482,6 @@ cognee/modules/metrics/operations/__init__.py,sha256=MZ3xbVdfEKqfLct8WnbyFVyZmkB
|
|
|
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
484
|
cognee/modules/notebooks/methods/create_notebook.py,sha256=S41H3Rha0pj9dEKFy1nBG9atTGHhUdOmDZgr0ckUA6M,633
|
|
485
|
-
cognee/modules/notebooks/methods/create_tutorial_notebook.py,sha256=8YPoDcMUZSNhEWSKxUcPOM61y0St2Z1Y-PC1HFRmlbk,4248
|
|
486
485
|
cognee/modules/notebooks/methods/delete_notebook.py,sha256=BKxoRlPzkwXvTYh5WcF-zo_iVmaXqEiptS42JwB0KQU,309
|
|
487
486
|
cognee/modules/notebooks/methods/get_notebook.py,sha256=IP4imsdt9X6GYd6i6WF6PlVhotGNH0i7XZpPqbtqMwo,554
|
|
488
487
|
cognee/modules/notebooks/methods/get_notebooks.py,sha256=ee40ALHvebVORuwZVkQ271qAj260rrYy6eVGxAmfo8c,483
|
|
@@ -518,7 +517,7 @@ cognee/modules/pipelines/methods/reset_pipeline_run_status.py,sha256=vHrGf2m9N89
|
|
|
518
517
|
cognee/modules/pipelines/models/DataItemStatus.py,sha256=QsWnMvcVE4ZDwTQP7pckg3O0Mlxs2xixqlOySMYPX0s,122
|
|
519
518
|
cognee/modules/pipelines/models/Pipeline.py,sha256=UOipcAaslLKJOceBQNaqUK-nfiD6wz7h6akwtDWkNA8,803
|
|
520
519
|
cognee/modules/pipelines/models/PipelineRun.py,sha256=zx714gI16v6OcOmho530Akmz2OdWlvDU5HI4KtqHNFg,949
|
|
521
|
-
cognee/modules/pipelines/models/PipelineRunInfo.py,sha256=
|
|
520
|
+
cognee/modules/pipelines/models/PipelineRunInfo.py,sha256=6gZKYN-15JNX05IXHLm9sOugBgSqH6jS2s4uiji9Hdc,1156
|
|
522
521
|
cognee/modules/pipelines/models/PipelineTask.py,sha256=v9HgLxjc9D5mnMU_dospVTUQ_VpyTOL00mUF9ckERSY,481
|
|
523
522
|
cognee/modules/pipelines/models/Task.py,sha256=SENQAPI5yAXCNdbLxO-hNKnxZ__0ykOCyCN2DSZc_Yw,796
|
|
524
523
|
cognee/modules/pipelines/models/TaskRun.py,sha256=Efb9ZrYVEYpCb92K_eW_K4Zwjm8thHmZh1vMTkpBMdM,478
|
|
@@ -577,9 +576,9 @@ cognee/modules/retrieval/utils/stop_words.py,sha256=HP8l2leoLf6u7tnWHrYhgVMY_TX6
|
|
|
577
576
|
cognee/modules/search/exceptions/__init__.py,sha256=7lH9BznC2274FD481U_8hfrxWonzJ8Mcv4oAkFFveqc,172
|
|
578
577
|
cognee/modules/search/exceptions/exceptions.py,sha256=Zc5Y0M-r-UnSSlpKzHKBplfjZ-Kcvmx912Cuw7wBg9g,431
|
|
579
578
|
cognee/modules/search/methods/__init__.py,sha256=jGfRvNwM5yIzj025gaVhcx7nCupRSXbUUnFjYVjL_Js,27
|
|
580
|
-
cognee/modules/search/methods/get_search_type_tools.py,sha256=
|
|
579
|
+
cognee/modules/search/methods/get_search_type_tools.py,sha256=omZUt5gJmmxGFizABgnKmGoYOo0tRJBfKdAmYinA9SE,7090
|
|
581
580
|
cognee/modules/search/methods/no_access_control_search.py,sha256=R08aMgaB8AkD0_XVaX15qLyC9KJ3fSVFv9zeZwuyez4,1566
|
|
582
|
-
cognee/modules/search/methods/search.py,sha256=
|
|
581
|
+
cognee/modules/search/methods/search.py,sha256=JjB9Nhxt_AIDF24z81FWGm7VVJFW90RCXRAU9VhMG34,12430
|
|
583
582
|
cognee/modules/search/models/Query.py,sha256=9WcF5Z1oCFtA4O-7An37eNAPX3iyygO4B5NSwhx7iIg,558
|
|
584
583
|
cognee/modules/search/models/Result.py,sha256=U7QtoNzAtZnUDwGWhjVfcalHQd4daKtYYvJz2BeWQ4w,564
|
|
585
584
|
cognee/modules/search/operations/__init__.py,sha256=AwJl6v9BTpocoefEZLk-flo1EtydYb46NSUoNFHkhX0,156
|
|
@@ -593,8 +592,9 @@ cognee/modules/search/types/SearchResult.py,sha256=blEean6PRFKcDRQugsojZPfH-Wohx
|
|
|
593
592
|
cognee/modules/search/types/SearchType.py,sha256=-lT4bLKKunV4cL4FfF3tjNbdN7X4AsRMLpTkReNwXZM,594
|
|
594
593
|
cognee/modules/search/types/__init__.py,sha256=8k6OjVrL70W1Jh-ClTbG2ETYIhOtSk3tfqjzYgEdPzA,117
|
|
595
594
|
cognee/modules/search/utils/__init__.py,sha256=86mRtCN-B5-2NNChdQoU5x8_8hqTczGZjBoKVE9O7hA,124
|
|
596
|
-
cognee/modules/search/utils/prepare_search_result.py,sha256=
|
|
597
|
-
cognee/modules/search/utils/transform_context_to_graph.py,sha256=
|
|
595
|
+
cognee/modules/search/utils/prepare_search_result.py,sha256=I_NrC6G549mEm1f0JZYJLCxAYQbKXBIzTJB4kv_3538,2334
|
|
596
|
+
cognee/modules/search/utils/transform_context_to_graph.py,sha256=Wl0kZR6YqyBxY-vBNNIy2pPIZaJVCigcRveJWjSX8BA,1238
|
|
597
|
+
cognee/modules/search/utils/transform_insights_to_graph.py,sha256=_ID5-37Ppl7jHbxNkUioZyH_I8SGXnhbfeLHgfEYec8,925
|
|
598
598
|
cognee/modules/settings/__init__.py,sha256=_SZQgCQnnnIHLJuKOMO9uWzXNBQxwYHHMUSBp0qa2uQ,210
|
|
599
599
|
cognee/modules/settings/get_current_settings.py,sha256=R2lOusG5Q2PMa2-2vDndh3Lm7nXyZVkdzTV7vQHT81Y,1642
|
|
600
600
|
cognee/modules/settings/get_settings.py,sha256=qkpNB_-IRexSzaiVvSS7NXG3S3fpbhDb6BQIPGAKET4,4221
|
|
@@ -648,7 +648,7 @@ cognee/modules/users/permissions/permission_types.py,sha256=6oUwupxBANfEYp9tx7Hc
|
|
|
648
648
|
cognee/modules/users/permissions/methods/__init__.py,sha256=0y-DjLFEdJEG_JOy0WoXJnVaiK-Q--LuAvfunl_74s0,861
|
|
649
649
|
cognee/modules/users/permissions/methods/authorized_give_permission_on_datasets.py,sha256=HSbrnTsb-MWUiZ3e_hAZqUgjYdTcqggJ0fRbPJ1Iaoc,1016
|
|
650
650
|
cognee/modules/users/permissions/methods/check_permission_on_dataset.py,sha256=mJTv-BSCAzrYEBPs6BL-W6qJhL-ZEq8C8LZ85d7WIPU,522
|
|
651
|
-
cognee/modules/users/permissions/methods/get_all_user_permission_datasets.py,sha256=
|
|
651
|
+
cognee/modules/users/permissions/methods/get_all_user_permission_datasets.py,sha256=sPv-k-UlpzwBdzFHiUimYvK90na2CNxOHi0CrzYcYD8,1411
|
|
652
652
|
cognee/modules/users/permissions/methods/get_document_ids_for_user.py,sha256=UDOgHh0p2uGYm-k7LMd3yQChaW8oAL7IBfItMV7cjWM,2604
|
|
653
653
|
cognee/modules/users/permissions/methods/get_principal.py,sha256=m5VlhZUscAD-Zn1D_ylCi1t-6eIoYZZPSOmaGbzkqRo,485
|
|
654
654
|
cognee/modules/users/permissions/methods/get_principal_datasets.py,sha256=jsJLfRRFGAat3biHtoz6VE7jNif_uDri5l6SaaodtZ0,917
|
|
@@ -762,10 +762,10 @@ cognee/tasks/temporal_graph/add_entities_to_event.py,sha256=wH4TlJfGN5_tjouuSFKK
|
|
|
762
762
|
cognee/tasks/temporal_graph/enrich_events.py,sha256=aLwGKzKLdUXbdn4WGN1uK5vOBk8nPzGM6bJ-7lWkt6s,1097
|
|
763
763
|
cognee/tasks/temporal_graph/extract_events_and_entities.py,sha256=iL0ppf5zmTey67yncLPkDY0Fd2GL4CqDGV4v1L0VmoA,1301
|
|
764
764
|
cognee/tasks/temporal_graph/extract_knowledge_graph_from_events.py,sha256=biDjIOnL_6ZSifFokwAlhVqNUixuzoFdYUmPzAT9d1Y,1440
|
|
765
|
-
cognee/tasks/temporal_graph/models.py,sha256=
|
|
765
|
+
cognee/tasks/temporal_graph/models.py,sha256=2fBZWqfZfLNh5BHqU8RbW60R1_IZU3PgY8MZJHlF0S0,1390
|
|
766
766
|
cognee/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
767
767
|
cognee/tests/test_chromadb.py,sha256=D9JEN0xbFxNLgp8UJTVAjpwob9S-LOQC-hSaMVvYhR8,9240
|
|
768
|
-
cognee/tests/test_cognee_server_start.py,sha256=
|
|
768
|
+
cognee/tests/test_cognee_server_start.py,sha256=jxFexF_Pir6zWPxpnZ-JTI9HOftqCXc6aaox4U3w1YM,4206
|
|
769
769
|
cognee/tests/test_custom_model.py,sha256=vypoJkF5YACJ6UAzV7lQFRmtRjVYEoPcUS8Rylgc1Wg,3465
|
|
770
770
|
cognee/tests/test_deduplication.py,sha256=1wSVq58rwFQOE5JtUcO3T92BBzzGTkC49yiaausjOac,8365
|
|
771
771
|
cognee/tests/test_delete_by_id.py,sha256=ROCGHYpI9bLBC-6d6F1VUq4kGPr0fzutbcSO3CGKbC8,13175
|
|
@@ -792,13 +792,13 @@ cognee/tests/test_s3_file_storage.py,sha256=62tvIFyh_uTP0TFF9Ck4Y-sxWPW-cwJKYEJU
|
|
|
792
792
|
cognee/tests/test_search_db.py,sha256=4GpLx8ZJoMjkp-XqQ-LCrkf3NhAM4j_rMmlOFgmDO-A,13420
|
|
793
793
|
cognee/tests/test_starter_pipelines.py,sha256=X1J8RDD0bFMKnRETyi5nyaF4TYdmUIu0EuD3WQwShNs,2475
|
|
794
794
|
cognee/tests/test_telemetry.py,sha256=FIneuVofSKWFYqxNC88sT_P5GPzgfjVyqDCf2TYBE2E,4130
|
|
795
|
-
cognee/tests/test_temporal_graph.py,sha256=
|
|
795
|
+
cognee/tests/test_temporal_graph.py,sha256=GRYS2FsFybYOuoQvmG711UTVAHgvGvapgMEzW4sclZg,11551
|
|
796
796
|
cognee/tests/cli_tests/cli_integration_tests/__init__.py,sha256=xYkvpZkxv_HRWmX71pGM3NUw2KKkDQIM-V6Ehxu-f0I,39
|
|
797
797
|
cognee/tests/cli_tests/cli_integration_tests/test_cli_integration.py,sha256=3hdz1DoGeidJInqbCy1YQte6J0QeQG1_WKGs9utjAFg,11560
|
|
798
798
|
cognee/tests/cli_tests/cli_unit_tests/__init__.py,sha256=U069aFvdwfKPd6YsR_FJML5LRphHHF5wx9mwug1hRh4,32
|
|
799
799
|
cognee/tests/cli_tests/cli_unit_tests/test_cli_commands.py,sha256=5a3vPiSFmKumq6sTfdfMyeUpJGjbZ6_5zX4TUcV0ZJQ,17625
|
|
800
800
|
cognee/tests/cli_tests/cli_unit_tests/test_cli_edge_cases.py,sha256=PyFCnClvbXG1GaiS16qwcuyXXDJ4sRyBCKV5WHrOUxk,23501
|
|
801
|
-
cognee/tests/cli_tests/cli_unit_tests/test_cli_main.py,sha256=
|
|
801
|
+
cognee/tests/cli_tests/cli_unit_tests/test_cli_main.py,sha256=6tx2A4us8uyZ7Zk4wZXplqLn5MtAejxOrG5ZxZpbFvQ,6143
|
|
802
802
|
cognee/tests/cli_tests/cli_unit_tests/test_cli_runner.py,sha256=WZ8oZIlc_JintDq_cnEg9tmLEMZMGFPQGhU7Y_7sfgs,1497
|
|
803
803
|
cognee/tests/cli_tests/cli_unit_tests/test_cli_utils.py,sha256=Flej8LNYRXNkWd2tq8elMm8MkqbhCUb8RtXaPzfNYm4,4323
|
|
804
804
|
cognee/tests/integration/documents/AudioDocument_test.py,sha256=0mJnlWRc7gWqOxAUfdSSIxntcUrzkPXhlsd-MFsiRoM,2790
|
|
@@ -889,9 +889,9 @@ distributed/tasks/queued_add_edges.py,sha256=kz1DHE05y-kNHORQJjYWHUi6Q1QWUp_v3Dl
|
|
|
889
889
|
distributed/tasks/queued_add_nodes.py,sha256=aqK4Ij--ADwUWknxYpiwbYrpa6CcvFfqHWbUZW4Kh3A,452
|
|
890
890
|
distributed/workers/data_point_saving_worker.py,sha256=jFmA0-P_0Ru2IUDrSug0wML-5goAKrGtlBm5BA5Ryw4,3229
|
|
891
891
|
distributed/workers/graph_saving_worker.py,sha256=oUYl99CdhlrPAIsUOHbHnS3d4XhGoV0_OIbCO8wYzRg,3648
|
|
892
|
-
cognee-0.3.
|
|
893
|
-
cognee-0.3.
|
|
894
|
-
cognee-0.3.
|
|
895
|
-
cognee-0.3.
|
|
896
|
-
cognee-0.3.
|
|
897
|
-
cognee-0.3.
|
|
892
|
+
cognee-0.3.4.dev1.dist-info/METADATA,sha256=6bowgjMT-6oiTpzQfG_eEjB3vtlxkwyu0bJeUmqbsYU,15097
|
|
893
|
+
cognee-0.3.4.dev1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
894
|
+
cognee-0.3.4.dev1.dist-info/entry_points.txt,sha256=GCCTsNg8gzOJkolq7dR7OK1VlIAO202dGDnMI8nm8oQ,55
|
|
895
|
+
cognee-0.3.4.dev1.dist-info/licenses/LICENSE,sha256=pHHjSQj1DD8SDppW88MMs04TPk7eAanL1c5xj8NY7NQ,11344
|
|
896
|
+
cognee-0.3.4.dev1.dist-info/licenses/NOTICE.md,sha256=6L3saP3kSpcingOxDh-SGjMS8GY79Rlh2dBNLaO0o5c,339
|
|
897
|
+
cognee-0.3.4.dev1.dist-info/RECORD,,
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
from uuid import UUID, uuid4
|
|
3
|
-
from sqlalchemy.ext.asyncio import AsyncSession
|
|
4
|
-
|
|
5
|
-
from ..models import NotebookCell
|
|
6
|
-
from .create_notebook import create_notebook
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
async def create_tutorial_notebook(user_id: UUID, session: AsyncSession):
|
|
10
|
-
await create_notebook(
|
|
11
|
-
user_id=user_id,
|
|
12
|
-
notebook_name="Welcome to cognee 🧠",
|
|
13
|
-
cells=[
|
|
14
|
-
NotebookCell(
|
|
15
|
-
id=uuid4(),
|
|
16
|
-
name="Welcome",
|
|
17
|
-
content="Cognee is your toolkit for turning text into a structured knowledge graph, optionally enhanced by ontologies, and then querying it with advanced retrieval techniques. This notebook will guide you through a simple example.",
|
|
18
|
-
type="markdown",
|
|
19
|
-
),
|
|
20
|
-
NotebookCell(
|
|
21
|
-
id=uuid4(),
|
|
22
|
-
name="Example",
|
|
23
|
-
content="",
|
|
24
|
-
type="markdown",
|
|
25
|
-
),
|
|
26
|
-
],
|
|
27
|
-
deletable=False,
|
|
28
|
-
session=session,
|
|
29
|
-
)
|
|
30
|
-
|
|
31
|
-
cell_content = [
|
|
32
|
-
"""
|
|
33
|
-
# Using Cognee with Python Development Data
|
|
34
|
-
|
|
35
|
-
Unite authoritative Python practice (Guido van Rossum's own contributions!), normative guidance (Zen/PEP 8), and your lived context (rules + conversations) into one *AI memory* that produces answers that are relevant, explainable, and consistent.
|
|
36
|
-
""",
|
|
37
|
-
|
|
38
|
-
"""
|
|
39
|
-
## What You'll Learn
|
|
40
|
-
|
|
41
|
-
In this comprehensive tutorial, you'll discover how to transform scattered development data into an intelligent knowledge system that enhances your coding workflow. By the end, you'll have:
|
|
42
|
-
- Connected disparate data sources (Guido's CPython contributions, mypy development, PEP discussions, your Python projects) into a unified AI memory graph
|
|
43
|
-
- Built an memory layer that understands Python design philosophy, best practice coding patterns, and your preferences and experience
|
|
44
|
-
- Learn how to use intelligent search capabilities that combine the diverse context
|
|
45
|
-
- Integrated everything with your coding environment through MCP (Model Context Protocol)
|
|
46
|
-
|
|
47
|
-
This tutorial demonstrates the power of **knowledge graphs** and **retrieval-augmented generation (RAG)** for software development, showing you how to build systems that learn from Python's creator and improve your own Python development.
|
|
48
|
-
""",
|
|
49
|
-
|
|
50
|
-
"""
|
|
51
|
-
## Cognee and its core operations
|
|
52
|
-
|
|
53
|
-
Before we dive in, let's understand the core Cognee operations we'll be working with:
|
|
54
|
-
- `cognee.add()` - Ingests raw data (files, text, APIs) into the system
|
|
55
|
-
- `cognee.cognify()` - Processes and structures data into a knowledge graph using AI
|
|
56
|
-
- `cognee.search()` - Queries the knowledge graph with natural language or Cypher
|
|
57
|
-
- `cognee.memify()` - Cognee's \"secret sauce\" that infers implicit connections and rules from your data
|
|
58
|
-
""",
|
|
59
|
-
|
|
60
|
-
"""
|
|
61
|
-
## Data used in this tutorial
|
|
62
|
-
|
|
63
|
-
Cognee can ingest many types of sources. In this tutorial, we use a small, concrete set of files that cover different perspectives:
|
|
64
|
-
- `guido_contributions.json` — Authoritative exemplars. Real PRs and commits from Guido van Rossum (mypy, CPython). These show how Python's creator solved problems and provide concrete anchors for patterns.
|
|
65
|
-
- `pep_style_guide.md` — Norms. Encodes community style and typing conventions (PEP 8 and related). Ensures that search results and inferred rules align with widely accepted standards.
|
|
66
|
-
- `zen_principles.md` — Philosophy. The Zen of Python. Grounds design trade-offs (simplicity, explicitness, readability) beyond syntax or mechanics.
|
|
67
|
-
- `my_developer_rules.md` — Local constraints. Your house rules, conventions, and project-specific requirements (scope, privacy, Spec.md). Keeps recommendations relevant to your actual workflow.
|
|
68
|
-
- `copilot_conversations.json` — Personal history. Transcripts of real assistant conversations, including your questions, code snippets, and discussion topics. Captures "how you code" and connects it to "how Guido codes."
|
|
69
|
-
""",
|
|
70
|
-
|
|
71
|
-
"""
|
|
72
|
-
# Preliminaries
|
|
73
|
-
|
|
74
|
-
To strike the balanace between speed, cost, anc quality, we recommend using OpenAI's `4o-mini` model; make sure your `.env` file contains this line:
|
|
75
|
-
`
|
|
76
|
-
LLM_MODEL="gpt-4o-mini"
|
|
77
|
-
`
|
|
78
|
-
""",
|
|
79
|
-
|
|
80
|
-
"""
|
|
81
|
-
import cognee
|
|
82
|
-
|
|
83
|
-
result = await cognee.add(
|
|
84
|
-
"file://data/guido_contributions.json",
|
|
85
|
-
node_set=["guido_data"]
|
|
86
|
-
)
|
|
87
|
-
|
|
88
|
-
await cognee.cognify(temporal_cognify=True)
|
|
89
|
-
|
|
90
|
-
results = await cognee.search("Show me commits")
|
|
91
|
-
"""
|
|
92
|
-
]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|