|
3 | 3 | #
|
4 | 4 | import logging
|
5 | 5 | import numbers
|
6 |
| -import warnings |
7 | 6 | from abc import ABC, abstractmethod
|
8 | 7 | from functools import wraps
|
9 | 8 | from typing import NamedTuple, Optional, Dict, Iterable, Union, List, Tuple, Any
|
@@ -340,8 +339,8 @@ def _dict_to_grpc_vector(item):
|
340 | 339 |
|
341 | 340 | excessive_keys = item_keys - (REQUIRED_VECTOR_FIELDS | OPTIONAL_VECTOR_FIELDS)
|
342 | 341 | if len(excessive_keys) > 0:
|
343 |
| - warnings.warn(f"Found excessive keys in the vector dictionary: {list(excessive_keys)}. " |
344 |
| - f"These keys will be ignored. The allowed keys are: {list(REQUIRED_VECTOR_FIELDS | OPTIONAL_VECTOR_FIELDS)}") |
| 342 | + raise ValueError(f"Found excess keys in the vector dictionary: {list(excessive_keys)}. " |
| 343 | + f"The allowed keys are: {list(REQUIRED_VECTOR_FIELDS | OPTIONAL_VECTOR_FIELDS)}") |
345 | 344 |
|
346 | 345 | sparse_values = None
|
347 | 346 | if 'sparse_values' in item:
|
@@ -377,7 +376,7 @@ def _vector_transform(item):
|
377 | 376 | if len(item) > 3:
|
378 | 377 | raise ValueError(f"Found a tuple of length {len(item)} which is not supported. "
|
379 | 378 | f"Vectors can be represented as tuples either the form (id, values, metadata) or (id, values). "
|
380 |
| - f"To pass sparse values please use either dicts or a GRPCVector objects as inputs.") |
| 379 | + f"To pass sparse values please use either dicts or GRPCVector objects as inputs.") |
381 | 380 | id, values, metadata = fix_tuple_length(item, 3)
|
382 | 381 | return GRPCVector(id=id, values=values, metadata=dict_to_proto_struct(metadata) or {})
|
383 | 382 | elif isinstance(item, Mapping):
|
|
0 commit comments