MicrosoftDocs / semantic-kernel-docs

Semantic Kernel (SK) is a lightweight SDK enabling integration of AI Large Language Models (LLMs) with conventional programming languages.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

.Net Dependency Injection using Plugins

KapteinBabbalas opened this issue · comments

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