![]() |
VOOZH | about |
dotnet add package Encamina.Enmarcha.SemanticKernel.Plugins.Chat --version 10.0.5
NuGet\Install-Package Encamina.Enmarcha.SemanticKernel.Plugins.Chat -Version 10.0.5
<PackageReference Include="Encamina.Enmarcha.SemanticKernel.Plugins.Chat" Version="10.0.5" />
<PackageVersion Include="Encamina.Enmarcha.SemanticKernel.Plugins.Chat" Version="10.0.5" />Directory.Packages.props
<PackageReference Include="Encamina.Enmarcha.SemanticKernel.Plugins.Chat" />Project file
paket add Encamina.Enmarcha.SemanticKernel.Plugins.Chat --version 10.0.5
#r "nuget: Encamina.Enmarcha.SemanticKernel.Plugins.Chat, 10.0.5"
#:package Encamina.Enmarcha.SemanticKernel.Plugins.Chat@10.0.5
#addin nuget:?package=Encamina.Enmarcha.SemanticKernel.Plugins.Chat&version=10.0.5Install as a Cake Addin
#tool nuget:?package=Encamina.Enmarcha.SemanticKernel.Plugins.Chat&version=10.0.5Install as a Cake Tool
Chat Plugin is a project that provides Chat functionality in the form of a Semantic Kernel Plugin. It allows users to interact while chatting and asking questions to an Artificial Intelligence, usually a Large Language Model (LLM). Additionally, it stores the conversation history.
First, install NuGet. Then, install Encamina.Enmarcha.SemanticKernel.Plugins.Chat from the package manager console:
PM> Install-Package Encamina.Enmarcha.SemanticKernel.Plugins.Chat
First, install .NET CLI. Then, install Encamina.Enmarcha.SemanticKernel.Plugins.Chat from the .NET CLI:
dotnet add package Encamina.Enmarcha.SemanticKernel.Plugins.Chat
To use , 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 , which handles the import of the Plugin into Semantic Kernel. However, some previous configuration is required before importing it.
First, you need to add the , and to your project configuration. You can achieve this by using any configuration provider. The followng code is an example of how the settings should look like using the appsettings.json file:
{
// ...
"SemanticKernelOptions": {
"ChatModelName": "gpt-35-turbo", // Name (sort of a unique identifier) of the model to use for chat
"ChatModelDeploymentName": "gpt-35-turbo", // Model deployment name on the LLM (for example OpenAI) to use for chat
"EmbeddingsModelName": "text-embedding-ada-002", // Name (sort of a unique identifier) of the model to use for embeddings
"EmbeddingsModelDeploymentName": "text-embedding-ada-002", // Model deployment name on the LLM (for example OpenAI) to use for embeddings
"Endpoint": "https://your-url.openai.azure.com/", // Uri for an LLM resource (like OpenAI). This should include protocol and hostname.
"Key": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", // Key credential used to authenticate to an LLM resource
},
"ChatWithHistoryPluginOptions": {
"ChatRequestSettings": {
"MaxTokens": 1000, // Maximum number of tokens to generate in the completion
"Temperature": 0.8, // Controls the randomness of the completion. The higher the temperature, the more random the completion
"TopP": 0.5, // Controls the diversity of the completion. The higher the TopP, the more diverse the completion.
}
},
"ChatHistoryProviderOptions": {
HistoryMaxMessages": 12,
}
// ...
}
Next, in Program.cs or a similar entry point file in your project, add the following code.
// Entry point
var builder = WebApplication.CreateBuilder(new WebApplicationOptions
{
// ...
});
// ...
var tokenLengthFunction = ILengthFunctions.LengthByTokenCount;
string cosmosContainer = "cosmosDbContainer"; // You probably want to save this in the appsettings or similar
// Or others configuration providers...
builder.Configuration.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true);
// Requires Encamina.Enmarcha.SemanticKernel.Abstractions nuget
builder.Services.AddOptions<SemanticKernelOptions>().Bind(builder.Configuration.GetSection(nameof(SemanticKernelOptions)))
.ValidateDataAnnotations()
.ValidateOnStart();
builder.Services.AddOptions<ChatWithHistoryPluginOptions>().Bind(builder.Configuration.GetSection(nameof(ChatWithHistoryPluginOptions)))
.ValidateDataAnnotations()
.ValidateOnStart();
builder.Services.AddOptions<ChatHistoryProviderOptions>().Bind(builder.Configuration.GetSection(nameof(ChatHistoryProviderOptions)))
.ValidateDataAnnotations()
.ValidateOnStart();
// Requieres Encamina.Enmarcha.Data.Cosmos
builder.Services.AddCosmos(builder.Configuration);
builder.Services.AddCosmosChatHistoryProvider(cosmosContainer, tokenLengthFunction);
builder.Services.AddScoped(sp =>
{
var kernel = new KernelBuilder()
.WithAzureChatCompletionService("<YOUR DEPLOYMENT NAME>", "<YOUR AZURE ENDPOINT>", "<YOUR API KEY>")
//.WithOpenAIChatCompletionService("<YOUR MODEL ID>", "<YOUR API KEY>", "<YOUR API KEY>")
/// ...
.Build();
// ...
kernel.ImportChatWithHistoryPlugin(sp, openAIOptions, tokenLengthFunction);
return kernel;
});
Now you can inject the kernel via constructor, and the chat capabilities are already available.
public class MyClass
{
private readonly Kernel kernel;
public MyClass(Kernel kernel)
{
this.kernel = kernel;
}
public async Task TestChatAsync()
{
var contextVariables = new ContextVariables();
contextVariables.Set(PluginsInfo.ChatWithHistoryPlugin.Functions.Chat.Parameters.Ask, "What is the weather like in Madrid?");
contextVariables.Set(PluginsInfo.ChatWithHistoryPlugin.Functions.Chat.Parameters.UserId, "123456");
contextVariables.Set(PluginsInfo.ChatWithHistoryPlugin.Functions.Chat.Parameters.UserName, "John Doe");
contextVariables.Set(PluginsInfo.ChatWithHistoryPlugin.Functions.Chat.Parameters.Locale, "en");
var functionChat = kernel.Func(PluginsInfo.ChatWithHistoryPlugin.Name, PluginsInfo.ChatWithHistoryPlugin.Functions.Chat.Name);
var resultContext = await kernel.RunAsync(contextVariables, functionChat);
}
}
If you want to disable chat history, simply configure the with a value of 0.
You can also inherit from the ChatWithHistoryPlugin class and add the customizations you need.
public class MyCustomChatWithHistoryPlugin : ChatWithHistoryPlugin
{
public MyCustomChatWithHistoryPlugin(Kernel kernel, string chatModelName, Func<string, int> tokensLengthFunction, IChatHistoryProvider chatHistoryProvider, IOptionsMonitor<ChatWithHistoryPluginOptions> options)
: base(kernel, chatModelName, tokensLengthFunction, chatHistoryProvider, options)
{
}
protected override string SystemPrompt => "You are a Virtual Assistant who only talks about the weather.";
// There are more overridable methods/properties
}
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
This package is not used by any NuGet packages.
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 10.0.5 | 323 | 6/1/2026 |
| 10.0.4 | 139 | 4/8/2026 |
| 10.0.3 | 1,189 | 4/6/2026 |
| 10.0.2 | 1,805 | 12/17/2025 |
| 10.0.1 | 319 | 12/17/2025 |
| 10.0.0 | 325 | 12/16/2025 |
| 10.0.0-preview-09 | 432 | 11/19/2025 |
| 10.0.0-preview-08 | 421 | 11/18/2025 |
| 10.0.0-preview-07 | 209 | 10/22/2025 |
| 10.0.0-preview-06 | 1,042 | 10/14/2025 |
| 10.0.0-preview-05 | 223 | 10/8/2025 |
| 10.0.0-preview-04 | 209 | 10/7/2025 |
| 10.0.0-preview-03 | 345 | 9/16/2025 |
| 10.0.0-preview-02 | 343 | 9/16/2025 |
| 8.3.0 | 1,037 | 9/10/2025 |
| 8.3.0-preview-02 | 241 | 9/10/2025 |
| 8.3.0-preview-01 | 248 | 9/8/2025 |
| 8.2.1-preview-08 | 215 | 8/18/2025 |
| 8.2.1-preview-07 | 224 | 8/12/2025 |