converting to pydantic-settings
This commit is contained in:
@@ -35,7 +35,6 @@ if TYPE_CHECKING:
|
||||
from python.ebook_search.config import EbookSearchConfig
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
BM25_CANDIDATE_LIMIT = 120
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
@@ -111,6 +110,7 @@ def search_ebooks(
|
||||
reciprocal_rank_fusion,
|
||||
retrieval.vector_results,
|
||||
retrieval.lexical_results,
|
||||
rank_constant=config.rrf_rank_constant,
|
||||
)
|
||||
timings.append(timing)
|
||||
if config.rerank.enabled and rerank:
|
||||
@@ -216,7 +216,7 @@ def vector_candidates(engine: Engine, query: str, config: EbookSearchConfig) ->
|
||||
raise ValueError(msg)
|
||||
|
||||
embedding = embed_query(query, config)
|
||||
limit = max(config.rerank.candidates, config.top_k) * 4
|
||||
limit = max(config.rerank.candidates, config.top_k) * config.vector_candidate_multiplier
|
||||
embedding_table = get_embedding_table(model.dimension)
|
||||
|
||||
embedding_param = literal(embedding, type_=Vector(model.dimension))
|
||||
@@ -263,7 +263,7 @@ def bm25_candidates(query: str, config: EbookSearchConfig) -> list[SearchResult]
|
||||
logger.info("ebook_bm25_search_complete corpus=0 candidates=0")
|
||||
return []
|
||||
|
||||
scored_records = score_bm25_corpus(query, corpus, limit=BM25_CANDIDATE_LIMIT)
|
||||
scored_records = score_bm25_corpus(query, corpus, limit=config.bm25_candidate_limit)
|
||||
results = [
|
||||
replace(search_result_from_row(record), score=score, vector_score=None, bm25_score=score)
|
||||
for record, score in scored_records
|
||||
|
||||
Reference in New Issue
Block a user