Skip to content

Commit f8d7d2d

Browse files
authored
Vectors/deprecate legacy introduce named vectors only syntax (#1659)
* Introduce `Configure.Vectors` and `vector_config` in `.create`/`.update` * Update CI images to latest build on each branch * Change prop descr test to handle props sorted by name * Make changes to pass unit tests of legacy vectorization * Alter specific tests for old versions with new syntax * Add skip to test with resolved issue absent from previous vers * - Add `MultiVectors` factory - Allow `quantizer` at root of all `Vectors` and `MultiVectors` methods - Allow `encoding` also at root of all `MultiVectors` methods * Update CI tags to latest patch * Rename `.text2colbert_jinaa()` to `text2vec_jinaai()` * Add warnings for all deprecated syntax * Response to review comments - Add `multi_vector_config` arg to `MultiVectors` methods - Add deprs warnings if `multi_vector` - Update tests to use new syntax * Update tests to reflect single vectors usage * Fix vector config name passing when creating collections * Skip parsing vector to obj if it's empty * Update CI images to latest patches * Remove unneeded added parsing
1 parent dd929bf commit f8d7d2d

27 files changed

Lines changed: 2382 additions & 604 deletions

.github/workflows/main.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ concurrency:
2020
env:
2121
WEAVIATE_125: 1.25.34
2222
WEAVIATE_126: 1.26.17
23-
WEAVIATE_127: 1.27.14
24-
WEAVIATE_128: 1.28.8
25-
WEAVIATE_129: 1.29.8
26-
WEAVIATE_130: 1.30.9
23+
WEAVIATE_127: 1.27.27
24+
WEAVIATE_128: 1.28.16
25+
WEAVIATE_129: 1.29.9
26+
WEAVIATE_130: 1.30.11
2727
WEAVIATE_131: 1.31.5
28-
WEAVIATE_132: 1.32.0-rc.0-6eb89d6.amd64
28+
WEAVIATE_132: 1.32.0-rc.1-098c594
2929

3030
jobs:
3131
lint-and-format:

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,4 @@ repos:
4949
language: node
5050
pass_filenames: false
5151
types: [python]
52-
additional_dependencies: [pyright@1.1.398]
52+
additional_dependencies: [pyright@1.1.400]

docs/conf.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import contextlib
77
import os
88
import sys
9-
109
from importlib.metadata import PackageNotFoundError
1110
from importlib.metadata import version as version_func
1211

integration/conftest.py

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
_ReferencePropertyBase,
2929
_ReplicationConfigCreate,
3030
_RerankerProvider,
31+
_VectorConfigCreate,
3132
_VectorIndexConfigCreate,
3233
_VectorizerConfigCreate,
3334
)
@@ -58,6 +59,9 @@ def __call__(
5859
vector_index_config: Optional[_VectorIndexConfigCreate] = None,
5960
description: Optional[str] = None,
6061
reranker_config: Optional[_RerankerProvider] = None,
62+
vector_config: Optional[
63+
Optional[Union[_VectorConfigCreate, List[_VectorConfigCreate]]]
64+
] = None,
6165
) -> Collection[Any, Any]:
6266
"""Typing for fixture."""
6367
...
@@ -129,6 +133,9 @@ def _factory(
129133
vector_index_config: Optional[_VectorIndexConfigCreate] = None,
130134
description: Optional[str] = None,
131135
reranker_config: Optional[_RerankerProvider] = None,
136+
vector_config: Optional[
137+
Optional[Union[_VectorConfigCreate, List[_VectorConfigCreate]]]
138+
] = None,
132139
) -> Collection[Any, Any]:
133140
try:
134141
nonlocal client_fixture, name_fixtures, call_counter # noqa: F824
@@ -148,7 +155,8 @@ def _factory(
148155
collection: Collection[Any, Any] = client_fixture.collections.create(
149156
name=name_fixture,
150157
description=description,
151-
vectorizer_config=vectorizer_config or Configure.Vectorizer.none(),
158+
vectorizer_config=vectorizer_config
159+
or (Configure.Vectorizer.none() if vector_config is None else None),
152160
properties=properties,
153161
references=references,
154162
inverted_index_config=inverted_index_config,
@@ -159,6 +167,7 @@ def _factory(
159167
replication_config=replication_config,
160168
vector_index_config=vector_index_config,
161169
reranker_config=reranker_config,
170+
vector_config=vector_config,
162171
)
163172
return collection
164173
except Exception as e:
@@ -315,6 +324,9 @@ def __call__(
315324
vectorizer_config: Optional[
316325
Union[_VectorizerConfigCreate, List[_NamedVectorConfigCreate]]
317326
] = None,
327+
vector_config: Optional[
328+
Optional[Union[_VectorConfigCreate, List[_VectorConfigCreate]]]
329+
] = None,
318330
) -> Collection[Any, Any]:
319331
"""Typing for fixture."""
320332
...
@@ -329,17 +341,18 @@ def _factory(
329341
vectorizer_config: Optional[
330342
Union[_VectorizerConfigCreate, List[_NamedVectorConfigCreate]]
331343
] = None,
344+
vector_config: Optional[
345+
Optional[Union[_VectorConfigCreate, List[_VectorConfigCreate]]]
346+
] = None,
332347
) -> Collection[Any, Any]:
333348
api_key = os.environ.get("OPENAI_APIKEY")
334349
if api_key is None:
335350
pytest.skip("No OpenAI API key found.")
336351

337-
if vectorizer_config is None:
338-
vectorizer_config = Configure.Vectorizer.none()
339-
340352
collection = collection_factory(
341353
name=name,
342-
vectorizer_config=vectorizer_config or Configure.Vectorizer.none(),
354+
vectorizer_config=vectorizer_config,
355+
vector_config=vector_config or Configure.Vectors.self_provided(),
343356
properties=[
344357
Property(name="text", data_type=DataType.TEXT),
345358
Property(name="content", data_type=DataType.TEXT),

integration/test_client.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Callable, Generator, Tuple, Union
1+
from typing import Callable, Generator, Optional, Tuple, Union
22

33
import pytest
44
from _pytest.fixtures import SubRequest
@@ -28,7 +28,7 @@
2828

2929
@pytest.fixture(scope="module")
3030
def client_factory() -> Generator[Callable[[int, int], weaviate.WeaviateClient], None, None]:
31-
client: weaviate.WeaviateClient = None
31+
client: Optional[weaviate.WeaviateClient] = None
3232

3333
def maker(http: int, grpc: int) -> weaviate.WeaviateClient:
3434
nonlocal client
@@ -593,7 +593,7 @@ async def test_async_client_with_extra_options() -> None:
593593

594594
def test_client_error_for_wcs_without_auth() -> None:
595595
with pytest.raises(weaviate.exceptions.AuthenticationFailedError) as e:
596-
weaviate.connect_to_wcs(cluster_url=WCS_URL, auth_credentials=None)
596+
weaviate.connect_to_wcs(cluster_url=WCS_URL, auth_credentials=None) # pyright: ignore
597597
assert "wvc.init.Auth.api_key" in e.value.message
598598

599599

0 commit comments

Comments
 (0)