Machine Learning, Python

Consuming Chatgpt API in Python

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)
Career Management, Entrepreneurship, Fintech, Python, Tech

IIT Madras launches online Bachelor, Diploma in Datascience and Programming

It’s here finally! It has been my dream that a reputed school in India offer an online undergrad degree in Computer Science and now IIT-M is doing it. Now it’s open to all. Well, almost to all. I wish IIT-M opened it to all, not solely to those who completed 12th grade! I see a big demand for this course and wish IIT-M success. This is going to open doors to so many poor, bright students. Please send me your views to my Stanford email ID.


null