From 9700051942e59ae1b383ded1090fce4d62c8c7a2 Mon Sep 17 00:00:00 2001 From: Marco Minerva Date: Fri, 10 Jan 2025 11:15:18 +0100 Subject: [PATCH] Add appSettings field and CreateQuestionAsync method The `ChatService` class now includes a private readonly field `appSettings`, initialized via the constructor. A new method `CreateQuestionAsync` has been added to handle question creation asynchronously, leveraging chat history. Additionally, a comment has been updated for clarity regarding chunk limitations. --- SqlDatabaseVectorSearch/Services/ChatService.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/SqlDatabaseVectorSearch/Services/ChatService.cs b/SqlDatabaseVectorSearch/Services/ChatService.cs index c320d1c..4a109dc 100644 --- a/SqlDatabaseVectorSearch/Services/ChatService.cs +++ b/SqlDatabaseVectorSearch/Services/ChatService.cs @@ -9,6 +9,8 @@ namespace SqlDatabaseVectorSearch.Services; public class ChatService(IChatCompletionService chatCompletionService, TokenizerService tokenizerService, HybridCache cache, IOptions appSettingsOptions) { + private readonly AppSettings appSettings = appSettingsOptions.Value; + public async Task CreateQuestionAsync(Guid conversationId, string question) { var chat = await GetChatHistoryAsync(conversationId); @@ -62,7 +64,7 @@ public class ChatService(IChatCompletionService chatCompletionService, Tokenizer var tokenCount = tokenizerService.CountTokens(text); if (tokenCount > tokensAvailable) { - // There isn't enough space to add the text. + // There isn't enough space to add the chunks. break; }