Skip to content

Commit

Permalink
fix: upgrade rerankers and remove flashrank patch (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
lsorber authored Nov 22, 2024
1 parent cd967d1 commit 714c68f
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 52 deletions.
15 changes: 8 additions & 7 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ pydantic = ">=2.7.0"
pynndescent = ">=0.5.12"
# Reranking:
langdetect = ">=1.0.9"
rerankers = { extras = ["flashrank"], version = ">=0.5.3" }
rerankers = { extras = ["flashrank"], version = ">=0.6.0" }
# Storage:
pg8000 = ">=1.31.2"
sqlmodel-slim = ">=0.0.18"
Expand Down
3 changes: 1 addition & 2 deletions src/raglite/_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@
from llama_cpp import llama_supports_gpu_offload
from sqlalchemy.engine import URL

from raglite._flashrank import PatchedFlashRankRanker as FlashRankRanker

# Suppress rerankers output on import until [1] is fixed.
# [1] https://github.com/AnswerDotAI/rerankers/issues/36
with contextlib.redirect_stdout(StringIO()):
from rerankers.models.flashrank_ranker import FlashRankRanker
from rerankers.models.ranker import BaseRanker


Expand Down
41 changes: 0 additions & 41 deletions src/raglite/_flashrank.py

This file was deleted.

2 changes: 1 addition & 1 deletion tests/test_rerank.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
"""Test RAGLite's reranking functionality."""

import pytest
from rerankers.models.flashrank_ranker import FlashRankRanker
from rerankers.models.ranker import BaseRanker

from raglite import RAGLiteConfig, hybrid_search, rerank_chunks, retrieve_chunks
from raglite._database import Chunk
from raglite._flashrank import PatchedFlashRankRanker as FlashRankRanker


@pytest.fixture(
Expand Down

0 comments on commit 714c68f

Please sign in to comment.