From 7bee6e1a9b9b05d71b45883efe4f839365fc3165 Mon Sep 17 00:00:00 2001
From: Chris <66376200+crickman@users.noreply.github.com>
Date: Thu, 26 Oct 2023 09:30:31 -0700
Subject: [PATCH] Update to "final" semantic-memory package (#546)

### Motivation and Context
1. Semantic-Memory is being renamed and repackage.
1. Semantic-Kernel is also going through march to release (currently
beta3)
1. CC and SM both have dependency on SK.
1. Ideally CC and SM should update to the same SK beta (SM first and
then CC)
1. This is the final available update of SM for CC prior to any SK beta
update and includes functional and stabilization updates

### Contribution Checklist

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

- [x] The code builds clean without any errors or warnings
- [x] The PR follows the [Contribution
Guidelines](https://github.com/microsoft/chat-copilot/blob/main/CONTRIBUTING.md)
and the [pre-submission formatting
script](https://github.com/microsoft/chat-copilot/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:
---
 .gitignore                                           |  4 +---
 memorypipeline/CopilotChatMemoryPipeline.csproj      |  2 +-
 memorypipeline/appsettings.json                      | 10 +++++-----
 shared/CopilotChatShared.csproj                      |  2 +-
 webapi/CopilotChatWebApi.csproj                      |  2 +-
 webapi/Extensions/ISemanticMemoryClientExtensions.cs |  1 +
 webapi/appsettings.json                              | 10 +++++-----
 7 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/.gitignore b/.gitignore
index d658427a8..a06144dcb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -493,9 +493,7 @@ webapi/CopilotChatWebApi.sln
 *.traineddata
 
 # Semantic Memory local storage
-tmp-cache
-tmp-database
-tmp-queues
+tmp/*
 
 # Custom plugins in default directories
 */Skills/NativePlugins
diff --git a/memorypipeline/CopilotChatMemoryPipeline.csproj b/memorypipeline/CopilotChatMemoryPipeline.csproj
index 317449a8b..3b68a3db6 100644
--- a/memorypipeline/CopilotChatMemoryPipeline.csproj
+++ b/memorypipeline/CopilotChatMemoryPipeline.csproj
@@ -16,7 +16,7 @@
   <ItemGroup>
     <PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.21.0" />
     <PackageReference Include="Microsoft.SemanticKernel" Version="0.24.230918.1-preview" />
-    <PackageReference Include="Microsoft.SemanticMemory.Core" Version="0.2.230919.2-preview" />
+    <PackageReference Include="Microsoft.SemanticMemory.Core" Version="0.4.231023.1-preview" />
   </ItemGroup>
 
 </Project>
diff --git a/memorypipeline/appsettings.json b/memorypipeline/appsettings.json
index 4f14c9ef0..f189cd479 100644
--- a/memorypipeline/appsettings.json
+++ b/memorypipeline/appsettings.json
@@ -57,23 +57,23 @@
       // - Directory is the location where files are stored.
       //
       "SimpleFileStorage": {
-        "Directory": "../webapi/tmp-cache"
+        "Directory": "../tmp/cache"
       },
       //
       // File based queue for local/development use.
       // - Directory is the location where messages are stored.
       //
       "SimpleQueues": {
-        "Directory": "../webapi/tmp-queues"
+        "Directory": "../tmp/queues"
       },
       //
       // File based vector database for local/development use.
-      // - StorageType is the storage configuration: "TextFile" or "Volatile"
+      // - StorageType is the storage configuration: "Disk" or "Volatile"
       // - Directory is the location where data is stored.
       //
       "SimpleVectorDb": {
-        "StorageType": "TextFile",
-        "Directory": "../webapi/tmp-database"
+        "StorageType": "Disk",
+        "Directory": "../tmp/database"
       },
       //
       // Azure blob storage for the memory pipeline
diff --git a/shared/CopilotChatShared.csproj b/shared/CopilotChatShared.csproj
index e210634fb..55699e9c3 100644
--- a/shared/CopilotChatShared.csproj
+++ b/shared/CopilotChatShared.csproj
@@ -9,7 +9,7 @@
   </PropertyGroup>
 
   <ItemGroup>
-    <PackageReference Include="Microsoft.SemanticMemory.Core" Version="0.2.230919.2-preview" />
+    <PackageReference Include="Microsoft.SemanticMemory.Core" Version="0.4.231023.1-preview" />
     <PackageReference Include="Tesseract" Version="5.2.0" />
   </ItemGroup>
 
diff --git a/webapi/CopilotChatWebApi.csproj b/webapi/CopilotChatWebApi.csproj
index b14b28cdd..f0e375e37 100644
--- a/webapi/CopilotChatWebApi.csproj
+++ b/webapi/CopilotChatWebApi.csproj
@@ -29,7 +29,7 @@
     <PackageReference Include="Microsoft.SemanticKernel.Skills.MsGraph" Version="0.24.230918.1-preview" />
     <PackageReference Include="Microsoft.SemanticKernel.Skills.OpenAPI" Version="0.24.230918.1-preview" />
     <PackageReference Include="Microsoft.SemanticKernel.Skills.Web" Version="0.24.230918.1-preview" />
-    <PackageReference Include="Microsoft.SemanticMemory.Core" Version="0.2.230919.2-preview" />
+    <PackageReference Include="Microsoft.SemanticMemory.Core" Version="0.4.231023.1-preview" />
     <PackageReference Include="SharpToken" Version="1.2.12" />
     <PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
   </ItemGroup>
diff --git a/webapi/Extensions/ISemanticMemoryClientExtensions.cs b/webapi/Extensions/ISemanticMemoryClientExtensions.cs
index e301497e2..1b7e008d2 100644
--- a/webapi/Extensions/ISemanticMemoryClientExtensions.cs
+++ b/webapi/Extensions/ISemanticMemoryClientExtensions.cs
@@ -98,6 +98,7 @@ await memoryClient.SearchAsync(
                 query,
                 indexName,
                 filter,
+                null,
                 resultCount,
                 cancellationToken);
 
diff --git a/webapi/appsettings.json b/webapi/appsettings.json
index 578a51405..416e4b409 100644
--- a/webapi/appsettings.json
+++ b/webapi/appsettings.json
@@ -252,23 +252,23 @@
       // - Directory is the location where files are stored.
       //
       "SimpleFileStorage": {
-        "Directory": "./tmp-cache"
+        "Directory": "../tmp/cache"
       },
       //
       // File based queue for local/development use.
       // - Directory is the location where messages are stored.
       //
       "SimpleQueues": {
-        "Directory": "./tmp-queues"
+        "Directory": "../tmp/queues"
       },
       //
       // File based vector database for local/development use.
-      // - StorageType is the storage configuration: "TextFile" or "Volatile"
+      // - StorageType is the storage configuration: "Disk" or "Volatile"
       // - Directory is the location where data is stored.
       //
       "SimpleVectorDb": {
-        "StorageType": "TextFile",
-        "Directory": "./tmp-database"
+        "StorageType": "Disk",
+        "Directory": "../tmp/database"
       },
       //
       // Azure blob storage for the memory pipeline