Encamina.Enmarcha.SemanticKernel.Plugins.Memory 8.1.8-preview-03

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.8-preview-03                
NuGet\Install-Package Encamina.Enmarcha.SemanticKernel.Plugins.Memory -Version 8.1.8-preview-03                
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.8-preview-03" />                
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.8-preview-03                
#r "nuget: Encamina.Enmarcha.SemanticKernel.Plugins.Memory, 8.1.8-preview-03"                
#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.8-preview-03&prerelease

// Install Encamina.Enmarcha.SemanticKernel.Plugins.Memory as a Cake Tool
#tool nuget:?package=Encamina.Enmarcha.SemanticKernel.Plugins.Memory&version=8.1.8-preview-03&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 119 10/22/2024
8.2.0-preview-01-m01 95 9/17/2024
8.1.9-preview-02 61 10/22/2024
8.1.9-preview-01 190 10/4/2024
8.1.8 155 9/23/2024
8.1.8-preview-07 164 9/12/2024
8.1.8-preview-06 144 9/11/2024
8.1.8-preview-05 99 9/10/2024
8.1.8-preview-04 213 8/16/2024
8.1.8-preview-03 130 8/13/2024
8.1.8-preview-02 107 8/13/2024
8.1.8-preview-01 110 8/12/2024
8.1.7 108 8/7/2024
8.1.7-preview-09 127 7/3/2024
8.1.7-preview-08 92 7/2/2024
8.1.7-preview-07 88 6/10/2024
8.1.7-preview-06 89 6/10/2024
8.1.7-preview-05 117 6/6/2024
8.1.7-preview-04 95 6/6/2024
8.1.7-preview-03 94 5/24/2024
8.1.7-preview-02 99 5/10/2024
8.1.7-preview-01 94 5/8/2024
8.1.6 151 5/7/2024
8.1.6-preview-08 61 5/2/2024
8.1.6-preview-07 95 4/29/2024
8.1.6-preview-06 261 4/26/2024
8.1.6-preview-05 98 4/24/2024
8.1.6-preview-04 96 4/22/2024
8.1.6-preview-03 87 4/22/2024
8.1.6-preview-02 115 4/17/2024
8.1.6-preview-01 81 4/15/2024
8.1.5 128 4/15/2024
8.1.5-preview-15 92 4/10/2024
8.1.5-preview-14 125 3/20/2024
8.1.5-preview-13 85 3/18/2024
8.1.5-preview-12 102 3/13/2024
8.1.5-preview-11 89 3/13/2024
8.1.5-preview-10 108 3/13/2024
8.1.5-preview-09 95 3/12/2024
8.1.5-preview-08 90 3/12/2024
8.1.5-preview-07 97 3/8/2024
8.1.5-preview-06 202 3/8/2024
8.1.5-preview-05 87 3/7/2024
8.1.5-preview-04 99 3/7/2024
8.1.5-preview-03 94 3/7/2024
8.1.5-preview-02 158 2/28/2024
8.1.5-preview-01 137 2/19/2024
8.1.4 195 2/15/2024
8.1.3 135 2/13/2024
8.1.3-preview-07 87 2/13/2024
8.1.3-preview-06 106 2/12/2024
8.1.3-preview-05 96 2/9/2024
8.1.3-preview-04 86 2/8/2024
8.1.3-preview-03 94 2/7/2024
8.1.3-preview-02 92 2/2/2024
8.1.3-preview-01 86 2/2/2024
8.1.2 150 2/1/2024
8.1.2-preview-9 111 1/22/2024
8.1.2-preview-8 89 1/19/2024
8.1.2-preview-7 83 1/19/2024
8.1.2-preview-6 92 1/19/2024
8.1.2-preview-5 92 1/19/2024
8.1.2-preview-4 87 1/19/2024
8.1.2-preview-3 91 1/18/2024
8.1.2-preview-2 97 1/18/2024
8.1.2-preview-16 84 1/31/2024
8.1.2-preview-15 91 1/31/2024
8.1.2-preview-14 198 1/25/2024
8.1.2-preview-13 82 1/25/2024
8.1.2-preview-12 95 1/23/2024
8.1.2-preview-11 89 1/23/2024
8.1.2-preview-10 94 1/22/2024
8.1.2-preview-1 76 1/18/2024
8.1.1 137 1/18/2024
8.1.0 112 1/18/2024
8.0.3 169 12/29/2023
8.0.1 160 12/14/2023
8.0.0 169 12/7/2023
6.0.4.3 174 12/29/2023
6.0.4.2 180 12/20/2023
6.0.4.1 125 12/19/2023
6.0.4 196 12/4/2023
6.0.3.20 164 11/27/2023
6.0.3.19 157 11/22/2023