The assistants created through the web UI, that are using retrieval or file search, worked ok in version 1 but they do not work in version 2.
I think that the root cause is that the web UI for creating assistants is not working as expected.
It is creating incorrect assistants with the tool type of “retrieval” instead of “file_search”
See: “tools”: [ { “type”: “retrieval” }]
Moreover the vector store and the file attached are not part of the assistant object, so they are never used.
It is a misleading bug because the assistant seems to work but it never uses the vector store, so it responds with messages like this: “It looks like there aren’t any documents uploaded to search for information about …”.
I hope that we will hear from OpenAI and this bug gets fixed soon.
A possible workaround is to update the assistant programmatically and force it to use “tools”: [ { “type”: “file_search” }]
How to test?
Run this node script that would list all assistants:
// node script to retrieve all assistants
// use: node list-assistants
const OpenAI = require('openai');
async function retrieveAssistants() {
console.log("Starting retrieval process...");
try {
console.log("API Key:", process.env.OPENAI_API_KEY);
const openai = new OpenAI({
apiKey: process.env.OPENAI_API_KEY
})
const myAssistants = await openai.beta.assistants.list({
order: "desc",
limit: "20",
});
console.log(`myAssistants: \n${JSON.stringify(myAssistants, null, 2)} \n`);
} catch (error) {
console.error('Error retrieving assistant:', error);
}
}
retrieveAssistants();
Or run this script that list an assistant by ID:
// node script to retrieve an assistant by ID
// use: node list1-assistant.js asst_1234567890
const OpenAI = require('openai');
async function retrieveAssistant(assistant_id) {
console.log("Starting retrieval process...");
try {
console.log("API Key:", process.env.OPENAI_API_KEY);
const openai = new OpenAI({
apiKey: process.env.OPENAI_API_KEY
})
const myAssistant = await openai.beta.assistants.retrieve(assistant_id);
console.log(`myAssistant:\n${JSON.stringify(myAssistant, null, 2)} \n`);
} catch (error) {
console.error('Error retrieving assistant:', error);
}
}
const args = process.argv.slice(2);
if (args.length === 0) {
console.error('Please provide an assistant ID as an argument.');
process.exit(1);
}
const assistantId = args[0];
console.log("Assistant ID provided:", assistantId);
retrieveAssistant(assistantId);