Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Chat-Copilot to Semantic Kernel Beta4 and Kernel-Memory #581

Merged
merged 12 commits into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CopilotChat.sln
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ChatCopilotIntegrationTests", "integration-tests\ChatCopilotIntegrationTests.csproj", "{0CD2CD95-536B-455F-B74A-772A455FA607}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CopilotChatShared", "shared\CopilotChatShared.csproj", "{94F12185-FAF9-43E3-B153-28A1708AC918}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebSearcher", "plugins\web-searcher\WebSearcher.csproj", "{F83C857D-3080-4DEA-B3D1-978E2BC64BFB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PluginShared", "plugins\shared\PluginShared.csproj", "{9D03913A-21FF-4D0A-9883-95C4B3D6F65A}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PluginShared", "plugins\shared\PluginShared.csproj", "{9D03913A-21FF-4D0A-9883-95C4B3D6F65A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
4 changes: 2 additions & 2 deletions memorypipeline/CopilotChatMemoryPipeline.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@

<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.4.231023.1-preview" />
<PackageReference Include="Microsoft.KernelMemory.Core" Version="0.7.231106.1-preview" />
<PackageReference Include="Microsoft.SemanticKernel" Version="1.0.0-beta4" />
</ItemGroup>

</Project>
8 changes: 4 additions & 4 deletions memorypipeline/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.SemanticMemory;
using Microsoft.SemanticMemory.Diagnostics;
using Microsoft.KernelMemory;
using Microsoft.KernelMemory.Diagnostics;

// ********************************************************
// ************** SETUP ***********************************
// ********************************************************

var builder = WebApplication.CreateBuilder();

ISemanticMemoryClient memory =
new MemoryClientBuilder(builder.Services)
IKernelMemory memory =
new KernelMemoryBuilder(builder.Services)
.FromAppSettings()
.WithCustomOcr(builder.Configuration)
.Build();
Expand Down
4 changes: 2 additions & 2 deletions memorypipeline/appsettings.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
//
// Semantic Memory configuration - https://github.com/microsoft/semantic-memory
// Kernel Memory configuration - https://github.com/microsoft/kernel-memory
// - ContentStorageType is the storage configuration for memory transfer: "AzureBlobs" or "SimpleFileStorage"
// - TextGeneratorType is the AI completion service configuration: "AzureOpenAIText" or "OpenAI"
// - ImageOcrType is the image OCR configuration: "None" or "AzureFormRecognizer" or "Tesseract"
// - DataIngestion is the configuration section for data ingestion pipelines.
// - Retrieval is the configuration section for memory retrieval.
// - Services is the configuration sections for various memory settings.
//
"SemanticMemory": {
"KernelMemory": {
"ContentStorageType": "SimpleFileStorage",
"TextGeneratorType": "AzureOpenAIText",
"ImageOcrType": "None",
Expand Down
6 changes: 5 additions & 1 deletion plugins/web-searcher/PluginEndpoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,11 @@ public async Task<HttpResponseData> WebSearch([HttpTrigger(AuthorizationLevel.Fu
return await this.CreateBadRequestResponseAsync(req, "Invalid number of results.");
}

var offset = queries.ContainsKey("Offset") ? int.Parse(queries["Offset"]) : 0;
int offset = 0;
if (queries.TryGetValue("Offset", out var offsetValue))
{
int.TryParse(offsetValue, out offset);
}

var site = queries.ContainsKey("Site") ? queries["Site"].ToString() : string.Empty;
if (string.IsNullOrWhiteSpace(site))
Expand Down
6 changes: 3 additions & 3 deletions plugins/web-searcher/local.settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"Host": {
"CORS": "*"
},
"PluginConfig": {
"BingApiKey": ""
}
"PluginConfig": {
"BingApiKey": ""
}
}
8 changes: 4 additions & 4 deletions scripts/Configure.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ $webapiProjectPath = Join-Path "$PSScriptRoot" '../webapi'

Write-Host "Setting 'APIKey' user secret for $AIService..."
if ($AIService -eq $varOpenAI) {
dotnet user-secrets set --project $webapiProjectPath SemanticMemory:Services:OpenAI:APIKey $ApiKey
dotnet user-secrets set --project $webapiProjectPath KernelMemory:Services:OpenAI:APIKey $ApiKey
if ($LASTEXITCODE -ne 0) { exit(1) }
$AIServiceOverrides = @{
OpenAI = @{
Expand All @@ -151,9 +151,9 @@ if ($AIService -eq $varOpenAI) {
};
}
else {
dotnet user-secrets set --project $webapiProjectPath SemanticMemory:Services:AzureOpenAIText:APIKey $ApiKey
dotnet user-secrets set --project $webapiProjectPath KernelMemory:Services:AzureOpenAIText:APIKey $ApiKey
if ($LASTEXITCODE -ne 0) { exit(1) }
dotnet user-secrets set --project $webapiProjectPath SemanticMemory:Services:AzureOpenAIEmbedding:APIKey $ApiKey
dotnet user-secrets set --project $webapiProjectPath KernelMemory:Services:AzureOpenAIEmbedding:APIKey $ApiKey
if ($LASTEXITCODE -ne 0) { exit(1) }
$AIServiceOverrides = @{
AzureOpenAIText = @{
Expand All @@ -180,7 +180,7 @@ $appsettingsOverrides = @{
Planner = @{
Model = $PlannerModel
};
SemanticMemory = @{
KernelMemory = @{
TextGeneratorType = $AIService;
DataIngestion = @{
EmbeddingGeneratorTypes = @($AIService)
Expand Down
8 changes: 4 additions & 4 deletions scripts/configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ WEBAPI_PROJECT_PATH="${SCRIPT_DIRECTORY}/../webapi"

echo "Setting 'APIKey' user secret for $AI_SERVICE..."
if [ "$AI_SERVICE" = "$ENV_OPEN_AI" ]; then
dotnet user-secrets set --project $WEBAPI_PROJECT_PATH SemanticMemory:Services:OpenAI:APIKey $API_KEY
dotnet user-secrets set --project $WEBAPI_PROJECT_PATH KernelMemory:Services:OpenAI:APIKey $API_KEY
if [ $? -ne 0 ]; then exit 1; fi
AISERVICE_OVERRIDES="{
\"OpenAI\":
Expand All @@ -168,9 +168,9 @@ if [ "$AI_SERVICE" = "$ENV_OPEN_AI" ]; then
}
}"
else
dotnet user-secrets set --project $WEBAPI_PROJECT_PATH SemanticMemory:Services:AzureOpenAIText:APIKey $API_KEY
dotnet user-secrets set --project $WEBAPI_PROJECT_PATH KernelMemory:Services:AzureOpenAIText:APIKey $API_KEY
if [ $? -ne 0 ]; then exit 1; fi
dotnet user-secrets set --project $WEBAPI_PROJECT_PATH SemanticMemory:Services:AzureOpenAIEmbedding:APIKey $API_KEY
dotnet user-secrets set --project $WEBAPI_PROJECT_PATH KernelMemory:Services:AzureOpenAIEmbedding:APIKey $API_KEY
if [ $? -ne 0 ]; then exit 1; fi
AISERVICE_OVERRIDES="{
\"AzureOpenAIText\": {
Expand All @@ -197,7 +197,7 @@ APPSETTINGS_OVERRIDES="{
\"Planner\": {
\"Model\": \"${PLANNER_MODEL}\"
},
\"SemanticMemory\": {
\"KernelMemory\": {
\"TextGeneratorType\": \"${AI_SERVICE}\",
\"DataIngestion\": {
\"EmbeddingGeneratorTypes\": [\"${AI_SERVICE}\"]
Expand Down
Loading