diff --git a/SqlDatabaseVectorSearch/Components/Pages/Home.razor b/SqlDatabaseVectorSearch/Components/Pages/Home.razor index f7336c8..571e0c4 100644 --- a/SqlDatabaseVectorSearch/Components/Pages/Home.razor +++ b/SqlDatabaseVectorSearch/Components/Pages/Home.razor @@ -1,39 +1,19 @@ @page "/" @rendermode @(new InteractiveServerRenderMode(prerender: false)) -@inject IWebHostEnvironment WebHostEnvironment - SQL Database Vector Search -@if (markdown is null) -{ -
- -
-} -else -{ -
-
- @markdown -
-
-} +

SQL Database Vector Search

+

+ How to use the native VECTOR type in Azure SQL Database to perform embeddings and RAG with Azure OpenAI. +

+

+ This application allows to load documents, generate embeddings and save them into the database as Vectors, and perform searches using Vector Search and RAG. Currently, PDF, DOCX, TXT and MD files are supported. Vectors are saved and retrieved with Entity Framework Core using the EFCore.SqlServer.VectorSearch library. Embedding and Chat Completion are integrated with Semantic Kernel. +

-@code -{ - private string markdown = default!; - - protected override async Task OnAfterRenderAsync(bool firstRender) - { - if (!firstRender) - { - return; - } - - var filePath = Path.Combine(WebHostEnvironment.WebRootPath, "docs.md"); - markdown = await File.ReadAllTextAsync(filePath); - - StateHasChanged(); - } -} \ No newline at end of file +

Supported features

+ diff --git a/SqlDatabaseVectorSearch/SqlDatabaseVectorSearch.csproj b/SqlDatabaseVectorSearch/SqlDatabaseVectorSearch.csproj index 4658723..a5b04db 100644 --- a/SqlDatabaseVectorSearch/SqlDatabaseVectorSearch.csproj +++ b/SqlDatabaseVectorSearch/SqlDatabaseVectorSearch.csproj @@ -20,10 +20,10 @@ - - - - + + + + diff --git a/SqlDatabaseVectorSearch/wwwroot/docs.md b/SqlDatabaseVectorSearch/wwwroot/docs.md deleted file mode 100644 index d67a11a..0000000 --- a/SqlDatabaseVectorSearch/wwwroot/docs.md +++ /dev/null @@ -1,15 +0,0 @@ -# SQL Database Vector Search - -## Setup - -- [Create an Azure SQL Database](https://learn.microsoft.com/en-us/azure/azure-sql/database/single-database-create-quickstart) -- Open the [appsettings.json](https://github.com/marcominerva/SqlDatabaseVectorSearch/blob/master/SqlDatabaseVectorSearch/appsettings.json) file and set the connection string to the database and the other settings required by Azure OpenAI - - If your embedding model supports shortening, like **text-embedding-3-small** and **text-embedding-3-large**, and you want to use this feature, you need to set the [`Dimensions`](https://github.com/marcominerva/SqlDatabaseVectorSearch/blob/master/SqlDatabaseVectorSearch/appsettings.json#L17) property to the corresponding value. If your model doesn't provide this feature, or do you want to use the default size, just leave the [`Dimensions`](https://github.com/marcominerva/SqlDatabaseVectorSearch/blob/master/SqlDatabaseVectorSearch/appsettings.json#L17) property to NULL. Keep in mind that **text-embedding-3-small** has a dimension of 1536, while **text-embedding-3-large** uses vectors with 3072 elements, so with this latter model it is mandatory to specify a value (that, as said, must be less or equal to 1998). -- You may need to update the size of the [`VECTOR`](https://github.com/marcominerva/SqlDatabaseVectorSearch/blob/master/SqlDatabaseVectorSearch/DataAccessLayer/ApplicationDbContext.cs?plain=1#L42C1-L42C47) column to match the size of the embedding model. The default value is 1536. Currently, the maximum allowed value is 1998. If you change it, remember to update also the [Database Migration](https://github.com/marcominerva/SqlDatabaseVectorSearch/blob/master/SqlDatabaseVectorSearch/DataAccessLayer/Migrations/00000000000000_Initial.cs?plain=1#L35C1-L35C92). -- Run the application and start importing your documents - -## Supported features - -- Conversation history with question reformulation -- Information about token usage -- Response streaming \ No newline at end of file diff --git a/SqlDatabaseVectorSearch/wwwroot/images/openai.svg b/SqlDatabaseVectorSearch/wwwroot/images/openai.svg new file mode 100644 index 0000000..a0e8f8e --- /dev/null +++ b/SqlDatabaseVectorSearch/wwwroot/images/openai.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/SqlDatabaseVectorSearch/wwwroot/images/sqldatabase.svg b/SqlDatabaseVectorSearch/wwwroot/images/sqldatabase.svg new file mode 100644 index 0000000..4271bd1 --- /dev/null +++ b/SqlDatabaseVectorSearch/wwwroot/images/sqldatabase.svg @@ -0,0 +1 @@ +Icon-databases-130 \ No newline at end of file