Skip to content

Commit

Permalink
Truncate vector in logs (neo4j#192)
Browse files Browse the repository at this point in the history
* Truncate vector in logs

* Changed log message for query vector

* Modified log

* Use correct query to avoid deprecation warning for Hybrid

* Modified log condition for query_vector
  • Loading branch information
willtai authored Oct 22, 2024
1 parent 358fafd commit fd9cd18
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/neo4j_graphrag/retrievers/hybrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
# limitations under the License.
from __future__ import annotations

import copy
import logging
from typing import Any, Callable, Optional

Expand Down Expand Up @@ -193,8 +194,10 @@ def get_search_results(
embedding_node_property=self._embedding_node_property,
neo4j_version_is_5_23_or_above=self.neo4j_version_is_5_23_or_above,
)

logger.debug("HybridRetriever Cypher parameters: %s", parameters)
sanitized_parameters = copy.deepcopy(parameters)
if "query_vector" in sanitized_parameters:
sanitized_parameters["query_vector"] = "..."
logger.debug("HybridRetriever Cypher parameters: %s", sanitized_parameters)
logger.debug("HybridRetriever Cypher query: %s", search_query)

records, _, _ = self.driver.execute_query(
Expand Down Expand Up @@ -348,9 +351,11 @@ def get_search_results(
retrieval_query=self.retrieval_query,
neo4j_version_is_5_23_or_above=self.neo4j_version_is_5_23_or_above,
)

logger.debug("HybridCypherRetriever Cypher parameters: %s", parameters)
logger.debug("HybridCypherRetriever Cypher query: %s", search_query)
sanitized_parameters = copy.deepcopy(parameters)
if "query_vector" in sanitized_parameters:
sanitized_parameters["query_vector"] = "..."
logger.debug("HybridRetriever Cypher parameters: %s", sanitized_parameters)
logger.debug("HybridRetriever Cypher query: %s", search_query)

records, _, _ = self.driver.execute_query(
search_query, parameters, database_=self.neo4j_database
Expand Down

0 comments on commit fd9cd18

Please sign in to comment.