Chandranshu Jain commited on
Commit
85b3a3f
1 Parent(s): 3bbb573

Update app3.py

Browse files
Files changed (1) hide show
  1. app3.py +3 -1
app3.py CHANGED
@@ -7,6 +7,7 @@ from langchain_community.vectorstores import Chroma
7
  from langchain_google_genai import ChatGoogleGenerativeAI
8
  from langchain.chains.question_answering import load_qa_chain
9
  from langchain.prompts import PromptTemplate
 
10
 
11
  st.set_page_config(page_title="Document Genie", layout="wide")
12
 
@@ -56,7 +57,8 @@ def get_pdf(pdf_docs,query):
56
  chunks=text_splitter.split_text(text)
57
  embeddings = GoogleGenerativeAIEmbeddings(model="models/embedding-001")
58
  vector = Chroma.from_documents(chunk, embeddings)
59
- docs = vector.similarity_search(query)
 
60
  chain = get_conversational_chain()
61
  response = chain({"input_documents": docs, "question": query}, return_only_outputs=True)
62
  return response
 
7
  from langchain_google_genai import ChatGoogleGenerativeAI
8
  from langchain.chains.question_answering import load_qa_chain
9
  from langchain.prompts import PromptTemplate
10
+ from langchain.chains import RetrievalQA
11
 
12
  st.set_page_config(page_title="Document Genie", layout="wide")
13
 
 
57
  chunks=text_splitter.split_text(text)
58
  embeddings = GoogleGenerativeAIEmbeddings(model="models/embedding-001")
59
  vector = Chroma.from_documents(chunk, embeddings)
60
+ #docs = vector.similarity_search(query)
61
+ docs = vector_store.as_retriever(search_type='similarity', search_kwargs={'k': 3})
62
  chain = get_conversational_chain()
63
  response = chain({"input_documents": docs, "question": query}, return_only_outputs=True)
64
  return response