Skip to content

Commit

Permalink
more changes
Browse files Browse the repository at this point in the history
  • Loading branch information
anakin87 committed Sep 25, 2024
1 parent 6f49997 commit 28adb9f
Show file tree
Hide file tree
Showing 66 changed files with 76 additions and 31 deletions.
2 changes: 1 addition & 1 deletion integrations/chroma/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ unfixable = [
exclude = ["example"]

[tool.ruff.lint.isort]
known-first-party = ["src", "example", "tests"]
known-first-party = ["haystack_integrations"]

[tool.ruff.lint.flake8-tidy-imports]
ban-relative-imports = "parents"
Expand Down
1 change: 1 addition & 0 deletions integrations/cohere/examples/cohere_embedding.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from haystack import Document, Pipeline
from haystack.components.retrievers.in_memory import InMemoryEmbeddingRetriever
from haystack.document_stores.in_memory import InMemoryDocumentStore

from haystack_integrations.components.embedders.cohere.document_embedder import CohereDocumentEmbedder
from haystack_integrations.components.embedders.cohere.text_embedder import CohereTextEmbedder

Expand Down
1 change: 1 addition & 0 deletions integrations/cohere/examples/cohere_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from haystack.components.joiners import BranchJoiner
from haystack.components.validators import JsonSchemaValidator
from haystack.dataclasses import ChatMessage

from haystack_integrations.components.generators.cohere import CohereChatGenerator

# Defines a JSON schema for validating a person's data. The schema specifies that a valid object must
Expand Down
1 change: 1 addition & 0 deletions integrations/cohere/examples/cohere_ranker.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from haystack import Document, Pipeline
from haystack.components.retrievers.in_memory import InMemoryBM25Retriever
from haystack.document_stores.in_memory import InMemoryDocumentStore

from haystack_integrations.components.rankers.cohere import CohereRanker

# Note set your API key by running the below command in your terminal
Expand Down
4 changes: 2 additions & 2 deletions integrations/cohere/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ dependencies = ["black>=23.1.0", "mypy>=1.0.0", "ruff>=0.0.243"]
[tool.hatch.envs.lint.scripts]
typing = "mypy --install-types --non-interactive --explicit-package-bases {args:src/ tests}"
style = [
"ruff check {args:}",
"ruff check {args:.}",
"black --check --diff {args:.}",
]
fmt = ["black {args:.}", "ruff check --fix {args:}", "style"]
Expand Down Expand Up @@ -130,7 +130,7 @@ unfixable = [
]

[tool.ruff.lint.isort]
known-first-party = ["src"]
known-first-party = ["haystack_integrations"]

[tool.ruff.lint.flake8-tidy-imports]
ban-relative-imports = "parents"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

from haystack import Document, component, default_from_dict, default_to_dict
from haystack.utils import Secret, deserialize_secrets_inplace
from haystack_integrations.components.embedders.cohere.utils import get_async_response, get_response

from cohere import AsyncClient, Client
from haystack_integrations.components.embedders.cohere.utils import get_async_response, get_response


@component
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

from haystack import component, default_from_dict, default_to_dict
from haystack.utils import Secret, deserialize_secrets_inplace
from haystack_integrations.components.embedders.cohere.utils import get_async_response, get_response

from cohere import AsyncClient, Client
from haystack_integrations.components.embedders.cohere.utils import get_async_response, get_response


@component
Expand Down
1 change: 1 addition & 0 deletions integrations/cohere/tests/test_cohere_chat_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from haystack.components.generators.utils import print_streaming_chunk
from haystack.dataclasses import ChatMessage, ChatRole, StreamingChunk
from haystack.utils import Secret

from haystack_integrations.components.generators.cohere import CohereChatGenerator

pytestmark = pytest.mark.chat_generators
Expand Down
1 change: 1 addition & 0 deletions integrations/cohere/tests/test_cohere_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from cohere.core import ApiError
from haystack.components.generators.utils import print_streaming_chunk
from haystack.utils import Secret

from haystack_integrations.components.generators.cohere import CohereGenerator

pytestmark = pytest.mark.generators
Expand Down
1 change: 1 addition & 0 deletions integrations/cohere/tests/test_cohere_ranker.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import pytest
from haystack import Document
from haystack.utils.auth import Secret

from haystack_integrations.components.rankers.cohere import CohereRanker

pytestmark = pytest.mark.ranker
Expand Down
1 change: 1 addition & 0 deletions integrations/cohere/tests/test_document_embedder.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import pytest
from haystack import Document
from haystack.utils import Secret

from haystack_integrations.components.embedders.cohere import CohereDocumentEmbedder

pytestmark = pytest.mark.embedders
Expand Down
1 change: 1 addition & 0 deletions integrations/cohere/tests/test_text_embedder.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import pytest
from haystack.utils import Secret

from haystack_integrations.components.embedders.cohere import CohereTextEmbedder

pytestmark = pytest.mark.embedders
Expand Down
2 changes: 1 addition & 1 deletion integrations/deepeval/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ unfixable = [
]

[tool.ruff.lint.isort]
known-first-party = ["src"]
known-first-party = ["haystack_integrations"]

[tool.ruff.lint.flake8-tidy-imports]
ban-relative-imports = "all"
Expand Down
2 changes: 1 addition & 1 deletion integrations/elasticsearch/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ unfixable = [
]

[tool.ruff.lint.isort]
known-first-party = ["src"]
known-first-party = ["haystack_integrations"]

[tool.ruff.lint.flake8-tidy-imports]
ban-relative-imports = "parents"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from haystack.dataclasses import Document
from haystack.document_stores.types import FilterPolicy
from haystack.document_stores.types.filter_policy import apply_filter_policy

from haystack_integrations.document_stores.elasticsearch.document_store import ElasticsearchDocumentStore


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from haystack.dataclasses import Document
from haystack.document_stores.types import FilterPolicy
from haystack.document_stores.types.filter_policy import apply_filter_policy

from haystack_integrations.document_stores.elasticsearch.document_store import ElasticsearchDocumentStore


Expand Down
1 change: 1 addition & 0 deletions integrations/elasticsearch/tests/test_bm25_retriever.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import pytest
from haystack.dataclasses import Document
from haystack.document_stores.types import FilterPolicy

from haystack_integrations.components.retrievers.elasticsearch import ElasticsearchBM25Retriever
from haystack_integrations.document_stores.elasticsearch import ElasticsearchDocumentStore

Expand Down
1 change: 1 addition & 0 deletions integrations/elasticsearch/tests/test_document_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from haystack.document_stores.errors import DocumentStoreError, DuplicateDocumentError
from haystack.document_stores.types import DuplicatePolicy
from haystack.testing.document_store import DocumentStoreBaseTests

from haystack_integrations.document_stores.elasticsearch import ElasticsearchDocumentStore


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import pytest
from haystack.dataclasses import Document
from haystack.document_stores.types import FilterPolicy

from haystack_integrations.components.retrievers.elasticsearch import ElasticsearchEmbeddingRetriever
from haystack_integrations.document_stores.elasticsearch import ElasticsearchDocumentStore

Expand Down
1 change: 1 addition & 0 deletions integrations/elasticsearch/tests/test_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# SPDX-License-Identifier: Apache-2.0
import pytest
from haystack.errors import FilterError

from haystack_integrations.document_stores.elasticsearch.filters import _normalize_filters, _normalize_ranges

filters_data = [
Expand Down
1 change: 1 addition & 0 deletions integrations/fastembed/examples/example.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from haystack import Document, Pipeline
from haystack.components.retrievers.in_memory import InMemoryEmbeddingRetriever
from haystack.document_stores.in_memory import InMemoryDocumentStore

from haystack_integrations.components.embedders.fastembed import FastembedDocumentEmbedder, FastembedTextEmbedder

document_store = InMemoryDocumentStore(embedding_similarity_function="cosine")
Expand Down
1 change: 1 addition & 0 deletions integrations/fastembed/examples/sparse_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# involving indexing and retrieval of documents.

from haystack import Document

from haystack_integrations.components.embedders.fastembed import FastembedSparseDocumentEmbedder

document_list = [
Expand Down
2 changes: 1 addition & 1 deletion integrations/fastembed/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ unfixable = [
]

[tool.ruff.lint.isort]
known-first-party = ["src"]
known-first-party = ["haystack_integrations"]

[tool.ruff.lint.flake8-tidy-imports]
ban-relative-imports = "parents"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import numpy as np
import pytest
from haystack import Document, default_from_dict

from haystack_integrations.components.embedders.fastembed.fastembed_document_embedder import (
FastembedDocumentEmbedder,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import pytest
from haystack import Document, default_from_dict
from haystack.dataclasses.sparse_embedding import SparseEmbedding

from haystack_integrations.components.embedders.fastembed.fastembed_sparse_document_embedder import (
FastembedSparseDocumentEmbedder,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import pytest
from haystack import default_from_dict
from haystack.dataclasses.sparse_embedding import SparseEmbedding

from haystack_integrations.components.embedders.fastembed.fastembed_sparse_text_embedder import (
FastembedSparseTextEmbedder,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import numpy as np
import pytest
from haystack import default_from_dict

from haystack_integrations.components.embedders.fastembed.fastembed_text_embedder import (
FastembedTextEmbedder,
)
Expand Down
2 changes: 1 addition & 1 deletion integrations/jina/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ unfixable = [
]

[tool.ruff.lint.isort]
known-first-party = ["jina_haystack"]
known-first-party = ["haystack_integrations"]

[tool.ruff.lint.flake8-tidy-imports]
ban-relative-imports = "parents"
Expand Down
1 change: 1 addition & 0 deletions integrations/jina/tests/test_document_embedder.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import requests
from haystack import Document
from haystack.utils import Secret

from haystack_integrations.components.embedders.jina import JinaDocumentEmbedder


Expand Down
1 change: 1 addition & 0 deletions integrations/jina/tests/test_ranker.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import requests
from haystack import Document
from haystack.utils import Secret

from haystack_integrations.components.rankers.jina import JinaRanker


Expand Down
1 change: 1 addition & 0 deletions integrations/jina/tests/test_text_embedder.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import pytest
import requests
from haystack.utils import Secret

from haystack_integrations.components.embedders.jina import JinaTextEmbedder


Expand Down
2 changes: 1 addition & 1 deletion integrations/langfuse/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ unfixable = [
]

[tool.ruff.lint.isort]
known-first-party = ["src"]
known-first-party = ["haystack_integrations"]

[tool.ruff.lint.flake8-tidy-imports]
ban-relative-imports = "parents"
Expand Down
1 change: 1 addition & 0 deletions integrations/llama_cpp/examples/rag_pipeline_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from haystack.components.retrievers import InMemoryEmbeddingRetriever
from haystack.components.writers import DocumentWriter
from haystack.document_stores import InMemoryDocumentStore

from haystack_integrations.components.generators.llama_cpp import LlamaCppGenerator

# Load first 100 rows of the Simple Wikipedia Dataset from HuggingFace
Expand Down
2 changes: 1 addition & 1 deletion integrations/llama_cpp/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ all = ["style", "typing"]
allow-direct-references = true

[tool.ruff.lint.isort]
known-first-party = ["src"]
known-first-party = ["haystack_integrations"]

[tool.black]
target-version = ["py38"]
Expand Down
1 change: 1 addition & 0 deletions integrations/llama_cpp/tests/test_chat_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from haystack.components.retrievers.in_memory import InMemoryBM25Retriever
from haystack.dataclasses import ChatMessage, ChatRole
from haystack.document_stores.in_memory import InMemoryDocumentStore

from haystack_integrations.components.generators.llama_cpp.chat.chat_generator import (
LlamaCppChatGenerator,
_convert_message_to_llamacpp_format,
Expand Down
1 change: 1 addition & 0 deletions integrations/llama_cpp/tests/test_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from haystack.components.builders.prompt_builder import PromptBuilder
from haystack.components.retrievers.in_memory import InMemoryBM25Retriever
from haystack.document_stores.in_memory import InMemoryDocumentStore

from haystack_integrations.components.generators.llama_cpp import LlamaCppGenerator


Expand Down
2 changes: 1 addition & 1 deletion integrations/mistral/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ unfixable = [
]

[tool.ruff.lint.isort]
known-first-party = ["src"]
known-first-party = ["haystack_integrations"]

[tool.ruff.lint.flake8-tidy-imports]
ban-relative-imports = "parents"
Expand Down
2 changes: 1 addition & 1 deletion integrations/mongodb_atlas/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ unfixable = [
]

[tool.ruff.lint.isort]
known-first-party = ["src"]
known-first-party = ["haystack_integrations"]

[tool.ruff.lint.flake8-tidy-imports]
ban-relative-imports = "parents"
Expand Down
2 changes: 1 addition & 1 deletion integrations/nvidia/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ unfixable = [
]

[tool.ruff.lint.isort]
known-first-party = ["src"]
known-first-party = ["haystack_integrations"]

[tool.ruff.lint.flake8-tidy-imports]
ban-relative-imports = "parents"
Expand Down
2 changes: 1 addition & 1 deletion integrations/ollama/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ all = ["style", "typing"]
allow-direct-references = true

[tool.ruff.lint.isort]
known-first-party = ["src"]
known-first-party = ["haystack_integrations"]

[tool.black]
target-version = ["py38"]
Expand Down
2 changes: 1 addition & 1 deletion integrations/opensearch/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ unfixable = [
]

[tool.ruff.lint.isort]
known-first-party = ["src"]
known-first-party = ["haystack_integrations"]

[tool.ruff.lint.flake8-tidy-imports]
ban-relative-imports = "parents"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from haystack.dataclasses import Document
from haystack.document_stores.types import FilterPolicy
from haystack.document_stores.types.filter_policy import apply_filter_policy

from haystack_integrations.document_stores.opensearch import OpenSearchDocumentStore

logger = logging.getLogger(__name__)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from haystack.dataclasses import Document
from haystack.document_stores.types import FilterPolicy
from haystack.document_stores.types.filter_policy import apply_filter_policy

from haystack_integrations.document_stores.opensearch import OpenSearchDocumentStore

logger = logging.getLogger(__name__)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@
from haystack.dataclasses import Document
from haystack.document_stores.errors import DocumentStoreError, DuplicateDocumentError
from haystack.document_stores.types import DuplicatePolicy
from haystack_integrations.document_stores.opensearch.auth import AWSAuth
from haystack_integrations.document_stores.opensearch.filters import normalize_filters
from opensearchpy import OpenSearch
from opensearchpy.helpers import bulk

from haystack_integrations.document_stores.opensearch.auth import AWSAuth
from haystack_integrations.document_stores.opensearch.filters import normalize_filters

logger = logging.getLogger(__name__)

Hosts = Union[str, List[Union[str, Mapping[str, Union[str, int]]]]]
Expand Down
3 changes: 2 additions & 1 deletion integrations/opensearch/tests/test_auth.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
from unittest.mock import Mock, patch

import pytest
from haystack_integrations.document_stores.opensearch.auth import AWSAuth
from opensearchpy import Urllib3AWSV4SignerAuth

from haystack_integrations.document_stores.opensearch.auth import AWSAuth


class TestAWSAuth:
@pytest.fixture(autouse=True)
Expand Down
Loading

0 comments on commit 28adb9f

Please sign in to comment.