RAG_sample_more_documents / backend /semantic_search.py
AlexKagan's picture
change generative model
f17e11c
raw
history blame
477 Bytes
import logging
import lancedb
import os
from pathlib import Path
from sentence_transformers import SentenceTransformer
EMB_MODEL_NAME = "thenlper/gte-base"
DB_TABLE_NAME = "Huggingface_docs"
# Setting up the logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
retriever = SentenceTransformer(EMB_MODEL_NAME)
# db
db_uri = os.path.join(Path(__file__).parents[1], ".lancedb")
db = lancedb.connect(db_uri)
table = db.open_table(DB_TABLE_NAME)