SemanticKernelSyringeExtensions
NexusLabs.Needlr.SemanticKernel¶
NexusLabs.Needlr.SemanticKernel¶
SemanticKernelSyringeExtensions Class¶
Extension methods for SemanticKernelSyringe providing fluent configuration of Semantic Kernel integration.
Inheritance System.Object 🡒 SemanticKernelSyringeExtensions
Methods¶
SemanticKernelSyringeExtensions.AddSemanticKernelPlugin<T>(this SemanticKernelSyringe) Method¶
Adds a single SemanticKernel plugin type to the syringe.
public static NexusLabs.Needlr.SemanticKernel.SemanticKernelSyringe AddSemanticKernelPlugin<T>(this NexusLabs.Needlr.SemanticKernel.SemanticKernelSyringe syringe);
Type parameters¶
T
The plugin type that contains Microsoft.SemanticKernel.KernelFunctionAttribute-marked methods.
Parameters¶
syringe SemanticKernelSyringe
The Semantic Kernel syringe to configure.
Returns¶
SemanticKernelSyringe
The configured syringe.
SemanticKernelSyringeExtensions.AddSemanticKernelPlugins(this SemanticKernelSyringe, ISemanticKernelPluginScanner, bool, bool) Method¶
Adds SemanticKernel plugins by scanning with a custom ISemanticKernelPluginScanner.
public static NexusLabs.Needlr.SemanticKernel.SemanticKernelSyringe AddSemanticKernelPlugins(this NexusLabs.Needlr.SemanticKernel.SemanticKernelSyringe syringe, NexusLabs.Needlr.SemanticKernel.ISemanticKernelPluginScanner scanner, bool includeInstancePlugins=true, bool includeStaticPlugins=true);
Parameters¶
syringe SemanticKernelSyringe
The Semantic Kernel syringe to configure.
scanner ISemanticKernelPluginScanner
The scanner that produces plugin types.
includeInstancePlugins System.Boolean
Whether to include instance-based plugins.
includeStaticPlugins System.Boolean
Whether to include static class plugins.
Returns¶
SemanticKernelSyringe
The configured syringe.
SemanticKernelSyringeExtensions.AddSemanticKernelPlugins(this SemanticKernelSyringe, IReadOnlyList<Type>, bool, bool) Method¶
Adds SemanticKernel plugins from an explicit list of plugin types.
public static NexusLabs.Needlr.SemanticKernel.SemanticKernelSyringe AddSemanticKernelPlugins(this NexusLabs.Needlr.SemanticKernel.SemanticKernelSyringe syringe, System.Collections.Generic.IReadOnlyList<System.Type> pluginTypes, bool includeInstancePlugins=true, bool includeStaticPlugins=true);
Parameters¶
syringe SemanticKernelSyringe
The Semantic Kernel syringe to configure.
pluginTypes System.Collections.Generic.IReadOnlyList<System.Type>
The plugin types to register.
includeInstancePlugins System.Boolean
Whether to include instance-based plugins.
includeStaticPlugins System.Boolean
Whether to include static class plugins.
Returns¶
SemanticKernelSyringe
The configured syringe.
SemanticKernelSyringeExtensions.AddSemanticKernelPluginsFromAssemblies(this SemanticKernelSyringe, bool, bool) Method¶
Adds SemanticKernel plugins discovered from all registered assemblies in the service provider.
public static NexusLabs.Needlr.SemanticKernel.SemanticKernelSyringe AddSemanticKernelPluginsFromAssemblies(this NexusLabs.Needlr.SemanticKernel.SemanticKernelSyringe syringe, bool includeInstancePlugins=true, bool includeStaticPlugins=true);
Parameters¶
syringe SemanticKernelSyringe
The Semantic Kernel syringe to configure.
includeInstancePlugins System.Boolean
Whether to include instance-based plugins.
includeStaticPlugins System.Boolean
Whether to include static class plugins.
Returns¶
SemanticKernelSyringe
The configured syringe.
SemanticKernelSyringeExtensions.AddSemanticKernelPluginsFromAssemblies(this SemanticKernelSyringe, IReadOnlyList<Assembly>, bool, bool) Method¶
Adds SemanticKernel plugins discovered from a specific list of assemblies.
public static NexusLabs.Needlr.SemanticKernel.SemanticKernelSyringe AddSemanticKernelPluginsFromAssemblies(this NexusLabs.Needlr.SemanticKernel.SemanticKernelSyringe syringe, System.Collections.Generic.IReadOnlyList<System.Reflection.Assembly> asssemblies, bool includeInstancePlugins=true, bool includeStaticPlugins=true);
Parameters¶
syringe SemanticKernelSyringe
The Semantic Kernel syringe to configure.
asssemblies System.Collections.Generic.IReadOnlyList<System.Reflection.Assembly>
The assemblies to scan for plugin types.
includeInstancePlugins System.Boolean
Whether to include instance-based plugins.
includeStaticPlugins System.Boolean
Whether to include static class plugins.
Returns¶
SemanticKernelSyringe
The configured syringe.
SemanticKernelSyringeExtensions.AddSemanticKernelPluginsFromGenerated(this SemanticKernelSyringe, IReadOnlyList<Type>) Method¶
Adds SemanticKernel plugins from a pre-discovered list of types. This is the recommended approach for AOT/trimmed applications.
public static NexusLabs.Needlr.SemanticKernel.SemanticKernelSyringe AddSemanticKernelPluginsFromGenerated(this NexusLabs.Needlr.SemanticKernel.SemanticKernelSyringe syringe, System.Collections.Generic.IReadOnlyList<System.Type> pluginTypes);
Parameters¶
syringe SemanticKernelSyringe
The SemanticKernel syringe to configure.
pluginTypes System.Collections.Generic.IReadOnlyList<System.Type>
Pre-discovered plugin types, typically from the generated
NexusLabs.Needlr.Generated.SemanticKernelPlugins.AllPluginTypes.
Returns¶
SemanticKernelSyringe
The configured syringe.
Remarks¶
Example usage with source-generated types:
syringe.AddSemanticKernelPluginsFromGenerated(
NexusLabs.Needlr.Generated.SemanticKernelPlugins.AllPluginTypes);
SemanticKernelSyringeExtensions.AddSemanticKernelPluginsFromProvider(this SemanticKernelSyringe) Method¶
Adds SemanticKernel plugins discovered by scanning all services registered in the service provider.
public static NexusLabs.Needlr.SemanticKernel.SemanticKernelSyringe AddSemanticKernelPluginsFromProvider(this NexusLabs.Needlr.SemanticKernel.SemanticKernelSyringe syringe);
Parameters¶
syringe SemanticKernelSyringe
The Semantic Kernel syringe to configure.
Returns¶
SemanticKernelSyringe
The configured syringe.
SemanticKernelSyringeExtensions.AddSemanticKernelPluginsFromScanner(this SemanticKernelSyringe, ISemanticKernelPluginScanner, bool, bool) Method¶
Adds SemanticKernel plugins from a custom scanner.
public static NexusLabs.Needlr.SemanticKernel.SemanticKernelSyringe AddSemanticKernelPluginsFromScanner(this NexusLabs.Needlr.SemanticKernel.SemanticKernelSyringe syringe, NexusLabs.Needlr.SemanticKernel.ISemanticKernelPluginScanner scanner, bool includeInstancePlugins=true, bool includeStaticPlugins=true);
Parameters¶
syringe SemanticKernelSyringe
The SemanticKernel syringe to configure.
scanner ISemanticKernelPluginScanner
The scanner to use for plugin discovery.
includeInstancePlugins System.Boolean
Whether to include instance plugins.
includeStaticPlugins System.Boolean
Whether to include static plugins.
Returns¶
SemanticKernelSyringe
The configured syringe.
SemanticKernelSyringeExtensions.Configure(this SemanticKernelSyringe, Action<KernelFactoryOptions>) Method¶
Registers a callback to further configure KernelFactoryOptions when the kernel factory is built.
public static NexusLabs.Needlr.SemanticKernel.SemanticKernelSyringe Configure(this NexusLabs.Needlr.SemanticKernel.SemanticKernelSyringe syringe, System.Action<NexusLabs.Needlr.SemanticKernel.KernelFactoryOptions> configure);
Parameters¶
syringe SemanticKernelSyringe
The Semantic Kernel syringe to configure.
configure System.Action<KernelFactoryOptions>
The configuration callback to apply.
Returns¶
SemanticKernelSyringe
The configured syringe.