Encamina.Enmarcha.SemanticKernel.Plugins.Memory 8.1.6-preview-06

This is a prerelease version of Encamina.Enmarcha.SemanticKernel.Plugins.Memory.
There is a newer version of this package available.
See the version list below for details.
dotnet add package Encamina.Enmarcha.SemanticKernel.Plugins.Memory --version 8.1.6-preview-06                
NuGet\Install-Package Encamina.Enmarcha.SemanticKernel.Plugins.Memory -Version 8.1.6-preview-06                
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="Encamina.Enmarcha.SemanticKernel.Plugins.Memory" Version="8.1.6-preview-06" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Encamina.Enmarcha.SemanticKernel.Plugins.Memory --version 8.1.6-preview-06                
#r "nuget: Encamina.Enmarcha.SemanticKernel.Plugins.Memory, 8.1.6-preview-06"                
#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 Encamina.Enmarcha.SemanticKernel.Plugins.Memory as a Cake Addin
#addin nuget:?package=Encamina.Enmarcha.SemanticKernel.Plugins.Memory&version=8.1.6-preview-06&prerelease

// Install Encamina.Enmarcha.SemanticKernel.Plugins.Memory as a Cake Tool
#tool nuget:?package=Encamina.Enmarcha.SemanticKernel.Plugins.Memory&version=8.1.6-preview-06&prerelease                

Semantic Kernel - Memory Plugin

Nuget package

Memory Plugin is a project that offers functionality as a plugin for searching the memory of the Semantic Kernel. When text is stored in memory within the Semantic Kernel, it is saved in the form of embeddings that can be queried through the Memory Plugin.

Setup

Nuget package

First, install NuGet. Then, install Encamina.Enmarcha.SemanticKernel.Plugins.Memory from the package manager console:

PM> Install-Package Encamina.Enmarcha.SemanticKernel.Plugins.Memory

.NET CLI:

First, install .NET CLI. Then, install Encamina.Enmarcha.SemanticKernel.Plugins.Memory from the .NET CLI:

dotnet add package Encamina.Enmarcha.SemanticKernel.Plugins.Memory

How to use

To use MemoryQueryPlugin, the usual approach is to import it as a plugin within Semantic Kernel. The simplest way to do this is by using the extension method ImportMemoryPlugin, which handles the import of the Plugin into Semantic Kernel.

// Entry point
var builder = WebApplication.CreateBuilder(new WebApplicationOptions
{
   // ...
});

// ... 

builder.Services.AddScoped(sp =>
{
      var kernel = new KernelBuilder()
        .WithAzureTextEmbeddingGenerationService("<YOUR DEPLOYMENT NAME>", "<YOUR AZURE ENDPOINT>", "<YOUR API KEY>")
        //.WithOpenAITextEmbeddingGenerationService("<YOUR MODEL ID>", "<YOUR API KEY>")
        /// ...
        .Build();

    // ...

    kernel.ImportMemoryPlugin(ILengthFunctions.LengthByTokenCount);

    return kernel;
});

Now you can inject the kernel via constructor, and the memory capabilities are already available.

public class MyClass
{
    private readonly Kernel kernel;

    public MyClass(Kernel kernel)
    {
        this.kernel = kernel;
    }

    public async Task TestMemoryQueryAsync()
    {
        var contextVariables = new ContextVariables();
        contextVariables.Set(PluginsInfo.MemoryQueryPlugin.Functions.QueryMemory.Parameters.Query, "What is the weather like in Madrid?");
        contextVariables.Set(PluginsInfo.MemoryQueryPlugin.Functions.QueryMemory.Parameters.CollectionsStr, "collection-1:collection-2");
        contextVariables.Set(PluginsInfo.MemoryQueryPlugin.Functions.QueryMemory.Parameters.CollectionSeparator, ":");
        contextVariables.Set(PluginsInfo.MemoryQueryPlugin.Functions.QueryMemory.Parameters.MinRelevance, "0.8");
        contextVariables.Set(PluginsInfo.MemoryQueryPlugin.Functions.QueryMemory.Parameters.ResponseTokenLimit, "1500");
        contextVariables.Set(PluginsInfo.MemoryQueryPlugin.Functions.QueryMemory.Parameters.ResultsLimit, "2");

        var functionMemoryQuery = kernel.Func(PluginsInfo.MemoryQueryPlugin.Name, PluginsInfo.MemoryQueryPlugin.Functions.QueryMemory.Name);

        var resultContext = await kernel.RunAsync(contextVariables, functionMemoryQuery);
    }
}

Within resultContext, you will find texts that meet the conditions.

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 Encamina.Enmarcha.SemanticKernel.Plugins.Memory:

Package Downloads
Encamina.Enmarcha.SemanticKernel.Plugins.QuestionAnswering

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
8.2.0 157 10/22/2024
8.2.0-preview-01-m01 98 9/17/2024
8.1.9-preview-03 63 11/19/2024
8.1.9-preview-02 62 10/22/2024
8.1.9-preview-01 197 10/4/2024
8.1.8 160 9/23/2024
8.1.8-preview-07 254 9/12/2024
8.1.8-preview-06 145 9/11/2024
8.1.8-preview-05 100 9/10/2024
8.1.8-preview-04 214 8/16/2024
8.1.8-preview-03 131 8/13/2024
8.1.8-preview-02 108 8/13/2024
8.1.8-preview-01 111 8/12/2024
8.1.7 111 8/7/2024
8.1.7-preview-09 128 7/3/2024
8.1.7-preview-08 93 7/2/2024
8.1.7-preview-07 89 6/10/2024
8.1.7-preview-06 90 6/10/2024
8.1.7-preview-05 118 6/6/2024
8.1.7-preview-04 96 6/6/2024
8.1.7-preview-03 97 5/24/2024
8.1.7-preview-02 100 5/10/2024
8.1.7-preview-01 95 5/8/2024
8.1.6 154 5/7/2024
8.1.6-preview-08 62 5/2/2024
8.1.6-preview-07 96 4/29/2024
8.1.6-preview-06 262 4/26/2024
8.1.6-preview-05 99 4/24/2024
8.1.6-preview-04 97 4/22/2024
8.1.6-preview-03 88 4/22/2024
8.1.6-preview-02 116 4/17/2024
8.1.6-preview-01 82 4/15/2024
8.1.5 131 4/15/2024
8.1.5-preview-15 93 4/10/2024
8.1.5-preview-14 126 3/20/2024
8.1.5-preview-13 86 3/18/2024
8.1.5-preview-12 103 3/13/2024
8.1.5-preview-11 90 3/13/2024
8.1.5-preview-10 109 3/13/2024
8.1.5-preview-09 96 3/12/2024
8.1.5-preview-08 91 3/12/2024
8.1.5-preview-07 98 3/8/2024
8.1.5-preview-06 205 3/8/2024
8.1.5-preview-05 88 3/7/2024
8.1.5-preview-04 100 3/7/2024
8.1.5-preview-03 95 3/7/2024
8.1.5-preview-02 159 2/28/2024
8.1.5-preview-01 138 2/19/2024
8.1.4 200 2/15/2024
8.1.3 139 2/13/2024
8.1.3-preview-07 88 2/13/2024
8.1.3-preview-06 107 2/12/2024
8.1.3-preview-05 97 2/9/2024
8.1.3-preview-04 87 2/8/2024
8.1.3-preview-03 95 2/7/2024
8.1.3-preview-02 93 2/2/2024
8.1.3-preview-01 87 2/2/2024
8.1.2 153 2/1/2024
8.1.2-preview-9 112 1/22/2024
8.1.2-preview-8 90 1/19/2024
8.1.2-preview-7 84 1/19/2024
8.1.2-preview-6 93 1/19/2024
8.1.2-preview-5 93 1/19/2024
8.1.2-preview-4 88 1/19/2024
8.1.2-preview-3 92 1/18/2024
8.1.2-preview-2 98 1/18/2024
8.1.2-preview-16 85 1/31/2024
8.1.2-preview-15 92 1/31/2024
8.1.2-preview-14 199 1/25/2024
8.1.2-preview-13 83 1/25/2024
8.1.2-preview-12 96 1/23/2024
8.1.2-preview-11 90 1/23/2024
8.1.2-preview-10 95 1/22/2024
8.1.2-preview-1 77 1/18/2024
8.1.1 140 1/18/2024
8.1.0 115 1/18/2024
8.0.3 172 12/29/2023
8.0.1 163 12/14/2023
8.0.0 172 12/7/2023
6.0.4.3 177 12/29/2023
6.0.4.2 183 12/20/2023
6.0.4.1 128 12/19/2023
6.0.4 199 12/4/2023
6.0.3.20 167 11/27/2023
6.0.3.19 160 11/22/2023