Skip to content

Commit 00dec12

Browse files
authored
Enable Float16 datatype test (#44501)
* Adding test for checking float16 datatype for vector embedding policy * Revert unnecessary change * Remove unnecessary print * Revert unnecessary change * Enable float16 tests * Add async float16 tests * address comments * address comments
1 parent 257525e commit 00dec12

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

sdk/cosmos/azure-cosmos/tests/test_vector_policy.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ def setUpClass(cls):
3535
def tearDownClass(cls):
3636
test_config.TestConfig.try_delete_database_with_id(cls.client, cls.test_db.id)
3737

38-
@unittest.skip
3938
def test_create_valid_vector_embedding_policy(self):
4039
# Using valid data types
4140
data_types = ["float32", "float16", "int8", "uint8"]

sdk/cosmos/azure-cosmos/tests/test_vector_policy_async.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,27 @@ async def asyncSetUp(self):
4646
async def asyncTearDown(self):
4747
await self.client.close()
4848

49+
async def test_create_valid_vector_embedding_policy_async(self):
50+
# Using valid data types
51+
data_types = ["float32", "float16", "int8", "uint8"]
52+
for data_type in data_types:
53+
vector_embedding_policy = {
54+
"vectorEmbeddings": [
55+
{
56+
"path": "/vector1",
57+
"dataType": data_type,
58+
"dimensions": 256,
59+
"distanceFunction": "euclidean"
60+
}]}
61+
container_id = 'vector_container_' + data_type
62+
created_container = await self.test_db.create_container(
63+
id=container_id,
64+
partition_key=PartitionKey(path="/id"),
65+
vector_embedding_policy=vector_embedding_policy)
66+
properties = await created_container.read()
67+
assert properties["vectorEmbeddingPolicy"]["vectorEmbeddings"][0]["dataType"] == data_type
68+
await self.test_db.delete_container(container_id)
69+
4970
async def test_create_vector_embedding_container_async(self):
5071
indexing_policy = {
5172
"vectorIndexes": [

0 commit comments

Comments
 (0)