diff --git a/lotus/vector_store/weaviate_vs.py b/lotus/vector_store/weaviate_vs.py index 702fb51..44eb746 100644 --- a/lotus/vector_store/weaviate_vs.py +++ b/lotus/vector_store/weaviate_vs.py @@ -118,9 +118,8 @@ def __call__(self, for obj in objects: indices.append(obj.properties.get('content')) # Convert cosine distance to similarity score - distance:float = obj.metadata.distance - distances.append(1 - distance) # Convert distance to similarity - + distance = obj.metadata.distance if obj.metadata and obj.metadata.distance is not None else 1.0 + distances.append(1 - distance) # Convert distance to similarity # Pad results if fewer than K matches while len(indices) < K: indices.append(-1)