Assistant API - tools: [{ type: 'retrieval' }] not allowing any more

couple of months ago I started working with openAI assistant. I created a simple pdf analyzer. I implemented using Nodejs. (“openai”: “^4.31.0”,). When I created the application it worked fine. But reasonly when i delete the all the node_module and installed. then I’m getting an error saying “rgument type {instructions: string, name: string, model: “gpt-3.5-turbo”, tools: {type: “retrieval”}} is not assignable to parameter type AssistantCreateParams”. Seems like now " tools: [{ type: ‘retrieval’ }]" is not working.

below is the code that used to work.

const assistant = await openai.beta.assistants.create({
      name: 'recruiter',
      instructions: 'Analyze the give 'file IDs' and return an summary"
      tools: [{ type: 'retrieval' }],
      model: 'gpt-3.5-turbo',
"file_ids": [
    "file-0EtPDfxuS6IUS1AWBY5BNDty",
    "file-5wFhHiCae4ygard1O1aKc2jM",
  ]
    });

but the best thing is curl version of above code is working perfectly in potsman. I started installing the latest openAI version also. but still same.
Please note that I’m new for openAI.

Have you tried to specify the v1 version of the assistant API?

client = OpenAI(api_key=OPENAI_API_KEY,
default_headers={“OpenAI-Beta”: “assistants=v1”})

2 Likes

@arakonaut is correct. Make sure now you mention the Assistant version as V2 is already out. Try updating your libraries and moving your assistant to V2 if you like.

2 Likes

thanks , when i use assistants=v1, it worked. I removed the npm library and used the curl command.

1 Like

Based on the updated version of the assistants API V2 the retrieval tool was replaced by ‘file_search’ parameter instead of ‘retrieval’. This expands the capabilities of this tool, but it may generate errors in your programs since the migration to V2 is very recent. suggest you to check out this section of the official documentation.

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