You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// Object representing the options for vector distance calculation. All field are optional. if a field is not specified, the default value will be used.
26
+
/// For more information, see https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/query/vectordistance.
27
+
/// </summary>
28
+
publicsealedclassVectorDistanceOptions
29
+
{
30
+
/// <summary>
31
+
/// The metric used to compute distance/similarity. Valid values are "cosine", "dotproduct", "euclidean".
32
+
/// If not specified, the default value is what is defined in the container policy
33
+
/// </summary>
34
+
[JsonPropertyName("distanceFunction")]
35
+
publicDistanceFunction?DistanceFunction{get;set;}
36
+
37
+
/// <summary>
38
+
/// The data type of the vectors. float32, int8, uint8 values. Default value is float32.
39
+
/// </summary>
40
+
[JsonPropertyName("dataType")]
41
+
publicVectorDataType?DataType{get;set;}
42
+
43
+
/// <summary>
44
+
/// An integer specifying the size of the search list when conducting a vector search on the DiskANN index.
45
+
/// Increasing this may improve accuracy at the expense of RU cost and latency. Min=1, Default=10, Max=100.
46
+
/// </summary>
47
+
[JsonPropertyName("searchListSizeMultiplier")]
48
+
publicint?SearchListSizeMultiplier{get;set;}
49
+
}
50
+
25
51
/// <summary>
26
52
/// Returns the integer identifier corresponding to a specific item within a physical partition.
27
53
/// This method is to be used in LINQ expressions only and will be evaluated on server.
/// Returns the similarity score between two specified vectors.
270
+
/// For more information, see https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/query/vectordistance.
271
+
/// This method is to be used in LINQ expressions only and will be evaluated on server.
272
+
/// There's no implementation provided in the client library.
273
+
/// </summary>
274
+
/// <param name="vector1">The first vector.</param>
275
+
/// <param name="vector2">The second vector.</param>
276
+
/// <param name="isBruteForce">A boolean specifying how the computed value is used in an ORDER BY expression. If true, then brute force is used. A value of false uses any index defined on the vector property, if it exists. </param>
277
+
/// <param name="options">An JSON formatted object literal used to specify options for the vector distance calculation. </param>
278
+
/// <returns>Returns the similarity score between two specified vectors.</returns>
279
+
/// <example>
280
+
/// <code>
281
+
/// <![CDATA[
282
+
/// var matched = documents.Select(document => document.vector1.VectorDistance(<vector2>, true, new VectorDistanceOptions() { DistanceFunction = DistanceFunction.Cosine, DataType = VectorDataType.Float32}));
/// Returns the similarity score between two specified vectors.
293
+
/// For more information, see https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/query/vectordistance.
294
+
/// This method is to be used in LINQ expressions only and will be evaluated on server.
295
+
/// There's no implementation provided in the client library.
296
+
/// </summary>
297
+
/// <param name="vector1">The first vector.</param>
298
+
/// <param name="vector2">The second vector.</param>
299
+
/// <param name="isBruteForce">A boolean specifying how the computed value is used in an ORDER BY expression. If true, then brute force is used. A value of false uses any index defined on the vector property, if it exists. </param>
300
+
/// <param name="options">An JSON formatted object literal used to specify options for the vector distance calculation. </param>
301
+
/// <returns>Returns the similarity score between two specified vectors.</returns>
302
+
/// <example>
303
+
/// <code>
304
+
/// <![CDATA[
305
+
/// var matched = documents.Select(document => document.vector1.VectorDistance(<vector2>, true, new VectorDistanceOptions() { DistanceFunction = DistanceFunction.Cosine, DataType = VectorDataType.Int8}));
/// Returns the similarity score between two specified vectors.
316
+
/// For more information, see https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/query/vectordistance.
317
+
/// This method is to be used in LINQ expressions only and will be evaluated on server.
318
+
/// There's no implementation provided in the client library.
319
+
/// </summary>
320
+
/// <param name="vector1">The first vector.</param>
321
+
/// <param name="vector2">The second vector.</param>
322
+
/// <param name="isBruteForce">A boolean specifying how the computed value is used in an ORDER BY expression. If true, then brute force is used. A value of false uses any index defined on the vector property, if it exists. </param>
323
+
/// <param name="options">An JSON formatted object literal used to specify options for the vector distance calculation. </param>
324
+
/// <returns>Returns the similarity score between two specified vectors.</returns>
325
+
/// <example>
326
+
/// <code>
327
+
/// <![CDATA[
328
+
/// var matched = documents.Select(document => document.vector1.VectorDistance(<vector2>, true, new VectorDistanceOptions() { DistanceFunction = DistanceFunction.Cosine, DataType = VectorDataType.Uint8}));
Copy file name to clipboardExpand all lines: Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqTranslationBaselineTests.TestRRFOrderByRankFunction.xml
+5-5Lines changed: 5 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -77,7 +77,7 @@ WHERE (RRF(FullTextScore(root["StringField"], "test1"), FullTextScore(root["Stri
77
77
</Input>
78
78
<Output>
79
79
<SqlQuery><![CDATA[]]></SqlQuery>
80
-
<ErrorMessage><![CDATA[Expressions of type System.Double is not supported as an argument to CosmosLinqExtensions.RRF. Supported expressions are method calls to FullTextScore.]]></ErrorMessage>
80
+
<ErrorMessage><![CDATA[Expressions of type System.Double is not supported as an argument to CosmosLinqExtensions.RRF. Supported expressions are method calls to FullTextScore, VectorDistance.]]></ErrorMessage>
81
81
</Output>
82
82
</Result>
83
83
<Result>
@@ -87,7 +87,7 @@ WHERE (RRF(FullTextScore(root["StringField"], "test1"), FullTextScore(root["Stri
87
87
</Input>
88
88
<Output>
89
89
<SqlQuery><![CDATA[]]></SqlQuery>
90
-
<ErrorMessage><![CDATA[Expressions of type System.Double is not supported as an argument to CosmosLinqExtensions.RRF. Supported expressions are method calls to FullTextScore.]]></ErrorMessage>
90
+
<ErrorMessage><![CDATA[Expressions of type System.Double is not supported as an argument to CosmosLinqExtensions.RRF. Supported expressions are method calls to FullTextScore, VectorDistance.]]></ErrorMessage>
91
91
</Output>
92
92
</Result>
93
93
<Result>
@@ -97,7 +97,7 @@ WHERE (RRF(FullTextScore(root["StringField"], "test1"), FullTextScore(root["Stri
97
97
</Input>
98
98
<Output>
99
99
<SqlQuery><![CDATA[]]></SqlQuery>
100
-
<ErrorMessage><![CDATA[Expressions of type System.Double is not supported as an argument to CosmosLinqExtensions.RRF. Supported expressions are method calls to FullTextScore.]]></ErrorMessage>
100
+
<ErrorMessage><![CDATA[Expressions of type System.Double is not supported as an argument to CosmosLinqExtensions.RRF. Supported expressions are method calls to FullTextScore, VectorDistance.]]></ErrorMessage>
101
101
</Output>
102
102
</Result>
103
103
<Result>
@@ -107,7 +107,7 @@ WHERE (RRF(FullTextScore(root["StringField"], "test1"), FullTextScore(root["Stri
107
107
</Input>
108
108
<Output>
109
109
<SqlQuery><![CDATA[]]></SqlQuery>
110
-
<ErrorMessage><![CDATA[Expressions of type System.Double is not supported as an argument to CosmosLinqExtensions.RRF. Supported expressions are method calls to FullTextScore.]]></ErrorMessage>
110
+
<ErrorMessage><![CDATA[Expressions of type System.Double is not supported as an argument to CosmosLinqExtensions.RRF. Supported expressions are method calls to FullTextScore, VectorDistance.]]></ErrorMessage>
111
111
</Output>
112
112
</Result>
113
113
<Result>
@@ -117,7 +117,7 @@ WHERE (RRF(FullTextScore(root["StringField"], "test1"), FullTextScore(root["Stri
117
117
</Input>
118
118
<Output>
119
119
<SqlQuery><![CDATA[]]></SqlQuery>
120
-
<ErrorMessage><![CDATA[Method RRF is not supported as an argument to CosmosLinqExtensions.RRF. Supported methods are FullTextScore.]]></ErrorMessage>
120
+
<ErrorMessage><![CDATA[Method RRF is not supported as an argument to CosmosLinqExtensions.RRF. Supported methods are FullTextScore, VectorDistance.]]></ErrorMessage>
0 commit comments