Hi,
I am trying to set up a python script and create/ access an assistant.
But I am failing to get the script run at all…
I get the error message: from openai import OpenAI
ImportError: cannot import name ‘OpenAI’ from ‘openai’
OpenAI version
pip show openai
Name: openai
Version: 1.2.3
My script so far looks like this:
import os
import openai
from openai import OpenAI
openai.api_key = os.getenv("OPENAI_API_KEY")
client = OpenAI()
my_assistant = client.beta.assistants.create(
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": "code_interpreter"}],
model="gpt-4",
)
print(my_assistant)
thread = client.beta.threads.create()
message = client.beta.threads.messages.create(
thread_id = thread.id,
role = "user",
content = "Help me devide 10 by pi"
)
run = client.beta.threads.runs.create(
thread_id = thread.id,
assistant_id = assistant.id,
instruction = "Please helpt the user."
)
import time
time.sleep(10)
print(run)
run_status = client.beat.threads.run.retrieve(
thread_id = thread.id,
run_id = run.id
)
type or paste code here
Any ideas?