semantic-kernel icon indicating copy to clipboard operation
semantic-kernel copied to clipboard

.Net: When the importPluginFromPromptDirectory Function fails in finding or validating the file content, the exception is not clear enough or none at all.

Open joslat opened this issue 1 year ago • 2 comments

When the importPluginFromPromptDiretory Function fails in finding or validating the file content, the exception is not clear enough or none at all. for example, when skprompt.txt or config.json files are not properly formatted, sometimes there is no exception being thrown and the function is simply not loaded. It would be great to have a warning or an exception being thrown stating the issue happening and on what file this is happening. It would be great to raise a warning that no functions/plugins have been loaded, along the path used.

on another side, the following syntax throws a not so clear exception: error "Microsoft.SemanticKernel.KernelException: 'Tokens must be separated by one space least'"

For example, in skprompt.txt with: User Input Format: {{ ""request"": ""{request}"" }} raises the "Tokens must be separated..."

Changing it to the following works User Input Format: {{ ""Request"": {{$input}} }}

Suggestion:

  • raise clear exception/warning when parsing-validating prompt and configuration files, including yaml.
  • improve the "tokens must be separated error" ideally pointing to the root cause.

joslat avatar Jan 31 '24 09:01 joslat

Thank you for logging this. Here's a screenshot of this issue

image

Further, if the prompt uses double curly brackets, it appears that SK starts looking at it as a function name itself. So for example if I define the output format to be something like

Instructions

Provide the city name from the input using the following format:

{{ ""city"": {{CityName}} }}

the kernel.InvokeAsync raises an error "System.Collections.Generic.KeyNotFoundException: 'The plugin collection does not contain a plugin and/or function with the specified names. Plugin name - '', function name - 'CityName'.'"

Here's a screenshot of this error image

Thank you

supreettare avatar Jan 31 '24 09:01 supreettare

This issue is stale because it has been open for 90 days with no activity.

github-actions[bot] avatar May 02 '24 01:05 github-actions[bot]

This issue was closed because it has been inactive for 14 days since being marked as stale.

github-actions[bot] avatar May 16 '24 01:05 github-actions[bot]