Skip to content

SemanticKernelSyringe

NexusLabs.Needlr.SemanticKernel

NexusLabs.Needlr.SemanticKernel

SemanticKernelSyringe Class

Fluent builder for configuring Semantic Kernel with Needlr plugin discovery.

public sealed record SemanticKernelSyringe : System.IEquatable<NexusLabs.Needlr.SemanticKernel.SemanticKernelSyringe>

Inheritance System.Object 🡒 SemanticKernelSyringe

Implements System.IEquatable<SemanticKernelSyringe>

Example

// Obtained from SyringeExtensionsForSemanticKernel.UsingSemanticKernel()
SemanticKernelSyringe syringe = app.Services.UsingSemanticKernel();

// Register plugins and build the kernel factory
IKernelFactory kernelFactory = syringe
    .AddSemanticKernelPluginsFromGenerated(GeneratedSemanticKernelPlugins.AllPluginTypes)
    .BuildKernelFactory();

// Create a Kernel instance from the factory
Kernel kernel = kernelFactory.CreateKernel();

Remarks

This class uses reflection to discover methods with Microsoft.SemanticKernel.KernelFunctionAttribute. For AOT/trimmed applications, consider registering kernel functions explicitly.