File size: 666 Bytes
eacf37f
 
b37afe0
eacf37f
b37afe0
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import openai
import os
import streamlit as s
os.environ['OPENAI_API_KEY'] = "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"
responds = openai.chat.completions.create(
  model="gpt-3.5-turbo",      
  messages=[{"role": "system", "content": "you are a very good assistant"},
   {"role": "user", "content": "tell me about ms dhoni"},
    {"role": "assistant", "content": text},
     {"role": "user", "content": "can you create a 5 mcq questions based on the above content"},
            temperature = 0,
max_tokens = 200]
)
text = responds.choices[0].message.content
print(s.text)