Graph-Native Infrastructure for Context and Accountable AI Systems
Python agent-memoryaiai-governanceai-infrastructureartificial-intelligencecontext-engineeringcontext-graphsdata-engineeringdecision-intelligencedeveloper-toolsexplainable-aigenerative-aigraph-ragknowledge-graphllmontologyprovenancepythonreasoningsemantic-search
fix(methods): enhance error logging for vector similarity calculations
ArmanGrewal0076148975e8334
diff --git a/semantica/semantic_extract/methods.py b/semantica/semantic_extract/methods.pyindex 06854619..09d98b22 100644--- a/semantica/semantic_extract/methods.py+++ b/semantica/semantic_extract/methods.py@@ -372,10 +372,12 @@ def find_best_match_index(text: str, candidates: List[str]) -> Tuple[int, float]vector_idx = -1if nlp and nlp.vocab.vectors.shape[0] > 0:+ failing_candidate_idx = -1try:doc = nlp(text)if doc.vector_norm:for i, candidate in enumerate(candidates):+ failing_candidate_idx = iif not candidate: continuecand_doc = nlp(candidate)if cand_doc.vector_norm:@@ -383,8 +385,12 @@ def find_best_match_index(text: str, candidates: List[str]) -> Tuple[int, float]if score > vector_score:vector_score = scorevector_idx = i- except Exception as e:- logger.debug(f"Vector similarity calculation failed: {e}")+ except Exception:+ logger.debug(+ "Vector similarity calculation failed at candidate index %s; continuing with fallback scoring.",+ failing_candidate_idx if failing_candidate_idx >= 0 else "N/A",+ exc_info=True,+ )vector_score = 0.0vector_idx = -1