client.vectorStores.create failed with 401

My UI for vector stores looks exactly as expected:

It looks like the platform site is using the file_batches endpoint, when uploads and attachments via the platform dashboard succeed; using this API URL is one approach you can try when you rewrite with more fault tolerance:

/v1/vector_stores/vs_69.../file_batches

One already cannot trust the .createAndPoll() method - it failed before by being too optimistic.

My own cl.vector_stores.files.create() use and then speculative error-tolerant cl.vector_stores.files.retrieve() poller is succeeding currently against my blank canvas of vector storage (after the expected failures of reading the newly-created file path):

-- Uploading file: vs_metadata_demo.py
   upload ok: file_id=file-5rSJwsPRTrpMg9p1cj27w1
-- Attaching file to vector store: vs_id=vs_699cd3c59cc48191adc18fff6b76fc49 file_id=file-5rSJwsPRTrpMg9p1cj27w1
   attach ok: vs_file_id=file-5rSJwsPRTrpMg9p1cj27w1
-- Listing check (immediate after attach (file1)): expecting file_id=file-5rSJwsPRTrpMg9p1cj27w1
   listing mismatch: file is NOT present (count=1)
-- Listing check (after 2s delay (file1)): expecting file_id=file-5rSJwsPRTrpMg9p1cj27w1
   listing mismatch: file is NOT present (count=1)
-- Polling vector store file status: vs_id=vs_699cd3c59cc48191adc18fff6b76fc49 file_id=file-5rSJwsPRTrpMg9p1cj27w1
   polling attempt 1/30: status=completed
   poll ok: terminal status=completed
-- File1 ready: file_id=file-5rSJwsPRTrpMg9p1cj27w1

Lesson: the code you write is the only code you can trust.

Click through the “reinforcement learning” about vector store service quality of this post to see code: creating your own polling method using the OpenAI SDK, although I’d encourage you to take control of the RESTful API request with your own code, also.


PS: polling until 404 to ensure removal also:

-- Cleanup starting
-- Deleting file: file-5rSJwsPRTrpMg9p1cj27w1
   delete ok: file-5rSJwsPRTrpMg9p1cj27w1
-- Deleting file: file-Fh37pLPEn6BqZnqaFXNYDa
   delete ok: file-Fh37pLPEn6BqZnqaFXNYDa
-- Deleting file: file-Fh37pLPEn6BqZnqaFXNYDa
NotFoundError: Error code: 404 - {'error': {'message': 'No such File object: file-Fh37pLPEn6BqZnqaFXNYDa', 'type': 'invalid_request_error', 'param': 'id', 'code': None}}
-- Deleting file: file-5rSJwsPRTrpMg9p1cj27w1
NotFoundError: Error code: 404 - {'error': {'message': 'No such File object: file-5rSJwsPRTrpMg9p1cj27w1', 'type': 'invalid_request_error', 'param': 'id', 'code': None}}
-- Deleting file: file-UN5xKa8AinnqYBJyaMYBWq
   delete ok: file-UN5xKa8AinnqYBJyaMYBWq
-- Deleting vector store: vs_699cd3c59cc48191adc18fff6b76fc49
   delete ok: vs_699cd3c59cc48191adc18fff6b76fc49
-- Cleanup done