safe-code-execution icon indicating copy to clipboard operation
safe-code-execution copied to clipboard

How can I perform data analysis on a specific file using Python?

Open murong1 opened this issue 1 year ago • 5 comments

I want to analyze the data in a particular Excel file using Python. I attempted to use the pandas library to load the file and calculate the sum of a specific column ('Quantity'). However, I encountered a 'FileNotFoundError' indicating that the file could not be located. How can I resolve this issue, and what are the best practices for loading and analyzing data from an Excel file in Python? image image

murong1 avatar Nov 05 '24 16:11 murong1

Sorry, there is currently no support for reading uploaded files, so this won't work. However, if your file is downloadable from an online source, you can ask the LLM to generate code that downloads the file and then does analysis on it.

I'll keep this issue open to track whether Open WebUI allows tools and functions to access uploaded files.

EtiennePerot avatar Nov 06 '24 08:11 EtiennePerot

I am also interested in this functionality!

latent-variable avatar Nov 09 '24 00:11 latent-variable

Sorry, there is currently no support for reading uploaded files, so this won't work. However, if your file is downloadable from an online source, you can ask the LLM to generate code that downloads the file and then does analysis on it.

I'll keep this issue open to track whether Open WebUI allows tools and functions to access uploaded files.

Would it be possible for the tools/functions to access Minio?

garyfanhku avatar Nov 15 '24 10:11 garyfanhku

@garyfanhku You can ask the LLM to generate code that fetches data from Minio or any other solution that can be remotely accessed programmatically. It wouldn't make sense to manually implement each one of them manually. That being said I realize that it would be good to have easier support for automatically installing Python packages and libraries so that LLM-generated code can use more than just the Python standard library. That work is tracked in #15.

EtiennePerot avatar Nov 16 '24 07:11 EtiennePerot

I'll keep this issue open to track whether Open WebUI allows tools and functions to access uploaded files.

I've looked into this a bit and, for my own reference (or for whoever wants to work on implementing this): Open WebUI does allow tools and functions to allow user-uploaded files.

Example of a function that accesses files: https://openwebui.com/f/omar97/visualize - however this one currently erroneously assumes that the installation is single-user, and so it uses Files.get_files() to get a list of files, which lists the uploaded files from all users. They instead need to be filtered by user_id using Files.get_files_by_user_id. Example of a function that looks up the current user's ID: https://openwebui.com/f/mhwhgm/auto_tool_v2.

The ID of the conversation that a file was uploaded from doesn't seem to be recorded, so I think this means all files from a user (or perhaps the most recent N files, to put a limit on resource usage) would need to be available to all code executions.

EtiennePerot avatar Nov 16 '24 07:11 EtiennePerot