Here’s the Python code I used in the class. I’m storing my key in the environment variable ‘OPENAI_API_KEY.’ Ram Subramaniam.
from openai import OpenAI import os openai.api_key = os.getenv("OPENAI_API_KEY") print ("\n") client = OpenAI(api_key=os.getenv("OPENAI_API_KEY")) mess = "beyond 120, any increment in IQ does not necessarily imply higher creativity" prompt = "restate the following statement: " + mess print ("Original Message : "+mess) for x in range (0, 5): chat_completion = client.chat.completions.create(messages=[{"role": "user", "content": prompt}, ],model="gpt-3.5-turbo") print("Revised Message : " +chat_completion.choices[0].message.content)