aimlapi-haystack 1.0.0__py3-none-any.whl → 2.1.0__py3-none-any.whl
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.
- {aimlapi_haystack-1.0.0.dist-info → aimlapi_haystack-2.1.0.dist-info}/METADATA +5 -5
- aimlapi_haystack-2.1.0.dist-info/RECORD +8 -0
- {aimlapi_haystack-1.0.0.dist-info → aimlapi_haystack-2.1.0.dist-info}/WHEEL +1 -1
- {aimlapi_haystack-1.0.0.dist-info → aimlapi_haystack-2.1.0.dist-info}/licenses/LICENSE.txt +1 -1
- haystack_integrations/components/generators/aimlapi/chat/chat_generator.py +22 -22
- aimlapi_haystack-1.0.0.dist-info/RECORD +0 -8
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: aimlapi-haystack
|
|
3
|
-
Version: 1.0
|
|
3
|
+
Version: 2.1.0
|
|
4
4
|
Project-URL: Documentation, https://github.com/deepset-ai/haystack-core-integrations/tree/main/integrations/aimlapi#readme
|
|
5
5
|
Project-URL: Issues, https://github.com/deepset-ai/haystack-core-integrations/issues
|
|
6
6
|
Project-URL: Source, https://github.com/deepset-ai/haystack-core-integrations/tree/main/integrations/aimlapi
|
|
7
|
-
Author-email: "Dmitry <D1m7asis> Tumanov" <d1m7asis@gmail.com>
|
|
7
|
+
Author-email: deepset GmbH <info@deepset.ai>, "Dmitry <D1m7asis> Tumanov" <d1m7asis@gmail.com>
|
|
8
8
|
License-Expression: Apache-2.0
|
|
9
9
|
License-File: LICENSE.txt
|
|
10
10
|
Classifier: Development Status :: 4 - Beta
|
|
11
11
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
12
12
|
Classifier: Programming Language :: Python
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
14
13
|
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
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
18
18
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
19
19
|
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
20
|
-
Requires-Python: >=3.
|
|
21
|
-
Requires-Dist: haystack-ai>=2.
|
|
20
|
+
Requires-Python: >=3.10
|
|
21
|
+
Requires-Dist: haystack-ai>=2.22.0
|
|
22
22
|
Description-Content-Type: text/markdown
|
|
23
23
|
|
|
24
24
|
# aimlapi-haystack
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
haystack_integrations/components/generators/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
haystack_integrations/components/generators/aimlapi/__init__.py,sha256=QVmh_YP8EKx4gjxrqQ54dzZEZewtjtd1MgsjjJolxpI,90
|
|
3
|
+
haystack_integrations/components/generators/aimlapi/chat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
+
haystack_integrations/components/generators/aimlapi/chat/chat_generator.py,sha256=PqkE-pTx8A1c7bI6RMXKmDkb1tviTI8bQr39lnF_1JI,9870
|
|
5
|
+
aimlapi_haystack-2.1.0.dist-info/METADATA,sha256=X1hm3qmtZ-mZAQ8q0BojggFR-d_UGzPvEM6oWADhpMQ,1881
|
|
6
|
+
aimlapi_haystack-2.1.0.dist-info/WHEEL,sha256=lCkmxWfQsSc9CfIClYeavTdQeEX2toPqufh9gI35EQA,87
|
|
7
|
+
aimlapi_haystack-2.1.0.dist-info/licenses/LICENSE.txt,sha256=uzzy9ltYNge367fW8mo54Vr-dKlRNoddNEV5nB1ScUM,10273
|
|
8
|
+
aimlapi_haystack-2.1.0.dist-info/RECORD,,
|
|
@@ -58,7 +58,7 @@ APPENDIX: How to apply the Apache License to your work.
|
|
|
58
58
|
|
|
59
59
|
To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
|
|
60
60
|
|
|
61
|
-
Copyright 2025
|
|
61
|
+
Copyright 2025-present deepset GmbH
|
|
62
62
|
|
|
63
63
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
64
64
|
you may not use this file except in compliance with the License.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
#
|
|
3
3
|
# SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
|
|
5
|
-
from typing import Any
|
|
5
|
+
from typing import Any
|
|
6
6
|
|
|
7
7
|
from haystack import component, default_to_dict, logging
|
|
8
8
|
from haystack.components.generators.chat import OpenAIChatGenerator
|
|
@@ -20,6 +20,7 @@ AIMLAPI_HEADERS = {"HTTP-Referer": "https://github.com/deepset-ai/haystack-core-
|
|
|
20
20
|
class AIMLAPIChatGenerator(OpenAIChatGenerator):
|
|
21
21
|
"""
|
|
22
22
|
Enables text generation using AIMLAPI generative models.
|
|
23
|
+
|
|
23
24
|
For supported models, see AIMLAPI documentation.
|
|
24
25
|
|
|
25
26
|
Users can pass any text generation parameters valid for the AIMLAPI chat completion API
|
|
@@ -63,18 +64,19 @@ class AIMLAPIChatGenerator(OpenAIChatGenerator):
|
|
|
63
64
|
*,
|
|
64
65
|
api_key: Secret = Secret.from_env_var("AIMLAPI_API_KEY"),
|
|
65
66
|
model: str = "openai/gpt-5-chat-latest",
|
|
66
|
-
streaming_callback:
|
|
67
|
-
api_base_url:
|
|
68
|
-
generation_kwargs:
|
|
69
|
-
tools:
|
|
70
|
-
timeout:
|
|
71
|
-
extra_headers:
|
|
72
|
-
max_retries:
|
|
73
|
-
http_client_kwargs:
|
|
74
|
-
):
|
|
67
|
+
streaming_callback: StreamingCallbackT | None = None,
|
|
68
|
+
api_base_url: str | None = "https://api.aimlapi.com/v1",
|
|
69
|
+
generation_kwargs: dict[str, Any] | None = None,
|
|
70
|
+
tools: ToolsType | None = None,
|
|
71
|
+
timeout: float | None = None,
|
|
72
|
+
extra_headers: dict[str, Any] | None = None,
|
|
73
|
+
max_retries: int | None = None,
|
|
74
|
+
http_client_kwargs: dict[str, Any] | None = None,
|
|
75
|
+
) -> None:
|
|
75
76
|
"""
|
|
76
|
-
Creates an instance of AIMLAPIChatGenerator.
|
|
77
|
-
|
|
77
|
+
Creates an instance of AIMLAPIChatGenerator.
|
|
78
|
+
|
|
79
|
+
Unless specified otherwise, the default model is `openai/gpt-5-chat-latest`.
|
|
78
80
|
|
|
79
81
|
:param api_key:
|
|
80
82
|
The AIMLAPI API key.
|
|
@@ -128,7 +130,7 @@ class AIMLAPIChatGenerator(OpenAIChatGenerator):
|
|
|
128
130
|
)
|
|
129
131
|
self.extra_headers = extra_headers
|
|
130
132
|
|
|
131
|
-
def to_dict(self) ->
|
|
133
|
+
def to_dict(self) -> dict[str, Any]:
|
|
132
134
|
"""
|
|
133
135
|
Serialize this component to a dictionary.
|
|
134
136
|
|
|
@@ -154,18 +156,18 @@ class AIMLAPIChatGenerator(OpenAIChatGenerator):
|
|
|
154
156
|
def _prepare_api_call(
|
|
155
157
|
self,
|
|
156
158
|
*,
|
|
157
|
-
messages:
|
|
158
|
-
streaming_callback:
|
|
159
|
-
generation_kwargs:
|
|
160
|
-
tools:
|
|
161
|
-
tools_strict:
|
|
162
|
-
) ->
|
|
159
|
+
messages: list[ChatMessage],
|
|
160
|
+
streaming_callback: StreamingCallbackT | None = None,
|
|
161
|
+
generation_kwargs: dict[str, Any] | None = None,
|
|
162
|
+
tools: ToolsType | None = None,
|
|
163
|
+
tools_strict: bool | None = None,
|
|
164
|
+
) -> dict[str, Any]:
|
|
163
165
|
# update generation kwargs by merging with the generation kwargs passed to the run method
|
|
164
166
|
generation_kwargs = {**self.generation_kwargs, **(generation_kwargs or {})}
|
|
165
167
|
extra_headers = {**AIMLAPI_HEADERS, **(self.extra_headers or {})}
|
|
166
168
|
|
|
167
169
|
# adapt ChatMessage(s) to the format expected by the OpenAI API (AIMLAPI uses the same format)
|
|
168
|
-
aimlapi_formatted_messages:
|
|
170
|
+
aimlapi_formatted_messages: list[dict[str, Any]] = [message.to_openai_dict_format() for message in messages]
|
|
169
171
|
|
|
170
172
|
tools_strict = tools_strict if tools_strict is not None else self.tools_strict
|
|
171
173
|
flattened_tools = flatten_tools_or_toolsets(tools or self.tools)
|
|
@@ -192,8 +194,6 @@ class AIMLAPIChatGenerator(OpenAIChatGenerator):
|
|
|
192
194
|
raise ValueError(msg)
|
|
193
195
|
response_format = generation_kwargs.pop("response_format", None)
|
|
194
196
|
|
|
195
|
-
response_format = generation_kwargs.pop("response_format", None)
|
|
196
|
-
|
|
197
197
|
base_args = {
|
|
198
198
|
"model": self.model,
|
|
199
199
|
"messages": aimlapi_formatted_messages,
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
haystack_integrations/components/generators/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
haystack_integrations/components/generators/aimlapi/__init__.py,sha256=QVmh_YP8EKx4gjxrqQ54dzZEZewtjtd1MgsjjJolxpI,90
|
|
3
|
-
haystack_integrations/components/generators/aimlapi/chat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
-
haystack_integrations/components/generators/aimlapi/chat/chat_generator.py,sha256=fnTmV_tOi6bfsupfCz5XU9lRWQQBl9viZttkn6_iRc8,9992
|
|
5
|
-
aimlapi_haystack-1.0.0.dist-info/METADATA,sha256=6kU1ZCMPurQiYK0h32dZy1yh8ENYqojxq3BluhJBEqs,1847
|
|
6
|
-
aimlapi_haystack-1.0.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
7
|
-
aimlapi_haystack-1.0.0.dist-info/licenses/LICENSE.txt,sha256=dBoNaaXH0arIHtfis5LQowOenGorOi0fqfeWub_w3kI,10262
|
|
8
|
-
aimlapi_haystack-1.0.0.dist-info/RECORD,,
|