Skip to content

Commit

Permalink
Added default index kind and distance function for Azure CosmosDB NoS…
Browse files Browse the repository at this point in the history
…QL connector
  • Loading branch information
dmytrostruk committed Oct 11, 2024
1 parent ec9233c commit 91ad124
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,12 @@ private ContainerProperties GetContainerProperties()
/// </summary>
private static VectorIndexType GetIndexKind(string? indexKind, string vectorPropertyName)
{
if (string.IsNullOrWhiteSpace(indexKind))
{
// Use default index kind.
return VectorIndexType.DiskANN;
}

return indexKind switch
{
IndexKind.Flat => VectorIndexType.Flat,
Expand All @@ -542,6 +548,12 @@ private static VectorIndexType GetIndexKind(string? indexKind, string vectorProp
/// </summary>
private static DistanceFunction GetDistanceFunction(string? distanceFunction, string vectorPropertyName)
{
if (string.IsNullOrWhiteSpace(distanceFunction))
{
// Use default distance function.
return DistanceFunction.Cosine;
}

return distanceFunction switch
{
SKDistanceFunction.CosineSimilarity => DistanceFunction.Cosine,
Expand Down

0 comments on commit 91ad124

Please sign in to comment.