File size: 463 Bytes
a77281d
 
 
 
 
f3fbeb9
be2c0d0
f3fbeb9
a77281d
 
 
 
f3fbeb9
a77281d
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import openai
import os
import streamlit as s
os.environ["OPENAI_API_KEY"]="sk-proj-uHasdgbriPPlFMm99ZtJT3BlbkFJOl231YfdxCSNmQjVEpMX"


q=s.text_input("type any message")

responds=openai.chat.completions.create(
  model="gpt-3.5-turbo",
  messages=[
    {"role": "system", "content": "you are a very good assistant"},# set the behaviour of 
    {"role": "user", "content":q}
  ],
  temperature=0,
  max_tokens=200

)
s.write(responds.choices[0].message.content)