Skip to content

Commit

Permalink
Merge branch 'main' into cohere-embedders
Browse files Browse the repository at this point in the history
  • Loading branch information
masci authored Dec 6, 2023
2 parents 414fb98 + 0634b23 commit 297e0dd
Show file tree
Hide file tree
Showing 12 changed files with 12 additions and 29 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/chroma.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cohere.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/elasticsearch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gradient.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/instructor_embedders.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.10'

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nodes_text2speech.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.10'

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/opensearch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unstructured_fileconverter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

Expand Down
Original file line number Diff line number Diff line change
@@ -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__)

Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
@@ -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__)

Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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]]:
Expand Down

0 comments on commit 297e0dd

Please sign in to comment.