Vector store files re-use issue, instead of re-uploading on each new runtime

Instead of re-uploading the file(s) I want to use for file_search in the vector store each time I execute my code - I want to upload them once the first time but use the existing vector store again if the files that would have been uploaded are already there.

I have figured out how to basically check if the vector_file_store already exists (by listing the vector stores and finding the ID by name).

What I haven’t figured out is how to confirm that the files already exist in the vector store since they don’t have filenames in the listFiles object (https://platform.openai.com/docs/api-reference/vector-stores-files/listFiles)

Am I better off using a local cache (on disk) to persist this information or can I, at runtime:

  • confirm the vector store’s existence and only create it if it’s missing
  • confirm the file(s) existence and only upload the files if they aren’t already there

Am I doing this wrong?

2 Likes