Skip to content

Commit 5977220

Browse files
committed
Merge branch 'main' into docs/update-repo-guides
2 parents 74f0186 + 049cef5 commit 5977220

30 files changed

+1606
-418
lines changed

.github/dependabot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ updates:
88
- package-ecosystem: "pip" # See documentation for possible values
99
directory: "/" # Location of package manifests
1010
schedule:
11-
interval: "weekly"
11+
interval: "monthly"
1212
ignore:
1313
- dependency-name: "grpcio"
1414
- dependency-name: "grpcio-tools"

ci/docker-compose-wcs.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ services:
1919
PERSISTENCE_DATA_PATH: '/var/lib/weaviate'
2020
AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED: 'false'
2121
AUTHENTICATION_OIDC_ENABLED: 'true'
22-
AUTHENTICATION_OIDC_CLIENT_ID: 'wcs'
23-
AUTHENTICATION_OIDC_ISSUER: 'https://auth.wcs.api.weaviate.io/auth/realms/SeMI'
22+
AUTHENTICATION_OIDC_CLIENT_ID: 'Peuc12y02UA0eAED1dqSjE5HtGUrpBsx'
23+
AUTHENTICATION_OIDC_ISSUER: 'https://auth.weaviate.cloud/Peuc12y02UA0eAED1dqSjE5HtGUrpBsx'
2424
AUTHENTICATION_OIDC_USERNAME_CLAIM: 'email'
25-
AUTHENTICATION_OIDC_GROUPS_CLAIM: 'groups'
25+
AUTHENTICATION_OIDC_GROUPS_CLAIM: 'roles'
2626
AUTHORIZATION_ADMINLIST_ENABLED: 'true'
2727
AUTHORIZATION_ADMINLIST_USERS: '[email protected]'
2828
AUTHENTICATION_OIDC_SCOPES: 'openid,email'

docs/changelog.rst

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,24 @@
11
Changelog
22
=========
33

4+
Version 4.18.3
5+
--------------
6+
This patch version includes:
7+
- Fixes wrong deprecation warning in PyCharm when creating a collection without vectorizers
8+
- Fixes warnings with boolean filters
9+
10+
Version 4.18.2
11+
--------------
12+
This patch version includes:
13+
- Add support for contextual generative and reranker modules
14+
- Add support for ZSTD compression in backups
15+
- Add support for VoyageAI's voyage-3-large model
16+
417
Version 4.18.1
518
--------------
619
This patch version includes:
720
- Add 'dimensions' param to cohere vectorizers (feat/cohere-dimensions-param)
8-
- Add dimensions parameter to text2vec-voyageai methods (feat/t2v-voyage-add-dimensions)
21+
- Add 'dimensions' parameter to text2vec-voyageai methods (feat/t2v-voyage-add-dimensions)
922

1023
Version 4.18.0
1124
--------------

integration/test_backup_v4.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,6 @@ def test_backup_and_restore_with_collection_and_config_1_24_x(
464464
wait_for_completion=True,
465465
config=BackupConfigCreate(
466466
cpu_percentage=60,
467-
chunk_size=256,
468467
compression_level=BackupCompressionLevel.BEST_SPEED,
469468
),
470469
)

integration/test_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ def test_create_export_and_recreate(client: weaviate.WeaviateClient, request: Su
271271
assert export.generative_config is not None
272272
assert export.generative_config.generative == GenerativeSearches.COHERE
273273
assert export.generative_config.model["model"] == "command-r-plus"
274-
assert export.generative_config.model["kProperty"] == 10
274+
assert export.generative_config.model["k"] == 10
275275

276276
client.collections.delete([name1, name2])
277277
assert not client.collections.exists(name1)

integration/test_collection_config.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -913,9 +913,11 @@ def test_config_vector_index_hnsw_and_quantizer_pq(collection_factory: Collectio
913913
[
914914
(Configure.Reranker.cohere(), Rerankers.COHERE, {}),
915915
(
916-
Configure.Reranker.cohere(model="rerank-english-v2.0"),
916+
Configure.Reranker.cohere(
917+
model="rerank-english-v2.0", base_url="https://some-cohere-baseurl.ai/"
918+
),
917919
Rerankers.COHERE,
918-
{"model": "rerank-english-v2.0"},
920+
{"model": "rerank-english-v2.0", "baseURL": "https://some-cohere-baseurl.ai/"},
919921
),
920922
(Configure.Reranker.transformers(), Rerankers.TRANSFORMERS, {}),
921923
],

integration/test_collection_filter.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,13 +278,14 @@ def test_filters_comparison(
278278
],
279279
)
280280
def test_filters_contains(
281+
recwarn: pytest.WarningsRecorder,
281282
collection_factory: CollectionFactory,
282283
weaviate_filter: _FilterValue,
283284
results: List[int],
284285
require_version: Optional[tuple[int, int, int]],
285286
) -> None:
286287
collection = collection_factory(
287-
vectorizer_config=Configure.Vectorizer.none(),
288+
vector_config=Configure.Vectors.self_provided(),
288289
properties=[
289290
Property(name="text", data_type=DataType.TEXT),
290291
Property(name="texts", data_type=DataType.TEXT_ARRAY),
@@ -380,6 +381,12 @@ def test_filters_contains(
380381
uuids = [uuids[result] for result in results]
381382
assert all(obj.uuid in uuids for obj in objects)
382383

384+
# Check for warnings to make sure booleans are handled as their correct type and are not sent as ints
385+
if len(recwarn) != 0:
386+
for rwarning in recwarn.list:
387+
print(rwarning.message)
388+
assert len(recwarn) == 0
389+
383390

384391
@pytest.mark.parametrize(
385392
"weaviate_filter,results",

integration/test_collection_openai.py

Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -740,3 +740,170 @@ def test_near_text_generate_with_dynamic_rag(
740740
assert g0.debug is None
741741
assert g0.metadata is None
742742
assert g1.metadata is None
743+
744+
745+
@pytest.mark.parametrize("parameter,answer", [("text", "yes"), ("content", "no")])
746+
def test_contextualai_generative_search_single(
747+
collection_factory: CollectionFactory, parameter: str, answer: str
748+
) -> None:
749+
"""Test Contextual AI generative search with single prompt."""
750+
api_key = os.environ.get("CONTEXTUAL_API_KEY")
751+
if api_key is None:
752+
pytest.skip("No Contextual AI API key found.")
753+
754+
collection = collection_factory(
755+
name="TestContextualAIGenerativeSingle",
756+
generative_config=Configure.Generative.contextualai(
757+
model="v2",
758+
max_new_tokens=100,
759+
temperature=0.1,
760+
system_prompt="You are a helpful assistant that provides accurate and informative responses based on the given context. Answer with yes or no only.",
761+
avoid_commentary=False,
762+
),
763+
vectorizer_config=Configure.Vectorizer.none(),
764+
properties=[
765+
Property(name="text", data_type=DataType.TEXT),
766+
Property(name="content", data_type=DataType.TEXT),
767+
],
768+
headers={"X-Contextual-Api-Key": api_key},
769+
ports=(8086, 50057),
770+
)
771+
if collection._connection._weaviate_version.is_lower_than(1, 23, 1):
772+
pytest.skip("Generative search requires Weaviate 1.23.1 or higher")
773+
774+
collection.data.insert_many(
775+
[
776+
DataObject(properties={"text": "bananas are great", "content": "bananas are bad"}),
777+
DataObject(properties={"text": "apples are great", "content": "apples are bad"}),
778+
]
779+
)
780+
781+
res = collection.generate.fetch_objects(
782+
single_prompt=f"is it good or bad based on {{{parameter}}}? Just answer with yes or no without punctuation",
783+
)
784+
for obj in res.objects:
785+
assert obj.generated is not None
786+
assert obj.generated.lower() == answer
787+
assert res.generated is None
788+
789+
790+
def test_contextualai_generative_with_knowledge_parameter(
791+
collection_factory: CollectionFactory,
792+
) -> None:
793+
"""Test Contextual AI generative search with knowledge parameter override."""
794+
api_key = os.environ.get("CONTEXTUAL_API_KEY")
795+
if api_key is None:
796+
pytest.skip("No Contextual AI API key found.")
797+
798+
collection = collection_factory(
799+
name="TestContextualAIGenerativeKnowledge",
800+
generative_config=Configure.Generative.contextualai(
801+
model="v2",
802+
max_new_tokens=100,
803+
temperature=0.1,
804+
system_prompt="You are a helpful assistant.",
805+
avoid_commentary=False,
806+
),
807+
vectorizer_config=Configure.Vectorizer.none(),
808+
properties=[
809+
Property(name="text", data_type=DataType.TEXT),
810+
],
811+
headers={"X-Contextual-Api-Key": api_key},
812+
ports=(8086, 50057),
813+
)
814+
if collection._connection._weaviate_version.is_lower_than(1, 23, 1):
815+
pytest.skip("Generative search requires Weaviate 1.23.1 or higher")
816+
817+
collection.data.insert_many(
818+
[
819+
DataObject(properties={"text": "base knowledge"}),
820+
]
821+
)
822+
823+
# Test with knowledge parameter override
824+
res = collection.generate.fetch_objects(
825+
single_prompt="What is the custom knowledge?",
826+
config=GenerativeConfig.contextualai(
827+
knowledge=["Custom knowledge override", "Additional context"],
828+
),
829+
)
830+
for obj in res.objects:
831+
assert obj.generated is not None
832+
assert isinstance(obj.generated, str)
833+
834+
835+
def test_contextualai_generative_and_rerank_combined(collection_factory: CollectionFactory) -> None:
836+
"""Test Contextual AI generative search combined with reranking."""
837+
contextual_api_key = os.environ.get("CONTEXTUAL_API_KEY")
838+
if contextual_api_key is None:
839+
pytest.skip("No Contextual AI API key found.")
840+
841+
collection = collection_factory(
842+
name="TestContextualAIGenerativeAndRerank",
843+
generative_config=Configure.Generative.contextualai(
844+
model="v2",
845+
max_new_tokens=100,
846+
temperature=0.1,
847+
system_prompt="You are a helpful assistant that provides accurate and informative responses based on the given context.",
848+
avoid_commentary=False,
849+
),
850+
reranker_config=Configure.Reranker.contextualai(
851+
model="ctxl-rerank-v2-instruct-multilingual",
852+
instruction="Prioritize documents that contain the query term",
853+
),
854+
vectorizer_config=Configure.Vectorizer.text2vec_openai(),
855+
properties=[Property(name="text", data_type=DataType.TEXT)],
856+
headers={"X-Contextual-Api-Key": contextual_api_key},
857+
ports=(8086, 50057),
858+
)
859+
if collection._connection._weaviate_version < _ServerVersion(1, 23, 1):
860+
pytest.skip("Generative reranking requires Weaviate 1.23.1 or higher")
861+
862+
insert = collection.data.insert_many(
863+
[{"text": "This is a test"}, {"text": "This is another test"}]
864+
)
865+
uuid1 = insert.uuids[0]
866+
vector1 = collection.query.fetch_object_by_id(uuid1, include_vector=True).vector
867+
assert vector1 is not None
868+
869+
for _idx, query in enumerate(
870+
[
871+
lambda: collection.generate.bm25(
872+
"test",
873+
rerank=Rerank(prop="text", query="another"),
874+
single_prompt="What is it? {text}",
875+
),
876+
lambda: collection.generate.hybrid(
877+
"test",
878+
rerank=Rerank(prop="text", query="another"),
879+
single_prompt="What is it? {text}",
880+
),
881+
lambda: collection.generate.near_object(
882+
uuid1,
883+
rerank=Rerank(prop="text", query="another"),
884+
single_prompt="What is it? {text}",
885+
),
886+
lambda: collection.generate.near_vector(
887+
vector1["default"],
888+
rerank=Rerank(prop="text", query="another"),
889+
single_prompt="What is it? {text}",
890+
),
891+
lambda: collection.generate.near_text(
892+
"test",
893+
rerank=Rerank(prop="text", query="another"),
894+
single_prompt="What is it? {text}",
895+
),
896+
]
897+
):
898+
objects = query().objects
899+
assert len(objects) == 2
900+
assert objects[0].metadata.rerank_score is not None
901+
assert objects[0].generated is not None
902+
assert objects[1].metadata.rerank_score is not None
903+
assert objects[1].generated is not None
904+
905+
assert [obj for obj in objects if "another" in obj.properties["text"]][ # type: ignore
906+
0
907+
].metadata.rerank_score > [
908+
obj for obj in objects if "another" not in obj.properties["text"]
909+
][0].metadata.rerank_score

integration/test_collection_rerank.py

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,3 +138,61 @@ def test_queries_with_rerank_and_group_by(collection_factory: CollectionFactory)
138138
].rerank_score > [group for prop, group in ret.groups.items() if "another" not in prop][
139139
0
140140
].rerank_score
141+
142+
143+
def test_queries_with_rerank_contextualai(collection_factory: CollectionFactory) -> None:
144+
"""Test Contextual AI reranker with various query types."""
145+
api_key = os.environ.get("CONTEXTUAL_API_KEY")
146+
if api_key is None:
147+
pytest.skip("No Contextual AI API key found.")
148+
149+
collection = collection_factory(
150+
name="Test_test_queries_with_rerank_contextualai",
151+
reranker_config=wvc.config.Configure.Reranker.contextualai(
152+
model="ctxl-rerank-v2-instruct-multilingual",
153+
instruction="Prioritize documents that contain the query term",
154+
),
155+
vectorizer_config=wvc.config.Configure.Vectorizer.text2vec_openai(),
156+
properties=[wvc.config.Property(name="text", data_type=wvc.config.DataType.TEXT)],
157+
headers={"X-Contextual-Api-Key": api_key},
158+
ports=(8086, 50057),
159+
)
160+
if collection._connection._weaviate_version.is_lower_than(1, 23, 1):
161+
pytest.skip("Reranking requires Weaviate 1.23.1 or higher")
162+
163+
insert = collection.data.insert_many(
164+
[{"text": "This is a test"}, {"text": "This is another test"}]
165+
)
166+
uuid1 = insert.uuids[0]
167+
vector1 = collection.query.fetch_object_by_id(uuid1, include_vector=True).vector
168+
assert vector1 is not None
169+
170+
for _idx, query in enumerate(
171+
[
172+
lambda: collection.query.bm25(
173+
"test", rerank=wvc.query.Rerank(prop="text", query="another")
174+
),
175+
lambda: collection.query.hybrid(
176+
"test", rerank=wvc.query.Rerank(prop="text", query="another")
177+
),
178+
lambda: collection.query.near_object(
179+
uuid1, rerank=wvc.query.Rerank(prop="text", query="another")
180+
),
181+
lambda: collection.query.near_vector(
182+
vector1["default"], rerank=wvc.query.Rerank(prop="text", query="another")
183+
),
184+
lambda: collection.query.near_text(
185+
"test", rerank=wvc.query.Rerank(prop="text", query="another")
186+
),
187+
]
188+
):
189+
objects = query().objects
190+
assert len(objects) == 2
191+
assert objects[0].metadata.rerank_score is not None
192+
assert objects[1].metadata.rerank_score is not None
193+
194+
assert [obj for obj in objects if "another" in obj.properties["text"]][ # type: ignore
195+
0
196+
].metadata.rerank_score > [
197+
obj for obj in objects if "another" not in obj.properties["text"]
198+
][0].metadata.rerank_score

requirements-devel.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ sphinx-rtd-theme==3.0.2
1717
autodoc-pydantic==2.2.0
1818
importlib_metadata==8.7.0
1919

20-
tomli==2.2.1
20+
tomli==2.3.0
2121
types-protobuf==6.30.2.20250703
2222
types-urllib3==1.26.25.14
2323
typing_extensions==4.14.1
@@ -29,4 +29,4 @@ flake8-comprehensions==3.17.0
2929
flake8-builtins==3.0.0
3030
flake8-docstrings==1.7.0
3131
pydoclint==0.7.3
32-
ruff==0.12.8
32+
ruff==0.14.7

0 commit comments

Comments
 (0)