How do you use the SqliteVectorStore in Semantic Kernel?

Bao, Jeremy (Cognizant) 105 Reputation points
2025-02-26T00:25:58.3666667+00:00

I have managed to get some basic RAG working with semantic kernel in C#, by creating a VectorStoreTextSearch object based on an InMemoryVectorStoreRecordCollection inside a InMemoryVectorStore and creating a KernelPlugin using CreateWithGetTextSearchResults and adding it to kernel.Plugins.

However, I now want to do this with Sqlite.

I created and opened a connection to Sqlite with:

SqliteConnection sqliteConnection = new SqliteConnection(

new SqliteConnectionStringBuilder()

{

DataSource = "SqliteDB.db"

}.ToString()

);

sqliteConnection.Open();

This create "SqliteDB.db" at bin\Debug\net9.0 of my C# project.

I then had (as a toy example):

IVectorStore vectorStore = new SqliteVectorStore(sqliteConnection);

`IVectorStoreRecordCollection

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,317 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.