-
Notifications
You must be signed in to change notification settings - Fork 6k
Closed
Labels
Description
计划通过MultiQueryRetriever来提升效果,找到了MultiQueryRetriever示例:
from langchain.chat_models import ChatOpenAI
from langchain.retrievers.multi_query import MultiQueryRetriever
question = "What are the approaches to Task Decomposition?"
llm = ChatOpenAI(temperature=0)
retriever_from_llm = MultiQueryRetriever.from_llm(
retriever=vectordb.as_retriever(), llm=llm
)
Set logging for the queries
import logging
logging.basicConfig()
logging.getLogger("langchain.retrievers.multi_query").setLevel(logging.INFO)
unique_docs = retriever_from_llm.get_relevant_documents(query=question)
len(unique_docs)
具体需要修改项目中knowledge_base_chat.py的哪些内容来实现MultiQueryRetriever?