Assistants API version 2 cannot see the uploaded information

The assistant responds with “It looks like there aren’t any documents uploaded to search for information about …”.
It worked fine few days ago.
It works OK in the playground.
The assistant has the file search turned on and has an associated vector store that includes the correct files.
How can we troubleshoot this issue?
It is a bit strange that every thread creates a new vector store of size zero and it references this new created vector store.

Did you pass the Vector Store ID to the Assistant?

I did that at
https://platform.openai.com/assistants
setting up “file search” with a vector store that contain the specific files.
I that enough?

I am not sure if there are breaking changes between v1 and v2 and I need to establish that link specifically through the API.
I use Vercel AI SDK (useAssistant and AssistantResponse), so the calls are not completely transparent to me.

@MrFriday do we pass the Vector Store ID to the Assistant?
See also the post above.

Yes, like this:

curl "https://api.openai.com/v1/assistants" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "OpenAI-Beta: assistants=v2" \
  -d '{
    "instructions": "You are a personal math tutor. When asked a question, write and run Python code to answer the question.",
    "name": "Math Tutor",
    "tools": [{"type": "file_search"}],
    "model": "gpt-4-turbo",
	"tool_resources": {
      "file_search": {
        "vector_store_ids": ["VECTOR_STORE_FILE_ID"]
      }
    }
  }'

@MrFriday, I am using JavaScript and until few days ago it worked just passing Assistant Id.
At least for now I am using the OpenAI portal to configure the assistant with all the tools and files associated with it and then I just call it using the Assistant Id and the OpenAI API key.
The Assistant Id should have all the tools and files associated with it.
Something happed on the transition from v1 to v2 and the “file search” does not work anymore.
The curl command above does not make lot of sense to me because it does not refer to Assistant Id. Does it create an assistant on the fly every single call?

@MrFriday, I think that the root cause is that the web UI is not working as expected.
It is creating incorrect assistants with the tool type of “retrieval” instead of file “file_search”
See: “tools”: [ { “type”: “retrieval” }]

The above code is to create the assistant. If your assistant is creating a tool of type Retrieval, then it means you have a v1 assistant. You mentioned that you are using UI to create Assistant? There’s a small toggle button at assistant UI that make you switch between V1 assistant and V2 assistant.

1 Like

@MrFriday, I wrote a script to retrieve the assistants properties after they were created using the OpenAI vers 2 web user interface and they were all of type : [ { “type”: “retrieval” }] (version 1 ) instead of [ { “type”: “file_search” }] (version 2).
I think that upgrading the nodejs library to the latest version (openai": “^4.38.2”) and maybe some updates on the OpenAI side fixed the issue.
It works ok now.

2 Likes

This work to me!!

In the playground the assistant works well with the files provided, but in the API don´t use the files, giving random answers, but when I include the “tool_resources” with the vector store file id in the run call, it works fine!!!

Try it!!

1 Like