Chatbot+Code
Chatbot+Code
with st.sidebar:
st.title("Your Documents")
file = st.file_uploader(" Upload a PDf file and start asking questions",
type="pdf")
# generating embedding
embeddings = OpenAIEmbeddings(openai_api_key=OPENAI_API_KEY)
# do similarity search
if user_question:
match = vector_store.similarity_search(user_question)
#st.write(match)
#output results
#chain -> take the question, get relevant document, pass it to the LLM,
generate the output
chain = load_qa_chain(llm, chain_type="stuff")
response = chain.run(input_documents = match, question = user_question)
st.write(response)