cometapi-haystack 2.1.1__tar.gz → 4.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,92 @@
1
+ # Changelog
2
+
3
+ ## [integrations/cometapi-v3.0.0] - 2026-10-16
4
+
5
+ ### 🐛 Bug Fixes
6
+
7
+ - Fix new issues raised by ruff 0.16.0 (#3670)
8
+ - Standardize license files (#3771)
9
+
10
+ ### 🧪 Testing
11
+
12
+ - Fix tests for openai>=3.0.0 (#3801)
13
+ - Test compatible integrations with Python 3.15; update pyproject (#4104)
14
+
15
+ ### ⚙️ CI
16
+
17
+ - Improve changelog generation; fix existing changelogs (#3883)
18
+
19
+ ### 🧹 Chores
20
+
21
+ - Re-standardize READMEs (#3768)
22
+ - Replace ToolInvoker with Agent in tests, examples and docstrings (#4108)
23
+ - [**breaking**] Drop Python 3.10 support (#4105)
24
+
25
+
26
+ ## [integrations/cometapi-v2.1.1] - 2026-07-13
27
+
28
+ ### 🐛 Bug Fixes
29
+
30
+ - *(cometapi)* Make CometAPIChatGenerator deserializable in pipelines (#3542)
31
+ - Support Haystack 3.0's lazy OpenAI client initialization in OpenAI-inheriting generators (#3536)
32
+
33
+ ### 📚 Documentation
34
+
35
+ - Simplify pydoc configs (#2855)
36
+
37
+ ### 🧪 Testing
38
+
39
+ - Test compatible integrations with python 3.14; update pyproject (#3001)
40
+ - Track test coverage for all integrations (#3065)
41
+ - Trust test modules under Haystack 3.0's deserialization allowlist (#3537)
42
+ - Make Tool/Agent serialization assertions version-agnostic for Haystack 2.x/3.x (#3533)
43
+ - Guard ToolInvoker imports so chat-generator tests run under Haystack 3.0 (#3535)
44
+ - Fix tests for integrations that inherit from the OpenAIChatGenerator (#3583)
45
+
46
+ ### 🧹 Chores
47
+
48
+ - Enable ANN ruff ruleset for cometapi integration (#2984)
49
+ - Enforce ruff docstring rules (D102/D103/D205/D209/D213/D417/D419) in first 10 integrations (#3008)
50
+
51
+
52
+ ## [integrations/cometapi-v2.1.0] - 2026-01-28
53
+
54
+ ### 🧹 Chores
55
+
56
+ - CometAPI - upgrade to Haystack 2.23 and remove special delta handling (#2786)
57
+
58
+
59
+ ## [integrations/cometapi-v2.0.1] - 2026-01-19
60
+
61
+ ### 🐛 Bug Fixes
62
+
63
+ - `CometAPIChatGenerator` - handle `delta` set to `None` (#2759)
64
+
65
+
66
+ ## [integrations/cometapi-v2.0.0] - 2026-01-09
67
+
68
+ ### 🧹 Chores
69
+
70
+ - Remove Readme API CI workflow and configs (#2573)
71
+ - Make fmt command more forgiving (#2671)
72
+ - [**breaking**] Cometapi - drop Python 3.9 and use X|Y typing (#2697)
73
+
74
+
75
+ ## [integrations/cometapi-v1.1.0] - 2025-11-26
76
+
77
+ ### 🧹 Chores
78
+
79
+ - Update CometAPIChatGenerator default model to gpt-5-mini and remove e… (#2559)
80
+
81
+ ### 🌀 Miscellaneous
82
+
83
+ - Add missing config file for Docusaurus sync (#2505)
84
+ - Adopt PEP 585 type hinting (part 3) (#2510)
85
+
86
+ ## [integrations/cometapi-v1.0.0] - 2025-11-11
87
+
88
+ ### 🚀 Features
89
+
90
+ - Add CometAPI integration with CometAPIChatGenerator class and configuration (#2345)
91
+
92
+ <!-- generated by git-cliff -->
@@ -9,7 +9,8 @@
9
9
  "License" shall mean the terms and conditions for use, reproduction,
10
10
  and distribution as defined by Sections 1 through 9 of this document.
11
11
 
12
- "Licensor" shall mean the copyright owner or entity granting the License.
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
13
14
 
14
15
  "Legal Entity" shall mean the union of the acting entity and all
15
16
  other entities that control, are controlled by, or are under common
@@ -34,8 +35,15 @@
34
35
  "Work" shall mean the work of authorship, whether in Source or
35
36
  Object form, made available under the License, as indicated by a
36
37
  copyright notice that is included in or attached to the work
37
- (which shall not include communications that are marked or
38
- designated in writing by the copyright owner as "Not a Contribution").
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
39
47
 
40
48
  "Contribution" shall mean any work of authorship, including
41
49
  the original version of the Work and any modifications or additions
@@ -45,11 +53,11 @@
45
53
  the copyright owner. For the purposes of this definition, "submitted"
46
54
  means any form of electronic, verbal, or written communication sent
47
55
  to the Licensor or its representatives, including but not limited to
48
- communication on electronic mailing lists, source code control
49
- systems, and issue tracking systems that are managed by, or on behalf
50
- of, the Licensor for the purpose of discussing and improving the Work,
51
- but excluding communication that is conspicuously marked or otherwise
52
- designated in writing by the copyright owner as "Not a Contribution".
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
53
61
 
54
62
  "Contributor" shall mean Licensor and any individual or Legal Entity
55
63
  on behalf of whom a Contribution has been received by Licensor and
@@ -58,10 +66,9 @@
58
66
  2. Grant of Copyright License. Subject to the terms and conditions of
59
67
  this License, each Contributor hereby grants to You a perpetual,
60
68
  worldwide, non-exclusive, no-charge, royalty-free, irrevocable
61
- copyright license to use, reproduce, modify, distribute, and prepare
62
- Derivative Works of, publicly display, publicly perform, sublicense,
63
- and distribute the Work and such Derivative Works in Source or Object
64
- form.
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
65
72
 
66
73
  3. Grant of Patent License. Subject to the terms and conditions of
67
74
  this License, each Contributor hereby grants to You a perpetual,
@@ -91,8 +98,8 @@
91
98
  stating that You changed the files; and
92
99
 
93
100
  (c) You must retain, in the Source form of any Derivative Works
94
- that You distribute, all copyright, trademark, patent,
95
- attribution and other notices from the Source form of the Work,
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
96
103
  excluding those notices that do not pertain to any part of
97
104
  the Derivative Works; and
98
105
 
@@ -113,7 +120,7 @@
113
120
  that such additional attribution notices cannot be construed
114
121
  as modifying the License.
115
122
 
116
- You may add Your own copyright notice to Your modifications and
123
+ You may add Your own copyright statement to Your modifications and
117
124
  may provide additional or different license terms and conditions
118
125
  for use, reproduction, or distribution of Your modifications, or
119
126
  for any such Derivative Works as a whole, provided Your use,
@@ -155,14 +162,16 @@
155
162
  other commercial damages or losses), even if such Contributor
156
163
  has been advised of the possibility of such damages.
157
164
 
158
- 9. Accepting Warranty or Support. You may choose to offer, and to
159
- charge a fee for, warranty, support, indemnity or other liability
160
- obligations and/or rights consistent with this License. However, in
161
- accepting such obligations, You may act only on Your own behalf and on
162
- Your sole responsibility, not on behalf of any other Contributor, and
163
- only if You agree to indemnify, defend, and hold each Contributor
164
- harmless for any liability incurred by, or claims asserted against,
165
- such Contributor by reason of your accepting any such warranty or support.
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
166
175
 
167
176
  END OF TERMS AND CONDITIONS
168
177
 
@@ -174,8 +183,8 @@
174
183
  the brackets!) The text should be enclosed in the appropriate
175
184
  comment syntax for the file format. We also recommend that a
176
185
  file or class name and description of purpose be included on the
177
- same page as the copyright notice for easier identification within
178
- third-party archives.
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
179
188
 
180
189
  Copyright 2023-present deepset GmbH
181
190
 
@@ -189,4 +198,4 @@
189
198
  distributed under the License is distributed on an "AS IS" BASIS,
190
199
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
191
200
  See the License for the specific language governing permissions and
192
- limitations under the License.
201
+ limitations under the License.
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.5
2
2
  Name: cometapi-haystack
3
- Version: 2.1.1
3
+ Version: 4.0.0
4
4
  Summary: Use Comet API with Haystack to build AI applications with 500+ AI models.
5
5
  Project-URL: Documentation, https://github.com/deepset-ai/haystack-core-integrations/tree/main/integrations/cometapi#readme
6
6
  Project-URL: Issues, https://github.com/deepset-ai/haystack-core-integrations/issues
@@ -11,21 +11,21 @@ License-File: LICENSE.txt
11
11
  Classifier: Development Status :: 4 - Beta
12
12
  Classifier: License :: OSI Approved :: Apache Software License
13
13
  Classifier: Programming Language :: Python
14
- Classifier: Programming Language :: Python :: 3.10
15
14
  Classifier: Programming Language :: Python :: 3.11
16
15
  Classifier: Programming Language :: Python :: 3.12
17
16
  Classifier: Programming Language :: Python :: 3.13
18
17
  Classifier: Programming Language :: Python :: 3.14
18
+ Classifier: Programming Language :: Python :: 3.15
19
19
  Classifier: Programming Language :: Python :: Implementation :: CPython
20
20
  Classifier: Programming Language :: Python :: Implementation :: PyPy
21
- Requires-Python: >=3.10
21
+ Requires-Python: >=3.11
22
22
  Requires-Dist: haystack-ai>=2.23.0
23
23
  Description-Content-Type: text/markdown
24
24
 
25
25
  # cometapi-haystack
26
26
 
27
27
  [![PyPI - Version](https://img.shields.io/pypi/v/cometapi-haystack.svg)](https://pypi.org/project/cometapi-haystack)
28
- [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/cometapi-haystack.svg)](https://pypi.org/project/cometapihaystack)
28
+ [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/cometapi-haystack.svg)](https://pypi.org/project/cometapi-haystack)
29
29
 
30
30
  - [Integration page](https://haystack.deepset.ai/integrations/comet-api)
31
31
  - [Changelog](https://github.com/deepset-ai/haystack-core-integrations/blob/main/integrations/cometapi/CHANGELOG.md)
@@ -1,7 +1,7 @@
1
1
  # cometapi-haystack
2
2
 
3
3
  [![PyPI - Version](https://img.shields.io/pypi/v/cometapi-haystack.svg)](https://pypi.org/project/cometapi-haystack)
4
- [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/cometapi-haystack.svg)](https://pypi.org/project/cometapihaystack)
4
+ [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/cometapi-haystack.svg)](https://pypi.org/project/cometapi-haystack)
5
5
 
6
6
  - [Integration page](https://haystack.deepset.ai/integrations/comet-api)
7
7
  - [Changelog](https://github.com/deepset-ai/haystack-core-integrations/blob/main/integrations/cometapi/CHANGELOG.md)
@@ -7,7 +7,7 @@ name = "cometapi-haystack"
7
7
  dynamic = ["version"]
8
8
  description = 'Use Comet API with Haystack to build AI applications with 500+ AI models.'
9
9
  readme = "README.md"
10
- requires-python = ">=3.10"
10
+ requires-python = ">=3.11"
11
11
  license = "Apache-2.0"
12
12
  keywords = []
13
13
  authors = [
@@ -18,11 +18,11 @@ classifiers = [
18
18
  "License :: OSI Approved :: Apache Software License",
19
19
  "Development Status :: 4 - Beta",
20
20
  "Programming Language :: Python",
21
- "Programming Language :: Python :: 3.10",
22
21
  "Programming Language :: Python :: 3.11",
23
22
  "Programming Language :: Python :: 3.12",
24
23
  "Programming Language :: Python :: 3.13",
25
24
  "Programming Language :: Python :: 3.14",
25
+ "Programming Language :: Python :: 3.15",
26
26
  "Programming Language :: Python :: Implementation :: CPython",
27
27
  "Programming Language :: Python :: Implementation :: PyPy",
28
28
  ]
@@ -135,6 +135,7 @@ ignore = [
135
135
  "PLR0912",
136
136
  "PLR0913",
137
137
  "PLR0915",
138
+ "PLR0917",
138
139
  # Ignore unused params
139
140
  "ARG001",
140
141
  "ARG002",
@@ -3,15 +3,22 @@ from typing import Any
3
3
  from haystack import component, default_to_dict
4
4
  from haystack.components.generators.chat import OpenAIChatGenerator
5
5
  from haystack.dataclasses import (
6
+ ChatMessage,
6
7
  StreamingCallbackT,
7
8
  )
8
9
  from haystack.tools import (
9
10
  Tool,
10
11
  Toolset,
12
+ ToolsType,
11
13
  serialize_tools_or_toolset,
12
14
  )
13
15
  from haystack.utils import Secret, serialize_callable
14
16
 
17
+ # These models accept function tools over Chat Completions only with `reasoning_effort="none"` and return HTTP 400
18
+ # otherwise. Haystack's OpenAIChatGenerator applies this default for its own list of models, which doesn't include
19
+ # these yet; remove this once it does.
20
+ _NO_REASONING_TOOL_CALL_MODEL_PREFIXES = ("gpt-6.1-terra",)
21
+
15
22
 
16
23
  @component
17
24
  class CometAPIChatGenerator(OpenAIChatGenerator):
@@ -27,7 +34,7 @@ class CometAPIChatGenerator(OpenAIChatGenerator):
27
34
  self,
28
35
  *,
29
36
  api_key: Secret = Secret.from_env_var("COMET_API_KEY"),
30
- model: str = "gpt-5-mini",
37
+ model: str = "gpt-6.1-terra",
31
38
  streaming_callback: StreamingCallbackT | None = None,
32
39
  generation_kwargs: dict[str, Any] | None = None,
33
40
  timeout: int | None = None,
@@ -40,7 +47,7 @@ class CometAPIChatGenerator(OpenAIChatGenerator):
40
47
  Creates a `CometAPIChatGenerator` instance.
41
48
 
42
49
  :param api_key: The API key for authenticating with the CometAPI.
43
- :param model: The name of the model to use for chat generation (e.g., `"gpt-5-mini"`, `"grok-3-mini"`).
50
+ :param model: The name of the model to use for chat generation (e.g., `"gpt-6.1-terra"`, `"grok-3-mini"`).
44
51
  :param streaming_callback: An optional callable invoked with each chunk of a streaming response.
45
52
  :param generation_kwargs: Optional keyword arguments passed to the underlying generation API call.
46
53
  :param timeout: The maximum time in seconds to wait for a response from the API.
@@ -65,6 +72,28 @@ class CometAPIChatGenerator(OpenAIChatGenerator):
65
72
  http_client_kwargs=http_client_kwargs,
66
73
  )
67
74
 
75
+ def _prepare_api_call(
76
+ self,
77
+ *,
78
+ messages: list[ChatMessage],
79
+ streaming_callback: StreamingCallbackT | None = None,
80
+ generation_kwargs: dict[str, Any] | None = None,
81
+ tools: ToolsType | None = None,
82
+ tools_strict: bool | None = None,
83
+ ) -> dict[str, Any]:
84
+ # the @component decorator recreates the class, so the zero-argument form of super() cannot be used
85
+ api_args = super(CometAPIChatGenerator, self)._prepare_api_call( # noqa: UP008
86
+ messages=messages,
87
+ streaming_callback=streaming_callback,
88
+ generation_kwargs=generation_kwargs,
89
+ tools=tools,
90
+ tools_strict=tools_strict,
91
+ )
92
+ # setdefault keeps a reasoning_effort the user set explicitly
93
+ if "tools" in api_args and self.model.startswith(_NO_REASONING_TOOL_CALL_MODEL_PREFIXES):
94
+ api_args.setdefault("reasoning_effort", "none")
95
+ return api_args
96
+
68
97
  def to_dict(self) -> dict[str, Any]:
69
98
  """
70
99
  Serialize this component to a dictionary.
@@ -1,17 +1,12 @@
1
1
  import os
2
- from dataclasses import asdict
3
2
  from datetime import datetime
4
3
  from unittest.mock import patch
5
4
 
6
5
  import pytest
7
6
  import pytz
8
7
  from haystack import Pipeline
8
+ from haystack.components.agents import Agent
9
9
  from haystack.components.generators.utils import print_streaming_chunk
10
-
11
- try:
12
- from haystack.components.tools import ToolInvoker
13
- except ImportError: # ToolInvoker was removed in Haystack 3.0
14
- ToolInvoker = None
15
10
  from haystack.dataclasses import ChatMessage, ChatRole, StreamingChunk, ToolCall
16
11
  from haystack.tools import Tool
17
12
  from haystack.utils.auth import Secret
@@ -70,7 +65,7 @@ def mock_chat_completion():
70
65
  with patch("openai.resources.chat.completions.Completions.create") as mock_chat_completion_create:
71
66
  completion = ChatCompletion(
72
67
  id="foo",
73
- model="gpt-5-mini",
68
+ model="gpt-6.1-terra",
74
69
  object="chat.completion",
75
70
  choices=[
76
71
  Choice(
@@ -93,7 +88,7 @@ class TestCometAPIChatGenerator:
93
88
  monkeypatch.setenv("COMET_API_KEY", "test-api-key")
94
89
  component = CometAPIChatGenerator()
95
90
  assert component.api_key.resolve_value() == "test-api-key"
96
- assert component.model == "gpt-5-mini"
91
+ assert component.model == "gpt-6.1-terra"
97
92
  assert component.api_base_url == "https://api.cometapi.com/v1"
98
93
  assert component.streaming_callback is None
99
94
  assert not component.generation_kwargs
@@ -114,12 +109,12 @@ class TestCometAPIChatGenerator:
114
109
  def test_init_with_parameters(self):
115
110
  component = CometAPIChatGenerator(
116
111
  api_key=Secret.from_token("test-api-key"),
117
- model="gpt-5-mini",
112
+ model="gpt-6.1-terra",
118
113
  streaming_callback=print_streaming_chunk,
119
114
  generation_kwargs={"max_tokens": 10, "some_test_param": "test-params"},
120
115
  )
121
116
  assert component.api_key.resolve_value() == "test-api-key"
122
- assert component.model == "gpt-5-mini"
117
+ assert component.model == "gpt-6.1-terra"
123
118
  assert component.streaming_callback is print_streaming_chunk
124
119
  assert component.generation_kwargs == {"max_tokens": 10, "some_test_param": "test-params"}
125
120
 
@@ -135,7 +130,7 @@ class TestCometAPIChatGenerator:
135
130
 
136
131
  expected_params = {
137
132
  "api_key": {"env_vars": ["COMET_API_KEY"], "strict": True, "type": "env_var"},
138
- "model": "gpt-5-mini",
133
+ "model": "gpt-6.1-terra",
139
134
  "streaming_callback": None,
140
135
  "generation_kwargs": {},
141
136
  "timeout": None,
@@ -151,7 +146,7 @@ class TestCometAPIChatGenerator:
151
146
  monkeypatch.setenv("ENV_VAR", "test-api-key")
152
147
  component = CometAPIChatGenerator(
153
148
  api_key=Secret.from_env_var("ENV_VAR"),
154
- model="gpt-5-mini",
149
+ model="gpt-6.1-terra",
155
150
  streaming_callback=print_streaming_chunk,
156
151
  generation_kwargs={"max_tokens": 10, "some_test_param": "test-params"},
157
152
  timeout=10,
@@ -168,7 +163,7 @@ class TestCometAPIChatGenerator:
168
163
 
169
164
  expected_params = {
170
165
  "api_key": {"env_vars": ["ENV_VAR"], "strict": True, "type": "env_var"},
171
- "model": "gpt-5-mini",
166
+ "model": "gpt-6.1-terra",
172
167
  "streaming_callback": "haystack.components.generators.utils.print_streaming_chunk",
173
168
  "generation_kwargs": {"max_tokens": 10, "some_test_param": "test-params"},
174
169
  "timeout": 10,
@@ -186,7 +181,7 @@ class TestCometAPIChatGenerator:
186
181
  "type": ("haystack_integrations.components.generators.cometapi.chat.chat_generator.CometAPIChatGenerator"),
187
182
  "init_parameters": {
188
183
  "api_key": {"env_vars": ["COMET_API_KEY"], "strict": True, "type": "env_var"},
189
- "model": "gpt-5-mini",
184
+ "model": "gpt-6.1-terra",
190
185
  "streaming_callback": "haystack.components.generators.utils.print_streaming_chunk",
191
186
  "generation_kwargs": {"max_tokens": 10, "some_test_param": "test-params"},
192
187
  "timeout": 10,
@@ -196,7 +191,7 @@ class TestCometAPIChatGenerator:
196
191
  },
197
192
  }
198
193
  component = CometAPIChatGenerator.from_dict(data)
199
- assert component.model == "gpt-5-mini"
194
+ assert component.model == "gpt-6.1-terra"
200
195
  assert component.streaming_callback is print_streaming_chunk
201
196
  assert component.api_base_url == "https://api.cometapi.com/v1"
202
197
  assert component.generation_kwargs == {"max_tokens": 10, "some_test_param": "test-params"}
@@ -235,6 +230,33 @@ class TestCometAPIChatGenerator:
235
230
  assert len(response["replies"]) == 1
236
231
  assert [isinstance(reply, ChatMessage) for reply in response["replies"]]
237
232
 
233
+ @pytest.mark.parametrize(
234
+ ("model", "use_tools", "generation_kwargs", "expected_reasoning_effort"),
235
+ [
236
+ ("gpt-6.1-terra", True, {}, "none"),
237
+ ("gpt-6.1-terra", True, {"reasoning_effort": "low"}, "low"),
238
+ ("gpt-6.1-terra", False, {}, None),
239
+ ("gpt-4.1", True, {}, None),
240
+ ],
241
+ )
242
+ def test_run_reasoning_effort_default_with_tools(
243
+ self,
244
+ chat_messages,
245
+ tools,
246
+ mock_chat_completion,
247
+ monkeypatch,
248
+ model,
249
+ use_tools,
250
+ generation_kwargs,
251
+ expected_reasoning_effort,
252
+ ):
253
+ monkeypatch.setenv("COMET_API_KEY", "fake-api-key")
254
+ component = CometAPIChatGenerator(model=model)
255
+ component.run(chat_messages, tools=tools if use_tools else None, generation_kwargs=generation_kwargs)
256
+
257
+ _, kwargs = mock_chat_completion.call_args
258
+ assert kwargs.get("reasoning_effort") == expected_reasoning_effort
259
+
238
260
  @pytest.mark.skipif(
239
261
  not os.environ.get("COMET_API_KEY", None),
240
262
  reason="Export an env var called COMET_API_KEY containing the cometapi API key to run this test.",
@@ -247,7 +269,7 @@ class TestCometAPIChatGenerator:
247
269
  assert len(results["replies"]) == 1
248
270
  message: ChatMessage = results["replies"][0]
249
271
  assert "Paris" in message.text
250
- assert "gpt-5-mini" in message.meta["model"]
272
+ assert "gpt-6.1-terra" in message.meta["model"]
251
273
  assert message.meta["finish_reason"] == "stop"
252
274
 
253
275
  @pytest.mark.skipif(
@@ -273,7 +295,7 @@ class TestCometAPIChatGenerator:
273
295
  message: ChatMessage = results["replies"][0]
274
296
  assert "Paris" in message.text
275
297
 
276
- assert "gpt-5-mini" in message.meta["model"]
298
+ assert "gpt-6.1-terra" in message.meta["model"]
277
299
  assert message.meta["finish_reason"] == "stop"
278
300
 
279
301
  assert callback.counter > 1
@@ -290,7 +312,7 @@ class TestCometAPIChatGenerator:
290
312
  results = component.run(chat_messages)
291
313
  assert len(results["replies"]) == 1
292
314
  message = results["replies"][0]
293
- assert message.text is None
315
+ assert not message.text
294
316
 
295
317
  assert message.tool_calls
296
318
  tool_call = message.tool_call
@@ -386,30 +408,15 @@ class TestCometAPIChatGenerator:
386
408
  reason="Export an env var called COMET_API_KEY containing the OpenAI API key to run this test.",
387
409
  )
388
410
  @pytest.mark.integration
389
- @pytest.mark.skipif(ToolInvoker is None, reason="ToolInvoker is not available in the installed haystack-ai version")
390
- def test_pipeline_with_cometapi_chat_generator(self, tools):
411
+ def test_agent_with_cometapi_chat_generator(self, tools):
391
412
  """
392
- Test that the CometAPIChatGenerator component can be used in a pipeline
413
+ Test that the CometAPIChatGenerator component can drive tool calls in an Agent
393
414
  """
394
- pipeline = Pipeline()
395
- pipeline.add_component("generator", CometAPIChatGenerator(tools=tools))
396
- pipeline.add_component("tool_invoker", ToolInvoker(tools=tools))
397
-
398
- pipeline.connect("generator", "tool_invoker")
399
-
400
- results = pipeline.run(
401
- data={
402
- "generator": {
403
- "messages": [ChatMessage.from_user("What's the weather like in Paris?")],
404
- "generation_kwargs": {"tool_choice": "auto"},
405
- }
406
- }
407
- )
415
+ agent = Agent(chat_generator=CometAPIChatGenerator(), tools=tools)
416
+ result = agent.run(messages=[ChatMessage.from_user("What's the weather like in Paris?")])
408
417
 
409
- assert (
410
- "The weather in Paris is sunny and 32°C"
411
- == results["tool_invoker"]["tool_messages"][0].tool_call_result.result
412
- )
418
+ tool_results = [msg.tool_call_result.result for msg in result["messages"] if msg.tool_call_result]
419
+ assert "The weather in Paris is sunny and 32°C" in tool_results
413
420
 
414
421
  def test_serde_in_pipeline(self, monkeypatch):
415
422
  """
@@ -454,7 +461,7 @@ class TestCometAPIChatGenerator:
454
461
  "haystack_integrations.components.generators.cometapi.chat.chat_generator.CometAPIChatGenerator"
455
462
  ),
456
463
  "init_parameters": {
457
- "model": "gpt-5-mini",
464
+ "model": "gpt-6.1-terra",
458
465
  "streaming_callback": "haystack.components.generators.utils.print_streaming_chunk",
459
466
  "generation_kwargs": {"temperature": 0.7},
460
467
  "api_key": {"type": "env_var", "env_vars": ["COMET_API_KEY"], "strict": True},
@@ -499,7 +506,7 @@ class TestChatCompletionChunkConversion:
499
506
  ChoiceChunk(delta=ChoiceDelta(content="", role="assistant"), index=0, native_finish_reason=None)
500
507
  ],
501
508
  created=1750162525,
502
- model="gpt-5-mini",
509
+ model="gpt-6.1-terra",
503
510
  object="chat.completion.chunk",
504
511
  system_fingerprint="fp_34a54ae93c",
505
512
  provider="OpenAI",
@@ -524,7 +531,7 @@ class TestChatCompletionChunkConversion:
524
531
  )
525
532
  ],
526
533
  created=1750162525,
527
- model="gpt-5-mini",
534
+ model="gpt-6.1-terra",
528
535
  object="chat.completion.chunk",
529
536
  system_fingerprint="fp_34a54ae93c",
530
537
  provider="OpenAI",
@@ -548,7 +555,7 @@ class TestChatCompletionChunkConversion:
548
555
  )
549
556
  ],
550
557
  created=1750162525,
551
- model="gpt-5-mini",
558
+ model="gpt-6.1-terra",
552
559
  object="chat.completion.chunk",
553
560
  system_fingerprint="fp_34a54ae93c",
554
561
  provider="OpenAI",
@@ -572,7 +579,7 @@ class TestChatCompletionChunkConversion:
572
579
  )
573
580
  ],
574
581
  created=1750162525,
575
- model="gpt-5-mini",
582
+ model="gpt-6.1-terra",
576
583
  object="chat.completion.chunk",
577
584
  system_fingerprint="fp_34a54ae93c",
578
585
  provider="OpenAI",
@@ -596,7 +603,7 @@ class TestChatCompletionChunkConversion:
596
603
  )
597
604
  ],
598
605
  created=1750162525,
599
- model="gpt-5-mini",
606
+ model="gpt-6.1-terra",
600
607
  object="chat.completion.chunk",
601
608
  system_fingerprint="fp_34a54ae93c",
602
609
  provider="OpenAI",
@@ -620,7 +627,7 @@ class TestChatCompletionChunkConversion:
620
627
  )
621
628
  ],
622
629
  created=1750162525,
623
- model="gpt-5-mini",
630
+ model="gpt-6.1-terra",
624
631
  object="chat.completion.chunk",
625
632
  system_fingerprint="fp_34a54ae93c",
626
633
  provider="OpenAI",
@@ -645,7 +652,7 @@ class TestChatCompletionChunkConversion:
645
652
  )
646
653
  ],
647
654
  created=1750162525,
648
- model="gpt-5-mini",
655
+ model="gpt-6.1-terra",
649
656
  object="chat.completion.chunk",
650
657
  service_tier=None,
651
658
  system_fingerprint="fp_34a54ae93c",
@@ -672,7 +679,7 @@ class TestChatCompletionChunkConversion:
672
679
  )
673
680
  ],
674
681
  created=1750162525,
675
- model="gpt-5-mini",
682
+ model="gpt-6.1-terra",
676
683
  object="chat.completion.chunk",
677
684
  system_fingerprint="fp_34a54ae93c",
678
685
  provider="OpenAI",
@@ -696,7 +703,7 @@ class TestChatCompletionChunkConversion:
696
703
  )
697
704
  ],
698
705
  created=1750162525,
699
- model="gpt-5-mini",
706
+ model="gpt-6.1-terra",
700
707
  object="chat.completion.chunk",
701
708
  system_fingerprint="fp_34a54ae93c",
702
709
  provider="OpenAI",
@@ -720,7 +727,7 @@ class TestChatCompletionChunkConversion:
720
727
  )
721
728
  ],
722
729
  created=1750162525,
723
- model="gpt-5-mini",
730
+ model="gpt-6.1-terra",
724
731
  object="chat.completion.chunk",
725
732
  system_fingerprint="fp_34a54ae93c",
726
733
  provider="OpenAI",
@@ -744,7 +751,7 @@ class TestChatCompletionChunkConversion:
744
751
  )
745
752
  ],
746
753
  created=1750162525,
747
- model="gpt-5-mini",
754
+ model="gpt-6.1-terra",
748
755
  object="chat.completion.chunk",
749
756
  system_fingerprint="fp_34a54ae93c",
750
757
  provider="OpenAI",
@@ -760,7 +767,7 @@ class TestChatCompletionChunkConversion:
760
767
  )
761
768
  ],
762
769
  created=1750162525,
763
- model="gpt-5-mini",
770
+ model="gpt-6.1-terra",
764
771
  object="chat.completion.chunk",
765
772
  system_fingerprint="fp_34a54ae93c",
766
773
  provider="OpenAI",
@@ -775,7 +782,7 @@ class TestChatCompletionChunkConversion:
775
782
  )
776
783
  ],
777
784
  created=1750162525,
778
- model="gpt-5-mini",
785
+ model="gpt-6.1-terra",
779
786
  object="chat.completion.chunk",
780
787
  usage=CompletionUsage(
781
788
  completion_tokens=42,
@@ -805,41 +812,14 @@ class TestChatCompletionChunkConversion:
805
812
  assert result.tool_calls[1].arguments == {"city": "Berlin"}
806
813
 
807
814
  # Verify meta information
808
- assert result.meta["model"] == "gpt-5-mini"
815
+ assert result.meta["model"] == "gpt-6.1-terra"
809
816
  assert result.meta["finish_reason"] == "tool_calls"
810
817
  assert result.meta["index"] == 0
811
818
  assert result.meta["completion_start_time"] is not None
812
819
 
813
- # Normalize usage details before asserting
814
820
  usage = result.meta["usage"]
815
-
816
- if hasattr(usage["completion_tokens_details"], "model_dump"):
817
- usage["completion_tokens_details"] = usage["completion_tokens_details"].model_dump()
818
- if hasattr(usage["prompt_tokens_details"], "model_dump"):
819
- usage["prompt_tokens_details"] = usage["prompt_tokens_details"].model_dump()
820
-
821
- # For dataclass fallback
822
- if not isinstance(usage["completion_tokens_details"], dict):
823
- usage["completion_tokens_details"] = asdict(usage["completion_tokens_details"])
824
- if not isinstance(usage["prompt_tokens_details"], dict):
825
- usage["prompt_tokens_details"] = asdict(usage["prompt_tokens_details"])
826
-
827
- # Normalize usage details since cache_write_tokens is not always present in the response
828
- usage["prompt_tokens_details"].setdefault("cache_write_tokens", None)
829
-
830
- assert usage == {
831
- "completion_tokens": 42,
832
- "prompt_tokens": 55,
833
- "total_tokens": 97,
834
- "completion_tokens_details": {
835
- "accepted_prediction_tokens": None,
836
- "audio_tokens": None,
837
- "reasoning_tokens": 0,
838
- "rejected_prediction_tokens": None,
839
- },
840
- "prompt_tokens_details": {
841
- "audio_tokens": None,
842
- "cache_write_tokens": None,
843
- "cached_tokens": 0,
844
- },
845
- }
821
+ assert usage["completion_tokens"] == 42
822
+ assert usage["prompt_tokens"] == 55
823
+ assert usage["total_tokens"] == 97
824
+ assert usage["completion_tokens_details"]["reasoning_tokens"] == 0
825
+ assert usage["prompt_tokens_details"]["cached_tokens"] == 0
@@ -60,7 +60,7 @@ def mock_async_chat_completion():
60
60
  ) as mock_chat_completion_create:
61
61
  completion = ChatCompletion(
62
62
  id="foo",
63
- model="openai/gpt-5-mini",
63
+ model="openai/gpt-6.1-terra",
64
64
  object="chat.completion",
65
65
  choices=[
66
66
  Choice(
@@ -129,6 +129,36 @@ class TestCometAPIChatGeneratorAsync:
129
129
  assert len(response["replies"]) == 1
130
130
  assert [isinstance(reply, ChatMessage) for reply in response["replies"]]
131
131
 
132
+ @pytest.mark.parametrize(
133
+ ("model", "use_tools", "generation_kwargs", "expected_reasoning_effort"),
134
+ [
135
+ ("gpt-6.1-terra", True, {}, "none"),
136
+ ("gpt-6.1-terra", True, {"reasoning_effort": "low"}, "low"),
137
+ ("gpt-6.1-terra", False, {}, None),
138
+ ("gpt-4.1", True, {}, None),
139
+ ],
140
+ )
141
+ @pytest.mark.asyncio
142
+ async def test_run_async_reasoning_effort_default_with_tools(
143
+ self,
144
+ chat_messages,
145
+ tools,
146
+ mock_async_chat_completion,
147
+ monkeypatch,
148
+ model,
149
+ use_tools,
150
+ generation_kwargs,
151
+ expected_reasoning_effort,
152
+ ):
153
+ monkeypatch.setenv("COMET_API_KEY", "fake-api-key")
154
+ component = CometAPIChatGenerator(model=model)
155
+ await component.run_async(
156
+ chat_messages, tools=tools if use_tools else None, generation_kwargs=generation_kwargs
157
+ )
158
+
159
+ _, kwargs = mock_async_chat_completion.call_args
160
+ assert kwargs.get("reasoning_effort") == expected_reasoning_effort
161
+
132
162
  @pytest.mark.skipif(
133
163
  not os.environ.get("COMET_API_KEY", None),
134
164
  reason="Export an env var called COMET_API_KEY containing the OpenAI API key to run this test.",
@@ -142,7 +172,7 @@ class TestCometAPIChatGeneratorAsync:
142
172
  assert len(results["replies"]) == 1
143
173
  message: ChatMessage = results["replies"][0]
144
174
  assert "Paris" in message.text
145
- assert "gpt-5-mini" in message.meta["model"]
175
+ assert "gpt-6.1-terra" in message.meta["model"]
146
176
  assert message.meta["finish_reason"] == "stop"
147
177
 
148
178
  @pytest.mark.skipif(
@@ -168,7 +198,7 @@ class TestCometAPIChatGeneratorAsync:
168
198
  message: ChatMessage = results["replies"][0]
169
199
  assert "Paris" in message.text
170
200
 
171
- assert "gpt-5-mini" in message.meta["model"]
201
+ assert "gpt-6.1-terra" in message.meta["model"]
172
202
  assert message.meta["finish_reason"] == "stop"
173
203
 
174
204
  assert counter > 1
@@ -1,41 +0,0 @@
1
- # Changelog
2
-
3
- ## [integrations/cometapi-v2.1.0] - 2026-01-28
4
-
5
- ### 🧹 Chores
6
-
7
- - CometAPI - upgrade to Haystack 2.23 and remove special delta handling (#2786)
8
-
9
-
10
- ## [integrations/cometapi-v2.0.1] - 2026-01-19
11
-
12
- ### 🐛 Bug Fixes
13
-
14
- - `CometAPIChatGenerator` - handle `delta` set to `None` (#2759)
15
-
16
-
17
- ## [integrations/cometapi-v2.0.0] - 2026-01-09
18
-
19
- ### 🧹 Chores
20
-
21
- - Remove Readme API CI workflow and configs (#2573)
22
- - Make fmt command more forgiving (#2671)
23
- - [**breaking**] Cometapi - drop Python 3.9 and use X|Y typing (#2697)
24
-
25
-
26
- ## [integrations/cometapi-v1.1.0] - 2025-11-26
27
-
28
- ### 🚀 Features
29
-
30
- - Add CometAPI integration with CometAPIChatGenerator class and configuration (#2345)
31
-
32
- ### 🧹 Chores
33
-
34
- - Update CometAPIChatGenerator default model to gpt-5-mini and remove e… (#2559)
35
-
36
- ### 🌀 Miscellaneous
37
-
38
- - Add missing config file for Docusaurus sync (#2505)
39
- - Adopt PEP 585 type hinting (part 3) (#2510)
40
-
41
- <!-- generated by git-cliff -->