πHybrid Retrievers
Enhancing Retrieval Accuracy
Code Example: Hybrid Retrievers
1. Load and Process the Data
# fit the data from the pdf file
from beyondllm.source import fit
data = fit(path="path/to/your/pdf/file.pdf", dtype="pdf", chunk_size=512, chunk_overlap=100)2. Load Embedding Model
# Load the embedding model from Hugging Face Hub
from beyondllm.embeddings import HuggingFaceEmbeddings
embed_model = HuggingFaceEmbeddings(model_name="sentence-transformers/all-MiniLM-L6-v2")3. Initialize Retriever with Hybrid Search
4. Load LLM for Evaluation and Generation
5. Evaluate Retriever Performance
6. Generate Response and Evaluate LLM Output
Explanation of Evaluation Outputs:
Last updated