Skip to content

Commit 54b888f

Browse files
committed
[ENH] Embedding validation error message
1 parent 0e0994a commit 54b888f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

chromadb/api/types.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def normalize_embeddings(
143143

144144
if len(target) == 0:
145145
raise ValueError(
146-
f"Expected Embeddings to be non-empty list or numpy array, got {target}"
146+
f"Expected embeddings to be non-empty list or numpy array, got {target}"
147147
)
148148

149149
if isinstance(target, list):
@@ -152,6 +152,8 @@ def normalize_embeddings(
152152
return [np.array(target, dtype=np.float32)]
153153
# List of PyEmbeddings
154154
if isinstance(target[0], list):
155+
if len(target[0]) == 0:
156+
raise ValueError("Expected embeddings to be at least 1-dimensional")
155157
if isinstance(target[0][0], (int, float)) and not isinstance(
156158
target[0][0], bool
157159
):

0 commit comments

Comments
 (0)