From a3c9d779f840116d9efdefa6484f9964d845fe5c Mon Sep 17 00:00:00 2001
From: Debdatta Kunda <87335885+kundadebdatta@users.noreply.github.com>
Date: Wed, 15 May 2024 15:57:23 -0700
Subject: [PATCH] ContainerProperties: Refactors Vector Embedding and Indexing
Policy Interfaces to Mark Them as Public for Preview (#4486)
* Code changes to mark internal vector interfaces as public.
* Code changes to update the public and preview modifiers.
* Code changes to update preview and ga contracts.
* Code changes to mark the policy definitions as public interface.
* Code changes to update GA contract and use #if all over.
* Code changes to fix some of the broken tests in preview.
* Code changes to update the preview contract too reflect the JSON Ignore.
* Code changes to upgrade direct version to 3.34.2
---
Directory.Build.props | 2 +-
.../src/Fluent/Settings/ContainerBuilder.cs | 7 +-
.../Settings/IndexingPolicyDefinition.cs | 7 +-
.../VectorEmbeddingPolicyDefinition.cs | 15 +-
.../Fluent/Settings/VectorIndexDefinition.cs | 16 +-
.../Resource/Settings/ContainerProperties.cs | 7 +-
.../src/Resource/Settings/DistanceFunction.cs | 7 +-
.../src/Resource/Settings/Embedding.cs | 7 +-
.../src/Resource/Settings/IndexingPolicy.cs | 29 +-
.../src/Resource/Settings/VectorDataType.cs | 7 +-
.../Settings/VectorEmbeddingPolicy.cs | 7 +-
.../src/Resource/Settings/VectorIndexPath.cs | 7 +-
.../src/Resource/Settings/VectorIndexType.cs | 7 +-
.../Contracts/DotNetPreviewSDKAPI.json | 379 ++++++++++++++++++
.../CosmosContainerSettingsTests.cs | 44 +-
.../SettingsContractTests.cs | 29 +-
16 files changed, 510 insertions(+), 67 deletions(-)
diff --git a/Directory.Build.props b/Directory.Build.props
index f7d23a8b88..fb45f3dca1 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -3,7 +3,7 @@
3.39.1
3.40.0
preview.1
- 3.34.0
+ 3.34.2
2.0.4
2.1.0
preview4
diff --git a/Microsoft.Azure.Cosmos/src/Fluent/Settings/ContainerBuilder.cs b/Microsoft.Azure.Cosmos/src/Fluent/Settings/ContainerBuilder.cs
index 6cb6c2a4bb..6b6f5e73cb 100644
--- a/Microsoft.Azure.Cosmos/src/Fluent/Settings/ContainerBuilder.cs
+++ b/Microsoft.Azure.Cosmos/src/Fluent/Settings/ContainerBuilder.cs
@@ -122,7 +122,12 @@ public ClientEncryptionPolicyDefinition WithClientEncryptionPolicy(int policyFor
///
/// List of vector embeddings to include in the policy definition.
/// An instance of .
- internal VectorEmbeddingPolicyDefinition WithVectorEmbeddingPolicy(
+#if PREVIEW
+ public
+#else
+ internal
+#endif
+ VectorEmbeddingPolicyDefinition WithVectorEmbeddingPolicy(
Collection embeddings)
{
return new VectorEmbeddingPolicyDefinition(
diff --git a/Microsoft.Azure.Cosmos/src/Fluent/Settings/IndexingPolicyDefinition.cs b/Microsoft.Azure.Cosmos/src/Fluent/Settings/IndexingPolicyDefinition.cs
index 9de73206dd..3800e8c8a7 100644
--- a/Microsoft.Azure.Cosmos/src/Fluent/Settings/IndexingPolicyDefinition.cs
+++ b/Microsoft.Azure.Cosmos/src/Fluent/Settings/IndexingPolicyDefinition.cs
@@ -117,7 +117,12 @@ public SpatialIndexDefinition> WithSpatialIndex()
/// Defines a in the current 's definition.
///
/// An instance of .
- internal VectorIndexDefinition> WithVectorIndex()
+#if PREVIEW
+ public
+#else
+ internal
+#endif
+ VectorIndexDefinition> WithVectorIndex()
{
return new VectorIndexDefinition>(
this,
diff --git a/Microsoft.Azure.Cosmos/src/Fluent/Settings/VectorEmbeddingPolicyDefinition.cs b/Microsoft.Azure.Cosmos/src/Fluent/Settings/VectorEmbeddingPolicyDefinition.cs
index 9f47145048..cf4ce8db11 100644
--- a/Microsoft.Azure.Cosmos/src/Fluent/Settings/VectorEmbeddingPolicyDefinition.cs
+++ b/Microsoft.Azure.Cosmos/src/Fluent/Settings/VectorEmbeddingPolicyDefinition.cs
@@ -11,13 +11,24 @@ namespace Microsoft.Azure.Cosmos.Fluent
///
/// fluent definition.
///
- internal class VectorEmbeddingPolicyDefinition
+#if PREVIEW
+ public
+#else
+ internal
+#endif
+ class VectorEmbeddingPolicyDefinition
{
private readonly ContainerBuilder parent;
private readonly Action attachCallback;
private readonly Collection vectorEmbeddings;
- internal VectorEmbeddingPolicyDefinition(
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The original instance of .
+ /// List of embeddings to include in the policy definition.
+ /// A callback delegate to be used at a later point of time.
+ public VectorEmbeddingPolicyDefinition(
ContainerBuilder parent,
Collection embeddings,
Action attachCallback)
diff --git a/Microsoft.Azure.Cosmos/src/Fluent/Settings/VectorIndexDefinition.cs b/Microsoft.Azure.Cosmos/src/Fluent/Settings/VectorIndexDefinition.cs
index ab5ded29c9..98870592d6 100644
--- a/Microsoft.Azure.Cosmos/src/Fluent/Settings/VectorIndexDefinition.cs
+++ b/Microsoft.Azure.Cosmos/src/Fluent/Settings/VectorIndexDefinition.cs
@@ -10,13 +10,23 @@ namespace Microsoft.Azure.Cosmos.Fluent
/// Vector index fluent definition.
///
///
- internal class VectorIndexDefinition
+#if PREVIEW
+ public
+#else
+ internal
+#endif
+ class VectorIndexDefinition
{
- private readonly VectorIndexPath vectorIndexPath = new VectorIndexPath();
+ private readonly VectorIndexPath vectorIndexPath = new ();
private readonly T parent;
private readonly Action attachCallback;
- internal VectorIndexDefinition(
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The original instance of .
+ /// A callback delegate to be used at a later point of time.
+ public VectorIndexDefinition(
T parent,
Action attachCallback)
{
diff --git a/Microsoft.Azure.Cosmos/src/Resource/Settings/ContainerProperties.cs b/Microsoft.Azure.Cosmos/src/Resource/Settings/ContainerProperties.cs
index 4406ec5164..6f6b0c4e8b 100644
--- a/Microsoft.Azure.Cosmos/src/Resource/Settings/ContainerProperties.cs
+++ b/Microsoft.Azure.Cosmos/src/Resource/Settings/ContainerProperties.cs
@@ -306,7 +306,12 @@ public IndexingPolicy IndexingPolicy
///
///
[JsonIgnore]
- internal VectorEmbeddingPolicy VectorEmbeddingPolicy
+#if PREVIEW
+ public
+#else
+ internal
+#endif
+ VectorEmbeddingPolicy VectorEmbeddingPolicy
{
get => this.vectorEmbeddingPolicyInternal;
diff --git a/Microsoft.Azure.Cosmos/src/Resource/Settings/DistanceFunction.cs b/Microsoft.Azure.Cosmos/src/Resource/Settings/DistanceFunction.cs
index 24a6b3eb25..c5f4873e01 100644
--- a/Microsoft.Azure.Cosmos/src/Resource/Settings/DistanceFunction.cs
+++ b/Microsoft.Azure.Cosmos/src/Resource/Settings/DistanceFunction.cs
@@ -9,7 +9,12 @@ namespace Microsoft.Azure.Cosmos
/// Defines the distance function for a vector index specification in the Azure Cosmos DB service.
///
/// for usage.
- internal enum DistanceFunction
+#if PREVIEW
+ public
+#else
+ internal
+#endif
+ enum DistanceFunction
{
///
/// Represents the euclidean distance function.
diff --git a/Microsoft.Azure.Cosmos/src/Resource/Settings/Embedding.cs b/Microsoft.Azure.Cosmos/src/Resource/Settings/Embedding.cs
index c27ac95bb1..c511299870 100644
--- a/Microsoft.Azure.Cosmos/src/Resource/Settings/Embedding.cs
+++ b/Microsoft.Azure.Cosmos/src/Resource/Settings/Embedding.cs
@@ -14,7 +14,12 @@ namespace Microsoft.Azure.Cosmos
///
/// Represents the embedding settings for the vector index.
///
- internal class Embedding : IEquatable
+#if PREVIEW
+ public
+#else
+ internal
+#endif
+ class Embedding : IEquatable
{
///
/// Gets or sets a string containing the path of the vector index.
diff --git a/Microsoft.Azure.Cosmos/src/Resource/Settings/IndexingPolicy.cs b/Microsoft.Azure.Cosmos/src/Resource/Settings/IndexingPolicy.cs
index aac39e7bfe..b8e0323b76 100644
--- a/Microsoft.Azure.Cosmos/src/Resource/Settings/IndexingPolicy.cs
+++ b/Microsoft.Azure.Cosmos/src/Resource/Settings/IndexingPolicy.cs
@@ -111,6 +111,12 @@ public IndexingPolicy()
[JsonProperty(PropertyName = Constants.Properties.CompositeIndexes)]
public Collection> CompositeIndexes { get; internal set; } = new Collection>();
+ ///
+ /// Collection of spatial index definitions to be used
+ ///
+ [JsonProperty(PropertyName = Constants.Properties.SpatialIndexes)]
+ public Collection SpatialIndexes { get; internal set; } = new Collection();
+
///
/// Gets the vector indexes for additional indexes
///
@@ -132,23 +138,14 @@ public IndexingPolicy()
/// ]
/// ]]>
///
- internal Collection VectorIndexes
- {
- get => this.VectorIndexesInternal ??= new Collection();
- set => this.VectorIndexesInternal = value;
- }
-
- ///
- /// Collection of spatial index definitions to be used
- ///
- [JsonProperty(PropertyName = Constants.Properties.SpatialIndexes)]
- public Collection SpatialIndexes { get; internal set; } = new Collection();
-
- ///
- /// Gets or Sets an internal placeholder collection to hold the vector indexes.
- ///
[JsonProperty(PropertyName = "vectorIndexes", NullValueHandling = NullValueHandling.Ignore)]
- internal Collection VectorIndexesInternal { get; set; }
+#if PREVIEW
+
+ public
+#else
+ internal
+#endif
+ Collection VectorIndexes { get; set; } = new Collection();
///
/// This contains additional values for scenarios where the SDK is not aware of new fields.
diff --git a/Microsoft.Azure.Cosmos/src/Resource/Settings/VectorDataType.cs b/Microsoft.Azure.Cosmos/src/Resource/Settings/VectorDataType.cs
index 06be37b6fb..39355130d4 100644
--- a/Microsoft.Azure.Cosmos/src/Resource/Settings/VectorDataType.cs
+++ b/Microsoft.Azure.Cosmos/src/Resource/Settings/VectorDataType.cs
@@ -8,7 +8,12 @@ namespace Microsoft.Azure.Cosmos
///
/// Defines the target data type of a vector index specification in the Azure Cosmos DB service.
///
- internal enum VectorDataType
+#if PREVIEW
+ public
+#else
+ internal
+#endif
+ enum VectorDataType
{
///
/// Represent a float16 data type.
diff --git a/Microsoft.Azure.Cosmos/src/Resource/Settings/VectorEmbeddingPolicy.cs b/Microsoft.Azure.Cosmos/src/Resource/Settings/VectorEmbeddingPolicy.cs
index 8f8b7f904f..40db04fca9 100644
--- a/Microsoft.Azure.Cosmos/src/Resource/Settings/VectorEmbeddingPolicy.cs
+++ b/Microsoft.Azure.Cosmos/src/Resource/Settings/VectorEmbeddingPolicy.cs
@@ -13,7 +13,12 @@ namespace Microsoft.Azure.Cosmos
/// Represents the vector embedding policy configuration for specifying the vector embeddings on documents in the collection in the Azure Cosmos DB service.
///
///
- internal sealed class VectorEmbeddingPolicy
+#if PREVIEW
+ public
+#else
+ internal
+#endif
+ sealed class VectorEmbeddingPolicy
{
///
/// Initializes a new instance of the class.
diff --git a/Microsoft.Azure.Cosmos/src/Resource/Settings/VectorIndexPath.cs b/Microsoft.Azure.Cosmos/src/Resource/Settings/VectorIndexPath.cs
index c6c00801ac..a7d4a94f98 100644
--- a/Microsoft.Azure.Cosmos/src/Resource/Settings/VectorIndexPath.cs
+++ b/Microsoft.Azure.Cosmos/src/Resource/Settings/VectorIndexPath.cs
@@ -42,7 +42,12 @@ namespace Microsoft.Azure.Cosmos
/// }
/// ]]>
///
- internal sealed class VectorIndexPath
+#if PREVIEW
+ public
+#else
+ internal
+#endif
+ sealed class VectorIndexPath
{
///
/// Gets or sets the full path in a document used for vector indexing.
diff --git a/Microsoft.Azure.Cosmos/src/Resource/Settings/VectorIndexType.cs b/Microsoft.Azure.Cosmos/src/Resource/Settings/VectorIndexType.cs
index 64318c9389..47c27cc42d 100644
--- a/Microsoft.Azure.Cosmos/src/Resource/Settings/VectorIndexType.cs
+++ b/Microsoft.Azure.Cosmos/src/Resource/Settings/VectorIndexType.cs
@@ -8,7 +8,12 @@ namespace Microsoft.Azure.Cosmos
///
/// Defines the target index type of an vector index path specification in the Azure Cosmos DB service.
///
- internal enum VectorIndexType
+#if PREVIEW
+ public
+#else
+ internal
+#endif
+ enum VectorIndexType
{
///
/// Represents a flat vector index type.
diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Contracts/DotNetPreviewSDKAPI.json b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Contracts/DotNetPreviewSDKAPI.json
index f11e74d42a..b43ef3d0e7 100644
--- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Contracts/DotNetPreviewSDKAPI.json
+++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Contracts/DotNetPreviewSDKAPI.json
@@ -332,6 +332,18 @@
"Attributes": [],
"MethodInfo": "Microsoft.Azure.Cosmos.ChangeFeedPolicy get_ChangeFeedPolicy();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;"
},
+ "Microsoft.Azure.Cosmos.VectorEmbeddingPolicy get_VectorEmbeddingPolicy()": {
+ "Type": "Method",
+ "Attributes": [],
+ "MethodInfo": "Microsoft.Azure.Cosmos.VectorEmbeddingPolicy get_VectorEmbeddingPolicy();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;"
+ },
+ "Microsoft.Azure.Cosmos.VectorEmbeddingPolicy VectorEmbeddingPolicy[Newtonsoft.Json.JsonIgnoreAttribute()]": {
+ "Type": "Property",
+ "Attributes": [
+ "JsonIgnoreAttribute"
+ ],
+ "MethodInfo": "Microsoft.Azure.Cosmos.VectorEmbeddingPolicy VectorEmbeddingPolicy;CanRead:True;CanWrite:True;Microsoft.Azure.Cosmos.VectorEmbeddingPolicy get_VectorEmbeddingPolicy();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_VectorEmbeddingPolicy(Microsoft.Azure.Cosmos.VectorEmbeddingPolicy);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;"
+ },
"System.Collections.ObjectModel.Collection`1[Microsoft.Azure.Cosmos.ComputedProperty] ComputedProperties[Newtonsoft.Json.JsonIgnoreAttribute()]": {
"Type": "Property",
"Attributes": [
@@ -353,6 +365,150 @@
"Type": "Method",
"Attributes": [],
"MethodInfo": "Void set_ComputedProperties(System.Collections.ObjectModel.Collection`1[Microsoft.Azure.Cosmos.ComputedProperty]);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;"
+ },
+ "Void set_VectorEmbeddingPolicy(Microsoft.Azure.Cosmos.VectorEmbeddingPolicy)": {
+ "Type": "Method",
+ "Attributes": [],
+ "MethodInfo": "Void set_VectorEmbeddingPolicy(Microsoft.Azure.Cosmos.VectorEmbeddingPolicy);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;"
+ }
+ },
+ "NestedTypes": {}
+ },
+ "Microsoft.Azure.Cosmos.DistanceFunction;System.Enum;IsAbstract:False;IsSealed:True;IsInterface:False;IsEnum:True;IsClass:False;IsValueType:True;IsNested:False;IsGenericType:False;IsSerializable:True": {
+ "Subclasses": {},
+ "Members": {
+ "Int32 value__": {
+ "Type": "Field",
+ "Attributes": [],
+ "MethodInfo": "Int32 value__;IsInitOnly:False;IsStatic:False;"
+ },
+ "Microsoft.Azure.Cosmos.DistanceFunction Cosine[System.Runtime.Serialization.EnumMemberAttribute(Value = \"cosine\")]": {
+ "Type": "Field",
+ "Attributes": [
+ "EnumMemberAttribute"
+ ],
+ "MethodInfo": "Microsoft.Azure.Cosmos.DistanceFunction Cosine;IsInitOnly:False;IsStatic:True;"
+ },
+ "Microsoft.Azure.Cosmos.DistanceFunction DotProduct[System.Runtime.Serialization.EnumMemberAttribute(Value = \"dotproduct\")]": {
+ "Type": "Field",
+ "Attributes": [
+ "EnumMemberAttribute"
+ ],
+ "MethodInfo": "Microsoft.Azure.Cosmos.DistanceFunction DotProduct;IsInitOnly:False;IsStatic:True;"
+ },
+ "Microsoft.Azure.Cosmos.DistanceFunction Euclidean[System.Runtime.Serialization.EnumMemberAttribute(Value = \"euclidean\")]": {
+ "Type": "Field",
+ "Attributes": [
+ "EnumMemberAttribute"
+ ],
+ "MethodInfo": "Microsoft.Azure.Cosmos.DistanceFunction Euclidean;IsInitOnly:False;IsStatic:True;"
+ }
+ },
+ "NestedTypes": {}
+ },
+ "Microsoft.Azure.Cosmos.Embedding;System.Object;IsAbstract:False;IsSealed:False;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:False;IsGenericType:False;IsSerializable:False": {
+ "Subclasses": {},
+ "Members": {
+ "Boolean Equals(Microsoft.Azure.Cosmos.Embedding)": {
+ "Type": "Method",
+ "Attributes": [],
+ "MethodInfo": "Boolean Equals(Microsoft.Azure.Cosmos.Embedding);IsAbstract:False;IsStatic:False;IsVirtual:True;IsGenericMethod:False;IsConstructor:False;IsFinal:True;"
+ },
+ "Microsoft.Azure.Cosmos.DistanceFunction DistanceFunction[Newtonsoft.Json.JsonPropertyAttribute(PropertyName = \"distanceFunction\")]-[Newtonsoft.Json.JsonConverterAttribute(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]": {
+ "Type": "Property",
+ "Attributes": [
+ "JsonConverterAttribute",
+ "JsonPropertyAttribute"
+ ],
+ "MethodInfo": "Microsoft.Azure.Cosmos.DistanceFunction DistanceFunction;CanRead:True;CanWrite:True;Microsoft.Azure.Cosmos.DistanceFunction get_DistanceFunction();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_DistanceFunction(Microsoft.Azure.Cosmos.DistanceFunction);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;"
+ },
+ "Microsoft.Azure.Cosmos.DistanceFunction get_DistanceFunction()[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": {
+ "Type": "Method",
+ "Attributes": [
+ "CompilerGeneratedAttribute"
+ ],
+ "MethodInfo": "Microsoft.Azure.Cosmos.DistanceFunction get_DistanceFunction();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;"
+ },
+ "Microsoft.Azure.Cosmos.VectorDataType DataType[Newtonsoft.Json.JsonPropertyAttribute(PropertyName = \"dataType\")]-[Newtonsoft.Json.JsonConverterAttribute(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]": {
+ "Type": "Property",
+ "Attributes": [
+ "JsonConverterAttribute",
+ "JsonPropertyAttribute"
+ ],
+ "MethodInfo": "Microsoft.Azure.Cosmos.VectorDataType DataType;CanRead:True;CanWrite:True;Microsoft.Azure.Cosmos.VectorDataType get_DataType();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_DataType(Microsoft.Azure.Cosmos.VectorDataType);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;"
+ },
+ "Microsoft.Azure.Cosmos.VectorDataType get_DataType()[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": {
+ "Type": "Method",
+ "Attributes": [
+ "CompilerGeneratedAttribute"
+ ],
+ "MethodInfo": "Microsoft.Azure.Cosmos.VectorDataType get_DataType();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;"
+ },
+ "System.String get_Path()[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": {
+ "Type": "Method",
+ "Attributes": [
+ "CompilerGeneratedAttribute"
+ ],
+ "MethodInfo": "System.String get_Path();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;"
+ },
+ "System.String Path[Newtonsoft.Json.JsonPropertyAttribute(PropertyName = \"path\")]": {
+ "Type": "Property",
+ "Attributes": [
+ "JsonPropertyAttribute"
+ ],
+ "MethodInfo": "System.String Path;CanRead:True;CanWrite:True;System.String get_Path();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_Path(System.String);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;"
+ },
+ "UInt64 Dimensions[Newtonsoft.Json.JsonPropertyAttribute(PropertyName = \"dimensions\")]": {
+ "Type": "Property",
+ "Attributes": [
+ "JsonPropertyAttribute"
+ ],
+ "MethodInfo": "UInt64 Dimensions;CanRead:True;CanWrite:True;UInt64 get_Dimensions();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_Dimensions(UInt64);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;"
+ },
+ "UInt64 get_Dimensions()[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": {
+ "Type": "Method",
+ "Attributes": [
+ "CompilerGeneratedAttribute"
+ ],
+ "MethodInfo": "UInt64 get_Dimensions();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;"
+ },
+ "Void .ctor()": {
+ "Type": "Constructor",
+ "Attributes": [],
+ "MethodInfo": "[Void .ctor(), Void .ctor()]"
+ },
+ "Void set_DataType(Microsoft.Azure.Cosmos.VectorDataType)[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": {
+ "Type": "Method",
+ "Attributes": [
+ "CompilerGeneratedAttribute"
+ ],
+ "MethodInfo": "Void set_DataType(Microsoft.Azure.Cosmos.VectorDataType);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;"
+ },
+ "Void set_Dimensions(UInt64)[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": {
+ "Type": "Method",
+ "Attributes": [
+ "CompilerGeneratedAttribute"
+ ],
+ "MethodInfo": "Void set_Dimensions(UInt64);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;"
+ },
+ "Void set_DistanceFunction(Microsoft.Azure.Cosmos.DistanceFunction)[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": {
+ "Type": "Method",
+ "Attributes": [
+ "CompilerGeneratedAttribute"
+ ],
+ "MethodInfo": "Void set_DistanceFunction(Microsoft.Azure.Cosmos.DistanceFunction);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;"
+ },
+ "Void set_Path(System.String)[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": {
+ "Type": "Method",
+ "Attributes": [
+ "CompilerGeneratedAttribute"
+ ],
+ "MethodInfo": "Void set_Path(System.String);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;"
+ },
+ "Void ValidateEmbeddingPath()": {
+ "Type": "Method",
+ "Attributes": [],
+ "MethodInfo": "Void ValidateEmbeddingPath();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;"
}
},
"NestedTypes": {}
@@ -391,6 +547,11 @@
"Type": "Method",
"Attributes": [],
"MethodInfo": "Microsoft.Azure.Cosmos.Fluent.ChangeFeedPolicyDefinition WithChangeFeedPolicy(System.TimeSpan);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;"
+ },
+ "Microsoft.Azure.Cosmos.Fluent.VectorEmbeddingPolicyDefinition WithVectorEmbeddingPolicy(System.Collections.ObjectModel.Collection`1[Microsoft.Azure.Cosmos.Embedding])": {
+ "Type": "Method",
+ "Attributes": [],
+ "MethodInfo": "Microsoft.Azure.Cosmos.Fluent.VectorEmbeddingPolicyDefinition WithVectorEmbeddingPolicy(System.Collections.ObjectModel.Collection`1[Microsoft.Azure.Cosmos.Embedding]);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;"
}
},
"NestedTypes": {}
@@ -406,6 +567,81 @@
},
"NestedTypes": {}
},
+ "Microsoft.Azure.Cosmos.Fluent.IndexingPolicyDefinition`1;System.Object;IsAbstract:False;IsSealed:False;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:False;IsGenericType:True;IsSerializable:False": {
+ "Subclasses": {},
+ "Members": {
+ "Microsoft.Azure.Cosmos.Fluent.VectorIndexDefinition`1[Microsoft.Azure.Cosmos.Fluent.IndexingPolicyDefinition`1[T]] WithVectorIndex()": {
+ "Type": "Method",
+ "Attributes": [],
+ "MethodInfo": "Microsoft.Azure.Cosmos.Fluent.VectorIndexDefinition`1[Microsoft.Azure.Cosmos.Fluent.IndexingPolicyDefinition`1[T]] WithVectorIndex();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;"
+ }
+ },
+ "NestedTypes": {}
+ },
+ "Microsoft.Azure.Cosmos.Fluent.VectorEmbeddingPolicyDefinition;System.Object;IsAbstract:False;IsSealed:False;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:False;IsGenericType:False;IsSerializable:False": {
+ "Subclasses": {},
+ "Members": {
+ "Microsoft.Azure.Cosmos.Fluent.ContainerBuilder Attach()": {
+ "Type": "Method",
+ "Attributes": [],
+ "MethodInfo": "Microsoft.Azure.Cosmos.Fluent.ContainerBuilder Attach();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;"
+ },
+ "Void .ctor(Microsoft.Azure.Cosmos.Fluent.ContainerBuilder, System.Collections.ObjectModel.Collection`1[Microsoft.Azure.Cosmos.Embedding], System.Action`1[Microsoft.Azure.Cosmos.VectorEmbeddingPolicy])": {
+ "Type": "Constructor",
+ "Attributes": [],
+ "MethodInfo": "[Void .ctor(Microsoft.Azure.Cosmos.Fluent.ContainerBuilder, System.Collections.ObjectModel.Collection`1[Microsoft.Azure.Cosmos.Embedding], System.Action`1[Microsoft.Azure.Cosmos.VectorEmbeddingPolicy]), Void .ctor(Microsoft.Azure.Cosmos.Fluent.ContainerBuilder, System.Collections.ObjectModel.Collection`1[Microsoft.Azure.Cosmos.Embedding], System.Action`1[Microsoft.Azure.Cosmos.VectorEmbeddingPolicy])]"
+ }
+ },
+ "NestedTypes": {}
+ },
+ "Microsoft.Azure.Cosmos.Fluent.VectorIndexDefinition`1;System.Object;IsAbstract:False;IsSealed:False;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:False;IsGenericType:True;IsSerializable:False": {
+ "Subclasses": {},
+ "Members": {
+ "Microsoft.Azure.Cosmos.Fluent.VectorIndexDefinition`1[T] Path(System.String, Microsoft.Azure.Cosmos.VectorIndexType)": {
+ "Type": "Method",
+ "Attributes": [],
+ "MethodInfo": "Microsoft.Azure.Cosmos.Fluent.VectorIndexDefinition`1[T] Path(System.String, Microsoft.Azure.Cosmos.VectorIndexType);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;"
+ },
+ "T Attach()": {
+ "Type": "Method",
+ "Attributes": [],
+ "MethodInfo": "T Attach();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;"
+ },
+ "Void .ctor(T, System.Action`1[Microsoft.Azure.Cosmos.VectorIndexPath])": {
+ "Type": "Constructor",
+ "Attributes": [],
+ "MethodInfo": "[Void .ctor(T, System.Action`1[Microsoft.Azure.Cosmos.VectorIndexPath]), Void .ctor(T, System.Action`1[Microsoft.Azure.Cosmos.VectorIndexPath])]"
+ }
+ },
+ "NestedTypes": {}
+ },
+ "Microsoft.Azure.Cosmos.IndexingPolicy;System.Object;IsAbstract:False;IsSealed:True;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:False;IsGenericType:False;IsSerializable:False": {
+ "Subclasses": {},
+ "Members": {
+ "System.Collections.ObjectModel.Collection`1[Microsoft.Azure.Cosmos.VectorIndexPath] get_VectorIndexes()[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": {
+ "Type": "Method",
+ "Attributes": [
+ "CompilerGeneratedAttribute"
+ ],
+ "MethodInfo": "System.Collections.ObjectModel.Collection`1[Microsoft.Azure.Cosmos.VectorIndexPath] get_VectorIndexes();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;"
+ },
+ "System.Collections.ObjectModel.Collection`1[Microsoft.Azure.Cosmos.VectorIndexPath] VectorIndexes[Newtonsoft.Json.JsonPropertyAttribute(NullValueHandling = 1, PropertyName = \"vectorIndexes\")]": {
+ "Type": "Property",
+ "Attributes": [
+ "JsonPropertyAttribute"
+ ],
+ "MethodInfo": "System.Collections.ObjectModel.Collection`1[Microsoft.Azure.Cosmos.VectorIndexPath] VectorIndexes;CanRead:True;CanWrite:True;System.Collections.ObjectModel.Collection`1[Microsoft.Azure.Cosmos.VectorIndexPath] get_VectorIndexes();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_VectorIndexes(System.Collections.ObjectModel.Collection`1[Microsoft.Azure.Cosmos.VectorIndexPath]);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;"
+ },
+ "Void set_VectorIndexes(System.Collections.ObjectModel.Collection`1[Microsoft.Azure.Cosmos.VectorIndexPath])[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": {
+ "Type": "Method",
+ "Attributes": [
+ "CompilerGeneratedAttribute"
+ ],
+ "MethodInfo": "Void set_VectorIndexes(System.Collections.ObjectModel.Collection`1[Microsoft.Azure.Cosmos.VectorIndexPath]);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;"
+ }
+ },
+ "NestedTypes": {}
+ },
"Microsoft.Azure.Cosmos.Linq.CosmosLinqExtensions;System.Object;IsAbstract:True;IsSealed:True;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:False;IsGenericType:False;IsSerializable:False": {
"Subclasses": {},
"Members": {
@@ -418,6 +654,149 @@
}
},
"NestedTypes": {}
+ },
+ "Microsoft.Azure.Cosmos.VectorDataType;System.Enum;IsAbstract:False;IsSealed:True;IsInterface:False;IsEnum:True;IsClass:False;IsValueType:True;IsNested:False;IsGenericType:False;IsSerializable:True": {
+ "Subclasses": {},
+ "Members": {
+ "Int32 value__": {
+ "Type": "Field",
+ "Attributes": [],
+ "MethodInfo": "Int32 value__;IsInitOnly:False;IsStatic:False;"
+ },
+ "Microsoft.Azure.Cosmos.VectorDataType Float16[System.Runtime.Serialization.EnumMemberAttribute(Value = \"float16\")]": {
+ "Type": "Field",
+ "Attributes": [
+ "EnumMemberAttribute"
+ ],
+ "MethodInfo": "Microsoft.Azure.Cosmos.VectorDataType Float16;IsInitOnly:False;IsStatic:True;"
+ },
+ "Microsoft.Azure.Cosmos.VectorDataType Float32[System.Runtime.Serialization.EnumMemberAttribute(Value = \"float32\")]": {
+ "Type": "Field",
+ "Attributes": [
+ "EnumMemberAttribute"
+ ],
+ "MethodInfo": "Microsoft.Azure.Cosmos.VectorDataType Float32;IsInitOnly:False;IsStatic:True;"
+ },
+ "Microsoft.Azure.Cosmos.VectorDataType Int8[System.Runtime.Serialization.EnumMemberAttribute(Value = \"int8\")]": {
+ "Type": "Field",
+ "Attributes": [
+ "EnumMemberAttribute"
+ ],
+ "MethodInfo": "Microsoft.Azure.Cosmos.VectorDataType Int8;IsInitOnly:False;IsStatic:True;"
+ },
+ "Microsoft.Azure.Cosmos.VectorDataType Uint8[System.Runtime.Serialization.EnumMemberAttribute(Value = \"uint8\")]": {
+ "Type": "Field",
+ "Attributes": [
+ "EnumMemberAttribute"
+ ],
+ "MethodInfo": "Microsoft.Azure.Cosmos.VectorDataType Uint8;IsInitOnly:False;IsStatic:True;"
+ }
+ },
+ "NestedTypes": {}
+ },
+ "Microsoft.Azure.Cosmos.VectorEmbeddingPolicy;System.Object;IsAbstract:False;IsSealed:True;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:False;IsGenericType:False;IsSerializable:False": {
+ "Subclasses": {},
+ "Members": {
+ "System.Collections.ObjectModel.Collection`1[Microsoft.Azure.Cosmos.Embedding] Embeddings[Newtonsoft.Json.JsonPropertyAttribute(PropertyName = \"vectorEmbeddings\")]": {
+ "Type": "Field",
+ "Attributes": [
+ "JsonPropertyAttribute"
+ ],
+ "MethodInfo": "System.Collections.ObjectModel.Collection`1[Microsoft.Azure.Cosmos.Embedding] Embeddings;IsInitOnly:True;IsStatic:False;"
+ },
+ "Void .ctor(System.Collections.ObjectModel.Collection`1[Microsoft.Azure.Cosmos.Embedding])": {
+ "Type": "Constructor",
+ "Attributes": [],
+ "MethodInfo": "[Void .ctor(System.Collections.ObjectModel.Collection`1[Microsoft.Azure.Cosmos.Embedding]), Void .ctor(System.Collections.ObjectModel.Collection`1[Microsoft.Azure.Cosmos.Embedding])]"
+ }
+ },
+ "NestedTypes": {}
+ },
+ "Microsoft.Azure.Cosmos.VectorIndexPath;System.Object;IsAbstract:False;IsSealed:True;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:False;IsGenericType:False;IsSerializable:False": {
+ "Subclasses": {},
+ "Members": {
+ "Microsoft.Azure.Cosmos.VectorIndexType get_Type()[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": {
+ "Type": "Method",
+ "Attributes": [
+ "CompilerGeneratedAttribute"
+ ],
+ "MethodInfo": "Microsoft.Azure.Cosmos.VectorIndexType get_Type();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;"
+ },
+ "Microsoft.Azure.Cosmos.VectorIndexType Type[Newtonsoft.Json.JsonPropertyAttribute(PropertyName = \"type\")]-[Newtonsoft.Json.JsonConverterAttribute(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]": {
+ "Type": "Property",
+ "Attributes": [
+ "JsonConverterAttribute",
+ "JsonPropertyAttribute"
+ ],
+ "MethodInfo": "Microsoft.Azure.Cosmos.VectorIndexType Type;CanRead:True;CanWrite:True;Microsoft.Azure.Cosmos.VectorIndexType get_Type();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_Type(Microsoft.Azure.Cosmos.VectorIndexType);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;"
+ },
+ "System.String get_Path()[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": {
+ "Type": "Method",
+ "Attributes": [
+ "CompilerGeneratedAttribute"
+ ],
+ "MethodInfo": "System.String get_Path();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;"
+ },
+ "System.String Path[Newtonsoft.Json.JsonPropertyAttribute(PropertyName = \"path\")]": {
+ "Type": "Property",
+ "Attributes": [
+ "JsonPropertyAttribute"
+ ],
+ "MethodInfo": "System.String Path;CanRead:True;CanWrite:True;System.String get_Path();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_Path(System.String);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;"
+ },
+ "Void .ctor()": {
+ "Type": "Constructor",
+ "Attributes": [],
+ "MethodInfo": "[Void .ctor(), Void .ctor()]"
+ },
+ "Void set_Path(System.String)[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": {
+ "Type": "Method",
+ "Attributes": [
+ "CompilerGeneratedAttribute"
+ ],
+ "MethodInfo": "Void set_Path(System.String);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;"
+ },
+ "Void set_Type(Microsoft.Azure.Cosmos.VectorIndexType)[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": {
+ "Type": "Method",
+ "Attributes": [
+ "CompilerGeneratedAttribute"
+ ],
+ "MethodInfo": "Void set_Type(Microsoft.Azure.Cosmos.VectorIndexType);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;"
+ }
+ },
+ "NestedTypes": {}
+ },
+ "Microsoft.Azure.Cosmos.VectorIndexType;System.Enum;IsAbstract:False;IsSealed:True;IsInterface:False;IsEnum:True;IsClass:False;IsValueType:True;IsNested:False;IsGenericType:False;IsSerializable:True": {
+ "Subclasses": {},
+ "Members": {
+ "Int32 value__": {
+ "Type": "Field",
+ "Attributes": [],
+ "MethodInfo": "Int32 value__;IsInitOnly:False;IsStatic:False;"
+ },
+ "Microsoft.Azure.Cosmos.VectorIndexType DiskANN[System.Runtime.Serialization.EnumMemberAttribute(Value = \"diskANN\")]": {
+ "Type": "Field",
+ "Attributes": [
+ "EnumMemberAttribute"
+ ],
+ "MethodInfo": "Microsoft.Azure.Cosmos.VectorIndexType DiskANN;IsInitOnly:False;IsStatic:True;"
+ },
+ "Microsoft.Azure.Cosmos.VectorIndexType Flat[System.Runtime.Serialization.EnumMemberAttribute(Value = \"flat\")]": {
+ "Type": "Field",
+ "Attributes": [
+ "EnumMemberAttribute"
+ ],
+ "MethodInfo": "Microsoft.Azure.Cosmos.VectorIndexType Flat;IsInitOnly:False;IsStatic:True;"
+ },
+ "Microsoft.Azure.Cosmos.VectorIndexType QuantizedFlat[System.Runtime.Serialization.EnumMemberAttribute(Value = \"quantizedFlat\")]": {
+ "Type": "Field",
+ "Attributes": [
+ "EnumMemberAttribute"
+ ],
+ "MethodInfo": "Microsoft.Azure.Cosmos.VectorIndexType QuantizedFlat;IsInitOnly:False;IsStatic:True;"
+ }
+ },
+ "NestedTypes": {}
}
},
"Members": {},
diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/CosmosContainerSettingsTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/CosmosContainerSettingsTests.cs
index bae30c8acd..a12f37fcfa 100644
--- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/CosmosContainerSettingsTests.cs
+++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/CosmosContainerSettingsTests.cs
@@ -183,31 +183,31 @@ public void SettingPKShouldNotResetVersion()
[TestMethod]
public void ValidateVectorEmbeddingsAndIndexes()
{
- Embedding embedding1 = new ()
+ Cosmos.Embedding embedding1 = new ()
{
Path = "/vector1",
- DataType = VectorDataType.Int8,
- DistanceFunction = DistanceFunction.DotProduct,
+ DataType = Cosmos.VectorDataType.Int8,
+ DistanceFunction = Cosmos.DistanceFunction.DotProduct,
Dimensions = 1200,
};
- Embedding embedding2 = new ()
+ Cosmos.Embedding embedding2 = new ()
{
Path = "/vector2",
- DataType = VectorDataType.Uint8,
- DistanceFunction = DistanceFunction.Cosine,
+ DataType = Cosmos.VectorDataType.Uint8,
+ DistanceFunction = Cosmos.DistanceFunction.Cosine,
Dimensions = 3,
};
- Embedding embedding3 = new ()
+ Cosmos.Embedding embedding3 = new ()
{
Path = "/vector3",
- DataType = VectorDataType.Float32,
- DistanceFunction = DistanceFunction.Euclidean,
+ DataType = Cosmos.VectorDataType.Float32,
+ DistanceFunction = Cosmos.DistanceFunction.Euclidean,
Dimensions = 400,
};
- Collection embeddings = new Collection()
+ Collection embeddings = new Collection()
{
embedding1,
embedding2,
@@ -216,25 +216,25 @@ public void ValidateVectorEmbeddingsAndIndexes()
ContainerProperties containerSettings = new ContainerProperties(id: "TestContainer", partitionKeyPath: "/partitionKey")
{
- VectorEmbeddingPolicy = new(embeddings),
+ VectorEmbeddingPolicy = new (embeddings),
IndexingPolicy = new Cosmos.IndexingPolicy()
{
VectorIndexes = new()
{
- new VectorIndexPath()
+ new Cosmos.VectorIndexPath()
{
Path = "/vector1",
- Type = VectorIndexType.Flat,
+ Type = Cosmos.VectorIndexType.Flat,
},
- new VectorIndexPath()
+ new Cosmos.VectorIndexPath()
{
Path = "/vector2",
- Type = VectorIndexType.Flat,
+ Type = Cosmos.VectorIndexType.Flat,
},
- new VectorIndexPath()
+ new Cosmos.VectorIndexPath()
{
Path = "/vector3",
- Type = VectorIndexType.Flat,
+ Type = Cosmos.VectorIndexType.Flat,
}
},
@@ -245,18 +245,18 @@ public void ValidateVectorEmbeddingsAndIndexes()
Assert.IsNotNull(containerSettings.VectorEmbeddingPolicy);
Assert.IsNotNull(containerSettings.IndexingPolicy.VectorIndexes);
- VectorEmbeddingPolicy embeddingPolicy = containerSettings.VectorEmbeddingPolicy;
+ Cosmos.VectorEmbeddingPolicy embeddingPolicy = containerSettings.VectorEmbeddingPolicy;
Assert.IsNotNull(embeddingPolicy.Embeddings);
Assert.AreEqual(embeddings.Count, embeddingPolicy.Embeddings.Count());
CollectionAssert.AreEquivalent(embeddings, embeddingPolicy.Embeddings.ToList());
- Collection vectorIndexes = containerSettings.IndexingPolicy.VectorIndexes;
+ Collection vectorIndexes = containerSettings.IndexingPolicy.VectorIndexes;
Assert.AreEqual("/vector1", vectorIndexes[0].Path);
- Assert.AreEqual(VectorIndexType.Flat, vectorIndexes[0].Type);
+ Assert.AreEqual(Cosmos.VectorIndexType.Flat, vectorIndexes[0].Type);
Assert.AreEqual("/vector2", vectorIndexes[1].Path);
- Assert.AreEqual(VectorIndexType.Flat, vectorIndexes[1].Type);
+ Assert.AreEqual(Cosmos.VectorIndexType.Flat, vectorIndexes[1].Type);
Assert.AreEqual("/vector3", vectorIndexes[2].Path);
- Assert.AreEqual(VectorIndexType.Flat, vectorIndexes[2].Type);
+ Assert.AreEqual(Cosmos.VectorIndexType.Flat, vectorIndexes[2].Type);
}
private static string SerializeDocumentCollection(DocumentCollection collection)
diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/SettingsContractTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/SettingsContractTests.cs
index 0aebb7e07d..3224a6618c 100644
--- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/SettingsContractTests.cs
+++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/SettingsContractTests.cs
@@ -400,9 +400,9 @@ public void ContainerPropertiesDeserializeWithAdditionalDataTest()
Assert.IsNotNull(containerProperties.VectorEmbeddingPolicy);
Assert.AreEqual(3, containerProperties.VectorEmbeddingPolicy.Embeddings.Count);
Assert.AreEqual("/vector1", containerProperties.VectorEmbeddingPolicy.Embeddings[0].Path);
- Assert.AreEqual(VectorDataType.Float32, containerProperties.VectorEmbeddingPolicy.Embeddings[0].DataType);
+ Assert.AreEqual(Cosmos.VectorDataType.Float32, containerProperties.VectorEmbeddingPolicy.Embeddings[0].DataType);
Assert.AreEqual((ulong)1200, containerProperties.VectorEmbeddingPolicy.Embeddings[0].Dimensions);
- Assert.AreEqual(DistanceFunction.Cosine, containerProperties.VectorEmbeddingPolicy.Embeddings[0].DistanceFunction);
+ Assert.AreEqual(Cosmos.DistanceFunction.Cosine, containerProperties.VectorEmbeddingPolicy.Embeddings[0].DistanceFunction);
Assert.AreEqual(2, containerProperties.ComputedProperties.Count);
Assert.AreEqual("lowerName", containerProperties.ComputedProperties[0].Name);
@@ -749,7 +749,8 @@ public void ContainerSettingsDefaults()
"ConflictResolutionPolicy",
"ChangeFeedPolicy",
"ClientEncryptionPolicy",
- "PartitionKeyPaths");
+ "PartitionKeyPaths",
+ "VectorEmbeddingPolicy");
#else
SettingsContractTests.TypeAccessorGuard(typeof(ContainerProperties),
"Id",
@@ -804,7 +805,7 @@ public void ContainerSettingsDefaults()
[TestMethod]
public async Task ContainerSettingsIndexTest()
{
- string containerJsonString = "{\"indexingPolicy\":{\"automatic\":true,\"indexingMode\":\"Consistent\",\"includedPaths\":[{\"path\":\"/*\",\"indexes\":[{\"dataType\":\"Number\",\"precision\":-1,\"kind\":\"Range\"},{\"dataType\":\"String\",\"precision\":-1,\"kind\":\"Range\"}]}],\"excludedPaths\":[{\"path\":\"/\\\"_etag\\\"/?\"}],\"compositeIndexes\":[],\"spatialIndexes\":[]},\"id\":\"MigrationTest\",\"partitionKey\":{\"paths\":[\"/id\"],\"kind\":\"Hash\"}}";
+ string containerJsonString = "{\"indexingPolicy\":{\"automatic\":true,\"indexingMode\":\"Consistent\",\"includedPaths\":[{\"path\":\"/*\",\"indexes\":[{\"dataType\":\"Number\",\"precision\":-1,\"kind\":\"Range\"},{\"dataType\":\"String\",\"precision\":-1,\"kind\":\"Range\"}]}],\"excludedPaths\":[{\"path\":\"/\\\"_etag\\\"/?\"}],\"compositeIndexes\":[],\"spatialIndexes\":[],\"vectorIndexes\":[]},\"id\":\"MigrationTest\",\"partitionKey\":{\"paths\":[\"/id\"],\"kind\":\"Hash\"}}";
CosmosJsonDotNetSerializer serializerCore = new CosmosJsonDotNetSerializer();
ContainerProperties containerProperties = null;
@@ -1077,29 +1078,29 @@ public void VectorEmbeddingPolicySerialization()
string serialization = JsonConvert.SerializeObject(containerSettings);
Assert.IsFalse(serialization.Contains("vectorEmbeddingPolicy"), "Vector Embedding Policy should not be included by default");
- Embedding embedding1 = new()
+ Cosmos.Embedding embedding1 = new()
{
Path = "/vector1",
- DataType = VectorDataType.Int8,
- DistanceFunction = DistanceFunction.DotProduct,
+ DataType = Cosmos.VectorDataType.Int8,
+ DistanceFunction = Cosmos.DistanceFunction.DotProduct,
Dimensions = 1200,
};
- Embedding embedding2 = new()
+ Cosmos.Embedding embedding2 = new()
{
Path = "/vector2",
- DataType = VectorDataType.Uint8,
- DistanceFunction = DistanceFunction.Cosine,
+ DataType = Cosmos.VectorDataType.Uint8,
+ DistanceFunction = Cosmos.DistanceFunction.Cosine,
Dimensions = 3,
};
- Collection embeddings = new ()
+ Collection embeddings = new ()
{
embedding1,
embedding2,
};
- containerSettings.VectorEmbeddingPolicy = new VectorEmbeddingPolicy(embeddings);
+ containerSettings.VectorEmbeddingPolicy = new Cosmos.VectorEmbeddingPolicy(embeddings);
string serializationWithValues = JsonConvert.SerializeObject(containerSettings);
Assert.IsTrue(serializationWithValues.Contains("vectorEmbeddingPolicy"), "Vector Embedding Policy should be included.");
@@ -1108,8 +1109,8 @@ public void VectorEmbeddingPolicySerialization()
JObject parsed = JObject.Parse(serializationWithValues);
JToken vectorEmbeddings = parsed["vectorEmbeddingPolicy"]["vectorEmbeddings"];
Assert.AreEqual(JTokenType.Array, vectorEmbeddings.Type, "Vector Embedding Policy serialized vectorEmbeddings should be an array.");
- Assert.IsTrue(embedding1.Equals(vectorEmbeddings.Value()[0].ToObject()));
- Assert.IsTrue(embedding2.Equals(vectorEmbeddings.Value()[1].ToObject()));
+ Assert.IsTrue(embedding1.Equals(vectorEmbeddings.Value()[0].ToObject()));
+ Assert.IsTrue(embedding2.Equals(vectorEmbeddings.Value()[1].ToObject()));
}
private static T CosmosDeserialize(string payload)