Chandranshu Jain commited on
Commit
5e306a5
1 Parent(s): 8f8a8f6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -22
app.py CHANGED
@@ -49,28 +49,6 @@ def response_generate(text,query):
49
  qa = RetrievalQA.from_chain_type(llm = GoogleGenerativeAI(model="gemini-pro", google_api_key=GOOGLE_API_KEY ), chain_type='stuff', retriever=retriever)
50
  return qa.run(query_text)
51
 
52
- def get_conversational_chain():
53
- prompt_template = """
54
- Answer the question as detailed as possible from the provided context, make sure to provide all the details, if the answer is not in
55
- provided context just say, "answer is not available in the context", don't provide the wrong answer\n\n
56
- Context:\n {context}?\n
57
- Question: \n{question}\n
58
-
59
- Answer:
60
- """
61
- model = ChatGoogleGenerativeAI(model="gemini-pro", temperature=0.3, google_api_key=GOOGLE_API_KEY)
62
- prompt = PromptTemplate(template=prompt_template, input_variables=["context", "question"])
63
- chain = load_qa_chain(model, chain_type="stuff", prompt=prompt)
64
- return chain
65
-
66
- def user_call(query):
67
- embeddings = GoogleGenerativeAIEmbeddings(model="models/embedding-001")
68
- db3 = Chroma(persist_directory="./chroma_db", embedding_function=embeddings)
69
- docs = db3.similarity_search(query)
70
- chain = get_conversational_chain()
71
- response = chain({"input_documents": docs, "question": query}, return_only_outputs=True)
72
- #st.write("Reply: ", response["output_text"])
73
-
74
  def main():
75
  st.header("Chat with your pdf💁")
76
 
 
49
  qa = RetrievalQA.from_chain_type(llm = GoogleGenerativeAI(model="gemini-pro", google_api_key=GOOGLE_API_KEY ), chain_type='stuff', retriever=retriever)
50
  return qa.run(query_text)
51
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52
  def main():
53
  st.header("Chat with your pdf💁")
54