Spaces:
Sleeping
Sleeping
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}, | |
) |