fix: implementing deletion in search.py
This commit is contained in:
parent
07e67e268b
commit
4860d1c550
4 changed files with 0 additions and 8 deletions
|
|
@ -1,5 +1,4 @@
|
||||||
from typing import Any, Optional
|
from typing import Any, Optional
|
||||||
from cognee.modules.retrieval.utils.access_tracking import update_node_access_timestamps
|
|
||||||
from cognee.shared.logging_utils import get_logger
|
from cognee.shared.logging_utils import get_logger
|
||||||
from cognee.infrastructure.databases.vector import get_vector_engine
|
from cognee.infrastructure.databases.vector import get_vector_engine
|
||||||
from cognee.modules.retrieval.base_retriever import BaseRetriever
|
from cognee.modules.retrieval.base_retriever import BaseRetriever
|
||||||
|
|
@ -49,7 +48,6 @@ class ChunksRetriever(BaseRetriever):
|
||||||
try:
|
try:
|
||||||
found_chunks = await vector_engine.search("DocumentChunk_text", query, limit=self.top_k)
|
found_chunks = await vector_engine.search("DocumentChunk_text", query, limit=self.top_k)
|
||||||
logger.info(f"Found {len(found_chunks)} chunks from vector search")
|
logger.info(f"Found {len(found_chunks)} chunks from vector search")
|
||||||
await update_node_access_timestamps(found_chunks)
|
|
||||||
|
|
||||||
except CollectionNotFoundError as error:
|
except CollectionNotFoundError as error:
|
||||||
logger.error("DocumentChunk_text collection not found in vector database")
|
logger.error("DocumentChunk_text collection not found in vector database")
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@ from cognee.modules.retrieval.utils.session_cache import (
|
||||||
save_conversation_history,
|
save_conversation_history,
|
||||||
get_conversation_history,
|
get_conversation_history,
|
||||||
)
|
)
|
||||||
from cognee.modules.retrieval.utils.access_tracking import update_node_access_timestamps
|
|
||||||
from cognee.modules.retrieval.base_retriever import BaseRetriever
|
from cognee.modules.retrieval.base_retriever import BaseRetriever
|
||||||
from cognee.modules.retrieval.exceptions.exceptions import NoDataError
|
from cognee.modules.retrieval.exceptions.exceptions import NoDataError
|
||||||
from cognee.infrastructure.databases.vector.exceptions import CollectionNotFoundError
|
from cognee.infrastructure.databases.vector.exceptions import CollectionNotFoundError
|
||||||
|
|
@ -66,7 +65,6 @@ class CompletionRetriever(BaseRetriever):
|
||||||
|
|
||||||
if len(found_chunks) == 0:
|
if len(found_chunks) == 0:
|
||||||
return ""
|
return ""
|
||||||
await update_node_access_timestamps(found_chunks)
|
|
||||||
# Combine all chunks text returned from vector search (number of chunks is determined by top_k
|
# Combine all chunks text returned from vector search (number of chunks is determined by top_k
|
||||||
chunks_payload = [found_chunk.payload["text"] for found_chunk in found_chunks]
|
chunks_payload = [found_chunk.payload["text"] for found_chunk in found_chunks]
|
||||||
combined_context = "\n".join(chunks_payload)
|
combined_context = "\n".join(chunks_payload)
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,6 @@ from cognee.modules.retrieval.utils.session_cache import (
|
||||||
)
|
)
|
||||||
from cognee.shared.logging_utils import get_logger
|
from cognee.shared.logging_utils import get_logger
|
||||||
from cognee.modules.retrieval.utils.extract_uuid_from_node import extract_uuid_from_node
|
from cognee.modules.retrieval.utils.extract_uuid_from_node import extract_uuid_from_node
|
||||||
from cognee.modules.retrieval.utils.access_tracking import update_node_access_timestamps
|
|
||||||
from cognee.modules.retrieval.utils.models import CogneeUserInteraction
|
from cognee.modules.retrieval.utils.models import CogneeUserInteraction
|
||||||
from cognee.modules.engine.models.node_set import NodeSet
|
from cognee.modules.engine.models.node_set import NodeSet
|
||||||
from cognee.infrastructure.databases.graph import get_graph_engine
|
from cognee.infrastructure.databases.graph import get_graph_engine
|
||||||
|
|
@ -143,7 +142,6 @@ class GraphCompletionRetriever(BaseGraphRetriever):
|
||||||
|
|
||||||
entity_nodes = get_entity_nodes_from_triplets(triplets)
|
entity_nodes = get_entity_nodes_from_triplets(triplets)
|
||||||
|
|
||||||
await update_node_access_timestamps(entity_nodes)
|
|
||||||
return triplets
|
return triplets
|
||||||
|
|
||||||
async def get_completion(
|
async def get_completion(
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ from cognee.shared.logging_utils import get_logger
|
||||||
from cognee.infrastructure.databases.vector import get_vector_engine
|
from cognee.infrastructure.databases.vector import get_vector_engine
|
||||||
from cognee.modules.retrieval.base_retriever import BaseRetriever
|
from cognee.modules.retrieval.base_retriever import BaseRetriever
|
||||||
from cognee.modules.retrieval.exceptions.exceptions import NoDataError
|
from cognee.modules.retrieval.exceptions.exceptions import NoDataError
|
||||||
from cognee.modules.retrieval.utils.access_tracking import update_node_access_timestamps
|
|
||||||
from cognee.infrastructure.databases.vector.exceptions.exceptions import CollectionNotFoundError
|
from cognee.infrastructure.databases.vector.exceptions.exceptions import CollectionNotFoundError
|
||||||
|
|
||||||
logger = get_logger("SummariesRetriever")
|
logger = get_logger("SummariesRetriever")
|
||||||
|
|
@ -56,7 +55,6 @@ class SummariesRetriever(BaseRetriever):
|
||||||
)
|
)
|
||||||
logger.info(f"Found {len(summaries_results)} summaries from vector search")
|
logger.info(f"Found {len(summaries_results)} summaries from vector search")
|
||||||
|
|
||||||
await update_node_access_timestamps(summaries_results)
|
|
||||||
|
|
||||||
except CollectionNotFoundError as error:
|
except CollectionNotFoundError as error:
|
||||||
logger.error("TextSummary_text collection not found in vector database")
|
logger.error("TextSummary_text collection not found in vector database")
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue