IntelligentPlant.IndustrialAppStore.SemanticKernel
3.4.1
dotnet add package IntelligentPlant.IndustrialAppStore.SemanticKernel --version 3.4.1
NuGet\Install-Package IntelligentPlant.IndustrialAppStore.SemanticKernel -Version 3.4.1
<PackageReference Include="IntelligentPlant.IndustrialAppStore.SemanticKernel" Version="3.4.1" />
<PackageVersion Include="IntelligentPlant.IndustrialAppStore.SemanticKernel" Version="3.4.1" />
<PackageReference Include="IntelligentPlant.IndustrialAppStore.SemanticKernel" />
paket add IntelligentPlant.IndustrialAppStore.SemanticKernel --version 3.4.1
#r "nuget: IntelligentPlant.IndustrialAppStore.SemanticKernel, 3.4.1"
#addin nuget:?package=IntelligentPlant.IndustrialAppStore.SemanticKernel&version=3.4.1
#tool nuget:?package=IntelligentPlant.IndustrialAppStore.SemanticKernel&version=3.4.1
IntelligentPlant.IndustrialAppStore.SemanticKernel
This package contains extensions for the .NET version of Semantic Kernel to allow tool-trained AI models to query the Industrial App Store.
[!WARNING] This package is experimental and is intended for building proof of concept AI applications. Features may change or be removed in future releases.
Getting Started
You can register core Semantic Kernel services via the IIndustrialAppStoreBuilder
type:
// You must explicitly suppress the experimental warning to acknowledge
// that you understand the limits of using this package.
#pragma warning disable IASSK0001
builder.Services.AddIndustrialAppStoreApiServices()
.AddSemanticKernelServices();
This will register a scoped Kernel
service that can be used to interact with AI pipelines. The kernel is pre-configured with plugins that allow AI tools such as tool-trained large language models (LLMs) to query the Industrial App Store Data API.
[!NOTE] You must register Semantic Kernel AI services such as
IChatCompletionService
yourself. This package does not include any specific AI services, as the choice of AI service is dependent on your application and the models you wish to use.
Using a Chat Service
Refer to the Microsoft documentation about how to register a chat service with the Semantic Kernel.
Once you have registered your chat service and have configured the Industrial App Store API services so that the client can obtain a valid access token, you can use your Kernel
service to start a chat session. For example:
var kernel = scope.ServiceProvider.GetRequiredService<Kernel>();
var chatCompletionService = kernel.GetRequiredService<IChatCompletionService>();
#pragma warning disable IASSK0001
// Create a new chat history and add a system prompt that helps the AI
// understand how to use the Industrial App Store plugins.
var chatHistory = new ChatHistory()
.AddIndustrialAppStoreSystemPrompt();
chatHistory.AddUserMessage("List my Industrial App Store data sources.");
var response = chatCompletionService.GetStreamingChatMessageContentsAsync(
chatHistory: chatHistory,
kernel: kernel,
cancellationToken: cancellationToken);
await foreach (var chunk in response) {
Console.Write(chunk.Content ?? Environment.NewLine);
}
Managing Chat History
When you use a ChatHistory
object with an IChatCompletionService
it is your responsibility to add the messages returned by the assistant to the history, so that they can be included in the context for subsequent requests. You must also ensure that the context does not grow too large. Semantic Kernel provides services that can perform chat history reduction to truncate or summarise earlier messages in the chat history to ensure that the context remains manageable.
Working with Reasoning Models
Tool-trained reasoning models such as QwQ are capable of planning and executing a sequence of steps to achieve a goal. For example, you can ask the model questions such as "What is the current temperature of Sensor-1 on my Edge Historian?" and it will use multiple tool calls to retrieve available data sources, find the correct tag name, and then request the current value of the tag.
[!TIP] When maintaining a
ChatHistory
when working with a reasoning model, you usually need to filter out the part of the response that contains the reasoning steps to ensure that the context for subsequent messages does not become unnecessarily large. Identifying reasoning steps may vary depending on the model that you are using. In the case of QwQ, the reasoning steps are usually encloded in<think>...</think>
tags, so any part of the response inside these tags should be removed prior to adding the assistant response to theChatHistory
.
Additional Notes
When registering Industrial App Store-related services, most services are registered with a scoped lifetime (for example, to allow the IAS API client to use an access token associated with the calling user in an ASP.NET Core application). As a result, some of the Semantic Kernel-related services registered by this package (including the Kernel
service itself) are also registered with a scoped lifetime.
When using the Kernel
service, ensure that you create a new scope for the session if one has not already been created. This is typically only required in non-ASP.NET Core applications, such as console applications or background services.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- IntelligentPlant.IndustrialAppStore.DependencyInjection (>= 3.4.1)
- Microsoft.Bcl.TimeProvider (>= 8.0.1)
- Microsoft.SemanticKernel.Core (>= 1.45.0)
-
net8.0
- IntelligentPlant.IndustrialAppStore.DependencyInjection (>= 3.4.1)
- Microsoft.Bcl.TimeProvider (>= 8.0.1)
- Microsoft.SemanticKernel.Core (>= 1.45.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.