New API endpoint calls and Result Extraction

Hi Folks !

With the recent change in the API endpoint, just thought I’d put out the calls and extraction that worked for me in Python and hopefully, will make the transition easier for others as well.

Currently running openai module version 1.1.1

from openai import OpenAI

client = OpenAI()
output = client.chat.completions.create(model=model, temperature=0.1, messages=message)

  • Messages are in the same format as previous

op = output.choices
res_lst =
for res in op:
res_lst.append(res.message.content)

result = res_lst[0].strip()

Simple and unoptimised, but is working consistently for me

1 Like