Skip to content

Commit 898571a

Browse files
anakin87sjrl
authored andcommitted
unpin ruff and update code (#9040)
1 parent 7c3b05d commit 898571a

23 files changed

Lines changed: 33 additions & 33 deletions

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ repos:
1717
args: [--markdown-linebreak-ext=md]
1818

1919
- repo: https://github.com/astral-sh/ruff-pre-commit
20-
rev: v0.9.2
20+
rev: v0.11.0
2121
hooks:
2222
- id: ruff
2323
- id: ruff-format

haystack/components/converters/output_adapter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def __init__(
9595
input_types.update(route_input_names)
9696

9797
# the env is not needed, discarded automatically
98-
component.set_input_types(self, **{var: Any for var in input_types})
98+
component.set_input_types(self, **dict.fromkeys(input_types, Any))
9999
component.set_output_types(self, **{"output": output_type})
100100
self.output_type = output_type
101101

haystack/components/embedders/azure_document_embedder.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@ def __init__( # noqa: PLR0913 (too-many-arguments) # pylint: disable=too-many-p
124124
self.progress_bar = progress_bar
125125
self.meta_fields_to_embed = meta_fields_to_embed or []
126126
self.embedding_separator = embedding_separator
127-
self.timeout = timeout or float(os.environ.get("OPENAI_TIMEOUT", 30.0))
128-
self.max_retries = max_retries or int(os.environ.get("OPENAI_MAX_RETRIES", 5))
127+
self.timeout = timeout or float(os.environ.get("OPENAI_TIMEOUT", "30.0"))
128+
self.max_retries = max_retries or int(os.environ.get("OPENAI_MAX_RETRIES", "5"))
129129
self.default_headers = default_headers or {}
130130

131131
self._client = AzureOpenAI(

haystack/components/embedders/azure_text_embedder.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ def __init__( # pylint: disable=too-many-positional-arguments
104104
self.azure_deployment = azure_deployment
105105
self.dimensions = dimensions
106106
self.organization = organization
107-
self.timeout = timeout or float(os.environ.get("OPENAI_TIMEOUT", 30.0))
108-
self.max_retries = max_retries or int(os.environ.get("OPENAI_MAX_RETRIES", 5))
107+
self.timeout = timeout or float(os.environ.get("OPENAI_TIMEOUT", "30.0"))
108+
self.max_retries = max_retries or int(os.environ.get("OPENAI_MAX_RETRIES", "5"))
109109
self.prefix = prefix
110110
self.suffix = suffix
111111
self.default_headers = default_headers or {}

haystack/components/embedders/openai_document_embedder.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,9 @@ def __init__( # pylint: disable=too-many-positional-arguments
108108
self.embedding_separator = embedding_separator
109109

110110
if timeout is None:
111-
timeout = float(os.environ.get("OPENAI_TIMEOUT", 30.0))
111+
timeout = float(os.environ.get("OPENAI_TIMEOUT", "30.0"))
112112
if max_retries is None:
113-
max_retries = int(os.environ.get("OPENAI_MAX_RETRIES", 5))
113+
max_retries = int(os.environ.get("OPENAI_MAX_RETRIES", "5"))
114114

115115
self.client = OpenAI(
116116
api_key=api_key.resolve_value(),

haystack/components/embedders/openai_text_embedder.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,9 @@ def __init__( # pylint: disable=too-many-positional-arguments
9090
self.api_key = api_key
9191

9292
if timeout is None:
93-
timeout = float(os.environ.get("OPENAI_TIMEOUT", 30.0))
93+
timeout = float(os.environ.get("OPENAI_TIMEOUT", "30.0"))
9494
if max_retries is None:
95-
max_retries = int(os.environ.get("OPENAI_MAX_RETRIES", 5))
95+
max_retries = int(os.environ.get("OPENAI_MAX_RETRIES", "5"))
9696

9797
self.client = OpenAI(
9898
api_key=api_key.resolve_value(),

haystack/components/generators/azure.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,8 @@ def __init__( # pylint: disable=too-many-positional-arguments
136136
self.azure_deployment = azure_deployment
137137
self.organization = organization
138138
self.model: str = azure_deployment or "gpt-4o-mini"
139-
self.timeout = timeout or float(os.environ.get("OPENAI_TIMEOUT", 30.0))
140-
self.max_retries = max_retries or int(os.environ.get("OPENAI_MAX_RETRIES", 5))
139+
self.timeout = timeout or float(os.environ.get("OPENAI_TIMEOUT", "30.0"))
140+
self.max_retries = max_retries or int(os.environ.get("OPENAI_MAX_RETRIES", "5"))
141141
self.default_headers = default_headers or {}
142142

143143
self.client = AzureOpenAI(

haystack/components/generators/chat/azure.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,8 @@ def __init__( # pylint: disable=too-many-positional-arguments
146146
self.azure_deployment = azure_deployment
147147
self.organization = organization
148148
self.model = azure_deployment or "gpt-4o-mini"
149-
self.timeout = timeout or float(os.environ.get("OPENAI_TIMEOUT", 30.0))
150-
self.max_retries = max_retries or int(os.environ.get("OPENAI_MAX_RETRIES", 5))
149+
self.timeout = timeout or float(os.environ.get("OPENAI_TIMEOUT", "30.0"))
150+
self.max_retries = max_retries or int(os.environ.get("OPENAI_MAX_RETRIES", "5"))
151151
self.default_headers = default_headers or {}
152152

153153
_check_duplicate_tool_names(tools)

haystack/components/generators/chat/openai.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,9 @@ def __init__( # pylint: disable=too-many-positional-arguments
146146
_check_duplicate_tool_names(tools)
147147

148148
if timeout is None:
149-
timeout = float(os.environ.get("OPENAI_TIMEOUT", 30.0))
149+
timeout = float(os.environ.get("OPENAI_TIMEOUT", "30.0"))
150150
if max_retries is None:
151-
max_retries = int(os.environ.get("OPENAI_MAX_RETRIES", 5))
151+
max_retries = int(os.environ.get("OPENAI_MAX_RETRIES", "5"))
152152

153153
client_args: Dict[str, Any] = {
154154
"api_key": api_key.resolve_value(),

haystack/components/generators/openai.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,9 @@ def __init__( # pylint: disable=too-many-positional-arguments
112112
self.organization = organization
113113

114114
if timeout is None:
115-
timeout = float(os.environ.get("OPENAI_TIMEOUT", 30.0))
115+
timeout = float(os.environ.get("OPENAI_TIMEOUT", "30.0"))
116116
if max_retries is None:
117-
max_retries = int(os.environ.get("OPENAI_MAX_RETRIES", 5))
117+
max_retries = int(os.environ.get("OPENAI_MAX_RETRIES", "5"))
118118

119119
self.client = OpenAI(
120120
api_key=api_key.resolve_value(),

0 commit comments

Comments
 (0)