Skip to content

Commit 445dcbd

Browse files
anakin87davidsbatista
authored andcommitted
chore!: openrouter - drop Python 3.9 and use X|Y typing (#2720)
1 parent 3982525 commit 445dcbd

2 files changed

Lines changed: 15 additions & 21 deletions

File tree

integrations/openrouter/pyproject.toml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,22 @@ name = "openrouter-haystack"
77
dynamic = ["version"]
88
description = ''
99
readme = "README.md"
10-
requires-python = ">=3.9"
10+
requires-python = ">=3.10"
1111
license = "Apache-2.0"
1212
keywords = []
1313
authors = [{ name = "deepset GmbH", email = "info@deepset.ai" }]
1414
classifiers = [
1515
"License :: OSI Approved :: Apache Software License",
1616
"Development Status :: 4 - Beta",
1717
"Programming Language :: Python",
18-
"Programming Language :: Python :: 3.9",
1918
"Programming Language :: Python :: 3.10",
2019
"Programming Language :: Python :: 3.11",
2120
"Programming Language :: Python :: 3.12",
2221
"Programming Language :: Python :: 3.13",
2322
"Programming Language :: Python :: Implementation :: CPython",
2423
"Programming Language :: Python :: Implementation :: PyPy",
2524
]
26-
dependencies = ["haystack-ai>=2.19.0"]
25+
dependencies = ["haystack-ai>=2.22.0"]
2726

2827
[project.urls]
2928
Documentation = "https://github.com/deepset-ai/haystack-core-integrations/tree/main/integrations/openrouter#readme"
@@ -76,7 +75,6 @@ disallow_incomplete_defs = true
7675

7776

7877
[tool.ruff]
79-
target-version = "py39"
8078
line-length = 120
8179

8280
[tool.ruff.lint]
@@ -123,10 +121,6 @@ ignore = [
123121
"B008",
124122
"S101",
125123
]
126-
unfixable = [
127-
# Don't touch unused imports
128-
"F401",
129-
]
130124

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

integrations/openrouter/src/haystack_integrations/components/generators/openrouter/chat/chat_generator.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33
# SPDX-License-Identifier: Apache-2.0
44

5-
from typing import Any, Optional
5+
from typing import Any
66

77
from haystack import component, default_to_dict, logging
88
from haystack.components.generators.chat import OpenAIChatGenerator
@@ -61,14 +61,14 @@ def __init__(
6161
*,
6262
api_key: Secret = Secret.from_env_var("OPENROUTER_API_KEY"),
6363
model: str = "openai/gpt-5-mini",
64-
streaming_callback: Optional[StreamingCallbackT] = None,
65-
api_base_url: Optional[str] = "https://openrouter.ai/api/v1",
66-
generation_kwargs: Optional[dict[str, Any]] = None,
67-
tools: Optional[ToolsType] = None,
68-
timeout: Optional[float] = None,
69-
extra_headers: Optional[dict[str, Any]] = None,
70-
max_retries: Optional[int] = None,
71-
http_client_kwargs: Optional[dict[str, Any]] = None,
64+
streaming_callback: StreamingCallbackT | None = None,
65+
api_base_url: str | None = "https://openrouter.ai/api/v1",
66+
generation_kwargs: dict[str, Any] | None = None,
67+
tools: ToolsType | None = None,
68+
timeout: float | None = None,
69+
extra_headers: dict[str, Any] | None = None,
70+
max_retries: int | None = None,
71+
http_client_kwargs: dict[str, Any] | None = None,
7272
):
7373
"""
7474
Creates an instance of OpenRouterChatGenerator. Unless specified otherwise,
@@ -167,10 +167,10 @@ def _prepare_api_call(
167167
self,
168168
*,
169169
messages: list[ChatMessage],
170-
streaming_callback: Optional[StreamingCallbackT] = None,
171-
generation_kwargs: Optional[dict[str, Any]] = None,
172-
tools: Optional[ToolsType] = None,
173-
tools_strict: Optional[bool] = None,
170+
streaming_callback: StreamingCallbackT | None = None,
171+
generation_kwargs: dict[str, Any] | None = None,
172+
tools: ToolsType | None = None,
173+
tools_strict: bool | None = None,
174174
) -> dict[str, Any]:
175175
# update generation kwargs by merging with the generation kwargs passed to the run method
176176
generation_kwargs = {**self.generation_kwargs, **(generation_kwargs or {})}

0 commit comments

Comments
 (0)