mirror of
https://github.com/marcominerva/SqlDatabaseVectorSearch.git
synced 2026-06-20 12:23:10 +00:00
Improve README, add comments, and clean up VectorSearchService
Updated README.md for clarity and additional setup instructions: - Refined repository description to highlight native Vector type. - Rephrased note on Vector Support feature for readability. - Removed mention of EFCore.SqlServer.VectorSearch library. - Added instructions for updating VECTOR column size and setting Dimension property. Added comment in Scripts.sql to guide vector size setting in Embedding column. Cleaned up VectorSearchService.cs by removing unused and commented-out SQL command execution code.
This commit is contained in:
@@ -139,27 +139,6 @@ public class VectorSearchService(SqlConnection sqlConnection, ITextEmbeddingGene
|
||||
ORDER BY VECTOR_DISTANCE('cosine', Embedding, CAST(@QuestionEmbedding AS VECTOR({questionEmbedding.Length})));
|
||||
""", new { appSettings.MaxRelevantChunks, QuestionEmbedding = JsonSerializer.Serialize(questionEmbedding) });
|
||||
|
||||
//await sqlConnection.OpenAsync();
|
||||
//await using var command = sqlConnection.CreateCommand();
|
||||
|
||||
//command.CommandText = $"""
|
||||
// SELECT TOP (@MaxRelevantChunks) Content
|
||||
// FROM DocumentChunks
|
||||
// ORDER BY VECTOR_DISTANCE('cosine', Embedding, CAST(@QuestionEmbedding AS VECTOR({questionEmbedding.Length})));
|
||||
// """;
|
||||
|
||||
//command.Parameters.AddWithValue("@MaxRelevantChunks", appSettings.MaxRelevantChunks);
|
||||
//command.Parameters.AddWithValue("@QuestionEmbedding", JsonSerializer.Serialize(questionEmbedding));
|
||||
|
||||
//var chunks = new List<string>();
|
||||
|
||||
//await using var reader = await command.ExecuteReaderAsync();
|
||||
//while (await reader.ReadAsync())
|
||||
//{
|
||||
// var content = reader.GetString(0);
|
||||
// chunks.Add(content);
|
||||
//}
|
||||
|
||||
var answer = await chatService.AskQuestionAsync(question.ConversationId, chunks, reformulatedQuestion);
|
||||
return new Response(reformulatedQuestion, answer);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user