microsoft / kernel-memory

RAG architecture: index and query any data using LLM and natural language, track sources, show citations, asynchronous memory patterns.
https://microsoft.github.io/kernel-memory
MIT License
1.6k stars 308 forks source link

Could not load type 'Azure.Search.Documents.Models.SearchQueryVector' #142

Closed SantanaEduardo closed 1 year ago

SantanaEduardo commented 1 year ago

When using Azure Cognitive Search as a Vector DB, the following error is thrown when querying memories:

Could not load type 'Azure.Search.Documents.Models.SearchQueryVector' from assembly 'Azure.Search.Documents, Version=11.5.0.0, Culture=neutral, PublicKeyToken=92742159e12e44c8'.

Here is the piece of code which throws the error:

var searchResult = await memoryClient.SearchAsync( query, indexName, filter, null, resultCount, cancellationToken);

I'm using the following packages and versions:

image

anthonypuppo commented 1 year ago

You'll need to update Kernel Memory to at least 0.5.231029.1-preview which has support for Azure.Search.Documents 11.5.0-beta.5. This aligns with the version used by Microsoft.SemanticKernel.Connectors.Memory.AzureCognitiveSearch.

dotnet add package Microsoft.KernelMemory.Core --version 0.5.231029.1-preview
SantanaEduardo commented 1 year ago

You'll need to update Kernel Memory to at least 0.5.231029.1-preview which has support for Azure.Search.Documents to 11.5.0-beta.5. This aligns with the version used by Microsoft.SemanticKernel.Connectors.Memory.AzureCognitiveSearch.

dotnet add package Microsoft.KernelMemory.Core --version 0.5.231029.1-preview

Thanks for your response. So Microsoft.KernelMemory.Core replaces Microsoft.SemanticMemory.Core? Is there any documentation on what changes I need to make in order to use Microsoft.KernelMemory.Core? Thank you!

anthonypuppo commented 1 year ago

Thanks for your response. So Microsoft.KernelMemory.Core replaces Microsoft.SemanticMemory.Core? Is there any documentation on what changes I need to make in order to use Microsoft.KernelMemory.Core? Thank you!

Yup, it was a branding change, see #117.

SantanaEduardo commented 1 year ago

Thanks for your response. So Microsoft.KernelMemory.Core replaces Microsoft.SemanticMemory.Core? Is there any documentation on what changes I need to make in order to use Microsoft.KernelMemory.Core? Thank you!

Yup, it was a branding change, see #117.

I have made updates in my code accordingly and it is working, however, now I'm getting the issue Could not find a property named 'tags' on type 'search.document'. Where can I find the actual index definition from used method memoryClient.SearchAsync?

anthonypuppo commented 1 year ago

How was your index initially created? If your index was created using the Semantic Kernel Azure Cognitive Search connector and you're trying to consume it from Kernel Memory there may be some compatibility issues.

KM schema: https://github.com/microsoft/kernel-memory/blob/aee57008034f12bfa16b440f4ea58a258c6f0e00/dotnet/CoreLib/MemoryStorage/AzureCognitiveSearch/AzureCognitiveSearchMemory.cs#L435

SK ACS connector schema: https://github.com/microsoft/semantic-kernel/blob/cc6dd60d83558d7e84dee9b811c13c61793ba97a/dotnet/src/Connectors/Connectors.Memory.AzureCognitiveSearch/AzureCognitiveSearchMemoryRecord.cs#L15

On first glance it looks like SK doesn't have any concept of "tags" which may be your problem. Was your index created with the schema defined in the SK connector?

SantanaEduardo commented 1 year ago

How was your index initially created? If your index was created using the Semantic Kernel Azure Cognitive Search connector and you're trying to consume it from Kernel Memory there may be some compatibility issues.

KM schema:

https://github.com/microsoft/kernel-memory/blob/aee57008034f12bfa16b440f4ea58a258c6f0e00/dotnet/CoreLib/MemoryStorage/AzureCognitiveSearch/AzureCognitiveSearchMemory.cs#L435

SK ACS connector schema: https://github.com/microsoft/semantic-kernel/blob/cc6dd60d83558d7e84dee9b811c13c61793ba97a/dotnet/src/Connectors/Connectors.Memory.AzureCognitiveSearch/AzureCognitiveSearchMemoryRecord.cs#L15

On first glance it looks like SK doesn't have any concept of "tags" which may be your problem. Was your index created with the schema defined in the SK connector?

This worked! Yes it was originally created with SK Connector schema. Just migrated to KM schema and it worked. Appreciate the help @anthonypuppo I hope some updated documentation comes out in the next couple of weeks. It's been challenging because of the lack of documentation and different versions everywhere. Thanks a lot again! Feel free to close this issue.

anthonypuppo commented 1 year ago

This worked! Yes it was originally created with SK Connector schema. Just migrated to KM schema and it worked. Appreciate the help @anthonypuppo I hope some updated documentation comes out in the next couple of weeks. It's been challenging because of the lack of documentation and different versions everywhere. Thanks a lot again! Feel free to close this issue.

@SantanaEduardo Glad you figured it out! I'm just a community member without special access to the repository, so you'll need to close the issue manually 😄.