This simple PoC project XAF blazor uses native vector support from SQL Azure Vector functions, Native Vector Support in Azure SQL Database and Vector Support in Azure SQL Database
Set the database connection in appsettings
{
"ConnectionStrings": {
"DefaultConnection": "Server=.;Database=VectorSearch;Trusted_Connection=True;MultipleActiveResultSets=true"
}
}
In the AzureOpenAI section of the appsettings.json file, insert the access key for Microsoft's OpenAI service.
Once the document is loaded, click on Embedding document to generate the vector of the document (embedding model).
When chatting, a sorting operation will be performed based on the cosine similarity between the vectors of the document chunks in db and the vector of the entered phrase, and the top MaxRelevantChunks (in appsettings.json) will be taken to be used in the autocompletion context. (autocomplete model)