I’m trying to integrate the new OpenAI Assistants API into my application, but I’m facing some problems. I’ve already created an assistant using the API, but when trying to make calls to it, I’m getting errors. Here are the details:
Main Error: When I make a request using the assistant_id, I receive the error message: “unrecognized request argument supplied: assistant_id”. This suggests that the parameter is not recognized, despite following the documentation.
Attempts: I tried making calls in different ways, including creating threads, but I keep getting errors related to thread and assistant. I also tried doing it just with the wizard, without success.
Setup: I’m using the latest version of the OpenAI library (openai), but I’m still facing these issues.
Objective: I want to use the assistant that I already created in the API and be able to interact with it properly.
Has anyone experienced this or have any ideas on how to resolve it? I appreciate any help!
Below is the photo of the working code creating an assistant, the problem is when I try to use my assistant trained on the openai api.
The example in your image did use chat completion endpoint, nothing to do with assistant api.
To learn how to use assistant api you need to look at official docs carefully or search some examples like this:
If you really created an assistant and get assistant_id(asst_xxxx), you need to create a thread, append message(user input) to that thread, and create a run assigning your assistant_id, then do a loop to wait(pooling with some sleep time) the run status to complete then get the assistant response from message list. You may want assistant to streaming result, which a bit more complicated, and need search related examples.
And VERY import, you leak your openai apikey on above image which is VERY bad, delete that key and create a new one instead and don’t leak it again to public, or anyone can use your key to call api and you will pay for them.
Thank you for your concern about the API Key, I deleted it as soon as I posted the question.
I’m a junior developer, and I’m creating this project with the help of chatgpt, but there are many errors and the assistants API is complicated for me.
Could you help me develop this code? or point me where I should fix it?
I’ve read and reread the api and I can’t make it work.