diff --git a/.github/workflows/optimum.yml b/.github/workflows/optimum.yml index 10569a312b..8692888e9c 100644 --- a/.github/workflows/optimum.yml +++ b/.github/workflows/optimum.yml @@ -31,8 +31,8 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, windows-latest, macos-latest] - python-version: ["3.9", "3.12"] # onnx does not support 3.13 yet - + python-version: ["3.9", "3.13"] + steps: - name: Support longpaths if: matrix.os == 'windows-latest' @@ -60,9 +60,16 @@ jobs: - name: Run tests run: hatch run cov-retry + - name: Run unit tests with lowest direct dependencies + run: | + hatch run uv pip compile pyproject.toml --resolution lowest-direct --output-file requirements_lowest_direct.txt + hatch run uv pip install -r requirements_lowest_direct.txt + hatch run test -m "not integration" + - name: Nightly - run unit tests with Haystack main branch if: github.event_name == 'schedule' run: | + hatch env prune hatch run uv pip install git+https://github.com/deepset-ai/haystack.git@main hatch run cov-retry -m "not integration" diff --git a/integrations/optimum/pyproject.toml b/integrations/optimum/pyproject.toml index bd8322701d..a6eca7a964 100644 --- a/integrations/optimum/pyproject.toml +++ b/integrations/optimum/pyproject.toml @@ -33,7 +33,7 @@ dependencies = [ # Ref: https://github.com/huggingface/optimum/blob/8651c0ca1cccf095458bc80329dec9df4601edb4/optimum/exporters/onnx/__main__.py#L164 # "sentence-transformers" has been added, since most embedding models use it "sentence-transformers>=2.3", - "optimum[onnxruntime]", + "optimum[onnxruntime]>=1.17.0", ] [project.urls] diff --git a/integrations/optimum/tests/test_optimum_document_embedder.py b/integrations/optimum/tests/test_optimum_document_embedder.py index 32db9258fc..d8133167c6 100644 --- a/integrations/optimum/tests/test_optimum_document_embedder.py +++ b/integrations/optimum/tests/test_optimum_document_embedder.py @@ -235,7 +235,7 @@ def test_initialize_with_invalid_pooling_mode(self, mock_check_valid_model): # model="sentence-transformers/all-mpnet-base-v2", pooling_mode="Invalid_pooling_mode" ) - def test_infer_pooling_mode_from_str(self): + def test_infer_pooling_mode_from_str(self, mock_check_valid_model): # noqa: ARG002 """ Test that the pooling mode is correctly inferred from a string. The pooling mode is "mean" as per the model config. @@ -311,7 +311,7 @@ def test_prepare_texts_to_embed_w_suffix(self, mock_check_valid_model): # noqa: def test_run_wrong_input_format(self, mock_check_valid_model): # noqa: ARG002 embedder = OptimumDocumentEmbedder(model="sentence-transformers/all-mpnet-base-v2", pooling_mode="mean") - embedder.warm_up() + embedder._initialized = True # wrong formats string_input = "text" list_integers_input = [1, 2, 3] @@ -326,7 +326,7 @@ def test_run_on_empty_list(self, mock_check_valid_model): # noqa: ARG002 embedder = OptimumDocumentEmbedder( model="sentence-transformers/paraphrase-albert-small-v2", ) - embedder.warm_up() + embedder._initialized = True empty_list_input = [] result = embedder.run(documents=empty_list_input) diff --git a/integrations/optimum/tests/test_optimum_text_embedder.py b/integrations/optimum/tests/test_optimum_text_embedder.py index ba52942526..1b4cb1aeb0 100644 --- a/integrations/optimum/tests/test_optimum_text_embedder.py +++ b/integrations/optimum/tests/test_optimum_text_embedder.py @@ -198,7 +198,7 @@ def test_initialize_with_invalid_pooling_mode(self, mock_check_valid_model): # with pytest.raises(ValueError): OptimumTextEmbedder(model="sentence-transformers/all-mpnet-base-v2", pooling_mode="Invalid_pooling_mode") - def test_infer_pooling_mode_from_str(self): + def test_infer_pooling_mode_from_str(self, mock_check_valid_model): # noqa: ARG002 """ Test that the pooling mode is correctly inferred from a string. The pooling mode is "mean" as per the model config.