I used the below code and successfully uploaded the files to vector stores.
But after a while, the files had been deleted not only from vector stores but also from Storage.
# Step 7: Upload a file to openai
# https://platform.openai.com/docs/api-reference/files/create
message_file = client.files.create(
file=(file_name, file_stream), # Pass the file stream directly,
purpose="assistants"
)
# Step 8: Add the uploaded file to vector store
vector_store_file = client.beta.vector_stores.files.create(
vector_store_id=found_vector_store.id,
file_id=message_file.id
)
Please advise if you encounter this issue and how to resolve it.