Add bge-reranker-v2-m3; fix metadata and chunking bugs

This commit is contained in:
Eric Furst 2026-09-20 12:01:11 -04:00
commit 24a38ac43f
8 changed files with 149 additions and 23 deletions

View file

@ -15,7 +15,7 @@
# at import time.
import os
os.environ["TOKENIZERS_PARALLELISM"] = "false"
os.environ["SENTENCE_TRANSFORMERS_HOME"] = "./models"
os.environ["HF_HUB_CACHE"] = "./models" # HF hub cache for offline model loads
os.environ["HF_HUB_OFFLINE"] = "1"
from llama_index.core import (
@ -37,7 +37,9 @@ import textwrap
EMBED_MODEL = HuggingFaceEmbedding(cache_folder="./models", model_name="BAAI/bge-large-en-v1.5", local_files_only=True)
# Cross-encoder model for re-ranking (cached in ./models/)
RERANK_MODEL = "cross-encoder/ms-marco-MiniLM-L-12-v2"
# Must match query_hybrid.py -- see the note there on why this replaced
# cross-encoder/ms-marco-MiniLM-L-12-v2.
RERANK_MODEL = "BAAI/bge-reranker-v2-m3"
RERANK_TOP_N = 15
# Retrieval parameters