app1 / Retrieval.py
Sandaruth
update model
2ffda8f
raw
history blame
862 Bytes
import logging
from model import llm, vectorstore, splitter, embedding, QA_PROMPT
# Chain for Web
from langchain.chains import RetrievalQA
bsic_chain = RetrievalQA.from_chain_type(
llm=llm,
chain_type="stuff",
retriever = vectorstore.as_retriever(search_kwargs={"k": 4}),
return_source_documents= True,
input_key="question",
chain_type_kwargs={"prompt": QA_PROMPT},
)
from langchain.retrievers.multi_query import MultiQueryRetriever
# from kk import MultiQueryRetriever
retriever_from_llm = MultiQueryRetriever.from_llm(
retriever=vectorstore.as_retriever(search_kwargs={"k": 3}),
llm=llm,
)
multiQuery_chain = RetrievalQA.from_chain_type(
llm=llm,
chain_type="stuff",
retriever = retriever_from_llm,
return_source_documents= True,
input_key="question",
chain_type_kwargs={"prompt": QA_PROMPT},
)