Skip to content

Commit 0af764a

Browse files
committed
fix: convert NumPy arrays and other vector types in insert_many (Fixes #1002)
insert_many() in executor.py constructs _BatchObject directly without converting the vector, causing NumPy arrays, torch tensors, and other supported vector types to be silently discarded. The fix applies _get_vector_v4() conversion (same as BatchObject.__init__) before storing the vector in _BatchObject. Also handles named vectors (dict[str, vector]) by converting each value. Signed-off-by: rtmalikian <rtmalikian@gmail.com>
1 parent 17a9887 commit 0af764a

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

weaviate/collections/data/executor.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,13 @@ def insert_many(
177177
(
178178
_BatchObject(
179179
collection=self.name,
180-
vector=obj.vector,
180+
vector=(
181+
{key: _get_vector_v4(val) for key, val in obj.vector.items()}
182+
if isinstance(obj.vector, dict)
183+
else _get_vector_v4(obj.vector)
184+
if obj.vector is not None
185+
else None
186+
),
181187
uuid=str(obj.uuid if obj.uuid is not None else uuid_package.uuid4()),
182188
properties=cast(dict, obj.properties),
183189
tenant=self._tenant,

0 commit comments

Comments
 (0)