MicrosoftDocs / semantic-kernel-docs

Semantic Kernel (SK) is a lightweight SDK enabling integration of AI Large Language Models (LLMs) with conventional programming languages.
MIT License
172 stars 100 forks source link

.Net Dependency Injection using Plugins #83

Closed KapteinBabbalas closed 5 months ago

KapteinBabbalas commented 5 months ago

Can you guys maybe add some examples in the docs on how to use dependecy injection with SK?

I have a Plugin that has some dependecies on other service to get real-time information.

This appraoch worked in the older versions of Semantic Kernel because I could register plugins by providing an instance of the plugin. I would register my plugins and all their dependencies as you would do for any service. Then I would resolve the instances and pass to the kernel.

Now I can only register a Plugin by type. The Kernel has it's own isolated service collection . This now forces me to duplicate all my dependency registrations in my normal application and then again in the kernel builder.

Is there other way and am I missing something?

The Plugin: image

I'm injecting the IKernelBuilder image