Create week1day1.ipynb
My week 1 day 1 homework
This commit is contained in:
23
week1/community-contributions/week1day1.ipynb
Normal file
23
week1/community-contributions/week1day1.ipynb
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
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
|
||||||
Reference in New Issue
Block a user