Skip to content

Commit

Permalink
mmore and more changes
Browse files Browse the repository at this point in the history
  • Loading branch information
anakin87 committed Sep 25, 2024
1 parent 5d9abf8 commit 20fe0c8
Show file tree
Hide file tree
Showing 16 changed files with 30 additions and 25 deletions.
1 change: 0 additions & 1 deletion integrations/astra/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ unfixable = [
# Don't touch unused imports
"F401",
]
exclude = ["example"]

[tool.ruff.lint.isort]
known-first-party = ["haystack_integrations"]
Expand Down
1 change: 1 addition & 0 deletions integrations/deepeval/example/example.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# A valid OpenAI API key is required to run this example.

from haystack import Pipeline

from haystack_integrations.components.evaluators.deepeval import DeepEvalEvaluator, DeepEvalMetric

QUESTIONS = [
Expand Down
2 changes: 1 addition & 1 deletion integrations/deepeval/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ skip-string-normalization = true
[tool.ruff]
target-version = "py38"
line-length = 120
extend-exclude = ["tests", "example"]
exclude = ["example", "tests"]

[tool.ruff.lint]
select = [
Expand Down
2 changes: 1 addition & 1 deletion integrations/deepeval/tests/test_evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
from unittest.mock import patch

import pytest
from deepeval.evaluate import BaseMetric, TestResult
from haystack import DeserializationError

from haystack_integrations.components.evaluators.deepeval import DeepEvalEvaluator, DeepEvalMetric
from deepeval.evaluate import TestResult, BaseMetric

DEFAULT_QUESTIONS = [
"Which is the most popular global sport?",
Expand Down
1 change: 1 addition & 0 deletions integrations/langfuse/example/basic_rag.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from haystack.components.generators import OpenAIGenerator
from haystack.components.retrievers import InMemoryEmbeddingRetriever
from haystack.document_stores.in_memory import InMemoryDocumentStore

from haystack_integrations.components.connectors.langfuse import LangfuseConnector


Expand Down
2 changes: 1 addition & 1 deletion integrations/langfuse/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ skip-string-normalization = true
[tool.ruff]
target-version = "py38"
line-length = 120
extend-exclude = ["tests", "example"]
exclude = ["example", "tests"]

[tool.ruff.lint]
select = [
Expand Down
2 changes: 2 additions & 0 deletions integrations/langfuse/tests/test_langfuse_span.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
os.environ["HAYSTACK_CONTENT_TRACING_ENABLED"] = "true"

from unittest.mock import Mock

from haystack.dataclasses import ChatMessage

from haystack_integrations.tracing.langfuse.tracer import LangfuseSpan


Expand Down
2 changes: 1 addition & 1 deletion integrations/langfuse/tests/test_tracer.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import os
from unittest.mock import Mock, MagicMock, patch
from unittest.mock import MagicMock, Mock, patch

from haystack_integrations.tracing.langfuse.tracer import LangfuseTracer

Expand Down
9 changes: 5 additions & 4 deletions integrations/langfuse/tests/test_tracing.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import os
import random
import time
import pytest
from urllib.parse import urlparse

import pytest
import requests
from requests.auth import HTTPBasicAuth
from haystack import Pipeline
from haystack.components.builders import ChatPromptBuilder
from haystack.dataclasses import ChatMessage
from haystack_integrations.components.connectors.langfuse import LangfuseConnector
from haystack.components.generators.chat import OpenAIChatGenerator
from haystack.dataclasses import ChatMessage
from requests.auth import HTTPBasicAuth

from haystack_integrations.components.connectors.langfuse import LangfuseConnector
from haystack_integrations.components.generators.anthropic import AnthropicChatGenerator
from haystack_integrations.components.generators.cohere import CohereChatGenerator

Expand Down
4 changes: 2 additions & 2 deletions integrations/ollama/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ 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:. --exclude tests/, examples/ }", "black --check --diff {args:.}"]
fmt = ["black {args:.}", "ruff check --fix {args:. --exclude tests/, examples/ }", "style"]
style = ["ruff check {args:.}", "black --check --diff {args:.}"]
fmt = ["black {args:.}", "ruff check --fix {args:.}", "style"]
all = ["style", "typing"]

[tool.hatch.metadata]
Expand Down
4 changes: 2 additions & 2 deletions integrations/optimum/example/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
from haystack import Pipeline

from haystack_integrations.components.embedders.optimum import (
OptimumTextEmbedder,
OptimumEmbedderPooling,
OptimumEmbedderOptimizationConfig,
OptimumEmbedderOptimizationMode,
OptimumEmbedderPooling,
OptimumTextEmbedder,
)

pipeline = Pipeline()
Expand Down
2 changes: 1 addition & 1 deletion integrations/optimum/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ skip-string-normalization = true
[tool.ruff]
target-version = "py38"
line-length = 120
extend-exclude = ["tests", "example"]
exclude = ["example", "tests"]

[tool.ruff.lint]
select = [
Expand Down
13 changes: 6 additions & 7 deletions integrations/optimum/tests/test_optimum_document_embedder.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
from unittest.mock import MagicMock, patch
import tempfile
import copy
import tempfile
from unittest.mock import MagicMock, patch

import pytest
from haystack.dataclasses import Document
from haystack.utils.auth import Secret
from huggingface_hub.utils import RepositoryNotFoundError

from haystack_integrations.components.embedders.optimum import OptimumDocumentEmbedder
from haystack_integrations.components.embedders.optimum.pooling import OptimumEmbedderPooling
from haystack_integrations.components.embedders.optimum.optimization import (
OptimumEmbedderOptimizationConfig,
OptimumEmbedderOptimizationMode,
)
from haystack_integrations.components.embedders.optimum.pooling import OptimumEmbedderPooling
from haystack_integrations.components.embedders.optimum.quantization import (
OptimumEmbedderQuantizationConfig,
OptimumEmbedderQuantizationMode,
)
from huggingface_hub.utils import RepositoryNotFoundError


@pytest.fixture
Expand Down Expand Up @@ -147,9 +148,7 @@ def test_to_and_from_dict(self, mock_check_valid_model, mock_get_pooling_mode):
assert embedder._backend.parameters.optimizer_settings is None
assert embedder._backend.parameters.quantizer_settings is None

def test_to_and_from_dict_with_custom_init_parameters(
self, mock_check_valid_model, mock_get_pooling_mode
): # noqa: ARG002
def test_to_and_from_dict_with_custom_init_parameters(self, mock_check_valid_model, mock_get_pooling_mode):
component = OptimumDocumentEmbedder(
model="sentence-transformers/all-minilm-l6-v2",
token=Secret.from_env_var("ENV_VAR", strict=False),
Expand Down
5 changes: 3 additions & 2 deletions integrations/optimum/tests/test_optimum_text_embedder.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@

import pytest
from haystack.utils.auth import Secret
from huggingface_hub.utils import RepositoryNotFoundError

from haystack_integrations.components.embedders.optimum import OptimumTextEmbedder
from haystack_integrations.components.embedders.optimum.pooling import OptimumEmbedderPooling
from haystack_integrations.components.embedders.optimum.optimization import (
OptimumEmbedderOptimizationConfig,
OptimumEmbedderOptimizationMode,
)
from haystack_integrations.components.embedders.optimum.pooling import OptimumEmbedderPooling
from haystack_integrations.components.embedders.optimum.quantization import (
OptimumEmbedderQuantizationConfig,
OptimumEmbedderQuantizationMode,
)
from huggingface_hub.utils import RepositoryNotFoundError


@pytest.fixture
Expand Down
2 changes: 1 addition & 1 deletion integrations/ragas/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ skip-string-normalization = true
[tool.ruff]
target-version = "py38"
line-length = 120
extend-exclude = ["tests", "example"]
exclude = ["example", "tests"]

[tool.ruff.lint]
select = [
Expand Down
3 changes: 2 additions & 1 deletion integrations/ragas/tests/test_evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
import pytest
from datasets import Dataset
from haystack import DeserializationError
from haystack_integrations.components.evaluators.ragas import RagasEvaluator, RagasMetric
from ragas.evaluation import Result
from ragas.metrics.base import Metric

from haystack_integrations.components.evaluators.ragas import RagasEvaluator, RagasMetric

DEFAULT_QUESTIONS = [
"Which is the most popular global sport?",
"Who created the Python language?",
Expand Down

0 comments on commit 20fe0c8

Please sign in to comment.