Data persistence
AI Toolbox provides for data persistence out of the box a SimpleDataStorage
and a SimpleMemoryStore
class. These classes can store data volatile (memory) or persistent (text file). This allows you to get started with AI Toolbox (and Semantic Kernel) in no time, without having setup a data storage solution first.
Data storage
For data storage AI Toolbox provides an IDataStorage
interface. The interface is used by the PersistentChatAgentService
to store all chat related data. For more information please check the AIToolbox.Agents.ChatCompletion
namespace reference.
Note
For data storage currently only SimpleDataStorage
implementation is available. It is planned to provide an EF Core connector, so the data can be stored on a solution of your choice.
services
.AddAIToolbox()
.AddConnectors()
.IncludeOllamaConnector(options => ...)
.AddKernel(options => ...)
.AddAgents()
.IncludeChatCompletionAgent()
.WithSimpleDataStorage(options =>
{
options.StorageType = StorageType.Persistent;
options.Directory = "tmp-data";
});
Memory store
For the Semantic Kernel IMemoryStore
interface AI Toolbox provides the SimpleMemoryStore
implementation. For other available memory store connectors please check the NuGet package overview.
services
.AddAIToolbox()
.AddConnectors()
.IncludeOllamaConnector(options => ...)
.AddKernel(options => ...)
.AddMemory(options => ...)
.IncludeSimpleMemoryStore(options => options.StorageType = StorageType.Persistent)
.AddAgents()
.IncludeChatCompletionAgent(options =>
{
options.StorageType = StorageType.Persistent;
options.Directory = "tmp-sk-memory";
})
.WithSemanticTextMemoryRetriever()
.WithSimpleDataStorage(options => ...);