Python: Bug: Python's SessionsPythonTool is using wrong REST data and endpoints for Azure Container Apps Sessions
Describe the bug The request and response bodies for interacting with the ACA serverless code interpreter sessions is incorrect.
To Reproduce Steps to reproduce the behavior:
- Go to the sample workbook 'azure_python_code_interpreter_function_calling'
- Try using the file upload and/or code execution functions
- See errors
Expected behavior To be able to execute code interpreter sessions in ACA
Platform
- OS: Windows
- IDE: Visual Studio, VS Code
- Language: Python
- Source: main branch
Additional context REST API specifications: https://learn.microsoft.com/en-us/azure/container-apps/sessions-code-interpreter
For example:
The File Upload API endpoint should be files/upload not python/uploadFile. It also returns a list of files, rather than a single file metadata. method: https://github.com/microsoft/semantic-kernel/blob/8fc645d1fe152a53420db484ed85afc7cce903cb/python/semantic_kernel/core_plugins/sessions_python_tool/sessions_python_plugin.py#L177
I believe all endpoints and data are incorrect, but haven't tested the all of the plugin's functions.
@colincmac Thanks for the question. What version of Semantic Kernel are you using?
@markwallace-microsoft I'm using semantic-kernel v1.1.1
Hi @colincmac. I am not able to reproduce any issue with this SessionsPython plugin. What region did you deploy your sessions pool resource to?
When I make a call to my pool deployed to EastUS and the endpoint like <pool_endpoint>/code/execute I get a 400. If I send a request to <pool_endpoint>/python/execute I get a 200.
Similarly, if I upload a file to the container via <pool_endpoint>/python/uploadFile I get a 200, versus trying to upload via <pool_endpoint>/files/upload I get a 400.
I'm deployed to EastUS. I did incorporate it into an existing solution. Let me try a fresh project. It does seem like there's a difference with the docs and the current solution. For example, semantic kernel is requesting a token for the resource https://acasessions.io/.default and the docs/python quick starts request https://dynamicsessions.io/.default
Here's a Postman collection showing it work with the dynamicsessions scope Dynamic Sessions API.postman_collection.json
If I get a sec, I'll try to reproduce it via a fresh example.
@colincmac, thanks for your response. I have it working with the endpoints listed in the documentation that you linked to. I still find it odd that it works with the old endpoints/request body as well. I've linked the PR above.