File Manager

retrieve files with time & location specified
from llmcam.fn_to_fc import *
files = glob.glob("../data/cap_*.jpg")
len(files), files[:3], type(files[0])
(629,
 ['../data/cap_2024.10.07_13:39:09_Presidentinlinna.jpg',
  '../data/cap_2024.10.06_19:48:29_Tuomiokirkko.jpg',
  '../data/cap_2024.11.13_16:51:59_Porvoo_C0150200.jpg'],
 str)

source

list_image_files

 list_image_files ()

List all captured image files. file naming scheme is “cap_%Y.%m.%d_%H:%M:%S_.jpg”

tools = [tool_schema(list_image_files)]
m = form_msgs([
    ("system", "You are a helpful file manager. Use the supplied tools to assist the user."),
    ("user", "list all files, captured at Kauppatori"),
])
complete(m, tools=tools)
print_msgs(m)
>> System:
You are a helpful file manager. Use the supplied tools to assist the user.
>> User:
list all files, captured at Kauppatori
>> Assistant:
Here are the files that were captured at Kauppatori:  1. cap_2024.10.06_20:08:29_Kauppatori.jpg 2.
cap_2024.10.07_00:01:39_Kauppatori.jpg 3. cap_2024.10.06_19:36:24_Kauppatori.jpg 4.
cap_2024.10.29_11:31:38_Kauppatori.jpg 5. cap_2024.10.04_14:54:09_Kauppatori.jpg 6.
cap_2024.10.06_16:43:24_Kauppatori.jpg 7. cap_2024.10.06_23:30:49_Kauppatori.jpg 8.
cap_2024.10.06_23:16:04_Kauppatori.jpg 9. cap_2024.09.30_09:41:41_Kauppatori.jpg 10.
cap_2024.11.01_15:42:25_Kauppatori.jpg 11. cap_2024.09.29_19:20:31_Kauppatori.jpg 12.
cap_2024.10.06_23:43:49_Kauppatori.jpg 13. cap_2024.10.06_21:42:14_Kauppatori.jpg 14.
cap_2024.10.04_14:54:04_Kauppatori.jpg 15. cap_2024.09.28_20:07:56_Kauppatori.jpg 16.
cap_2024.10.07_00:33:49_Kauppatori.jpg 17. cap_2024.10.06_22:58:34_Kauppatori.jpg 18.
cap_2024.09.30_09:25:56_Kauppatori.jpg 19. cap_2024.10.04_14:54:14_Kauppatori.jpg 20.
cap_2024.10.30_12:18:22_Kauppatori.jpg 21. cap_2024.10.06_23:14:39_Kauppatori.jpg 22.
cap_2024.09.30_09:40:46_Kauppatori.jpg 23. cap_2024.10.06_21:58:19_Kauppatori.jpg 24.
cap_2024.10.06_19:51:09_Kauppatori.jpg 25. cap_2024.10.06_19:52:29_Kauppatori.jpg 26.
cap_2024.10.04_14:55:29_Kauppatori.jpg 27. cap_2024.10.07_11:46:44_Kauppatori.jpg 28.
cap_2024.10.06_21:10:04_Kauppatori.jpg 29. cap_2024.10.06_19:21:39_Kauppatori.jpg 30.
cap_2024.09.30_09:40:46_Kauppatori.jpg 31. cap_2024.10.06_20:07:09_Kauppatori.jpg 32.
cap_2024.10.06_20:23:14_Kauppatori.jpg 33. cap_2024.10.07_14:23:19_Kauppatori.jpg 34.
cap_2024.10.06_20:19:01_Kauppatori.jpg
m = form_msgs([
    ("system", "You are a helpful file manager. Use the supplied tools to assist the user."),
    ("user", "pick up 3 files, captured in September"),
])
complete(m, tools=tools)
print_msgs(m)
>> System:
You are a helpful file manager. Use the supplied tools to assist the user.
>> User:
pick up 3 files, captured in September
>> Assistant:
Here are three image files captured in September 2024:  1. `cap_2024.09.30_09:20:21_Torni.jpg` 2.
`cap_2024.09.28_20:04:41_Tuomiokirkko.jpg` 3. `cap_2024.09.28_20:20:01_Tuomiokirkko.jpg`  If you
need further assistance, feel free to ask!
m = form_msgs([
    ("system", "You are a helpful file manager. Use the supplied tools to assist the user."),
    ("user", "list all all locations"),
])
complete(m, tools=tools)
print_msgs(m)
>> System:
You are a helpful file manager. Use the supplied tools to assist the user.
>> User:
list all all locations
>> Assistant:
Here are the locations from the captured image files:  1. Presidentinlinna 2. Tuomiokirkko 3. Porvoo
4. Torni 5. Valkosaari 6. Olympiaterminaali 7. Kauppatori 8. Etelasatama 9. nowhere 10. unclear 11.
santaclausvillege