Adding keyword-based search to privategpt #1599
cloudrage999
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
hi guys, i as wondering can anybody implement this feature in this project ? because it will give much accurate results
i have a sample code snippet that may help you:
vectorstore_retriever = vectorstore.as_retriever(search_kwargs={"k": 3, "search_type": "mmr"})
keyword_retriever = BM25Retriever.from_documents(chunks)
keyword_retriever.k = 3
ensemble_retriever = EnsembleRetriever(
retrievers=[vectorstore_retriever, keyword_retriever],
retriever_weights={"vectorstore_retriever": 0.5, "keyword_retriever": 0.5},
search_kwargs={"search_type": "mmr"}
)
Beta Was this translation helpful? Give feedback.
All reactions