RegBot4.0 / app.py
Zwea Htet
added langchain to ui
19f4fce
raw
history blame
No virus
821 Bytes
# https://docs.streamlit.io/knowledge-base/tutorials/build-conversational-apps
import os
import openai
import requests
import streamlit as st
from utils.util import *
st.set_page_config(page_title="RegBotBeta", page_icon="📜🤖")
st.title("Welcome to RegBotBeta2.0")
st.header("Powered by `LlamaIndex🦙`, `Langchain🦜🔗 ` and `OpenAI API`")
api_key = st.text_input("Enter your OpenAI API key here:", type="password")
if api_key:
resp = validate(api_key)
if "error" in resp.json():
st.info("Invalid Token! Try again.")
else:
st.info("Success")
os.environ["OPENAI_API_KEY"] = api_key
openai.api_key = api_key
if "openai_api_key" not in st.session_state:
st.session_state.openai_api_key = ""
st.session_state.openai_api_key = api_key