Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions cognee/api/v1/delete/delete.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from uuid import UUID
from sqlalchemy import select
from sqlalchemy.sql import delete as sql_delete
from typing import Dict, Any

from cognee.infrastructure.engine import DataPoint
from cognee.infrastructure.databases.graph import get_graph_engine
Expand Down Expand Up @@ -30,7 +31,7 @@ async def delete(
dataset_id: UUID,
mode: str = "soft",
user: User = None,
):
) -> dict:
"""Delete data by its ID from the specified dataset.

Args:
Expand Down Expand Up @@ -92,7 +93,7 @@ async def delete(
return await delete_single_document(data_id, dataset.id, mode)


async def delete_single_document(data_id: str, dataset_id: UUID = None, mode: str = "soft"):
async def delete_single_document(data_id: str, dataset_id: UUID = None, mode: str = "soft") -> dict:
"""Delete a single document by its content hash."""

# Delete from graph database
Expand Down Expand Up @@ -215,7 +216,7 @@ async def delete_single_document(data_id: str, dataset_id: UUID = None, mode: st
}


async def delete_document_subgraph(document_id: str, mode: str = "soft"):
async def delete_document_subgraph(document_id: str, mode: str = "soft") -> dict:
"""Delete a document and all its related nodes in the correct order."""
graph_db = await get_graph_engine()
subgraph = await graph_db.get_document_subgraph(document_id)
Expand Down
2 changes: 1 addition & 1 deletion cognee/api/v1/update/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ async def update(
graph_db_config: dict = None,
preferred_loaders: dict[str, dict[str, Any]] = None,
incremental_loading: bool = True,
):
) -> Any:
"""
Update existing data in Cognee.

Expand Down
2 changes: 1 addition & 1 deletion cognee/api/v1/visualize/start_visualization_server.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from cognee.shared.utils import start_visualization_server


def visualization_server(port):
def visualization_server(port) -> callable:
"""
Start a visualization server on the specified port.

Expand Down
4 changes: 3 additions & 1 deletion cognee/api/v1/visualize/visualize.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from typing import Any

from cognee.modules.visualization.cognee_network_visualization import (
cognee_network_visualization,
)
Expand All @@ -11,7 +13,7 @@
logger = get_logger()


async def visualize_graph(destination_file_path: str = None):
async def visualize_graph(destination_file_path: str = None) -> Any:
graph_engine = await get_graph_engine()
graph_data = await graph_engine.get_graph_data()

Expand Down
4 changes: 3 additions & 1 deletion cognee/modules/ingestion/classify.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
from .data_types import TextData, BinaryData, S3BinaryData


def classify(data: Union[str, BinaryIO], filename: str = None):
def classify(
data: Union[str, BinaryIO], filename: str = None
) -> Union[TextData, BinaryData, S3BinaryData]:
if isinstance(data, str):
return TextData(data)

Expand Down