watsonx-haystack 2.0.0__tar.gz → 3.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.
- {watsonx_haystack-2.0.0 → watsonx_haystack-3.0.0}/CHANGELOG.md +20 -0
- {watsonx_haystack-2.0.0 → watsonx_haystack-3.0.0}/PKG-INFO +1 -1
- {watsonx_haystack-2.0.0 → watsonx_haystack-3.0.0}/pyproject.toml +0 -1
- {watsonx_haystack-2.0.0 → watsonx_haystack-3.0.0}/src/haystack_integrations/components/embedders/watsonx/document_embedder.py +2 -15
- {watsonx_haystack-2.0.0 → watsonx_haystack-3.0.0}/src/haystack_integrations/components/embedders/watsonx/text_embedder.py +2 -15
- {watsonx_haystack-2.0.0 → watsonx_haystack-3.0.0}/src/haystack_integrations/components/generators/watsonx/chat/chat_generator.py +3 -4
- {watsonx_haystack-2.0.0 → watsonx_haystack-3.0.0}/tests/test_document_embedder.py +3 -1
- {watsonx_haystack-2.0.0 → watsonx_haystack-3.0.0}/tests/test_text_embedder.py +3 -1
- {watsonx_haystack-2.0.0 → watsonx_haystack-3.0.0}/.gitignore +0 -0
- {watsonx_haystack-2.0.0 → watsonx_haystack-3.0.0}/LICENSE.txt +0 -0
- {watsonx_haystack-2.0.0 → watsonx_haystack-3.0.0}/README.md +0 -0
- {watsonx_haystack-2.0.0 → watsonx_haystack-3.0.0}/examples/chat_generator_example.py +0 -0
- {watsonx_haystack-2.0.0 → watsonx_haystack-3.0.0}/examples/embedders_example.py +0 -0
- {watsonx_haystack-2.0.0 → watsonx_haystack-3.0.0}/pydoc/config_docusaurus.yml +0 -0
- {watsonx_haystack-2.0.0 → watsonx_haystack-3.0.0}/src/haystack_integrations/components/embedders/py.typed +0 -0
- {watsonx_haystack-2.0.0 → watsonx_haystack-3.0.0}/src/haystack_integrations/components/embedders/watsonx/__init__.py +0 -0
- {watsonx_haystack-2.0.0 → watsonx_haystack-3.0.0}/src/haystack_integrations/components/generators/py.typed +0 -0
- {watsonx_haystack-2.0.0 → watsonx_haystack-3.0.0}/src/haystack_integrations/components/generators/watsonx/__init__.py +0 -0
- {watsonx_haystack-2.0.0 → watsonx_haystack-3.0.0}/src/haystack_integrations/components/generators/watsonx/chat/__init__.py +0 -0
- {watsonx_haystack-2.0.0 → watsonx_haystack-3.0.0}/tests/__init__.py +0 -0
- {watsonx_haystack-2.0.0 → watsonx_haystack-3.0.0}/tests/conftest.py +0 -0
- {watsonx_haystack-2.0.0 → watsonx_haystack-3.0.0}/tests/test_chat_generator.py +0 -0
- {watsonx_haystack-2.0.0 → watsonx_haystack-3.0.0}/tests/test_files/apple.jpg +0 -0
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [integrations/watsonx-v2.0.0] - 2026-09-11
|
|
4
|
+
|
|
5
|
+
### 🐛 Bug Fixes
|
|
6
|
+
|
|
7
|
+
- Standardize license files (#3771)
|
|
8
|
+
|
|
9
|
+
### 🚜 Refactor
|
|
10
|
+
|
|
11
|
+
- [**breaking**] Watsonx - move client creation to warm_up (#3944)
|
|
12
|
+
|
|
13
|
+
### ⚙️ CI
|
|
14
|
+
|
|
15
|
+
- Improve changelog generation; fix existing changelogs (#3883)
|
|
16
|
+
|
|
17
|
+
### 🧹 Chores
|
|
18
|
+
|
|
19
|
+
- Clarify how generation_kwargs passed in run are handled (#3805)
|
|
20
|
+
- [**breaking**] Remove deprecated `WatsonxGenerator` (use `WatsonxChatGenerator` instead) (#3889)
|
|
21
|
+
|
|
22
|
+
|
|
3
23
|
## [integrations/watsonx-v1.7.0] - 2026-08-07
|
|
4
24
|
|
|
5
25
|
### 🚀 Features
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: watsonx-haystack
|
|
3
|
-
Version:
|
|
3
|
+
Version: 3.0.0
|
|
4
4
|
Summary: Watsonx integration for Haystack
|
|
5
5
|
Project-URL: Documentation, https://github.com/deepset-ai/haystack-core-integrations/tree/main/integrations/watsonx#readme
|
|
6
6
|
Project-URL: Issues, https://github.com/deepset-ai/haystack-core-integrations/issues
|
|
@@ -7,8 +7,8 @@ from __future__ import annotations
|
|
|
7
7
|
from dataclasses import replace
|
|
8
8
|
from typing import Any
|
|
9
9
|
|
|
10
|
-
from haystack import Document, component,
|
|
11
|
-
from haystack.utils import Secret
|
|
10
|
+
from haystack import Document, component, default_to_dict
|
|
11
|
+
from haystack.utils import Secret
|
|
12
12
|
from ibm_watsonx_ai import Credentials
|
|
13
13
|
from ibm_watsonx_ai.foundation_models import Embeddings
|
|
14
14
|
|
|
@@ -158,19 +158,6 @@ class WatsonxDocumentEmbedder:
|
|
|
158
158
|
embedding_separator=self.embedding_separator,
|
|
159
159
|
)
|
|
160
160
|
|
|
161
|
-
@classmethod
|
|
162
|
-
def from_dict(cls, data: dict[str, Any]) -> "WatsonxDocumentEmbedder": # noqa: UP037
|
|
163
|
-
"""
|
|
164
|
-
Deserializes the component from a dictionary.
|
|
165
|
-
|
|
166
|
-
:param data:
|
|
167
|
-
The dictionary representation of this component.
|
|
168
|
-
:returns:
|
|
169
|
-
The deserialized component instance.
|
|
170
|
-
"""
|
|
171
|
-
deserialize_secrets_inplace(data["init_parameters"], keys=["api_key", "project_id"])
|
|
172
|
-
return default_from_dict(cls, data)
|
|
173
|
-
|
|
174
161
|
def _prepare_texts_to_embed(self, documents: list[Document]) -> list[str]:
|
|
175
162
|
"""
|
|
176
163
|
Prepare the texts to embed by concatenating the Document text with the metadata fields to embed.
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
from typing import Any
|
|
6
6
|
|
|
7
|
-
from haystack import component,
|
|
8
|
-
from haystack.utils import Secret
|
|
7
|
+
from haystack import component, default_to_dict
|
|
8
|
+
from haystack.utils import Secret
|
|
9
9
|
from ibm_watsonx_ai import Credentials
|
|
10
10
|
from ibm_watsonx_ai.foundation_models import Embeddings
|
|
11
11
|
|
|
@@ -136,19 +136,6 @@ class WatsonxTextEmbedder:
|
|
|
136
136
|
max_retries=self.max_retries,
|
|
137
137
|
)
|
|
138
138
|
|
|
139
|
-
@classmethod
|
|
140
|
-
def from_dict(cls, data: dict[str, Any]) -> "WatsonxTextEmbedder":
|
|
141
|
-
"""
|
|
142
|
-
Deserializes the component from a dictionary.
|
|
143
|
-
|
|
144
|
-
:param data:
|
|
145
|
-
The dictionary representation of this component.
|
|
146
|
-
:returns:
|
|
147
|
-
The deserialized component instance.
|
|
148
|
-
"""
|
|
149
|
-
deserialize_secrets_inplace(data["init_parameters"], keys=["api_key", "project_id"])
|
|
150
|
-
return default_from_dict(cls, data)
|
|
151
|
-
|
|
152
139
|
def _prepare_input(self, text: str) -> str:
|
|
153
140
|
if not isinstance(text, str):
|
|
154
141
|
msg = (
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import inspect
|
|
6
6
|
import json
|
|
7
7
|
from dataclasses import replace
|
|
8
|
-
from datetime import
|
|
8
|
+
from datetime import UTC, datetime
|
|
9
9
|
from typing import Any, ClassVar, Literal, get_args
|
|
10
10
|
|
|
11
11
|
from haystack import component, default_from_dict, default_to_dict, logging
|
|
@@ -31,7 +31,7 @@ from haystack.tools import (
|
|
|
31
31
|
flatten_tools_or_toolsets,
|
|
32
32
|
serialize_tools_or_toolset,
|
|
33
33
|
)
|
|
34
|
-
from haystack.utils import Secret, deserialize_callable,
|
|
34
|
+
from haystack.utils import Secret, deserialize_callable, serialize_callable
|
|
35
35
|
from ibm_watsonx_ai import Credentials
|
|
36
36
|
from ibm_watsonx_ai.foundation_models import ModelInference
|
|
37
37
|
|
|
@@ -250,7 +250,6 @@ class WatsonxChatGenerator:
|
|
|
250
250
|
:returns:
|
|
251
251
|
The deserialized component instance.
|
|
252
252
|
"""
|
|
253
|
-
deserialize_secrets_inplace(data["init_parameters"], keys=["api_key", "project_id"])
|
|
254
253
|
deserialize_tools_or_toolset_inplace(data["init_parameters"], key="tools")
|
|
255
254
|
init_params = data.get("init_parameters", {})
|
|
256
255
|
serialized_callback = init_params.get("streaming_callback")
|
|
@@ -430,7 +429,7 @@ class WatsonxChatGenerator:
|
|
|
430
429
|
"model_version": chunk.get("model_version"),
|
|
431
430
|
"created": chunk.get("created"),
|
|
432
431
|
"created_at": chunk.get("created_at"),
|
|
433
|
-
"received_at": datetime.now(
|
|
432
|
+
"received_at": datetime.now(UTC).isoformat(),
|
|
434
433
|
}
|
|
435
434
|
|
|
436
435
|
if choice["delta"] and (choice_delta_tool_calls := choice["delta"].get("tool_calls")):
|
|
@@ -6,6 +6,7 @@ from unittest.mock import patch
|
|
|
6
6
|
|
|
7
7
|
import pytest
|
|
8
8
|
from haystack import Document
|
|
9
|
+
from haystack.core.serialization import component_from_dict
|
|
9
10
|
from haystack.utils.auth import Secret
|
|
10
11
|
|
|
11
12
|
from haystack_integrations.components.embedders.watsonx.document_embedder import WatsonxDocumentEmbedder
|
|
@@ -87,12 +88,13 @@ class TestInitializationAndSerialization:
|
|
|
87
88
|
},
|
|
88
89
|
}
|
|
89
90
|
|
|
90
|
-
component = WatsonxDocumentEmbedder
|
|
91
|
+
component = component_from_dict(WatsonxDocumentEmbedder, data, name="component")
|
|
91
92
|
|
|
92
93
|
assert component.model == "ibm/slate-125m-english-rtrvr"
|
|
93
94
|
assert component.api_base_url == "https://custom-url.ibm.com"
|
|
94
95
|
assert isinstance(component.project_id, Secret)
|
|
95
96
|
assert component.project_id == Secret.from_env_var("WATSONX_PROJECT_ID")
|
|
97
|
+
assert component.api_key == Secret.from_env_var("WATSONX_API_KEY")
|
|
96
98
|
assert component.prefix == "prefix "
|
|
97
99
|
assert component.suffix == " suffix"
|
|
98
100
|
assert component.batch_size == 500
|
|
@@ -5,6 +5,7 @@ import os
|
|
|
5
5
|
from unittest.mock import patch
|
|
6
6
|
|
|
7
7
|
import pytest
|
|
8
|
+
from haystack.core.serialization import component_from_dict
|
|
8
9
|
from haystack.utils.auth import Secret
|
|
9
10
|
from ibm_watsonx_ai.wml_client_error import ApiRequestFailure
|
|
10
11
|
|
|
@@ -71,12 +72,13 @@ class TestInitializationAndSerialization:
|
|
|
71
72
|
},
|
|
72
73
|
}
|
|
73
74
|
|
|
74
|
-
component = WatsonxTextEmbedder
|
|
75
|
+
component = component_from_dict(WatsonxTextEmbedder, data, name="component")
|
|
75
76
|
|
|
76
77
|
assert component.model == "ibm/slate-125m-english-rtrvr"
|
|
77
78
|
assert component.api_base_url == "https://custom-url.ibm.com"
|
|
78
79
|
assert isinstance(component.project_id, Secret)
|
|
79
80
|
assert component.project_id == Secret.from_env_var("WATSONX_PROJECT_ID")
|
|
81
|
+
assert component.api_key == Secret.from_env_var("WATSONX_API_KEY")
|
|
80
82
|
assert component.prefix == "prefix "
|
|
81
83
|
assert component.suffix == " suffix"
|
|
82
84
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|