Minor updates

This commit is contained in:
Marco Minerva
2024-06-26 11:05:00 +02:00
parent 1840a63d75
commit 8ef8836075
5 changed files with 7 additions and 4 deletions
@@ -13,6 +13,7 @@ public class ApplicationDbContext(DbContextOptions<ApplicationDbContext> options
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{ {
base.OnConfiguring(optionsBuilder); base.OnConfiguring(optionsBuilder);
optionsBuilder.UseExceptionProcessor(); optionsBuilder.UseExceptionProcessor();
} }
+3 -1
View File
@@ -80,7 +80,9 @@ documentsApiGroup.MapGet(string.Empty, async (VectorSearchService vectorSearchSe
documentsApiGroup.MapPost(string.Empty, async (IFormFile file, VectorSearchService vectorSearchService, LinkGenerator linkGenerator, Guid? documentId = null) => documentsApiGroup.MapPost(string.Empty, async (IFormFile file, VectorSearchService vectorSearchService, LinkGenerator linkGenerator, Guid? documentId = null) =>
{ {
documentId = await vectorSearchService.ImportAsync(file.OpenReadStream(), file.FileName, documentId); using var stream = file.OpenReadStream();
documentId = await vectorSearchService.ImportAsync(stream, file.FileName, documentId);
return TypedResults.Ok(new UploadDocumentResponse(documentId.Value)); return TypedResults.Ok(new UploadDocumentResponse(documentId.Value));
}) })
.DisableAntiforgery() .DisableAntiforgery()
@@ -75,7 +75,7 @@ public class VectorSearchService(ApplicationDbContext dbContext, ITextEmbeddingG
} }
} }
public async Task<Response?> AskQuestionAsync(Question question, bool reformulate = true) public async Task<Response> AskQuestionAsync(Question question, bool reformulate = true)
{ {
// Reformulate the following question taking into account the context of the chat to perform keyword search and embeddings: // Reformulate the following question taking into account the context of the chat to perform keyword search and embeddings:
var reformulatedQuestion = reformulate ? await chatService.CreateQuestionAsync(question.ConversationId, question.Text) : question.Text; var reformulatedQuestion = reformulate ? await chatService.CreateQuestionAsync(question.ConversationId, question.Text) : question.Text;
@@ -13,7 +13,7 @@
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.6" /> <PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.6" /> <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.6" />
<PackageReference Include="Microsoft.SemanticKernel" Version="1.15.0" /> <PackageReference Include="Microsoft.SemanticKernel" Version="1.15.0" />
<PackageReference Include="MinimalHelpers.OpenApi" Version="2.0.8" /> <PackageReference Include="MinimalHelpers.OpenApi" Version="2.0.9" />
<PackageReference Include="PdfPig" Version="0.1.8" /> <PackageReference Include="PdfPig" Version="0.1.8" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.6.2" /> <PackageReference Include="Swashbuckle.AspNetCore" Version="6.6.2" />
<PackageReference Include="TinyHelpers" Version="3.1.7" /> <PackageReference Include="TinyHelpers" Version="3.1.7" />
+1 -1
View File
@@ -18,7 +18,7 @@
"MaxTokenPerLine": 300, "MaxTokenPerLine": 300,
"MaxTokensPerParagraph": 1024, "MaxTokensPerParagraph": 1024,
"OverlapTokens": 100, "OverlapTokens": 100,
"MaxRelevantChunks": 5, "MaxRelevantChunks": 10,
"MessageLimit": 20, "MessageLimit": 20,
"MessageExpiration": "00:05:00" "MessageExpiration": "00:05:00"
}, },