-
Notifications
You must be signed in to change notification settings - Fork 238
Description
This is just like #538, but for VectorStoreFileBatchService.PollStatus.
Summary
The PollStatus method in VectorStoreFileBatchService passes parameters to the Get method in the wrong order, causing API calls to fail with "Invalid 'batch_id'" errors.
Environment
- SDK Version: v1.12.0 (and likely earlier versions)
- Go Version: Any
- OS: Any
Description
The PollStatus method incorrectly swaps the vectorStoreID and batchID parameters when calling the Get method, causing the API to receive a vector store ID where it expects a batch ID.
Code Location
File: polling.go
Method: VectorStoreFileBatchService.PollStatus
Line: 70
Current (Buggy) Code
func (r *VectorStoreFileBatchService) PollStatus(ctx context.Context, vectorStoreID string, batchID string, pollIntervalMs int, opts ...option.RequestOption) (*VectorStoreFileBatch, error) {
// ... other code ...
for {
batch, err := r.Get(ctx, batchID, vectorStoreID, opts...) // ❌ WRONG ORDER
// ... rest of method ...
}
}Expected (Correct) Code
func (r *VectorStoreFileBatchService) PollStatus(ctx context.Context, vectorStoreID string, batchID string, pollIntervalMs int, opts ...option.RequestOption) (*VectorStoreFileBatch, error) {
// ... other code ...
for {
batch, err := r.Get(ctx, vectorStoreID, batchID, opts...) // ✅ CORRECT ORDER
// ... rest of method ...
}
}Get Method Signature
The Get method expects parameters in this order:
func (r *VectorStoreFileBatchService) Get(ctx context.Context, vectorStoreID string, batchID string, opts ...option.RequestOption) (res *VectorStoreFileBatch, err error)Error Details
When the bug occurs, the API returns:
{
"message": "Invalid 'batch_id': 'vs_abcdef...'. Expected an ID that begins with 'vsfb_'.",
"type": "invalid_request_error",
"param": "batch_id",
"code": "invalid_value"
}The error occurs because:
- A vector store ID (starting with
vs_) is being passed as thebatch_idparameter - The API expects batch IDs to start with
vsfb_ - This happens because the vector store ID and batch ID are swapped in the method call
Reproduction Steps
- Create a vector store file batch
- Call
PollStatuson the batch - The method will fail with the "Invalid 'batch_id'" error
Example Usage
// This is the correct way to call PollStatus
batch, err := client.VectorStores.FileBatches.PollStatus(ctx, vectorStoreID, batchID, 0)Impact
- Severity: High - breaks core functionality for vector store file batch operations
- Affected Users: Anyone using
PollStatuswith vector store file batches - Workaround: Use the
Getmethod directly instead ofPollStatus
Proposed Fix
Change line 70 in polling.go from:
batch, err := r.Get(ctx, batchID, vectorStoreID, opts...)to:
batch, err := r.Get(ctx, vectorStoreID, batchID, opts...)Additional Context
This bug affects the polling functionality for vector store file batches, which is essential for monitoring the status of batch operations. The fix is a simple parameter swap that aligns with the method signature and API expectations.