Nugget 18: Unit Test a Semantic Kernel Function - Would the LLM Call it?
During the past few months I have been working, at Dev-Nugget-Labs , on a AI-First application, WORKS Commons, WC. WC uses LLMs in deterministic workflows as a source of signals. The intelligence and decision making reside in the system, not in the models. But this Nugget is not about WC, nor about its deterministic workflows, or what they accomplish. This Nugget is about how to Unit Test a Semantic Kernel function. Why? Four questions: Will it cover the happy path. Would the Edge Cases be handled. Would the Plugin register with the Kernel correctly. Would the Plugin be called. The Plugin This is the Semantic Kernel Function the LLM will call based on instructions. The Unit Tests will mimic how LLMs will call the function. Note that the plugin follows the architecture Microsoft recommends for Semantic Kernel: No business logic lives in the plugin. This is what is supposed to happen: LLM → Kernel → Plugin → Service → Repository This separation ensures reusability: whether exposed via RE...