Method Signature
Parameters
str
required
The ID of the file to delete.
Response
Returns aFileDeleted object:
Examples
Delete a File
Delete and Verify
Delete Multiple Files
Delete Old Files
Delete Files by Purpose
Async Usage
Delete Multiple Files Concurrently
Error Handling
Important Notes
- Vector Store Removal: Deleting a file removes it from all vector stores where it’s being used
- Irreversible: File deletion cannot be undone
- Fine-tuning Jobs: Deleting a training file does not affect fine-tuning jobs that have already completed
- Active Jobs: Be cautious when deleting files that may be in use by active jobs
- Batch Files: Files with
purpose=batchmay auto-expire, so manual deletion might not be necessary
Best Practices
-
Check before deleting: Always verify the file details before deletion
-
Clean up expired files: Delete expired batch files to free up storage
-
Log deletions: Keep track of deleted files for audit purposes