A source-generated string value type for classifying Semantic Kernel workloads.
dotnet add package Soenneker.SemanticKernel.Enums.KernelTypeKernelType.ChatKernelType.CompletionKernelType.ImageKernelType.EmbeddingKernelType.Audio
Each underlying string value matches its member name, such as "Chat" and "Embedding".
using Soenneker.SemanticKernel.Enums.KernelType;
KernelType type = KernelType.Chat;
if (type == KernelType.Chat)
{
// Select chat-specific connector or execution behavior.
}Parse untrusted input without throwing:
if (!KernelType.TryFromValue(input, out KernelType type))
{
return Results.BadRequest("Unsupported kernel type.");
}Known values can also be retrieved with FromValue, TryFromName, and FromName. Name and value lookups are ordinal and case-sensitive.
The generated JSON converter reads and writes the underlying string:
{
"type": "Embedding"
}Unknown JSON values fail deserialization. KernelType is descriptive metadata only; assigning a value does not register a Semantic Kernel connector or enforce which operations a kernel supports. The application or pool consuming it must select the corresponding implementation.