Skip to content

Commit

Permalink
introduced context in query
Browse files Browse the repository at this point in the history
  • Loading branch information
alkampfergit committed Nov 24, 2024
1 parent 477c591 commit c4d1d42
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ private static IKernelMemoryBuilder CreateBasicKernelMemoryBuilder(
services.AddSingleton<HyDeQueryHandler>();
var hydeConfig = new HiDeQueryHandlerConfiguration()
{
Prompt = "Given a question, generate a paragraph of text that answers the question in the context of computer security and IT security"
Prompt = "Given a question, generate a paragraph of text that answers the question"
};
services.AddSingleton(hydeConfig);
services.AddSingleton<KeywordSearchQueryHandler>();
Expand Down
5 changes: 5 additions & 0 deletions src/KernelMemory.Extensions/QueryPipeline/HyDeQueryHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ protected override async Task OnHandleAsync(UserQuestion userQuestion, Cancellat
// Perform a vector search in default memory
StringBuilder prompt = new StringBuilder(_configuration.Prompt.Length + userQuestion.Question.Length + "Question: ".Length + "Paragraph: ".Length + 20);
prompt.AppendLine(_configuration.Prompt);
if (!string.IsNullOrEmpty(userQuestion.Context))

Check failure on line 50 in src/KernelMemory.Extensions/QueryPipeline/HyDeQueryHandler.cs

View workflow job for this annotation

GitHub Actions / Build

'UserQuestion' does not contain a definition for 'Context' and no accessible extension method 'Context' accepting a first argument of type 'UserQuestion' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 50 in src/KernelMemory.Extensions/QueryPipeline/HyDeQueryHandler.cs

View workflow job for this annotation

GitHub Actions / Build and analyze

'UserQuestion' does not contain a definition for 'Context' and no accessible extension method 'Context' accepting a first argument of type 'UserQuestion' could be found (are you missing a using directive or an assembly reference?)
{
prompt.AppendLine("The context of the question is: " + userQuestion.Context);

Check failure on line 52 in src/KernelMemory.Extensions/QueryPipeline/HyDeQueryHandler.cs

View workflow job for this annotation

GitHub Actions / Build

'UserQuestion' does not contain a definition for 'Context' and no accessible extension method 'Context' accepting a first argument of type 'UserQuestion' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 52 in src/KernelMemory.Extensions/QueryPipeline/HyDeQueryHandler.cs

View workflow job for this annotation

GitHub Actions / Build and analyze

'UserQuestion' does not contain a definition for 'Context' and no accessible extension method 'Context' accepting a first argument of type 'UserQuestion' could be found (are you missing a using directive or an assembly reference?)
}

prompt.AppendLine("Question: " + userQuestion.Question);
prompt.AppendLine("Paragraph: ");

Expand Down

0 comments on commit c4d1d42

Please sign in to comment.