Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
0269f52
Adding changes for vectorIndex and vectorEmbeddingPolicy
aayush3011 Mar 22, 2024
29ad391
Adding some necessary comments
aayush3011 Mar 27, 2024
cd4d8cf
Adding test case
aayush3011 Mar 28, 2024
a2f6a83
updating enum values
aayush3011 Mar 28, 2024
c4bc283
Updating test case
aayush3011 Mar 28, 2024
af99d7b
Updating test case
aayush3011 Mar 29, 2024
6d8fc9b
Updating test case
aayush3011 Mar 29, 2024
2f7112d
updating changelog
aayush3011 Mar 29, 2024
158880f
Merge branch 'main' into users/akataria/vectorindexing
aayush3011 Mar 29, 2024
bb85dd3
Updating test case
aayush3011 Mar 29, 2024
a7185d7
Merge branch 'users/akataria/vectorindexing' of https://github.com/aa…
aayush3011 Mar 29, 2024
f4c4012
Merge branch 'Azure:main' into users/akataria/vectorindexing
aayush3011 Apr 2, 2024
72a4bcd
Resolving comments
aayush3011 Apr 2, 2024
dfb3575
Resolving comments
aayush3011 Apr 2, 2024
67f51cb
Fixing test case
aayush3011 Apr 2, 2024
730f8c2
Resolving comments
aayush3011 Apr 23, 2024
ad3ac89
Resolving Comments
aayush3011 Apr 27, 2024
940c6af
Merge branch 'main' into users/akataria/vectorindexing
aayush3011 Apr 27, 2024
3eb77ea
Fixing build issues
aayush3011 Apr 27, 2024
44f4e07
Merge branch 'main' into users/akataria/vectorindexing
aayush3011 Apr 29, 2024
460f681
Resolving comments
aayush3011 Apr 30, 2024
5579dd1
Resolving Comments
aayush3011 May 1, 2024
54a2ce3
Merge branch 'users/akataria/vectorindexing' of https://github.com/aa…
aayush3011 May 1, 2024
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
5 changes: 1 addition & 4 deletions sdk/cosmos/azure-cosmos/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@

#### Features Added
* Added `cosmosVectorEmbeddingPolicy` in `cosmosContainerProperties` and `vectorIndexes` in `indexPolicy` to support vector search in CosmosDB - See[39379](https://github.com/Azure/azure-sdk-for-java/pull/39379)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the PR reference here seems wrong - should be 40004?


#### Breaking Changes

#### Bugs Fixed
* Added public APIs `getCustomItemSerializer` and `setCustomItemSerializer` to allow customers to specify custom payload transformations or serialization settings. - See [PR 38997](https://github.com/Azure/azure-sdk-for-java/pull/38997) and [PR 39933](https://github.com/Azure/azure-sdk-for-java/pull/39933)

#### Other Changes
* Load Blackbird or Afterburner into the ObjectMapper depending upon Java version and presence of modules in classpath. Make Afterburner and Blackbird optional maven dependencies. See - [PR 39689](https://github.com/Azure/azure-sdk-for-java/pull/39689)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import com.azure.cosmos.CosmosItemSerializer;
import com.azure.cosmos.implementation.apachecommons.lang.StringUtils;
import com.azure.cosmos.implementation.caches.SerializableWrapper;
import com.azure.cosmos.models.ClientEncryptionPolicy;
import com.azure.cosmos.models.ChangeFeedPolicy;
import com.azure.cosmos.models.ClientEncryptionPolicy;
import com.azure.cosmos.models.ComputedProperty;
import com.azure.cosmos.models.ConflictResolutionPolicy;
import com.azure.cosmos.models.CosmosVectorEmbeddingPolicy;
Expand All @@ -25,7 +25,6 @@
import java.util.Collection;
import java.util.Collections;

import static com.azure.cosmos.BridgeInternal.setProperty;
import static com.azure.cosmos.implementation.guava25.base.Preconditions.checkNotNull;

/**
Expand Down Expand Up @@ -439,8 +438,7 @@ public CosmosVectorEmbeddingPolicy getVectorEmbeddingPolicy() {
*/
public void setVectorEmbeddingPolicy(CosmosVectorEmbeddingPolicy value) {
checkNotNull(value, "cosmosVectorEmbeddingPolicy cannot be null");
this.cosmosVectorEmbeddingPolicy = value;
setProperty(this, Constants.Properties.VECTOR_EMBEDDING_POLICY, value);
this.set(Constants.Properties.VECTOR_EMBEDDING_POLICY, value, CosmosItemSerializer.DEFAULT_SERIALIZER);
}

public void populatePropertyBag() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public CosmosVectorDataType getDataType() {
* @return CosmosVectorEmbedding
*/
public CosmosVectorEmbedding setDataType(CosmosVectorDataType dataType) {
checkNotNull(dataType, "cosmosVectorDataType cannot be empty");
checkNotNull(dataType, "cosmosVectorDataType cannot be null");
this.dataType = dataType.toString();
return this;
}
Expand All @@ -95,9 +95,9 @@ public Long getDimensions() {
* @return CosmosVectorEmbedding
*/
public CosmosVectorEmbedding setDimensions(Long dimensions) {
checkNotNull(dimensions, "dimensions cannot be empty");
checkNotNull(dimensions, "dimensions cannot be null");
if (dimensions < 1) {
throw new IllegalArgumentException("Dimensions for the embedding has to be a long value greater than 1 " +
throw new IllegalArgumentException("Dimensions for the embedding has to be a long value greater than 0 " +
"for the vector embedding policy");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@

package com.azure.cosmos.models;

import com.azure.cosmos.CosmosItemSerializer;
import com.azure.cosmos.implementation.Constants;
import com.azure.cosmos.implementation.JsonSerializable;

import static com.azure.cosmos.implementation.guava25.base.Preconditions.checkNotNull;

/**
* Vector Indexes spec for Azure CosmosDB service.
*/
Expand Down Expand Up @@ -35,7 +38,7 @@ public String getPath() {
* @return the SpatialSpec.
*/
public CosmosVectorIndexSpec setPath(String path) {
this.jsonSerializable.set(Constants.Properties.PATH, path);
this.jsonSerializable.set(Constants.Properties.PATH, path, CosmosItemSerializer.DEFAULT_SERIALIZER);
return this;
}

Expand All @@ -47,10 +50,6 @@ public CosmosVectorIndexSpec setPath(String path) {
public String getType() {
if (this.type == null) {
this.type = this.jsonSerializable.getString(Constants.Properties.VECTOR_INDEX_TYPE);

if (this.type == null) {
throw new IllegalArgumentException("INVALID vectorIndexType of " + this.jsonSerializable.getString(Constants.Properties.VECTOR_INDEX_TYPE));
}
}
return this.type;
}
Expand All @@ -62,8 +61,9 @@ public String getType() {
* @return the VectorIndexSpec
*/
public CosmosVectorIndexSpec setType(String type) {
checkNotNull(type, "cosmosVectorIndexType cannot be null");
this.type = type;
this.jsonSerializable.set(Constants.Properties.VECTOR_INDEX_TYPE, this.type);
this.jsonSerializable.set(Constants.Properties.VECTOR_INDEX_TYPE, this.type, CosmosItemSerializer.DEFAULT_SERIALIZER);
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ public List<CosmosVectorIndexSpec> getVectorIndexes() {
*/
public IndexingPolicy setVectorIndexes(List<CosmosVectorIndexSpec> vectorIndexes) {
this.vectorIndexes = vectorIndexes;
this.jsonSerializable.set(Constants.Properties.VECTOR_INDEXES,this.vectorIndexes);
this.jsonSerializable.set(Constants.Properties.VECTOR_INDEXES,this.vectorIndexes, CosmosItemSerializer.DEFAULT_SERIALIZER);
return this;
}

Expand Down