Skip to content

Commit 9f2ba11

Browse files
committed
Small modifications
1 parent 83d4f63 commit 9f2ba11

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

src/KernelMemory.Extensions.ConsoleTest/Program.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ static async Task Main(string[] args)
6363
.AddChoices([
6464
@"c:\temp\advancedapisecurity.pdf",
6565
@"S:\OneDrive\B19553_11.pdf",
66+
@"c:\temp\blackhatpython.pdf",
6667
@"/Users/gianmariaricci/Downloads/llchaindata/blackhatpython.pdf"]));
6768
await sampleInstance1.RunSample(book);
6869
}

src/KernelMemory.Extensions.ConsoleTest/Samples/ContextualRetrievalSample.cs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public async Task RunSample(string bookPdf)
3232
});
3333
services.AddTransient<RawAnthropicClient>();
3434

35-
var anthropicApiKey = Environment.GetEnvironmentVariable("ANTHROPIC_API_KEY")!;
35+
var anthropicApiKey = Dotenv.Get("ANTHROPIC_API_KEY")!;
3636
if (string.IsNullOrEmpty(anthropicApiKey))
3737
{
3838
throw new Exception("ANTHROPIC_API_KEY is not set");
@@ -44,7 +44,6 @@ public async Task RunSample(string bookPdf)
4444
};
4545
services.AddSingleton(config);
4646

47-
4847
var builder = CreateBasicKernelMemoryBuilder(services);
4948
var kernelMemory = builder.Build<MemoryServerless>();
5049

@@ -148,14 +147,14 @@ private static IKernelMemoryBuilder CreateBasicKernelMemoryBuilder(
148147
kernelMemoryBuilder
149148
.WithSimpleFileStorage(new SimpleFileStorageConfig()
150149
{
151-
Directory = "/tmp/km/storage",
152-
//Directory = "c:\\temp\\km2\\storage",
150+
//Directory = "/tmp/km/storage",
151+
Directory = "c:\\temp\\km2\\storage",
153152
StorageType = FileSystemTypes.Disk
154153
})
155154
.WithSimpleVectorDb(new SimpleVectorDbConfig()
156155
{
157-
Directory = "/tmp/km/vectorstorage",
158-
//Directory = "c:\\temp\\km2\\vectorstorage",
156+
//Directory = "/tmp/km/vectorstorage",
157+
Directory = "c:\\temp\\km2\\vectorstorage",
159158
StorageType = FileSystemTypes.Disk
160159
});
161160

src/KernelMemory.Extensions/QueryPipeline/IConversationQueryRewriter.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,10 @@ public async Task<string> RewriteAsync(Conversation conversation, string questio
5656
}
5757
}
5858
string prompt = $@"You will reformulate the question based on the conversation up to this point so the question will
59-
be a standalone question that contains also the previous context. If there is no correlation you will output the original question.
60-
You will answer only with the new Question no other text must be included.
61-
question {question}";
59+
be a standalone question that contains also the previous context. If there is no correlation
60+
between the conversation and the question you will output the question unchanged.
61+
You will answer only with the rewritten question no other text must be included.
62+
Question: {question}";
6263
chatMessages.AddUserMessage(prompt);
6364

6465
var result = await chatCompletionService.GetChatMessageContentAsync(chatMessages, new PromptExecutionSettings()
@@ -99,7 +100,8 @@ public HandlebarSemanticKernelQueryRewriter(
99100
Name = "TestRewrite",
100101
Description = "Rewrite a query for kernel memory.",
101102
Template = @"system:
102-
* Given the following conversation history and the users next question,rephrase the question to be a stand alone question.
103+
* Given the following conversation history and the users next question, rephrase the
104+
follow up input to be a stand alone question.
103105
If the conversation is irrelevant or empty, just restate the original question.
104106
Do not add more details than necessary to the question.
105107

0 commit comments

Comments
 (0)