microsoft / semantic-kernel

Integrate cutting-edge LLM technology quickly and easily into your apps
https://aka.ms/semantic-kernel
MIT License
21.26k stars 3.12k forks source link

Python: c# SessionsPythonPlugin doesn't expose the DownloadFileAsync as a kernel function #6643

Open rcoccia opened 2 months ago

rcoccia commented 2 months ago

the SessionsPythonPlugin class in Microsoft.SemanticKernel.Plugins.Core.CodeInterpreter provides a DownloadFileAsync to download file from the remote session to a local path.

The methos is not marked with the KernelFunction attribute so it is not visible as a function in a kernel using the plugin.

Don't know if this is a bug or a design choise.

alliscode commented 2 months ago

Hi @rcoccia, thank you for filling this issue. We chose not to expose the DownloadFileAsync method as a KernelFunction because it was not clear to us what the scenario would be for the model to download a file and how the KernelFunction should behave. Would you mind giving us some context on your scenario and how you would want model to interact with the file?

rcoccia commented 2 months ago

Hi, I'm experiment with a math tutor agent. The user question should be something like plot me the equation y=3x+1;
The agent should have the following instruction: You are a math tutor. You could write and run python code to answer user questions. When executing code remember that you are using a persistent session to a remote code interpreter. Don't write code that returns binary content in the stdout; instead save binary content in the remote session file system and automatically download it in the 'c:\temp' local folder. Provide a reference to the locally download file in your response. If the kernel supporting the agent has the download function enable I expect a result like... the plot was produced and it is available in the c:\temp\plot.png local folder