From 34940fba33dc0e719dac756ca21dc56d60bf7c44 Mon Sep 17 00:00:00 2001 From: Michael Landis Date: Tue, 14 Nov 2023 17:27:20 -0800 Subject: [PATCH] chore: update mvi control plane for create and list indexes protos (#518) Updates MVI list and create indexes backend for latest changes. Updates protos but developer-facing API remains otherwise the same. --- src/Momento.Sdk/Internal/VectorIndexControlClient.cs | 12 ++++++------ src/Momento.Sdk/Momento.Sdk.csproj | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Momento.Sdk/Internal/VectorIndexControlClient.cs b/src/Momento.Sdk/Internal/VectorIndexControlClient.cs index ba149917..57066d9d 100644 --- a/src/Momento.Sdk/Internal/VectorIndexControlClient.cs +++ b/src/Momento.Sdk/Internal/VectorIndexControlClient.cs @@ -33,22 +33,22 @@ public async Task CreateIndexAsync(string indexName, long n _logger.LogTraceVectorIndexRequest("createVectorIndex", indexName); CheckValidIndexName(indexName); var validatedNumDimensions = ValidateNumDimensions(numDimensions); - var request = new _CreateIndexRequest { IndexName = indexName, NumDimensions = validatedNumDimensions }; + var request = new _CreateIndexRequest { IndexName = indexName, NumDimensions = validatedNumDimensions, SimilarityMetric = new _SimilarityMetric() }; switch (similarityMetric) { case SimilarityMetric.CosineSimilarity: - request.CosineSimilarity = new _CreateIndexRequest.Types._CosineSimilarity(); + request.SimilarityMetric.CosineSimilarity = new _SimilarityMetric.Types._CosineSimilarity(); break; case SimilarityMetric.InnerProduct: - request.InnerProduct = new _CreateIndexRequest.Types._InnerProduct(); + request.SimilarityMetric.InnerProduct = new _SimilarityMetric.Types._InnerProduct(); break; case SimilarityMetric.EuclideanSimilarity: - request.EuclideanSimilarity = new _CreateIndexRequest.Types._EuclideanSimilarity(); + request.SimilarityMetric.EuclideanSimilarity = new _SimilarityMetric.Types._EuclideanSimilarity(); break; default: throw new InvalidArgumentException($"Unknown similarity metric {similarityMetric}"); } - + await grpcManager.Client.CreateIndexAsync(request, new CallOptions(deadline: CalculateDeadline())); return _logger.LogTraceVectorIndexRequestSuccess("createVectorIndex", indexName, new CreateIndexResponse.Success()); } @@ -71,7 +71,7 @@ public async Task ListIndexesAsync() var response = await grpcManager.Client.ListIndexesAsync(request, new CallOptions(deadline: CalculateDeadline())); return _logger.LogTraceGenericRequestSuccess("listVectorIndexes", new ListIndexesResponse.Success( - new List(response.IndexNames.Select(n => new IndexInfo(n))))); + new List(response.Indexes.Select(n => new IndexInfo(n.IndexName))))); } catch (Exception e) { diff --git a/src/Momento.Sdk/Momento.Sdk.csproj b/src/Momento.Sdk/Momento.Sdk.csproj index d691efb5..be2e27e7 100644 --- a/src/Momento.Sdk/Momento.Sdk.csproj +++ b/src/Momento.Sdk/Momento.Sdk.csproj @@ -55,7 +55,7 @@ - +