import openai
OPENAI_API_KEY = ''
OPENAI_AZURE_ENDPOINT = ''
OPENAI_API_TYPE = 'azure'
OPENAI_API_VERSION = '2023-05-15'
openai.api_key = OPENAI_API_KEY
openai.azure_endpoint = OPENAI_AZURE_ENDPOINT
openai.api_type = OPENAI_API_TYPE
openai.api_version = OPENAI_API_VERSION
query = 'Who is Hellen Keller'
result = openai.chat.completions.create(
model = 'dev-gpt-35-turbo',
messages=[
{'role':'system', 'content':'You are a helpful assistant.'},
{'role':'user', 'content':query}
]
)
print(result.choices[0].message.content)

import streamlit as st
st.header('Welcome to GPT Bot!',
divider='rainbow')
-> 저장 후 웹사이트 rerun하면,

import streamlit as st
st.header('Welcome to GPT Bot!',
divider='rainbow')
st.write('Welcome to GPT Chatbot')
query = st.text_input('Query: ')
if query:
st.write('Your query is '+query)
button_result = st.button('RUN')
if button_result:
st.write('Thanks!!')
-> 결과
