Im new to the Openai API and I am trying to experiment with assistants. I have installed the SDK and stored my API Key as a system variable. When following the steps in the QuickStart I am running into the error of not getting a response from my assistant and the output simply just says failed. Here is my code.
from openai import OpenAI
client = OpenAI()
assistant = client.beta.assistants.create(
name="Math Tutor",
instructions="You are a personal math tutor. Write and run code to answer math questions.",
tools=[{"type": "code_interpreter"}],
model="gpt-4o-mini",
)
thread = client.beta.threads.create()
message = client.beta.threads.messages.create(
thread_id=thread.id,
role="user",
content="I need to solve the equation `3x + 11 = 14`. Can you help me?"
)
run = client.beta.threads.runs.create_and_poll(
thread_id=thread.id,
assistant_id=assistant.id,
instructions="Please address the user as Jane Doe. The user has a premium account."
)
if run.status == 'completed':
messages = client.beta.threads.messages.list(
thread_id=thread.id
)
print(messages)
else:
print(run.status)
1 Like
I’m getting the same, a “failed” status that just says LastError(code='server_error', message='Sorry, something went wrong.')
status.openai.com doesn’t have any info on gpt-4o-mini not working.
I’m also using client.beta.threads.create_and_run()
since that’s mentioned in the API docs and I’m using tools.
I would love some clarification here on what’s best to use. I do my own polling with a handler for when there is a 'requires_action'
in order to submit my tool outputs.
I also have another assistant with tools on 'gpt-4o'
(not mini) I’ve been using that has been working fine, although I’m not using the create_and_run()
method, I’m doing that manually. I’ll try that with my mini assistant and report back.
1 Like
My responses are still failing. Same lack of reason given, the status page should reflect this. For all intents and purposes gpt-4o-mini is down. It seems to work on the playground, not sure what’s special about my API calls.
Edit 08-03:
I switched to using gpt-3.5-turbo
(the only change I made) and now it’s working. So very clearly there’s an issue with gpt-4o-mini
which should be reflected in the status page.
2 Likes