File size: 502 Bytes
1bdec92
56635d2
1bdec92
257894f
91fbeea
 
 
 
c7d6cd8
63ae6b3
1bdec92
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
from langchain.chains import RetrievalQA
#from Api_Key import google_plam
from langchain.llms import GooglePalm
import os
from dotenv import load_dotenv
load_dotenv()
os.getenv("GOOGLE_API_KEY")
google_plam = os.getenv("GOOGLE_API_KEY")


def Q_A(vectorstore,question):
    google_llm = GooglePalm(google_api_key=google_plam, temperature=0.5)
    qa = RetrievalQA.from_chain_type(llm=google_llm, chain_type="stuff", retriever=vectorstore.as_retriever())
    answer = qa.run(question)

    return answer