Skip to content

BrainAPI is a knowledge graph–powered AI memory layer that transforms unstructured data into structured knowledge, enabling intelligent search, recommendations, and contextual memory for AI agents and applications.

fix(sibilings retrieval): fixed missing embeddings accessoring

Christian592b81b90735
diff --git a/src/core/search/entity_sibilings.py b/src/core/search/entity_sibilings.py
index fbbd80e..f8be810 100644
--- a/src/core/search/entity_sibilings.py
+++ b/src/core/search/entity_sibilings.py
@@ -283,6 +283,7 @@ class EntitySinergyRetriever:
axis=0,
)
neighbor_node_vid = e[2].properties.get("v_id")
+ tn_score = None
if neighbor_node_vid:
neighbor_node_embedding = (
_get_first_embedding(
@@ -290,13 +291,14 @@ class EntitySinergyRetriever:
store="nodes",
)
)
- tn_score = wsim(
- cosine_similarity(
- neighbor_node_embedding,
- target_embedding,
- ),
- NODE_SIM_DESC_INCREMENTAL_WEIGHT,
- )
+ if neighbor_node_embedding is not None:
+ tn_score = wsim(
+ cosine_similarity(
+ neighbor_node_embedding,
+ target_embedding,
+ ),
+ NODE_SIM_DESC_INCREMENTAL_WEIGHT,
+ )
rel_score = cosine_similarity(
found_embeddings,
target_embeddings,