Skip to content

Commit 10d60da

Browse files
julian-rischclaude
andauthored
chore: enable ANN ruff ruleset for cometapi integration (#2984)
* chore: enable ANN ruff ruleset for cometapi integration Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * docs: add docstring to CometAPIChatGenerator.__init__ Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 07b26a8 commit 10d60da

File tree

2 files changed

+17
-16
lines changed

2 files changed

+17
-16
lines changed

integrations/cometapi/pyproject.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ line-length = 120
8484
[tool.ruff.lint]
8585
select = [
8686
"A",
87+
"ANN",
8788
"ARG",
8889
"B",
8990
"C",
@@ -110,6 +111,7 @@ select = [
110111
"YTT",
111112
]
112113
ignore = [
114+
"ANN401", # Allow Any - used legitimately for dynamic types and SDK boundaries
113115
# Allow non-abstract empty methods in abstract base classes
114116
"B027",
115117
# Allow boolean positional values in function calls, like `dict.get(... True)`
@@ -140,7 +142,7 @@ ban-relative-imports = "parents"
140142

141143
[tool.ruff.lint.per-file-ignores]
142144
# Tests can use magic values, assertions, and relative imports
143-
"tests/**/*" = ["PLR2004", "S101", "TID252"]
145+
"tests/**/*" = ["PLR2004", "S101", "TID252", "ANN"]
144146
# Examples can use print statements
145147
"examples/**/*" = ["T201"]
146148

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

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,6 @@ class CometAPIChatGenerator(OpenAIChatGenerator):
1818
This class extends Haystack's OpenAIChatGenerator to specifically interact with the CometAPI.
1919
It sets the `api_base_url` to the CometAPI endpoint and allows for all the
2020
standard configurations available in the OpenAIChatGenerator.
21-
22-
:param api_key: The API key for authenticating with the CometAPI. Defaults to
23-
loading from the "COMET_API_KEY" environment variable.
24-
:param model: The name of the model to use for chat generation (e.g., "gpt-5-mini", "grok-3-mini").
25-
Defaults to "gpt-5-mini".
26-
:param streaming_callback: An optional callable that will be called with each chunk of
27-
a streaming response.
28-
:param generation_kwargs: Optional keyword arguments to pass to the underlying generation
29-
API call.
30-
:param timeout: The maximum time in seconds to wait for a response from the API.
31-
:param max_retries: The maximum number of times to retry a failed API request.
32-
:param tools: An optional list of tool definitions that the model can use.
33-
:param tools_strict: If True, the model is forced to use one of the provided tools if a tool call is made.
34-
:param http_client_kwargs: Optional keyword arguments to pass to the HTTP client.
3521
"""
3622

3723
def __init__(
@@ -46,7 +32,20 @@ def __init__(
4632
tools: list[Tool | Toolset] | Toolset | None = None,
4733
tools_strict: bool = False,
4834
http_client_kwargs: dict[str, Any] | None = None,
49-
):
35+
) -> None:
36+
"""
37+
Creates a `CometAPIChatGenerator` instance.
38+
39+
:param api_key: The API key for authenticating with the CometAPI.
40+
:param model: The name of the model to use for chat generation (e.g., `"gpt-5-mini"`, `"grok-3-mini"`).
41+
:param streaming_callback: An optional callable invoked with each chunk of a streaming response.
42+
:param generation_kwargs: Optional keyword arguments passed to the underlying generation API call.
43+
:param timeout: The maximum time in seconds to wait for a response from the API.
44+
:param max_retries: The maximum number of times to retry a failed API request.
45+
:param tools: An optional list of tools the model can use.
46+
:param tools_strict: If `True`, the model is forced to use one of the provided tools.
47+
:param http_client_kwargs: Optional keyword arguments passed to the HTTP client.
48+
"""
5049
api_base_url = "https://api.cometapi.com/v1"
5150

5251
super().__init__(

0 commit comments

Comments
 (0)