mirror of
https://github.com/marcominerva/SqlDatabaseVectorSearch.git
synced 2026-06-20 12:23:10 +00:00
Update code style, ChatService, VectorSearch, and .NET 9.0
Updated .editorconfig with new code style preferences. Enhanced ChatService prompt string with a new directive. Modified VectorSearchService using directives and tuple order. Upgraded SqlDatabaseVectorSearch to target .NET 9.0 and updated packages.
This commit is contained in:
@@ -131,6 +131,7 @@ csharp_prefer_braces = true:silent
|
||||
csharp_prefer_simple_using_statement = true:suggestion
|
||||
csharp_style_namespace_declarations = file_scoped:suggestion
|
||||
csharp_style_prefer_method_group_conversion = true:silent
|
||||
csharp_prefer_system_threading_lock = true:suggestion
|
||||
|
||||
# Expression-level preferences
|
||||
csharp_prefer_simple_default_expression = true:suggestion
|
||||
|
||||
@@ -55,6 +55,7 @@ public class ChatService(IMemoryCache cache, IChatCompletionService chatCompleti
|
||||
}
|
||||
|
||||
prompt.AppendLine($"""
|
||||
|
||||
=====
|
||||
Answer the following question:
|
||||
---
|
||||
|
||||
@@ -9,7 +9,6 @@ using Microsoft.SemanticKernel.Embeddings;
|
||||
using Microsoft.SemanticKernel.Text;
|
||||
using SqlDatabaseVectorSearch.Models;
|
||||
using SqlDatabaseVectorSearch.Settings;
|
||||
using TinyHelpers.Extensions;
|
||||
using UglyToad.PdfPig;
|
||||
using UglyToad.PdfPig.DocumentLayoutAnalysis.TextExtractor;
|
||||
|
||||
@@ -45,7 +44,7 @@ public class VectorSearchService(SqlConnection sqlConnection, ITextEmbeddingGene
|
||||
var embeddings = await textEmbeddingGenerationService.GenerateEmbeddingsAsync(paragraphs);
|
||||
|
||||
// Save the document chunks and the corresponding embedding in the database.
|
||||
foreach (var (paragraph, index) in paragraphs.WithIndex())
|
||||
foreach (var (index, paragraph) in paragraphs.Index())
|
||||
{
|
||||
await sqlConnection.ExecuteAsync($"""
|
||||
INSERT INTO DocumentChunks (DocumentId, [Index], Content, Embedding)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<NoWarn>$(NoWarn);SKEXP0001;SKEXP0010;SKEXP0050;</NoWarn>
|
||||
@@ -9,13 +9,12 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Dapper" Version="2.1.35" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.10" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.0" />
|
||||
<PackageReference Include="Microsoft.Data.SqlClient" Version="5.2.2" />
|
||||
<PackageReference Include="Microsoft.SemanticKernel" Version="1.27.0" />
|
||||
<PackageReference Include="MinimalHelpers.OpenApi" Version="2.0.17" />
|
||||
<PackageReference Include="PdfPig" Version="0.1.9" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.9.0" />
|
||||
<PackageReference Include="TinyHelpers" Version="3.1.18" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="7.0.0" />
|
||||
<PackageReference Include="TinyHelpers.AspNetCore" Version="3.1.19" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user