-
-
Notifications
You must be signed in to change notification settings - Fork 634
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Description
If you attempt to use \OpenAI\Resources\VectorStoresFileBatches::cancel
to cancel a vector store file batch, the OAI API will return this error:
Invalid method for URL (DELETE /v1/vector_stores/vs_id/file_batches/vsfb_id)
This is because the payload is constructed with this HTTP method and URL pattern:
$payload = Payload::delete("vector_stores/$vectorStoreId/file_batches", $fileBatchId);
Per the OAI cancel batch documentation it should POST to cancel the batch, and construct the URL with this pattern:
https://api.openai.com/v1/vector_stores/{vector_store_id}/file_batches/{batch_id}/cancel
Solution: Change this to use the Payload's cancel helper method:
$payload = Payload::cancel("vector_stores/$vectorStoreId/file_batches", $fileBatchId);
Steps To Reproduce
- Create a file
$file = app(\OpenAI\Client::class)->files()->upload($data);
- Create a vector store file batch
$batch = app(\OpenAI\Client::class)->vectorStores()->batches()->create($vectorStoreId, ['file_ids' => [$file->id]);
- Cancel it with
app((\OpenAI\Client::class)->vectorStores()->batches()->cancel($vectorStoreId, $batch->id)

OpenAI PHP Client Version
v0.10.1
PHP Version
8.2.17
Notes
No response
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working