Skip to content

[Cosmos] update vector policy and vector query tests #37647

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 30, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def test_ordering_distances(self):
"SimilarityScore FROM c ORDER BY VectorDistance(c.embedding, [{}], false, {{'distanceFunction': 'euclidean'}})" \
.format(str(i), vector_string, vector_string)

flat_list = list(self.created_flat_euclidean_container.query_items(query=specs_query,
flat_list = list(self.created_flat_euclidean_container.query_items(query=vanilla_query,
enable_cross_partition_query=True))
verify_ordering(flat_list, "euclidean")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ async def test_ordering_distances_async(self):
"SimilarityScore FROM c ORDER BY VectorDistance(c.embedding, [{}], false, {{'distanceFunction': 'euclidean'}})" \
.format(str(i), vector_string, vector_string)

flat_list = [item async for item in self.created_flat_euclidean_container.query_items(query=specs_query)]
flat_list = [item async for item in self.created_flat_euclidean_container.query_items(query=vanilla_query)]
verify_ordering(flat_list, "euclidean")

quantized_list = [item async for item in self.created_quantized_cosine_container.query_items(query=specs_query)]
Expand Down
3 changes: 2 additions & 1 deletion sdk/cosmos/azure-cosmos/test/test_vector_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@ def test_fail_replace_vector_indexing_policy(self):
pytest.fail("Container replace should have failed for indexing policy.")
except exceptions.CosmosHttpResponseError as e:
assert e.status_code == 400
assert "Vector Indexing Policy cannot be changed in Collection Replace" in e.http_error_message
assert "Paths in existing vector indexing policy cannot be modified in Collection Replace." \
" They can only be added or removed." in e.http_error_message
self.test_db.delete_container(container_id)

def test_fail_create_vector_embedding_policy(self):
Expand Down
3 changes: 2 additions & 1 deletion sdk/cosmos/azure-cosmos/test/test_vector_policy_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,8 @@ async def test_fail_replace_vector_indexing_policy_async(self):
pytest.fail("Container replace should have failed for indexing policy.")
except exceptions.CosmosHttpResponseError as e:
assert e.status_code == 400
assert "Vector Indexing Policy cannot be changed in Collection Replace" in e.http_error_message
assert "Paths in existing vector indexing policy cannot be modified in Collection Replace." \
" They can only be added or removed." in e.http_error_message
await self.test_db.delete_container(container_id)

async def test_fail_create_vector_embedding_policy_async(self):
Expand Down
Loading