@Teemu so this is what I have reasoned:
in case anyone has to deal with this in the near term:
- “import openai”
this has to be commented out.
and replaced with this:
"from openai import OpenAI
client = OpenAI()”
the way we call the openai API has changed from this:
# Call the GPT model
response = openai.ChatCompletion.create(
model='gpt-4-1106-preview',
messages=[{"role": "system", "content": prompt}]
)
to this:
response = client.chat.completions.create(
model='gpt-4-1106-preview',
messages=[{"role": "system", "content": prompt}]
)
- the way we process the output has changed from this:
model_output = response['choices'][0]['message']['content']
to this
model_output = response.choices[0].message.content