Spaces:
				
			
			
	
			
			
		Sleeping
		
	
	
	
			
			
	
	
	
	
		
		
		Sleeping
		
	Update app.py
Browse files
    	
        app.py
    CHANGED
    
    | @@ -107,13 +107,14 @@ if query and st.session_state.documents_loaded: | |
| 107 | 
             
                    # Initialize Google Generative AI
         | 
| 108 | 
             
                    llm = GoogleGenerativeAI(model='gemini-1.0-pro', google_api_key="AIzaSyC1AvHnvobbycU8XSCXh-gRq3DUfG0EP98")
         | 
| 109 |  | 
| 110 | 
            -
             | 
|  | |
| 111 | 
             
                    qa_prompt = PromptTemplate(template="Answer the following question based on the context provided:\n\nContext: {context}\n\nQuestion: {question}\n\nAnswer:", input_variables=["context", "question"])
         | 
| 112 |  | 
| 113 | 
             
                    # Create the retrieval QA chain
         | 
| 114 | 
             
                    qa_chain = RetrievalQA.from_chain_type(
         | 
| 115 | 
             
                        retriever=st.session_state.vector_store.as_retriever(),
         | 
| 116 | 
            -
                        chain_type=" | 
| 117 | 
             
                        llm=llm,
         | 
| 118 | 
             
                        chain_type_kwargs={"prompt": qa_prompt}
         | 
| 119 | 
             
                    )
         | 
|  | |
| 107 | 
             
                    # Initialize Google Generative AI
         | 
| 108 | 
             
                    llm = GoogleGenerativeAI(model='gemini-1.0-pro', google_api_key="AIzaSyC1AvHnvobbycU8XSCXh-gRq3DUfG0EP98")
         | 
| 109 |  | 
| 110 | 
            +
             | 
| 111 | 
            +
                    #Create a PromptTemplate for the QA chain
         | 
| 112 | 
             
                    qa_prompt = PromptTemplate(template="Answer the following question based on the context provided:\n\nContext: {context}\n\nQuestion: {question}\n\nAnswer:", input_variables=["context", "question"])
         | 
| 113 |  | 
| 114 | 
             
                    # Create the retrieval QA chain
         | 
| 115 | 
             
                    qa_chain = RetrievalQA.from_chain_type(
         | 
| 116 | 
             
                        retriever=st.session_state.vector_store.as_retriever(),
         | 
| 117 | 
            +
                        chain_type="stuff",
         | 
| 118 | 
             
                        llm=llm,
         | 
| 119 | 
             
                        chain_type_kwargs={"prompt": qa_prompt}
         | 
| 120 | 
             
                    )
         |