This example shows how to import multiple files and ask questions, delegating the work to the Kernel Memory Service.
The example points to http://127.0.0.1:9001
so you should start the Kernel Memory Service locally before running this example.
Start dotnet/Service/Service.csproj
. See dotnet/Service/README.md
for details.
var memory = new MemoryWebClient("http://127.0.0.1:9001/");
await memory.ImportDocumentAsync(new Document("doc012")
.AddFiles([ "file2.txt", "file3.docx", "file4.pdf" ])
.AddTag("user", "Blake"));
while (!await memory.IsDocumentReadyAsync(documentId: "doc012"))
{
Console.WriteLine("Waiting for memory ingestion to complete...");
await Task.Delay(TimeSpan.FromSeconds(2));
string answer = await memory.AskAsync("What's Semantic Kernel?");
To run the example, depending on your platform, execute either run.sh
or run.cmd
or just dotnet run
You can easily deploy Kernel Memory to Azure by following procedure on this page. Next, you will need to update one line in Program.cs
to point to the Azure Public IP created during the deployment, you will also need to provide the API key you used when deploying the service.
var memory = new MemoryWebClient("http://[IP ADDRESS]/", apiKey: "KEY_YOU_PROVIDED_WHEN_DEPLOYING");