File size: 824 Bytes
1bf76d8 a1bd586 1bf76d8 a1bd586 1bf76d8 a1bd586 1bf76d8 a1bd586 1bf76d8 a1bd586 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
from openai import OpenAI
import streamlit as st
st.markdown('''
Hey there, I wrote a book titled "**:purple[Hands-On Retrieval-Augmented Generation]**," which includes this interactive example. If you\'re interested in exploring more practical applications of Retrieval-Augmented Generation, be sure to [check it out](https://retrieval-augmented-generation.com)!
''')
st.header('Question-Answering System', divider='rainbow')
client = OpenAI(api_key=st.secrets["OPENAI_API_KEY"])
text_search = st.text_input("Ask a question", value="")
if st.button("Ask"):
with st.spinner("Searching for an answer..."):
response = client.chat.completions.create(
model="gpt-3.5-turbo",
messages=[{"role": "user", "content": text_search}],
stream=False,
)
st.write(response) |