Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions integration/test_vectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,12 @@ def test_batch_add(collection_factory: CollectionFactory) -> None:
assert obj.vector["title"] is not None
assert obj.vector["bringYourOwn"] == [0.5, 0.25, 0.75]

obj = collection.query.fetch_object_by_id(uuid1, include_vector="bringYourOwn")
assert obj.vector == {"bringYourOwn": [0.5, 0.25, 0.75]}

obj = collection.query.fetch_object_by_id(uuid1, include_vector=("bringYourOwn",))
assert obj.vector == {"bringYourOwn": [0.5, 0.25, 0.75]}


def test_named_vector_with_index_config(collection_factory: CollectionFactory) -> None:
collection = collection_factory(
Expand Down
6 changes: 6 additions & 0 deletions weaviate/collections/classes/grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,12 @@ class _MetadataQuery:
def from_public(
cls, public: Optional[MetadataQuery], include_vector: INCLUDE_VECTOR
) -> "_MetadataQuery":
# The branches below test only for `bool` and `list`, so a bare `str` or a tuple of names
# would otherwise request no vector at all and the caller would get none back, with no error.
if isinstance(include_vector, str):
include_vector = [include_vector]
elif isinstance(include_vector, tuple):
include_vector = list(include_vector)
return (
cls(
vector=include_vector if isinstance(include_vector, bool) else False,
Expand Down
Loading