Menu

Post image 1
Post image 2
1 / 2
0

What is Hybrid search in RAGs?

DEV Community·Rushank Savant·about 1 month ago
#C8BhYYnp
#ai#rag#langchain#python#bm25#search
Reading 0:00
15s threshold

⚠️Need of Hybrid Search We have documents containing error codes in python with their respective definitions and use-cases. User writes a query to know about "What is ERR_404_AUTH?" Classic Rag: Will retrieve all the authentication and error related context it can find from vector db (document embeddings). Lexical search: Will search for terms ["What", "is", "ERR_404_AUTH"] Hybrid search: Will search for keyword "ERR_404_AUTH" and retrieve semantically similar documents using similarity search. 🛠️Using BM25 Take BM25 as extended version of TF-IDF for key-word based search. The step-wise implementation of BM25 in LangChain is straightforward because LangChain provides a built-in BM25Retriever . Here is the step-wise implementation alongside the intuition. # pip install rank_bm25 from langchain_community.retrievers import BM25Retriever from langchain_core.documents import Document # Chunks from your text splitter chunks = [ Document ( page_content = " The AX-705 engine uses a 4-stroke cycle.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More