diff --git a/integrations/gradient/src/gradient_haystack/embedders/gradient_document_embedder.py b/integrations/gradient/src/gradient_haystack/embedders/gradient_document_embedder.py index 81a93ad2b..a716b8cf2 100644 --- a/integrations/gradient/src/gradient_haystack/embedders/gradient_document_embedder.py +++ b/integrations/gradient/src/gradient_haystack/embedders/gradient_document_embedder.py @@ -1,11 +1,8 @@ import logging from typing import Any, Dict, List, Optional +from gradientai import Gradient from haystack import Document, component, default_to_dict -from haystack.lazy_imports import LazyImport - -with LazyImport(message="Run 'pip install gradientai'") as gradientai_import: - from gradientai import Gradient logger = logging.getLogger(__name__) @@ -49,7 +46,6 @@ def __init__( variable GRADIENT_WORKSPACE_ID. :param host: The Gradient host. By default it uses https://api.gradient.ai/. """ - gradientai_import.check() self._batch_size = batch_size self._host = host self._model_name = model_name diff --git a/integrations/gradient/src/gradient_haystack/embedders/gradient_text_embedder.py b/integrations/gradient/src/gradient_haystack/embedders/gradient_text_embedder.py index 53996b785..013d375ff 100644 --- a/integrations/gradient/src/gradient_haystack/embedders/gradient_text_embedder.py +++ b/integrations/gradient/src/gradient_haystack/embedders/gradient_text_embedder.py @@ -1,10 +1,7 @@ from typing import Any, Dict, List, Optional +from gradientai import Gradient from haystack import component, default_to_dict -from haystack.lazy_imports import LazyImport - -with LazyImport(message="Run 'pip install gradientai'") as gradientai_import: - from gradientai import Gradient @component @@ -43,7 +40,6 @@ def __init__( variable GRADIENT_WORKSPACE_ID. :param host: The Gradient host. By default it uses https://api.gradient.ai/. """ - gradientai_import.check() self._host = host self._model_name = model_name diff --git a/integrations/gradient/src/gradient_haystack/generator/base.py b/integrations/gradient/src/gradient_haystack/generator/base.py index 536525377..3adf0be01 100644 --- a/integrations/gradient/src/gradient_haystack/generator/base.py +++ b/integrations/gradient/src/gradient_haystack/generator/base.py @@ -1,11 +1,8 @@ import logging from typing import Any, Dict, List, Optional +from gradientai import Gradient from haystack import component, default_to_dict -from haystack.lazy_imports import LazyImport - -with LazyImport(message="Run 'pip install gradientai'") as gradientai_import: - from gradientai import Gradient logger = logging.getLogger(__name__) @@ -57,8 +54,6 @@ def __init__( :param workspace_id: The Gradient workspace ID. If not provided it's read from the environment variable GRADIENT_WORKSPACE_ID. """ - gradientai_import.check() - self._access_token = access_token self._base_model_slug = base_model_slug self._host = host diff --git a/integrations/instructor-embedders/instructor_embedders/embedding_backend/instructor_backend.py b/integrations/instructor-embedders/instructor_embedders/embedding_backend/instructor_backend.py index 5be300dd3..efe35e9b7 100644 --- a/integrations/instructor-embedders/instructor_embedders/embedding_backend/instructor_backend.py +++ b/integrations/instructor-embedders/instructor_embedders/embedding_backend/instructor_backend.py @@ -3,10 +3,7 @@ # SPDX-License-Identifier: Apache-2.0 from typing import ClassVar, Dict, List, Optional, Union -from haystack.lazy_imports import LazyImport - -with LazyImport(message="Run 'pip install InstructorEmbedding'") as instructor_embeddings_import: - from InstructorEmbedding import INSTRUCTOR +from InstructorEmbedding import INSTRUCTOR class _InstructorEmbeddingBackendFactory: @@ -40,7 +37,6 @@ class _InstructorEmbeddingBackend: def __init__( self, model_name_or_path: str, device: Optional[str] = None, use_auth_token: Union[bool, str, None] = None ): - instructor_embeddings_import.check() self.model = INSTRUCTOR(model_name_or_path=model_name_or_path, device=device, use_auth_token=use_auth_token) def embed(self, data: List[List[str]], **kwargs) -> List[List[float]]: