KeyNotFoundException: The given key 'url' was not present in the dictionary.
dmm-l-mediehus opened this issue · comments
Related to #209 but was closed by author. I still get this error despite re-uploading the file to storage + index.
Using the newest nuget package (service hosted with Web Client to self), and the plugin:
<PackageReference Include="Microsoft.SemanticKernel" Version="1.0.1" />
<PackageReference Include="Microsoft.KernelMemory.Core" Version="0.23.231218.2" />
<PackageReference Include="Microsoft.KernelMemory.SemanticKernelPlugin" Version="0.23.231218.2" />
Program.cs:
IKernelMemory memory = new KernelMemoryBuilder(builder.Services).FromAppSettings().Build();
builder.Services.AddSingleton(memory);
builder.Services.AddTransient(sp =>
{
KernelBuilder...
IKernelMemory kernelMemory = sp.GetRequiredService<IKernelMemory>();
kernelBuilder.Plugins.AddFromObject(new MemoryPlugin(kernelMemory));
...Return Kernel
}
Uploading (i.e. tables.json
) - which works fine, checked Azure Blob Storage + Azure AI index, etc.:
await KernelMemory.ImportDocumentAsync(fileStream, fileName: e.File.Name, documentId: GetValidFileName(filePath), cancellationToken: CancellationToken);
Running it with ChatCompletionService.GetStreamingChatMessageContentsAsync(...)
And example text; Give me tables that contain "Agriculture"
(or any prompt, it gives exception)...
info: Search[0]
Function Search invoking.
trce: Search[0]
Function arguments: {"query":"Agriculture"}
fail: Search[0]
Function failed. Error: The given key 'url' was not present in the dictionary.
System.Collections.Generic.KeyNotFoundException: The given key 'url' was not present in the dictionary.
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at Microsoft.KernelMemory.Search.SearchClient.SearchAsync(String index, String query, ICollection`1 filters, Double minRelevance, Int32 limit, CancellationToken cancellationToken)
at Microsoft.KernelMemory.MemoryPlugin.SearchAsync(String query, String index, Double minRelevance, Int32 limit, CancellationToken cancellationToken)
at Microsoft.SemanticKernel.KernelFunctionFromMethod.<>c.<<GetReturnValueMarshalerDelegate>b__12_4>d.MoveNext()
--- End of stack trace from previous location ---
Fixed in nuget version 0.23.231219.1