Microsoft.KernelMemory.MemoryDb.SQLServer 0.60.240517.1

The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org. Prefix Reserved
This package has a SemVer 2.0.0 package version: 0.60.240517.1+8cc78e6.
There is a newer version of this package available.
See the version list below for details.
dotnet add package Microsoft.KernelMemory.MemoryDb.SQLServer --version 0.60.240517.1
NuGet\Install-Package Microsoft.KernelMemory.MemoryDb.SQLServer -Version 0.60.240517.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Microsoft.KernelMemory.MemoryDb.SQLServer" Version="0.60.240517.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Microsoft.KernelMemory.MemoryDb.SQLServer --version 0.60.240517.1
#r "nuget: Microsoft.KernelMemory.MemoryDb.SQLServer, 0.60.240517.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Microsoft.KernelMemory.MemoryDb.SQLServer as a Cake Addin
#addin nuget:?package=Microsoft.KernelMemory.MemoryDb.SQLServer&version=0.60.240517.1

// Install Microsoft.KernelMemory.MemoryDb.SQLServer as a Cake Tool
#tool nuget:?package=Microsoft.KernelMemory.MemoryDb.SQLServer&version=0.60.240517.1

Kernel Memory with Microsoft SQL Server

Nuget package Discord

This folder contains tests for the MS SQL Server extension for Kernel Memory.

Please note that the connector should not be confused with a NL2SQL feature, e.g. the ability to query the content of a pre-existing SQL server. If you are looking for a solution that allows to import content from a SQL server and make it searchable please see How to index data from Azure SQL in Azure AI Search

Configuration

Configuration (appsettings.json):

  // ...
    "SqlServer": {
      "ConnectionString": "...",
    }
  // ...

Setup with Kernel Memory Builder / Dependency Injection

Method 1, simple applications:

var sqlServerConfig = cfg.GetSection("Services:SqlServer").Get<SqlServerConfig>()!;
var memory = new KernelMemoryBuilder()
    .WithSqlServerMemoryDb(sqlServerConfig)
    // .WithOpenAI(openAiConfig)
    // .WithAzureOpenAITextGeneration(azureOpenAITextConfiguration)
    // .WithAzureOpenAITextEmbeddingGeneration(azureOpenAIEmbeddingConfiguration)
    // .Build();

Method 2, injecting memory into an ASP.NET app:

builder.Services.AddSingleton<IKernelMemory>(sp =>
{
    KernelMemoryBuilder kernelMemoryBuilder = new()
        .WithSqlServerMemoryDb(builder.Configuration.GetConnectionString("DefaultConnection"))
        //... 

    return kernelMemoryBuilder.Build<MemoryServerless>();
});

KM Service setup

To run Kernel Memory service with SQL Server backend:

  1. clone KM repository
  2. add KernelMemory.MemoryStorage.SqlServer nuget to Service.csproj
  3. edit the part using KernelMemoryBuilder adding the same .WithSqlServerMemoryDb(...) call mentioned in the previous paragraph, e.g.
    IKernelMemory memory = new KernelMemoryBuilder(appBuilder.Services)
    .FromAppSettings()
    .WithSqlServerMemoryDb(...)
    .Build();
    

Local tests with Docker

You can test the connector locally with Docker:

docker pull mcr.microsoft.com/mssql/server:2022-latest

docker run -it -p 1433:1433 --rm -e "MSSQL_SA_PASSWORD=00_CHANGE_ME_00" -e "ACCEPT_EULA=Y" \
    mcr.microsoft.com/mssql/server:2022-latest

...using the following connection string:

Server=tcp:127.0.0.1,1433;Initial Catalog=master;Persist Security Info=False;User ID=sa;Password=00_CHANGE_ME_00;MultipleActiveResultSets=False;TrustServerCertificate=True;Connection Timeout=30;

For more information about the SQL Server Linux container:

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Microsoft.KernelMemory.MemoryDb.SQLServer:

Package Downloads
Microsoft.KernelMemory.Core The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org.

The package contains all the core logic and extensions of Kernel Memory, to index and query any data and documents, using LLM and natural language, tracking sources and showing citations.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.61.240524.1 2,063 5/24/2024
0.61.240519.2 3,246 5/19/2024
0.60.240517.1 129 5/18/2024
0.51.240513.2 1,804 5/13/2024