Skip to content

Commit

Permalink
.Net: Update Azure.Search.Documents.nupkg to version 11.5.0-beta.4 (#…
Browse files Browse the repository at this point in the history
…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

<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->
```
Method not found: 'Void Azure.Search.Documents.Models.SearchQueryVector.set_Fields(System.String)'.
   at Microsoft.SemanticKernel.Connectors.Memory.AzureCognitiveSearch.AzureCognitiveSearchMemoryStore.<GetNearestMatchesAsync>d__11.MoveNext()
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
   at Microsoft.SemanticKernel.Connectors.Memory.AzureCognitiveSearch.AzureCognitiveSearchMemoryStore.<GetNearestMatchesAsync>d__11.System.IAsyncDisposable.DisposeAsync()
   at System.Runtime.CompilerServices.ConfiguredCancelableAsyncEnumerable`1.Enumerator.DisposeAsync()
   at Microsoft.SemanticKernel.Memory.SemanticTextMemory.<SearchAsync>d__7.MoveNext()
   at Microsoft.SemanticKernel.Memory.SemanticTextMemory.<SearchAsync>d__7.System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult(Int16 token)
   at System.Collections.Generic.AsyncEnumerableHelpers.<ToArrayWithLength>d__1`1.MoveNext()
   at System.Collections.Generic.AsyncEnumerableHelpers.<ToArrayWithLength>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.<ToArray>d__0`1.MoveNext()
   at System.Threading.Tasks.ValueTask`1.get_Result()
   at CopilotChat.WebApi.Services.ChatMemoryMigrationService.<>c__DisplayClass5_0.<<MigrateAsync>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.<<MigrateAsync>g__QueryMemoriesAsync|0>d.System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult(Int16 token)
   at CopilotChat.WebApi.Services.ChatMemoryMigrationService.<MigrateAsync>d__5.MoveNext() in C:\Users\crickman\source\repos\sk-chat-copilot-memory\webapi\Services\ChatMemoryMigrationService.cs:line 71
   at CopilotChat.WebApi.Services.ChatMemoryMigrationService.<MigrateAsync>d__5.MoveNext() in C:\Users\crickman\source\repos\sk-chat-copilot-memory\webapi\Services\ChatMemoryMigrationService.cs:line 71
   at CopilotChat.WebApi.Services.ChatMigrationMiddleware.<Invoke>d__11.MoveNext() in C:\Users\crickman\source\repos\sk-chat-copilot-memory\webapi\Services\ChatMigrationMiddleware.cs:line 74
```
### Contribution Checklist

<!-- Before submitting this PR, please make sure: -->

- [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 😄
  • Loading branch information
crickman authored Sep 6, 2023
1 parent 782b46e commit 16d3004
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dotnet/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<ItemGroup>
<PackageVersion Include="Azure.AI.OpenAI" Version="1.0.0-beta.7" />
<PackageVersion Include="Azure.Identity" Version="1.10.0" />
<PackageVersion Include="Azure.Search.Documents" Version="11.5.0-beta.3" />
<PackageVersion Include="Azure.Search.Documents" Version="11.5.0-beta.4" />
<PackageVersion Include="Microsoft.ApplicationInsights.WorkerService" Version="2.21.0" />
<PackageVersion Include="Microsoft.Azure.Kusto.Data" Version="11.3.3" />
<PackageVersion Include="Microsoft.Bcl.HashCode" Version="[1.1.0, )" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,15 @@ public async IAsyncEnumerable<MemoryRecord> 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<SearchResults<AzureCognitiveSearchMemoryRecord>>? searchResult = null;
try
{
Expand Down

0 comments on commit 16d3004

Please sign in to comment.