Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion integrations/cometapi/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ module = [
ignore_missing_imports = true

[tool.ruff]
target-version = "py38"
target-version = "py39"
line-length = 120

[tool.ruff.lint]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Any, Dict, List, Optional, Union
from typing import Any, Optional, Union

from haystack.components.generators.chat import OpenAIChatGenerator
from haystack.dataclasses import StreamingCallbackT
Expand Down Expand Up @@ -35,12 +35,12 @@ def __init__(
api_key: Secret = Secret.from_env_var("COMET_API_KEY"),
model: str = "gpt-4o-mini",
streaming_callback: Optional[StreamingCallbackT] = None,
generation_kwargs: Optional[Dict[str, Any]] = None,
generation_kwargs: Optional[dict[str, Any]] = None,
timeout: Optional[int] = None,
max_retries: Optional[int] = None,
tools: Optional[Union[List[Union[Tool, Toolset]], Toolset]] = None,
tools: Optional[Union[list[Union[Tool, Toolset]], Toolset]] = None,
tools_strict: bool = False,
http_client_kwargs: Optional[Dict[str, Any]] = None,
http_client_kwargs: Optional[dict[str, Any]] = None,
):
api_base_url = "https://api.cometapi.com/v1"

Expand Down
2 changes: 1 addition & 1 deletion integrations/elasticsearch/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ disallow_incomplete_defs = true
allow-direct-references = true

[tool.ruff]
target-version = "py38"
target-version = "py39"
line-length = 120

[tool.ruff.lint]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# SPDX-FileCopyrightText: 2023-present deepset GmbH <[email protected]>
#
# SPDX-License-Identifier: Apache-2.0
from typing import Any, Dict, List, Optional, Union
from typing import Any, Optional, Union

from haystack import component, default_from_dict, default_to_dict
from haystack.dataclasses import Document
Expand Down Expand Up @@ -47,7 +47,7 @@ def __init__(
self,
*,
document_store: ElasticsearchDocumentStore,
filters: Optional[Dict[str, Any]] = None,
filters: Optional[dict[str, Any]] = None,
fuzziness: str = "AUTO",
top_k: int = 10,
scale_score: bool = False,
Expand Down Expand Up @@ -79,7 +79,7 @@ def __init__(
self._scale_score = scale_score
self._filter_policy = FilterPolicy.from_str(filter_policy) if isinstance(filter_policy, str) else filter_policy

def to_dict(self) -> Dict[str, Any]:
def to_dict(self) -> dict[str, Any]:
"""
Serializes the component to a dictionary.

Expand All @@ -97,7 +97,7 @@ def to_dict(self) -> Dict[str, Any]:
)

@classmethod
def from_dict(cls, data: Dict[str, Any]) -> "ElasticsearchBM25Retriever":
def from_dict(cls, data: dict[str, Any]) -> "ElasticsearchBM25Retriever":
"""
Deserializes the component from a dictionary.

Expand All @@ -115,10 +115,10 @@ def from_dict(cls, data: Dict[str, Any]) -> "ElasticsearchBM25Retriever":
data["init_parameters"]["filter_policy"] = FilterPolicy.from_str(filter_policy)
return default_from_dict(cls, data)

@component.output_types(documents=List[Document])
@component.output_types(documents=list[Document])
def run(
self, query: str, filters: Optional[Dict[str, Any]] = None, top_k: Optional[int] = None
) -> Dict[str, List[Document]]:
self, query: str, filters: Optional[dict[str, Any]] = None, top_k: Optional[int] = None
) -> dict[str, list[Document]]:
"""
Retrieve documents using the BM25 keyword-based algorithm.

Expand All @@ -140,10 +140,10 @@ def run(
)
return {"documents": docs}

@component.output_types(documents=List[Document])
@component.output_types(documents=list[Document])
async def run_async(
self, query: str, filters: Optional[Dict[str, Any]] = None, top_k: Optional[int] = None
) -> Dict[str, List[Document]]:
self, query: str, filters: Optional[dict[str, Any]] = None, top_k: Optional[int] = None
) -> dict[str, list[Document]]:
"""
Asynchronously retrieve documents using the BM25 keyword-based algorithm.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# SPDX-FileCopyrightText: 2023-present deepset GmbH <[email protected]>
#
# SPDX-License-Identifier: Apache-2.0
from typing import Any, Dict, List, Optional, Union
from typing import Any, Optional, Union

from haystack import component, default_from_dict, default_to_dict
from haystack.dataclasses import Document
Expand Down Expand Up @@ -49,7 +49,7 @@ def __init__(
self,
*,
document_store: ElasticsearchDocumentStore,
filters: Optional[Dict[str, Any]] = None,
filters: Optional[dict[str, Any]] = None,
top_k: int = 10,
num_candidates: Optional[int] = None,
filter_policy: Union[str, FilterPolicy] = FilterPolicy.REPLACE,
Expand Down Expand Up @@ -78,7 +78,7 @@ def __init__(
self._num_candidates = num_candidates
self._filter_policy = FilterPolicy.from_str(filter_policy) if isinstance(filter_policy, str) else filter_policy

def to_dict(self) -> Dict[str, Any]:
def to_dict(self) -> dict[str, Any]:
"""
Serializes the component to a dictionary.

Expand All @@ -95,7 +95,7 @@ def to_dict(self) -> Dict[str, Any]:
)

@classmethod
def from_dict(cls, data: Dict[str, Any]) -> "ElasticsearchEmbeddingRetriever":
def from_dict(cls, data: dict[str, Any]) -> "ElasticsearchEmbeddingRetriever":
"""
Deserializes the component from a dictionary.

Expand All @@ -113,10 +113,10 @@ def from_dict(cls, data: Dict[str, Any]) -> "ElasticsearchEmbeddingRetriever":
data["init_parameters"]["filter_policy"] = FilterPolicy.from_str(filter_policy)
return default_from_dict(cls, data)

@component.output_types(documents=List[Document])
@component.output_types(documents=list[Document])
def run(
self, query_embedding: List[float], filters: Optional[Dict[str, Any]] = None, top_k: Optional[int] = None
) -> Dict[str, List[Document]]:
self, query_embedding: list[float], filters: Optional[dict[str, Any]] = None, top_k: Optional[int] = None
) -> dict[str, list[Document]]:
"""
Retrieve documents using a vector similarity metric.

Expand All @@ -138,10 +138,10 @@ def run(
)
return {"documents": docs}

@component.output_types(documents=List[Document])
@component.output_types(documents=list[Document])
async def run_async(
self, query_embedding: List[float], filters: Optional[Dict[str, Any]] = None, top_k: Optional[int] = None
) -> Dict[str, List[Document]]:
self, query_embedding: list[float], filters: Optional[dict[str, Any]] = None, top_k: Optional[int] = None
) -> dict[str, list[Document]]:
"""
Asynchronously retrieve documents using a vector similarity metric.

Expand Down
Loading
Loading