Skip to content

Commit 6e64723

Browse files
Merge remote-tracking branch 'origin/dev' into test_sparse
2 parents 4843de4 + abbe52a commit 6e64723

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

pinecone/core/grpc/index_grpc.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -345,19 +345,19 @@ def _dict_to_grpc_vector(item):
345345
sparse_values = None
346346
if 'sparse_values' in item:
347347
if not isinstance(item['sparse_values'], Mapping):
348-
raise ValueError(f"Column `sparse_values` is expected to be a dictionary, found {type(item['sparse_values'])}")
348+
raise TypeError(f"Column `sparse_values` is expected to be a dictionary, found {type(item['sparse_values'])}")
349349
indices = item['sparse_values'].get('indices', None)
350350
values = item['sparse_values'].get('values', None)
351351
try:
352352
sparse_values = GRPCSparseValues(indices=indices, values=values)
353353
except TypeError as e:
354-
raise ValueError("Found unexpected data in column `sparse_values`. "
354+
raise TypeError("Found unexpected data in column `sparse_values`. "
355355
"Expected format is `'sparse_values': {'indices': List[int], 'values': List[float]}`."
356356
) from e
357357

358-
metadata = item.get('metadata', None)
359-
if metadata is not None and not isinstance(metadata, Mapping):
360-
raise TypeError(f"Column `metadata` is expected to be a dictionary, found {type(metadata)}")
358+
metadata = item.get('metadata', None)
359+
if metadata is not None and not isinstance(metadata, Mapping):
360+
raise TypeError(f"Column `metadata` is expected to be a dictionary, found {type(metadata)}")
361361

362362
try:
363363
return GRPCVector(id=item['id'], values=item['values'], sparse_values=sparse_values,

pinecone/index.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,9 @@ def _dict_to_vector(item):
190190
"Expected format is `'sparse_values': {'indices': List[int], 'values': List[float]}`."
191191
) from e
192192

193-
metadata = item.get('metadata') or {}
194-
if not isinstance(metadata, Mapping):
195-
raise TypeError(f"Column `metadata` is expected to be a dictionary, found {type(metadata)}")
193+
metadata = item.get('metadata') or {}
194+
if not isinstance(metadata, Mapping):
195+
raise TypeError(f"Column `metadata` is expected to be a dictionary, found {type(metadata)}")
196196

197197
try:
198198
return Vector(id=item['id'], values=item['values'], sparse_values=sparse_values, metadata=metadata)

0 commit comments

Comments
 (0)