-
Hey folks, in a web api what should be the lifetime of a Kernel instance with plugins and AzureChatCompletion service? Thanks a bunch! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @vslepakov, Generally, it's best to create and configure the Kernel as a singleton, reusing it across requests, to avoid the overhead of reinitializing plugins and services, provided everything is thread-safe. For per-session data like chat history, it's best to manage that state separately (for example, storing it per session) to keep user conversations isolated and maintain clean separation between global kernel state and session-specific context. |
Beta Was this translation helpful? Give feedback.
Hi @vslepakov,
Generally, it's best to create and configure the Kernel as a singleton, reusing it across requests, to avoid the overhead of reinitializing plugins and services, provided everything is thread-safe. For per-session data like chat history, it's best to manage that state separately (for example, storing it per session) to keep user conversations isolated and maintain clean separation between global kernel state and session-specific context.