repo stringclasses 454
values | file_path stringlengths 5 201 | extension stringclasses 1
value | content stringlengths 8 509k | num_lines int64 3 16.9k | size_bytes int64 8 511k |
|---|---|---|---|---|---|
cognee | cognee/tests/utils/assert_graph_nodes_not_present.py | .py | from typing import List
from cognee.infrastructure.databases.graph import get_graph_engine
from cognee.infrastructure.engine.models.DataPoint import DataPoint
async def assert_graph_nodes_not_present(data_points: List[DataPoint]):
graph_engine = await get_graph_engine()
nodes, __ = await graph_engine.get_grap... | 17 | 632 |
cognee | cognee/tests/utils/extract_entities.py | .py | from cognee.modules.engine.models import Entity, EntityType
from cognee.modules.engine.utils import generate_node_name
from cognee.shared.data_models import KnowledgeGraph
def extract_entities(graph: KnowledgeGraph, cache: dict | None = None):
if cache is None:
cache = {}
entities = []
entity_type... | 48 | 1,386 |
cognee | cognee/tests/utils/filter_overlapping_entities.py | .py | def filter_overlapping_entities(*entity_groups):
entity_count = {}
overlapping_entities = []
for group in entity_groups:
for entity in group:
if entity.id not in entity_count:
entity_count[entity.id] = 1
else:
entity_count[entity.id] += 1
... | 27 | 756 |
cognee | cognee/tests/utils/assert_nodes_vector_index_present.py | .py | from typing import List
from cognee.infrastructure.databases.vector import get_vector_engine_async
from cognee.infrastructure.engine.models.DataPoint import DataPoint
async def assert_nodes_vector_index_present(data_points: List[DataPoint]):
vector_engine = await get_vector_engine_async()
data_points_by_vect... | 29 | 1,219 |
cognee | cognee/tests/utils/assert_graph_edges_present.py | .py | from uuid import UUID
from typing import Dict, List, Tuple
from cognee.infrastructure.databases.graph import get_graph_engine
async def assert_graph_edges_present(relationships: List[Tuple[UUID, UUID, str, Dict]]):
graph_engine = await get_graph_engine()
nodes, edges = await graph_engine.get_graph_data()
... | 25 | 1,134 |
cognee | cognee/tests/utils/mock_ingestion/__init__.py | .py | from .mock_ingestion import (
ingest_mock,
install_mocks,
load_memories,
load_mock_data,
memory_to_text,
)
__all__ = [
"ingest_mock",
"install_mocks",
"load_memories",
"load_mock_data",
"memory_to_text",
]
| 16 | 247 |
cognee | cognee/tests/utils/mock_ingestion/mock_ingestion.py | .py | """Mock-replay ingestion: build a real cognee graph/vector store with zero
LLM or embedding API calls.
Extracted from the performance test system
(``cognee/tests/performance/statistics_percentile/bench_cognee.py``) so any
suite can build large deterministic systems the same way: the perf benchmarks,
and the large-scal... | 171 | 6,662 |
cognee | cognee/tests/release_migration/phase2_verify_large.py | .py | """Large-scale migration release test β Phase 2 (runs on the CURRENT branch).
Takes over the legacy-seeded 2Γ~100k-node system from phase 1 and proves the
release migrates it correctly, mirroring the manual 1.5.0 release validation:
1. ``cognee.run_migrations()`` β alembic + the cognee migration chain over
both da... | 145 | 6,870 |
cognee | cognee/tests/release_migration/phase1_seed_large.py | .py | """Large-scale migration release test β Phase 1 (runs on the LEGACY version).
Seeds a LARGE production-shaped system on the pinned legacy cognee (>= v1.2.0),
mirroring the manual 1.5.0 release validation: the war-and-peace large mock
(~100k nodes / ~100k semantic edges per dataset) is ingested into TWO datasets
with i... | 57 | 2,043 |
cognee | cognee/tests/e2e/docker/test_docker_multi_tenant_access_control.py | .py | """End-to-end Docker smoke test for multi-tenant access control (#3369).
Proves tenant isolation end-to-end with ENABLE_BACKEND_ACCESS_CONTROL=true
against a running Cognee Docker container.
Opt-in: requires COGNEE_DOCKER_E2E_IMAGE env var pointing to a built image.
Example::
COGNEE_DOCKER_E2E_IMAGE=cognee-back... | 298 | 10,337 |
cognee | cognee/tests/e2e/turso/test_graphdb_turso.py | .py | """End-to-end graph database test using the Turso (libSQL) backend.
Exercises the full add -> cognify -> search pipeline against a local libSQL file.
Requires:
- LLM_API_KEY set for cognify
- A working vector database (default LanceDB is fine)
Turso is local and needs no server or extra dependency (a libSQL file ... | 22 | 616 |
cognee | cognee/tests/e2e/turso/test_turso_adapter.py | .py | """Unit tests for TursoAdapter using an in-memory SQLite database."""
import json
import pytest
import pytest_asyncio
from cognee.infrastructure.databases.graph.turso.adapter import TursoAdapter
@pytest_asyncio.fixture
async def adapter():
"""In-memory SQLite adapter β fast, no disk I/O, isolated per test."""
... | 336 | 11,817 |
cognee | cognee/tests/e2e/dataset_queue/test_dataset_queue_buildup.py | .py | """Verify dataset-queue slot accounting under max_concurrent=1.
Runs the SDK calls inline (no isolation) so slots leaked by a call stay
visible to the next assertion. Expected to fail on the calls that hold a
slot past their own lifetime β fix those call sites and the test goes
green.
Covers: add/cognify, get_formatt... | 129 | 4,821 |
cognee | cognee/tests/e2e/dataset_queue/test_queue_serialization_e2e.py | .py | """End-to-end test proving the Dataset Queue serialises per-dataset operations.
Scenario:
- Queue enabled (``DATASET_QUEUE_ENABLED=true``).
- Single slot (``DATABASE_MAX_LRU_CACHE_SIZE=1`` at the queue level).
- Three concurrent ``cognee.add`` calls on three different datasets.
- Three concurrent ``cog... | 386 | 15,304 |
cognee | cognee/tests/e2e/postgres/test_shared_schema_isolation.py | .py | """Tests for shared-database (schema-per-dataset) isolation mode.
The ``pgvector_shared`` and ``postgres_graph_shared`` dataset handlers keep each
dataset's tables in a dedicated Postgres *schema* (``ds_<dataset_id>``) inside one
shared database, instead of provisioning a whole database per dataset. Isolation
is enfor... | 303 | 10,718 |
cognee | cognee/tests/e2e/postgres/test_postgres_adapter.py | .py | """Unit tests for the Postgres graph adapter.
Requires a running Postgres instance. Connection defaults:
DB_HOST=localhost, DB_PORT=5432, DB_USERNAME=cognee,
DB_PASSWORD=cognee, DB_NAME=cognee_db
Override via environment variables if needed.
"""
import os
import json
import pytest
import pytest_asyncio
from cog... | 456 | 12,634 |
cognee | cognee/tests/e2e/postgres/test_postgres_hybrid_adapter.py | .py | """Unit tests for the Postgres hybrid adapter.
Requires a running Postgres instance with pgvector extension.
Connection defaults: DB_HOST=localhost, DB_PORT=5432,
DB_USERNAME=cognee, DB_PASSWORD=cognee, DB_NAME=cognee_db.
"""
import os
import pytest
import pytest_asyncio
from cognee.infrastructure.databases.graph.po... | 455 | 15,260 |
cognee | cognee/tests/e2e/postgres/test_graphdb_shared.py | .py | """Shared graph database backend test.
Exercises the full add -> cognify -> search pipeline against whichever
graph backend is configured via `provider`. Requires:
- A working LLM API key (LLM_API_KEY in .env)
- A working vector database (default LanceDB is fine)
- For postgres: DB_PROVIDER=postgres with valid c... | 160 | 6,662 |
cognee | cognee/tests/e2e/postgres/test_pghybrid.py | .py | """End-to-end test for the pghybrid backend.
Exercises add -> cognify -> search with USE_UNIFIED_PROVIDER=pghybrid,
which uses the PostgresHybridAdapter for both graph and vector operations
in a single Postgres database.
Requires:
- A running Postgres instance with pgvector extension
- LLM_API_KEY set for cognify... | 51 | 2,009 |
cognee | cognee/tests/e2e/postgres/test_graphdb_postgres.py | .py | """End-to-end graph database test using the Postgres backend.
Requires:
- A running Postgres instance
- DB_PROVIDER=postgres with valid DB_HOST, DB_PORT, DB_USERNAME, DB_PASSWORD, DB_NAME
- LLM_API_KEY set for cognify
"""
import asyncio
from cognee.tests.e2e.postgres.test_graphdb_shared import run_graph_db_test... | 19 | 434 |
cognee | cognee/tests/deployment/test_mcp_http_direct.py | .py | """T3 (#3361): MCP Docker image e2e over streamable HTTP (direct mode).
Drives the built ``cognee/cognee-mcp`` image through a real MCP session: boots it
with ``TRANSPORT_MODE=http``, connects an MCP client at ``/mcp``, asserts the tool
surface (pinned + search transform, with unadvertised tools still callable),
exerc... | 222 | 8,373 |
cognee | cognee/tests/deployment/mcp_harness.py | .py | """Helpers for the MCP Docker HTTP e2e suite (T3 / #3361).
Drive the built ``cognee-mcp`` image over HTTP (Docker CLI + httpx + mcp): image
availability, a free-port picker, a health poller, a container context manager
with guaranteed teardown, and an MCP streamable-HTTP client session.
"""
from __future__ import ann... | 175 | 5,219 |
cognee | cognee/tests/deployment/conftest.py | .py | """Pytest fixtures and marker registration for deployment end-to-end tests.
Deployment tests run a prebuilt ``cognee-mcp`` Docker image and are therefore
opt-in via the ``deployment`` marker (select with ``pytest -m deployment``).
They are skipped automatically when Docker is unavailable or the image has not
been buil... | 59 | 1,956 |
cognee | cognee/api/client.py | .py | """FastAPI server for the Cognee API."""
import os
import uvicorn
from traceback import format_exc
from contextlib import asynccontextmanager
from fastapi import Request
from fastapi import FastAPI, status
from fastapi.encoders import jsonable_encoder
from fastapi.responses import JSONResponse
from fastapi.middleware... | 384 | 13,226 |
cognee | cognee/api/DTO.py | .py | from pydantic import BaseModel, ConfigDict
from pydantic.alias_generators import to_camel, to_snake
from typing import Optional
class OutDTO(BaseModel):
model_config = ConfigDict(
alias_generator=to_camel,
populate_by_name=True,
)
class InDTO(BaseModel):
model_config = ConfigDict(
... | 23 | 464 |
cognee | cognee/api/v1/ontologies/__init__.py | .py | from .ontologies import OntologyService
from .routers.get_ontology_router import get_ontology_router
__all__ = ["OntologyService", "get_ontology_router"]
| 5 | 155 |
cognee | cognee/api/v1/ontologies/ontologies.py | .py | import hashlib
import json
import os
import re
from pathlib import Path
from datetime import datetime, timezone
from typing import Optional, List
from dataclasses import dataclass
from fastapi import UploadFile
from cognee.base_config import get_base_config
_ONTOLOGY_KEY_RE = re.compile(r"^[A-Za-z0-9][A-Za-z0-9_.-]{0... | 208 | 7,182 |
cognee | cognee/api/v1/ontologies/routers/get_ontology_router.py | .py | import asyncio
from fastapi import APIRouter, File, Form, Path, UploadFile, Depends, Request
from fastapi.responses import JSONResponse
from typing import Optional, List
from cognee.modules.users.models import User
from cognee.modules.users.methods import get_authenticated_user
from cognee.shared.utils import send_te... | 195 | 8,217 |
cognee | cognee/api/v1/add/add.py | .py | from uuid import UUID
from typing import Union, BinaryIO, List, Optional, Any
from cognee.modules.users.models import User
from cognee.infrastructure.databases.vector.embeddings.config import EmbeddingConfig
from cognee.infrastructure.llm.config import LLMConfig
from cognee.modules.pipelines import Task, run_pipeline
... | 326 | 13,628 |
cognee | cognee/api/v1/add/routers/get_add_router.py | .py | from uuid import UUID
from fastapi import APIRouter
from fastapi.responses import JSONResponse
from fastapi import Form, File, UploadFile as UF, Depends, status
from typing import List, Optional, Union, Literal, Annotated
from pydantic import WithJsonSchema
from cognee.modules.users.models import User
from cognee.mod... | 199 | 8,755 |
cognee | cognee/api/v1/settings/routers/get_settings_router.py | .py | from fastapi import APIRouter, Depends
from fastapi.responses import JSONResponse
from cognee.api.DTO import InDTO, OutDTO
from typing import Union, Optional, Literal
from cognee.modules.users.methods import get_authenticated_user
from cognee.modules.users.models import User
from cognee.modules.settings.get_settings im... | 111 | 3,514 |
cognee | cognee/api/v1/export/export.py | .py | """SDK entry point: export a dataset's memory to a portable format."""
from pathlib import Path
from typing import Literal, Optional, Union, overload
from uuid import UUID
from cognee.modules.migration.export import ExportResult, export_dataset
from cognee.modules.migration.snapshot import GraphSnapshot
from cognee.m... | 107 | 3,839 |
cognee | cognee/api/v1/export/__init__.py | .py | from .export import export, ExportResult
__all__ = ["export", "ExportResult"]
| 4 | 79 |
cognee | cognee/api/v1/exceptions/exceptions.py | .py | from cognee.exceptions import CogneeConfigurationError, CogneeValidationError
from fastapi import status
class InvalidConfigAttributeError(CogneeConfigurationError):
def __init__(
self,
attribute: str,
name: str = "InvalidConfigAttributeError",
status_code: int = status.HTTP_400_BA... | 77 | 2,481 |
cognee | cognee/api/v1/exceptions/__init__.py | .py | """
Custom exceptions for the Cognee API.
This module defines a set of exceptions for handling various data errors
"""
from .exceptions import (
InvalidConfigAttributeError,
DocumentNotFoundError,
DatasetNotFoundError,
DataNotFoundError,
DocumentSubgraphNotFoundError,
UpdateTargetNotFoundError... | 15 | 324 |
cognee | cognee/api/v1/push/__init__.py | .py | from .push import PushResult, push
__all__ = ["PushResult", "push"]
| 4 | 69 |
cognee | cognee/api/v1/push/push.py | .py | """SDK entry point: push a local dataset's knowledge graph to Cognee Cloud.
Bridges ``cognee.export(format="cogx")`` and the remote remember endpoint:
the dataset's graph is exported to a COGX archive, packed as a tarball, and
uploaded via :class:`CloudClient`, where the receiving instance imports it
through :class:`C... | 195 | 7,988 |
cognee | cognee/api/v1/serve/state.py | .py | """Module-level singleton for the remote cloud client.
When set, V2 functions (remember/recall/improve/forget) route to the
cloud instead of executing locally.
"""
from typing import TYPE_CHECKING, Optional
if TYPE_CHECKING:
from cognee.api.v1.serve.cloud_client import CloudClient
_remote_client: Optional["Clou... | 26 | 607 |
cognee | cognee/api/v1/serve/cloud_client.py | .py | """Remote HTTP client that proxies V2 operations to a Cognee Cloud instance."""
import io
from pathlib import Path
from typing import Any, Optional
from uuid import UUID
import aiohttp
from cognee.modules.ingestion.data_types.TextData import create_text_data
from cognee.shared.logging_utils import get_logger
logger... | 393 | 16,681 |
cognee | cognee/api/v1/serve/device_auth.py | .py | """Auth0 Device Code Flow (RFC 8628) for CLI/SDK authentication."""
import asyncio
import os
import time
from dataclasses import dataclass
from typing import Optional
import aiohttp
from cognee.shared.logging_utils import get_logger
logger = get_logger("serve.device_auth")
# Defaults β override via env vars
DEFAUL... | 186 | 6,359 |
cognee | cognee/api/v1/serve/disconnect.py | .py | """Disconnect from Cognee Cloud and revert to local mode."""
from cognee.shared.logging_utils import get_logger
logger = get_logger("serve.disconnect")
async def disconnect(clear_saved: bool = False) -> None:
"""Disconnect from Cognee Cloud and revert to local mode.
After calling this, all V2 operations (r... | 36 | 1,194 |
cognee | cognee/api/v1/serve/serve.py | .py | """Top-level serve() orchestrator β connects the SDK to Cognee Cloud or a local instance."""
from __future__ import annotations
import os
import time
from typing import TYPE_CHECKING, Optional
if TYPE_CHECKING:
from cognee.api.v1.serve.cloud_client import CloudClient
from cognee.shared.logging_utils import get_... | 231 | 8,143 |
cognee | cognee/api/v1/serve/management_api.py | .py | """Management API client β tenant discovery and API key provisioning.
Replicates the frontend's TenantProvider.tsx flow in Python.
"""
import asyncio
import hashlib
import os
from dataclasses import dataclass
from typing import Optional
import aiohttp
from cognee.shared.logging_utils import get_logger
logger = get... | 155 | 5,330 |
cognee | cognee/api/v1/serve/credentials.py | .py | """Persist and load cloud credentials from ~/.cognee/cloud_credentials.json."""
import json
import os
import time
from dataclasses import asdict, dataclass, field
from pathlib import Path
from typing import Optional
from cognee.shared.logging_utils import get_logger
logger = get_logger("serve.credentials")
_CREDENT... | 68 | 1,838 |
cognee | cognee/api/v1/improve/improve.py | .py | from uuid import UUID
from typing import Union, Optional, List, Type, Any
try:
from typing import Unpack
except ImportError:
from typing_extensions import Unpack
from typing_extensions import TypedDict
from cognee.shared.logging_utils import get_logger
from cognee.modules.pipelines.layers.resolve_authorized_... | 477 | 19,077 |
cognee | cognee/api/v1/improve/routers/get_improve_router.py | .py | from uuid import UUID
from fastapi import APIRouter, HTTPException
from fastapi.responses import JSONResponse
from fastapi import Depends
from pydantic import Field
from typing import Dict, List, Optional, Union, Literal
from cognee.api.DTO import InDTO
from cognee.modules.users.models import User
from cognee.modules... | 112 | 4,860 |
cognee | cognee/api/v1/recall/query_router.py | .py | """
Rule-based query router for recall().
Classifies a query string into a SearchType without calling an LLM.
Uses a weighted scoring approach: each pattern adds points to candidate
search types, and the highest-scoring type wins.
"""
import re
from dataclasses import dataclass, field
from cognee.modules.search.types... | 233 | 7,055 |
cognee | cognee/api/v1/recall/recall.py | .py | import re
from typing import Annotated, Literal
from uuid import UUID
from pydantic import BaseModel, Field
from typing_extensions import TypedDict
from cognee.base_config import get_base_config
from cognee.context_global_variables import set_session_user_context_variable
from cognee.exceptions import CogneeValidatio... | 772 | 30,247 |
cognee | cognee/api/v1/recall/routers/get_recall_router.py | .py | from datetime import datetime
from typing import List, Optional, Union
from uuid import UUID
from fastapi import APIRouter, Depends
from fastapi.encoders import jsonable_encoder
from fastapi.responses import JSONResponse
from pydantic import Field
from cognee import __version__ as cognee_version
from cognee.api.DTO i... | 255 | 10,829 |
cognee | cognee/api/v1/users/create_user.py | .py | from cognee.modules.users.methods import create_user as create_user_method
async def create_user(email: str, password: str, is_superuser: bool = False):
user = await create_user_method(
email=email,
password=password,
is_superuser=is_superuser,
is_verified=True,
)
return u... | 13 | 324 |
cognee | cognee/api/v1/users/routers/get_verify_router.py | .py | from cognee.modules.users.get_fastapi_users import get_fastapi_users
from cognee.modules.users.models.User import UserRead
def get_verify_router():
return get_fastapi_users().get_verify_router(UserRead)
| 7 | 209 |
cognee | cognee/api/v1/users/routers/get_users_router.py | .py | from cognee.modules.users.get_fastapi_users import get_fastapi_users
from cognee.modules.users.models.User import UserRead, UserUpdate
def get_users_router():
return get_fastapi_users().get_users_router(UserRead, UserUpdate)
| 7 | 231 |
cognee | cognee/api/v1/users/routers/get_auth_router.py | .py | from fastapi import Depends, HTTPException, Response, APIRouter
from fastapi.security import OAuth2PasswordRequestForm
from cognee.modules.users.models import User
from cognee.modules.users.methods import get_authenticated_user
from cognee.modules.users.authentication.get_client_auth_backend import get_client_auth_bac... | 57 | 1,985 |
cognee | cognee/api/v1/users/routers/get_register_router.py | .py | from cognee.modules.users.get_fastapi_users import get_fastapi_users
from cognee.modules.users.models.User import UserRead, UserCreate
def get_register_router():
return get_fastapi_users().get_register_router(UserRead, UserCreate)
| 7 | 237 |
cognee | cognee/api/v1/users/routers/get_user_id_by_email_router.py | .py | from fastapi import APIRouter, HTTPException, Depends
from cognee.api.DTO import InDTO
from pydantic import EmailStr
from cognee.modules.users.models.User import User
from cognee.modules.users.methods import get_authenticated_user
from cognee.modules.users.methods.get_user_id_by_email import get_user_id_by_email
cla... | 27 | 800 |
cognee | cognee/api/v1/users/routers/get_visualize_router.py | .py | from datetime import datetime
from typing import List, Optional
from fastapi import APIRouter, Depends, Query
from fastapi.responses import HTMLResponse, JSONResponse
from pydantic import BaseModel, Field
from uuid import UUID
from cognee.modules.users.exceptions import PermissionDeniedError
from cognee.shared.logging... | 546 | 20,111 |
cognee | cognee/api/v1/users/routers/get_reset_password_router.py | .py | from cognee.modules.users.get_fastapi_users import get_fastapi_users
def get_reset_password_router():
return get_fastapi_users().get_reset_password_router()
| 6 | 163 |
cognee | cognee/api/v1/users/routers/get_configuration_router.py | .py | from fastapi import APIRouter
from fastapi import Form, Depends, Path
from uuid import UUID
from pydantic import Field
from cognee.api.DTO import InDTO
from cognee.modules.users.models import User
from cognee.modules.users.methods import get_authenticated_user
from cognee.shared.logging_utils import get_logger
from c... | 112 | 4,357 |
cognee | cognee/api/v1/llm/__init__.py | .py | from cognee.api.v1.llm.routers import get_llm_router
__all__ = ["get_llm_router"]
| 4 | 83 |
cognee | cognee/api/v1/llm/routers/__init__.py | .py | from cognee.api.v1.llm.routers.get_llm_router import get_llm_router
__all__ = ["get_llm_router"]
| 4 | 98 |
cognee | cognee/api/v1/llm/routers/get_llm_router.py | .py | import json
from typing import Any, Dict, List, Annotated
import litellm
from fastapi import APIRouter, Depends, File, UploadFile as UF, Form
from fastapi.responses import JSONResponse
from pydantic import Field
from pydantic import ConfigDict, ValidationError
from cognee import __version__ as cognee_version
from cog... | 378 | 14,012 |
cognee | cognee/api/v1/activity/routers/get_activity_router.py | .py | """Activity & telemetry endpoints.
Exposes pipeline run history and in-memory OTEL spans so the frontend
can render an activity timeline and trace viewer.
"""
from typing import Optional
from uuid import UUID
from fastapi import APIRouter, Query, Depends
from fastapi.responses import JSONResponse
from cognee.modules.... | 407 | 16,877 |
cognee | cognee/api/v1/tools/__init__.py | .py | from . import tools
from .tools import (
apply_write_proposal,
list_sql_connections,
list_write_proposals,
propose_corrections,
propose_sql_write,
register_sql_connection,
reject_write_proposal,
remove_sql_connection,
)
__all__ = [
"tools",
"register_sql_connection",
"list_s... | 24 | 505 |
cognee | cognee/api/v1/tools/tools.py | .py | """SDK surface for managing authorized tool connections.
Exposed as ``cognee.tools``:
await cognee.tools.register_sql_connection(
name="analytics",
connection_string="postgresql://ro_user:pw@host:5432/analytics",
)
await cognee.tools.list_sql_connections()
await cognee.tools.remove_sql... | 156 | 5,564 |
cognee | cognee/api/v1/prune/prune.py | .py | from cognee.modules.data.deletion import prune_system as _prune_system, prune_data as _prune_data
class prune:
@staticmethod
async def prune_data():
await _prune_data()
@staticmethod
async def prune_system(graph=True, vector=True, metadata=False, cache=True):
await _prune_system(graph... | 22 | 511 |
cognee | cognee/api/v1/visualize/visualize.py | .py | from datetime import datetime, timezone
from typing import Any, Dict, List, Tuple, Optional, Union
from uuid import UUID
from cognee.modules.users.models.User import User
from cognee.modules.visualization.cognee_network_visualization import (
cognee_network_visualization,
aggregate_multi_user_graphs,
build... | 448 | 17,683 |
cognee | cognee/api/v1/visualize/get_schema_inventory.py | .py | """Schema and entity inventory over the knowledge graph.
Summarizes the graph by semantic type: per-type instance counts, representative
sample names, and the per-pair relationship distribution. Composes the verified
building blocks ``get_graph_engine`` and ``get_graph_data`` and reads node/edge
fields using their exa... | 188 | 8,211 |
cognee | cognee/api/v1/visualize/__init__.py | .py | from .visualize import (
visualize_graph,
visualize_multi_user_graph,
visualize_graph_json,
visualize_semantic_json,
build_brains_payload,
get_live_events,
)
from .get_schema_inventory import get_schema_inventory
# build_provenance_graph is an internal assembly helper (it operates on records
# ... | 20 | 663 |
cognee | cognee/api/v1/visualize/start_visualization_server.py | .py | from collections.abc import Callable
from cognee.shared.utils import start_visualization_server
def visualization_server(port) -> Callable[[], Callable[[], None]]:
"""
Start a visualization server on the specified port.
Args:
port (int): The port number to run the server on
Returns:
... | 20 | 514 |
cognee | cognee/api/v1/visualize/memory_provenance.py | .py | """Memory provenance projection.
Projects cognee's *relational* actor/ownership/session metadata
(Tenant β User β Agent β Dataset/"brain" β Data/file, plus agent read/write
access and agent-written Sessions) into a single ``(nodes, edges)`` graph in
the exact shape ``GraphDBInterface.get_graph_data()`` returns β so th... | 780 | 32,356 |
cognee | cognee/api/v1/visualize/routers/get_schema_router.py | .py | """HTTP router for schema inventory and memory provenance endpoints.
Exposes schema/provenance SDK helpers over HTTP with explicit response schemas
and caller-scoped authorization.
"""
from uuid import UUID
from fastapi import APIRouter, Depends, Query
from fastapi.responses import HTMLResponse, JSONResponse
from py... | 250 | 8,991 |
cognee | cognee/api/v1/visualize/routers/__init__.py | .py | from .get_schema_router import get_schema_router
__all__ = ["get_schema_router"]
| 4 | 82 |
cognee | cognee/api/v1/search/search.py | .py | from uuid import UUID
from typing import Any, Union, Optional, List, Type
from cognee.modules.engine.models.node_set import NodeSet
from cognee.modules.engine.models import Skill
from cognee.modules.users.models import User
from cognee.infrastructure.databases.vector.embeddings.config import EmbeddingConfig
from cogne... | 386 | 17,420 |
cognee | cognee/api/v1/search/routers/get_search_router.py | .py | from datetime import datetime
from typing import Any, List, Optional, Union
from uuid import UUID
from fastapi import APIRouter, Depends, status
from fastapi.encoders import jsonable_encoder
from fastapi.responses import JSONResponse
from pydantic import Field
from cognee import __version__ as cognee_version
from cog... | 273 | 11,345 |
cognee | cognee/api/v1/sessions/__init__.py | .py | from .routers.get_sessions_router import get_sessions_router
__all__ = ["get_sessions_router"]
| 4 | 96 |
cognee | cognee/api/v1/sessions/routers/get_sessions_router.py | .py | """Sessions HTTP router.
Backs the dashboard: list/detail of sessions, aggregate stats, cost
by model. Effective status is computed in SQL with the
abandonment-by-idle rule so no sweeper is needed.
"""
from datetime import datetime, timedelta, timezone
from typing import Literal, Optional
from uuid import UUID as UUI... | 408 | 16,679 |
cognee | cognee/api/v1/permissions/routers/get_permissions_router.py | .py | from typing import List, Union
from uuid import UUID
from fastapi import APIRouter, Body, Depends, Query
from fastapi.responses import JSONResponse
from cognee import __version__ as cognee_version
from cognee.modules.users.tenants.methods.get_tenant_roles import (
get_tenant_roles as method_get_tenant_roles,
)
fr... | 635 | 24,315 |
cognee | cognee/api/v1/datasets/datasets.py | .py | import asyncio
from uuid import UUID
from typing import Optional
from cognee.context_global_variables import set_database_global_context_variables
from cognee.infrastructure.locks import dataset_lock
from cognee.modules.users.models import User
from cognee.modules.users.methods import get_default_user
from cognee.modu... | 206 | 8,306 |
cognee | cognee/api/v1/datasets/routers/get_datasets_router.py | .py | from uuid import UUID
from datetime import datetime
from pydantic import BaseModel, Field
from typing import Any, Dict, List, Optional, Union
from typing_extensions import Annotated
from fastapi import status
from fastapi import APIRouter
from fastapi.encoders import jsonable_encoder
from fastapi import HTTPException, ... | 836 | 32,173 |
cognee | cognee/api/v1/forget/forget.py | .py | from uuid import UUID
from typing import Optional, Union, Any
from cognee.context_global_variables import set_database_global_context_variables
from cognee.infrastructure.locks import dataset_lock
from cognee.shared.logging_utils import get_logger
from cognee.modules.observability import (
new_span,
COGNEE_DAT... | 413 | 15,847 |
cognee | cognee/api/v1/forget/routers/get_forget_router.py | .py | from uuid import UUID
from typing import Optional, Union, Literal
from pydantic import ConfigDict, Field
from fastapi import Depends, APIRouter
from fastapi.responses import JSONResponse
from cognee.api.DTO import InDTO
from cognee.modules.users.models import User
from cognee.modules.users.methods import get_authentic... | 127 | 5,089 |
cognee | cognee/api/v1/cognify/cognify.py | .py | import asyncio
from pydantic import BaseModel
from typing import Collection, Union, Optional
from uuid import UUID
from cognee.modules.cognify.config import get_cognify_config
from cognee.modules.cognify.rollback import cognify_rollback_handler
from cognee.modules.cognify.routing import CognifyRoute, cognify_route_for... | 523 | 23,085 |
cognee | cognee/api/v1/cognify/routers/get_cognify_router.py | .py | import os
import asyncio
from uuid import UUID
from pydantic import Field
from typing import Dict, List, Optional
from fastapi.responses import JSONResponse
from fastapi import APIRouter, WebSocket, Depends, WebSocketDisconnect, status
from starlette.status import WS_1000_NORMAL_CLOSURE, WS_1008_POLICY_VIOLATION
from ... | 361 | 15,968 |
cognee | cognee/api/v1/memify/routers/get_memify_router.py | .py | from uuid import UUID
from fastapi import APIRouter
from fastapi.responses import JSONResponse
from fastapi import Depends, status
from pydantic import Field
from typing import List, Optional, Union, Literal
from cognee.api.DTO import InDTO
from cognee.modules.users.models import User
from cognee.modules.users.method... | 155 | 7,127 |
cognee | cognee/api/v1/config/__init__.py | .py | from cognee.infrastructure.llm.config import LLMConfig
from .config import config
__all__ = ["LLMConfig", "config"]
| 6 | 118 |
cognee | cognee/api/v1/config/config.py | .py | """This module is used to set the configuration of the system."""
import os
from cognee.base_config import get_base_config
from cognee.modules.cognify.config import get_cognify_config
from cognee.infrastructure.data.chunking.config import get_chunk_config
from cognee.infrastructure.databases.vector import get_vectordb... | 881 | 32,365 |
cognee | cognee/api/v1/slack/routers/get_slack_router.py | .py | """Public Slack webhook receiver.
Three unauthenticated-by-design endpoints β Slack cannot send a bearer token
or cookie, so the ``X-Slack-Signature`` HMAC (enforced by the
``verify_slack_request`` dependency) is the entire auth model. Handlers
receive the verified raw bytes and parse them themselves; adding a parsed
... | 38 | 1,637 |
cognee | cognee/api/v1/slack/routers/__init__.py | .py | from .get_slack_channels_router import get_slack_channels_router
from .get_slack_router import get_slack_router
__all__ = ["get_slack_router", "get_slack_channels_router"]
| 5 | 173 |
cognee | cognee/api/v1/slack/routers/get_slack_channels_router.py | .py | """Slack channel-allowlist management β authenticated settings endpoints.
Separate from get_slack_router.py's public, signature-verified webhooks on
purpose: these need a real cognee session (Depends(get_authenticated_user)),
not an HMAC over the raw body, and "which channels can run slash commands"
is a Slack-specifi... | 139 | 5,029 |
cognee | cognee/api/v1/cloud/routers/get_checks_router.py | .py | from fastapi import APIRouter, Depends, Request
from cognee.modules.users.models import User
from cognee.modules.users.methods import get_authenticated_user
from cognee.modules.cloud.operations import check_api_key
from cognee.modules.cloud.exceptions import CloudApiKeyMissingError
def get_checks_router():
route... | 24 | 686 |
cognee | cognee/api/v1/proposals/routers/get_proposals_router.py | .py | """HTTP router for reviewing skill-improvement proposals.
Exposes a read-only view of a stored ``SkillImprovementProposal`` over HTTP so a
caller can inspect the before/after procedure, rationale and confidence *before*
deciding whether to apply it (apply still happens via
``POST /api/v1/remember/entry`` with ``skill_... | 126 | 5,208 |
cognee | cognee/api/v1/proposals/routers/__init__.py | .py | from .get_proposals_router import get_proposals_router
__all__ = ["get_proposals_router"]
| 4 | 91 |
cognee | cognee/api/v1/update/update.py | .py | from uuid import UUID
from typing import Union, BinaryIO, List, Optional, Any, Dict
from cognee.modules.pipelines.models import PipelineRunInfo
from cognee.modules.users.models import User
from cognee.modules.users.methods import get_default_user
from cognee.api.v1.add import add
from cognee.api.v1.cognify import cogn... | 163 | 7,092 |
cognee | cognee/api/v1/update/routers/get_update_router.py | .py | from fastapi.responses import JSONResponse
from fastapi import File, UploadFile as UF, Depends, Form, Query, status
from typing import Optional, Annotated, Dict
from fastapi import APIRouter
from typing import List
from uuid import UUID
from pydantic import WithJsonSchema
from cognee.shared.logging_utils import get_log... | 150 | 6,057 |
cognee | cognee/api/v1/health/health.py | .py | """Health check system for cognee API."""
from io import BytesIO
import time
import asyncio
from sqlalchemy import text
from datetime import datetime, timezone
from typing import Dict
from enum import Enum
from pydantic import BaseModel
from cognee.version import get_cognee_version
from cognee.shared.logging_utils im... | 321 | 12,030 |
cognee | cognee/api/v1/health/routers/get_health_router.py | .py | from fastapi import APIRouter
from fastapi.responses import JSONResponse
from cognee.api.v1.health import health_checker, HealthStatus
from cognee.shared.logging_utils import get_logger
logger = get_logger(__name__)
def get_health_router():
health_router = APIRouter()
@health_router.get("", response_model=... | 59 | 2,061 |
cognee | cognee/api/v1/session/__init__.py | .py | import types
from cognee.infrastructure.databases.cache.models import SessionQAEntry
from cognee.modules.session_distillation import DistillationResult, distill_session
from .session import add_feedback, add_frequency_weights, delete_feedback, get_session
session = types.SimpleNamespace(
get_session=get_session,... | 26 | 669 |
cognee | cognee/api/v1/session/session.py | .py | from typing import List, Optional, cast
from uuid import UUID
from cognee.context_global_variables import session_user
from cognee.exceptions import CogneeValidationError
from cognee.infrastructure.databases.cache.models import SessionQAEntry
from cognee.infrastructure.databases.exceptions import DatabaseNotCreatedErr... | 221 | 8,043 |
cognee | cognee/api/v1/api_keys/routers/get_api_key_management_router.py | .py | from uuid import UUID
from typing import Optional
from fastapi import APIRouter, Depends
from fastapi.responses import JSONResponse
from cognee.api.DTO import InDTO
from cognee.modules.users.models import User
from cognee.shared.utils import send_telemetry
from cognee.modules.users.methods import get_authenticated_us... | 102 | 3,232 |
cognee | cognee/api/v1/skills/__init__.py | .py | from .list_skills import list_skills
__all__ = ["list_skills"]
| 4 | 64 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.