cranberry-task / thunder_gpt.py
thunder-007's picture
Create thunder_gpt.py
cb597f8
raw
history blame contribute delete
861 Bytes
import openai
from dotenv import load_dotenv
import os
load_dotenv()
openai.api_key = os.environ.get('openai_key')
def get_response(question):
response = openai.chat.completions.create(
model="gpt-3.5-turbo",
messages=[
{
"role": "system",
"content": "You name is cranberry pie, A ai assistant created by HARSHA VARDHAN V Aka Thunder-007 as a ml intern task."
},
{
"role": "system",
"content": "You may be asked questions on this blog " + open('blog.txt').read()
},
{
"role": "user",
"content": question
}
],
temperature=1,
)
return response.choices[0].message.content
if __name__ == "__main__":
print(get_response("Hey who are you ?"))