Skip to content

Commit

Permalink
fix: Improve imports for new rankers (#5696)
Browse files Browse the repository at this point in the history
* Proper imports for new rankers

* Small fix
  • Loading branch information
vblagoje committed Aug 31, 2023
1 parent 7d39184 commit 11afa0a
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion examples/talk_to_website.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from haystack import Pipeline
from haystack.document_stores import InMemoryDocumentStore
from haystack.nodes import PromptNode, PromptTemplate, TopPSampler
from haystack.nodes.ranker.lost_in_the_middle import LostInTheMiddleRanker
from haystack.nodes.ranker import LostInTheMiddleRanker
from haystack.nodes.retriever.web import WebRetriever

search_key = os.environ.get("SERPERDEV_API_KEY")
Expand Down
5 changes: 2 additions & 3 deletions examples/web_lfqa_with_rankers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@

from haystack import Pipeline
from haystack.nodes import PromptNode, PromptTemplate, TopPSampler
from haystack.nodes.ranker.diversity import DiversityRanker
from haystack.nodes.ranker.lost_in_the_middle import LostInTheMiddleRanker
from haystack.nodes.retriever.web import WebRetriever
from haystack.nodes.ranker import DiversityRanker, LostInTheMiddleRanker
from haystack.nodes.retriever import WebRetriever

search_key = os.environ.get("SERPERDEV_API_KEY")
if not search_key:
Expand Down
3 changes: 3 additions & 0 deletions haystack/nodes/ranker/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
from haystack.nodes.ranker.base import BaseRanker
from haystack.nodes.ranker.sentence_transformers import SentenceTransformersRanker
from haystack.nodes.ranker.cohere import CohereRanker
from haystack.nodes.ranker.lost_in_the_middle import LostInTheMiddleRanker
from haystack.nodes.ranker.diversity import DiversityRanker
from haystack.nodes.ranker.recentness_ranker import RecentnessRanker
2 changes: 1 addition & 1 deletion haystack/nodes/ranker/diversity.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from pathlib import Path
from typing import List, Literal, Optional, Union

from haystack.nodes import BaseRanker
from haystack.nodes.ranker.base import BaseRanker
from haystack.schema import Document
from haystack.lazy_imports import LazyImport

Expand Down

0 comments on commit 11afa0a

Please sign in to comment.