File size: 549 Bytes
7325f6e
4f708f6
a98b8cc
 
7325f6e
a98b8cc
f0381b3
 
4f708f6
a98b8cc
 
4f708f6
 
 
 
a98b8cc
f0381b3
a98b8cc
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import streamlit as st
from utils.rag_chain import build_rag_chain
from dotenv import load_dotenv
import os

load_dotenv()
st.set_page_config(page_title="RAG Chatbot")
st.title("Ask about Shivaji Maharaj")

api_key = os.getenv("GOOGLE_API_KEY")
qa_chain = build_rag_chain(api_key)

query = st.text_input("Ask something about your documents")

if query:
    answer, retrieved_docs = qa_chain(query)
    st.markdown(f"**Answer:** {answer}")
    with st.expander("Show supporting context"):
        for doc in retrieved_docs:
            st.write(doc)