Instantiating Semantic Kernel in multi session AI Web/API Application #6816
-
I have a question, between the 2 methods below, which should be the better way? A) For every web request, instantiate kernel, add service, plugins B) Instantiate kernel, add service and plugins once during app startup. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
The better way is to instantiate it at startup, I would say. But sometimes you are not able to do that, like with the feature I need which you can see in this discussion: Dynamic Creation of chat completion endpoints during runtime #6811 I didn't like the creation of the kernel before each call, so I created a service which handles the creation and holds the semantic kernel instance. |
Beta Was this translation helpful? Give feedback.
@jamesmkfoo23 Here is an example for your scenario for .NET version of Semantic Kernel:
skprompt.txt
Question: {{$input}}
config.json
C#: