Can someone please fix the documentation?

The python code for this documentation just doesn’t work:

https://platform.openai.com/docs/assistants/tools/file-search

I had to change “file_search” to “retrieval”, and the second cell just doesn’t work at all. Get the following error about vector_stores:


AttributeError Traceback (most recent call last)
Cell In[208], line 2
1 # Create a vector store caled “Financial Statements”
----> 2 vector_store = client.beta.vector_stores.create(name=“policy Statements”)
4 # Ready the files for upload to OpenAI
5 file_paths = [r"C:\Users\squir\Downloads\baseline__statements.csv"]

AttributeError: ‘Beta’ object has no attribute ‘vector_stores’

The demonstrations rely on you using the latest OpenAI SDK client, which sends “Assistants=v2” headers to employ the correct API set. That is what unlocks vector stores and prevents use of retrieval.

For your installation or venv of Python, you would need to pip install --upgrade "openai>1.30"

Then you get: extra_headers = {"OpenAI-Beta": "assistants=v2", **(extra_headers or {})}

See if that doesn’t improve the symptom if you again continue with the demonstration code for creating a vector store.

2 Likes