24 lines
666 B
Plaintext
24 lines
666 B
Plaintext
import os
|
|
import requests
|
|
from dotenv import load_dotenv
|
|
from bs4 import BeautifulSoup
|
|
from IPython.display import Markdown, display
|
|
from openai import OpenAI
|
|
|
|
load_dotenv(override=True)
|
|
api_key = os.getenv('OPENAI_API_KEY')
|
|
|
|
openai = OpenAI()
|
|
|
|
client = OpenAI(api_key=os.getenv("OPENAI_API_key"))
|
|
|
|
system_prompt = "You are an student. Always maintain a polite and professional tone."
|
|
|
|
user_prompt = "Write a 500-word essay on the impact of social media on modern society, including the benefits and drawbacks."
|
|
|
|
messages =[
|
|
{"role": "system", "content": system_prompt},
|
|
{"role": "user", "content": user_prompt}
|
|
]
|
|
response = openai.chat.completions.create(m
|