Description: I successfully integrated the OpenAI Beta Assistant API into my Python application. However, I encountered an issue with file deletion from a vector store.
Problem: When I use the API to delete a file from a vector store, the operation returns a success message. However, when I subsequently retrieve all files from the same vector store, the deleted file is still present in the list.
Steps Taken:
- Successfully integrated the OpenAI API into my Python application.
- Used the API endpoint for deleting a file from a specific vector store.
- Received a success response indicating the file was deleted.
- Called the API to retrieve all files from the same vector store and found that the deleted file still appears in the list of files.
The endpoint in py to delete file from vector store
from openai import AsyncOpenAI
client = AsyncOpenAI(api_key=settings.OPENAI_API_KEY)
@chatbot_router.delete("/del-file-from-vs", response_model=Response)
async def delete_file_from_vector_store(
vector_store_id: str,
file_id: str,
):
try:
response = await client.beta.vector_stores.files.delete(
vector_store_id=vector_store_id,
file_id=file_id,
)
return Response(payload=response.model_dump(), message="File successfully deleted from VS")
except Exception as e:
raise CustomExceptionCase(
status_code=500,
detail=f"An error occurred while deleting a delete_file_from_vector_store: {e}",
)
``