Skip to content

Commit

Permalink
chore: update test dependency and LazyImport block to make compatib…
Browse files Browse the repository at this point in the history
…ility with `sentence-transformers>=3.0.0` explicit (#8295)

* sentence-transformers-3 update test dep and lazyimport block

* clearer release note
  • Loading branch information
anakin87 authored Aug 27, 2024
1 parent f0b45c8 commit 6b0ee4c
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from haystack.lazy_imports import LazyImport
from haystack.utils.auth import Secret

with LazyImport(message="Run 'pip install \"sentence-transformers>=2.3.0\"'") as sentence_transformers_import:
with LazyImport(message="Run 'pip install \"sentence-transformers>=3.0.0\"'") as sentence_transformers_import:
from sentence_transformers import SentenceTransformer


Expand Down
2 changes: 1 addition & 1 deletion haystack/components/evaluators/sas_evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from haystack.utils import ComponentDevice, expit
from haystack.utils.auth import Secret, deserialize_secrets_inplace

with LazyImport(message="Run 'pip install \"sentence-transformers>=2.3.0\"'") as sas_import:
with LazyImport(message="Run 'pip install \"sentence-transformers>=3.0.0\"'") as sas_import:
from sentence_transformers import CrossEncoder, SentenceTransformer, util
from transformers import AutoConfig

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
logger = logging.getLogger(__name__)


with LazyImport(message="Run 'pip install \"sentence-transformers>=2.3.0\"'") as torch_and_sentence_transformers_import:
with LazyImport(message="Run 'pip install \"sentence-transformers>=3.0.0\"'") as torch_and_sentence_transformers_import:
import torch
from sentence_transformers import SentenceTransformer

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ format-check = "ruff format --check {args}"
extra-dependencies = [
"transformers[torch,sentencepiece]==4.41.2", # ExtractiveReader, TransformersSimilarityRanker, LocalWhisperTranscriber, HFGenerators...
"huggingface_hub>=0.23.0", # Hugging Face API Generators and Embedders
"sentence-transformers>=2.3.0", # SentenceTransformersTextEmbedder and SentenceTransformersDocumentEmbedder
"sentence-transformers>=3.0.0", # SentenceTransformersTextEmbedder and SentenceTransformersDocumentEmbedder
"langdetect", # TextLanguageRouter and DocumentLanguageClassifier
"openai-whisper>=20231106", # LocalWhisperTranscriber

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
fixes:
- |
Starting from `haystack-ai==2.4.0`, Haystack is compatible with `sentence-transformers>=3.0.0`;
earlier versions of `sentence-transformers` are not supported.
We are updating the test dependency and the LazyImport messages to reflect that.

0 comments on commit 6b0ee4c

Please sign in to comment.