agentic_security icon indicating copy to clipboard operation
agentic_security copied to clipboard

Custom CSV in datasets/ is not detected at startup (v0.7.3, Windows / Python 3.11)

Open szlf619 opened this issue 9 months ago • 4 comments

Placing a CSV file that contains a correct prompt column inside the recommended datasets/ folder does not make the file appear in the Web-UI (Custom CSV → 0 prompts). The loader’s debug output (load_local_csv) never shows up, so the dataset is apparently not scanned at all.

The program was install by pip, I created a dir named 'datasets' either in the /installation path/probe_data, or the powershell start path. The csv has two columns named 'id' and 'prompt'.

How can I use my custom csv dataset ?

szlf619 avatar May 23 '25 03:05 szlf619

Hi, I encountered the same issue before. This is likely due to the @cache_to_disk() decorator in the file agentic_security/probe_data/data.py, which causes the dataset list to be cached and not refreshed in real time.

In my development setup, I removed the caching logic to avoid this problem. You can try the following workaround:

Locate the file: agentic_security/probe_data/data.py

In that file, find the functions decorated with @cache_to_disk(), especially the one responsible for loading local CSV files (e.g. load_local_csv).

Temporarily comment out or remove the @cache_to_disk() decorator.

Restart the Web-UI and see if your custom CSV now shows up.

Alternatively, you can try deleting any generated cache files (if present) or restarting the app to force a full rescan.

Hope this helps!


@msoedov Would it be possible to consider removing or making the cache optional for dataset loading? It seems to cause confusion when users add new files but don’t see them reflected in the UI.

Mundi-Xu avatar May 26 '25 08:05 Mundi-Xu

Just a quick note: the project looks for the datasets folder using a relative path, as seen in the source code here: https://github.com/msoedov/agentic_security/blob/17e34356e11ae643ad9b9b2c13b94be84d1231b2/agentic_security/probe_data/data.py#L251

So make sure your custom CSV file is placed in a ./datasets directory relative to the current working directory when you launch the application — not under the package installation path.

Of course, you can also just let the program create the folder automatically on first run.

Mundi-Xu avatar May 26 '25 08:05 Mundi-Xu

Hi, I encountered the same issue before. This is likely due to the @cache_to_disk() decorator in the file agentic_security/probe_data/data.py, which causes the dataset list to be cached and not refreshed in real time.

In my development setup, I removed the caching logic to avoid this problem. You can try the following workaround:

Locate the file: agentic_security/probe_data/data.py

In that file, find the functions decorated with @cache_to_disk(), especially the one responsible for loading local CSV files (e.g. load_local_csv).

Temporarily comment out or remove the @cache_to_disk() decorator.

Restart the Web-UI and see if your custom CSV now shows up.

Alternatively, you can try deleting any generated cache files (if present) or restarting the app to force a full rescan.

Hope this helps!

@msoedov Would it be possible to consider removing or making the cache optional for dataset loading? It seems to cause confusion when users add new files but don’t see them reflected in the UI.

Hi Mundi, thank you very much for all your replies.

I have tried your suggestions as followed:

  1. comment @cache_to_disk() in data.py at line 74, 174,184,192
  2. delete the python cache at the agentic_security and agentic_security/probe_data

Result:

  1. data was found at the start up stage, but the logger information shows up 4 times.
    The CSV file was found at the same location where the application was start. In my case is the project locaiton \Desktop\AI-Tools\agentic_security\datasets>, which is not the installation path.

Image

  1. At the Web-UI, it still show no promts.

Image

  1. I made the simpleset csv file, it still not work

Image

szlf619 avatar May 26 '25 15:05 szlf619

Hi, I encountered the same issue before. This is likely due to the @cache_to_disk() decorator in the file agentic_security/probe_data/data.py, which causes the dataset list to be cached and not refreshed in real time. In my development setup, I removed the caching logic to avoid this problem. You can try the following workaround: Locate the file: agentic_security/probe_data/data.py In that file, find the functions decorated with @cache_to_disk(), especially the one responsible for loading local CSV files (e.g. load_local_csv). Temporarily comment out or remove the @cache_to_disk() decorator. Restart the Web-UI and see if your custom CSV now shows up. Alternatively, you can try deleting any generated cache files (if present) or restarting the app to force a full rescan. Hope this helps! @msoedov Would it be possible to consider removing or making the cache optional for dataset loading? It seems to cause confusion when users add new files but don’t see them reflected in the UI.

Hi Mundi, thank you very much for all your replies.

I have tried your suggestions as followed:

  1. comment @cache_to_disk() in data.py at line 74, 174,184,192
  2. delete the python cache at the agentic_security and agentic_security/probe_data

Result:

  1. data was found at the start up stage, but the logger information shows up 4 times. The CSV file was found at the same location where the application was start. In my case is the project locaiton \Desktop\AI-Tools\agentic_security\datasets>, which is not the installation path.

Image

  1. At the Web-UI, it still show no promts.

Image

  1. I made the simpleset csv file, it still not work

Image

You're right — the front-end display does seem to have an issue. However, if you select the CSV entry in the Web-UI, the program will still use and run the local CSV file correctly, so functionality is not affected.

I'm not very familiar with the front-end part of the code, but perhaps you (or someone else) could take a look and help fix the display issue in the UI.

Mundi-Xu avatar May 27 '25 03:05 Mundi-Xu

Hey all! Thank you for reporting the issue. I have added a fix https://github.com/msoedov/agentic_security/compare/0.7.3...0.7.4 and bumped the version to address that.

msoedov avatar May 27 '25 10:05 msoedov

thank you for the updates, I upgraded to 0.7.4. In my case, although my dataset is scanned during the set-up stage, when I select custom dataset in Web-UI, it won't be loaded and will immediately shows scan complete.

szlf619 avatar May 29 '25 04:05 szlf619

thank you for the updates, I upgraded to 0.7.4. In my case, although my dataset is scanned during the set-up stage, when I select custom dataset in Web-UI, it won't be loaded and will immediately shows scan complete.

szlf619 avatar May 29 '25 04:05 szlf619

I click the reset state on web-ui, now it works.

szlf619 avatar May 29 '25 10:05 szlf619

Thank you @szlf619 !

msoedov avatar May 29 '25 13:05 msoedov