Mr-TD's picture
Update QnA.py
257894f verified
raw
history blame
502 Bytes
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