From 16d3004d12bdc50d82ecb0dad75e7a111df9ae85 Mon Sep 17 00:00:00 2001 From: Chris <66376200+crickman@users.noreply.github.com> Date: Wed, 6 Sep 2023 13:25:07 -0700 Subject: [PATCH] .Net: Update Azure.Search.Documents.nupkg to version 11.5.0-beta.4 (#2725) ### Motivation and Context Breaking changes cause missing method exception when integrating semantic-kernel with semantic-memory since sk references 11.5.0-beta.3 and sm 11.5.0-beta.4. [SearchQueryVector](https://learn.microsoft.com/en-us/dotnet/api/azure.search.documents.models.searchqueryvector?view=azure-dotnet-preview) [SearchOptions](https://learn.microsoft.com/en-us/dotnet/api/azure.search.documents.searchoptions?view=azure-dotnet-preview) ### Description ``` Method not found: 'Void Azure.Search.Documents.Models.SearchQueryVector.set_Fields(System.String)'. at Microsoft.SemanticKernel.Connectors.Memory.AzureCognitiveSearch.AzureCognitiveSearchMemoryStore.d__11.MoveNext() at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine) at Microsoft.SemanticKernel.Connectors.Memory.AzureCognitiveSearch.AzureCognitiveSearchMemoryStore.d__11.System.IAsyncDisposable.DisposeAsync() at System.Runtime.CompilerServices.ConfiguredCancelableAsyncEnumerable`1.Enumerator.DisposeAsync() at Microsoft.SemanticKernel.Memory.SemanticTextMemory.d__7.MoveNext() at Microsoft.SemanticKernel.Memory.SemanticTextMemory.d__7.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token) at System.Collections.Generic.AsyncEnumerableHelpers.d__1`1.MoveNext() at System.Collections.Generic.AsyncEnumerableHelpers.d__1`1.MoveNext() at System.Threading.Tasks.ValueTask`1.get_Result() at System.Runtime.CompilerServices.ConfiguredValueTaskAwaitable`1.ConfiguredValueTaskAwaiter.GetResult() at System.Collections.Generic.AsyncEnumerableHelpers.d__0`1.MoveNext() at System.Threading.Tasks.ValueTask`1.get_Result() at CopilotChat.WebApi.Services.ChatMemoryMigrationService.<>c__DisplayClass5_0.<g__QueryMemoriesAsync|0>d.MoveNext() in C:\Users\crickman\source\repos\sk-chat-copilot-memory\webapi\Services\ChatMemoryMigrationService.cs:line 88 at CopilotChat.WebApi.Services.ChatMemoryMigrationService.<>c__DisplayClass5_0.<g__QueryMemoriesAsync|0>d.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token) at CopilotChat.WebApi.Services.ChatMemoryMigrationService.d__5.MoveNext() in C:\Users\crickman\source\repos\sk-chat-copilot-memory\webapi\Services\ChatMemoryMigrationService.cs:line 71 at CopilotChat.WebApi.Services.ChatMemoryMigrationService.d__5.MoveNext() in C:\Users\crickman\source\repos\sk-chat-copilot-memory\webapi\Services\ChatMemoryMigrationService.cs:line 71 at CopilotChat.WebApi.Services.ChatMigrationMiddleware.d__11.MoveNext() in C:\Users\crickman\source\repos\sk-chat-copilot-memory\webapi\Services\ChatMigrationMiddleware.cs:line 74 ``` ### Contribution Checklist - [x] The code builds clean without any errors or warnings - [x] The PR follows the [SK Contribution Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md) and the [pre-submission formatting script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts) raises no violations - [x] All unit tests pass, and I have added new tests where possible - [x] I didn't break anyone :smile: --- dotnet/Directory.Packages.props | 2 +- .../AzureCognitiveSearchMemoryStore.cs | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/dotnet/Directory.Packages.props b/dotnet/Directory.Packages.props index 2cdc4ff030da..9bbeba03310f 100644 --- a/dotnet/Directory.Packages.props +++ b/dotnet/Directory.Packages.props @@ -7,7 +7,7 @@ - + diff --git a/dotnet/src/Connectors/Connectors.Memory.AzureCognitiveSearch/AzureCognitiveSearchMemoryStore.cs b/dotnet/src/Connectors/Connectors.Memory.AzureCognitiveSearch/AzureCognitiveSearchMemoryStore.cs index 4cf0c10adcd5..18c113a45e00 100644 --- a/dotnet/src/Connectors/Connectors.Memory.AzureCognitiveSearch/AzureCognitiveSearchMemoryStore.cs +++ b/dotnet/src/Connectors/Connectors.Memory.AzureCognitiveSearch/AzureCognitiveSearchMemoryStore.cs @@ -179,11 +179,15 @@ public async IAsyncEnumerable GetBatchAsync( SearchQueryVector vectorQuery = new() { KNearestNeighborsCount = limit, - Fields = AzureCognitiveSearchMemoryRecord.EmbeddingField, + Fields = { AzureCognitiveSearchMemoryRecord.EmbeddingField }, Value = MemoryMarshal.TryGetArray(embedding, out var array) && array.Count == embedding.Length ? array.Array! : embedding.ToArray(), }; - SearchOptions options = new() { Vector = vectorQuery }; + SearchOptions options = new() + { + Vectors = { vectorQuery } + }; + Response>? searchResult = null; try {