amazon-bedrock-haystack 3.5.1__py3-none-any.whl → 3.5.2__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: amazon-bedrock-haystack
3
- Version: 3.5.1
3
+ Version: 3.5.2
4
4
  Summary: An integration of Amazon Bedrock as an AmazonBedrockGenerator component.
5
5
  Project-URL: Documentation, https://github.com/deepset-ai/haystack-core-integrations/tree/main/integrations/amazon_bedrock#readme
6
6
  Project-URL: Issues, https://github.com/deepset-ai/haystack-core-integrations/issues
@@ -8,11 +8,11 @@ haystack_integrations/components/generators/amazon_bedrock/__init__.py,sha256=lv
8
8
  haystack_integrations/components/generators/amazon_bedrock/adapters.py,sha256=cnlfmie4HfEX4nipSXSDk_3koy7HYZ-ezimGN6BozQ0,19543
9
9
  haystack_integrations/components/generators/amazon_bedrock/generator.py,sha256=2L9-ZKJkMI5JxN0xZ8Gn_5MfdjhT4UlFjlrTd9Rdhsg,14514
10
10
  haystack_integrations/components/generators/amazon_bedrock/chat/__init__.py,sha256=6GZ8Y3Lw0rLOsOAqi6Tu5mZC977UzQvgDxKpOWr8IQw,110
11
- haystack_integrations/components/generators/amazon_bedrock/chat/chat_generator.py,sha256=0kwxL-tIdxnohL0QssEbq4LwZPztxtEf1Aux00ndRVA,20527
12
- haystack_integrations/components/generators/amazon_bedrock/chat/utils.py,sha256=PdfX-z5PYhKCW-jqttxug6UYqAmvtUQS65PFnp8YCjg,11839
11
+ haystack_integrations/components/generators/amazon_bedrock/chat/chat_generator.py,sha256=f60FRraGvPeMBiosclNN3hLv9uQihQcQFETC-gwGieM,20784
12
+ haystack_integrations/components/generators/amazon_bedrock/chat/utils.py,sha256=Dch2YkrDFu-Dvi9i1bE97taAA1Qf3wMQb4wh2T3Z-lw,11789
13
13
  haystack_integrations/components/rankers/amazon_bedrock/__init__.py,sha256=DWsCu-dav2wzr13U2H1jlFjdzdjkV0fnJw7DVDRY8RQ,63
14
14
  haystack_integrations/components/rankers/amazon_bedrock/ranker.py,sha256=kq9h_ApGXBDs_GW66QQpo8JwW9grLpqpFT9uXiwT8_M,11643
15
- amazon_bedrock_haystack-3.5.1.dist-info/METADATA,sha256=7OFuP5YBVnaN6-JBxlUu-4bIDM6oUgoHZ6bg4FTSnM8,2217
16
- amazon_bedrock_haystack-3.5.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
17
- amazon_bedrock_haystack-3.5.1.dist-info/licenses/LICENSE.txt,sha256=B05uMshqTA74s-0ltyHKI6yoPfJ3zYgQbvcXfDVGFf8,10280
18
- amazon_bedrock_haystack-3.5.1.dist-info/RECORD,,
15
+ amazon_bedrock_haystack-3.5.2.dist-info/METADATA,sha256=gumDQJXyNSXhdWQFhVuVY1OSmhOGJiXP9re3y2uTVE0,2217
16
+ amazon_bedrock_haystack-3.5.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
17
+ amazon_bedrock_haystack-3.5.2.dist-info/licenses/LICENSE.txt,sha256=B05uMshqTA74s-0ltyHKI6yoPfJ3zYgQbvcXfDVGFf8,10280
18
+ amazon_bedrock_haystack-3.5.2.dist-info/RECORD,,
@@ -5,10 +5,16 @@ from botocore.eventstream import EventStream
5
5
  from botocore.exceptions import ClientError
6
6
  from haystack import component, default_from_dict, default_to_dict, logging
7
7
  from haystack.dataclasses import ChatMessage, StreamingCallbackT, select_streaming_callback
8
- from haystack.tools import Tool, _check_duplicate_tool_names, deserialize_tools_inplace
8
+ from haystack.tools import Tool, _check_duplicate_tool_names
9
9
  from haystack.utils.auth import Secret, deserialize_secrets_inplace
10
10
  from haystack.utils.callable_serialization import deserialize_callable, serialize_callable
11
11
 
12
+ # Compatibility with Haystack 2.12.0 and 2.13.0 - remove after 2.13.0 is released
13
+ try:
14
+ from haystack.tools import deserialize_tools_or_toolset_inplace
15
+ except ImportError:
16
+ from haystack.tools import deserialize_tools_inplace as deserialize_tools_or_toolset_inplace
17
+
12
18
  from haystack_integrations.common.amazon_bedrock.errors import (
13
19
  AmazonBedrockConfigurationError,
14
20
  AmazonBedrockInferenceError,
@@ -287,7 +293,7 @@ class AmazonBedrockChatGenerator:
287
293
  data["init_parameters"],
288
294
  ["aws_access_key_id", "aws_secret_access_key", "aws_session_token", "aws_region_name", "aws_profile_name"],
289
295
  )
290
- deserialize_tools_inplace(data["init_parameters"], key="tools")
296
+ deserialize_tools_or_toolset_inplace(data["init_parameters"], key="tools")
291
297
  return default_from_dict(cls, data)
292
298
 
293
299
  def _prepare_request_params(
@@ -146,10 +146,7 @@ def _parse_streaming_response(
146
146
  replies = []
147
147
  current_content = ""
148
148
  current_tool_call: Optional[Dict[str, Any]] = None
149
- base_meta = {
150
- "model": model,
151
- "index": 0,
152
- }
149
+ base_meta = {"model": model, "index": 0}
153
150
 
154
151
  for event in response_stream:
155
152
  if "contentBlockStart" in event:
@@ -170,7 +167,7 @@ def _parse_streaming_response(
170
167
  if "text" in delta:
171
168
  delta_text = delta["text"]
172
169
  current_content += delta_text
173
- streaming_chunk = StreamingChunk(content=delta_text, meta=None)
170
+ streaming_chunk = StreamingChunk(content=delta_text, meta={})
174
171
  streaming_callback(streaming_chunk)
175
172
  elif "toolUse" in delta and current_tool_call:
176
173
  # Accumulate tool use input deltas
@@ -231,10 +228,7 @@ async def _parse_streaming_response_async(
231
228
  replies = []
232
229
  current_content = ""
233
230
  current_tool_call: Optional[Dict[str, Any]] = None
234
- base_meta = {
235
- "model": model,
236
- "index": 0,
237
- }
231
+ base_meta = {"model": model, "index": 0}
238
232
 
239
233
  async for event in response_stream:
240
234
  if "contentBlockStart" in event:
@@ -255,7 +249,7 @@ async def _parse_streaming_response_async(
255
249
  if "text" in delta:
256
250
  delta_text = delta["text"]
257
251
  current_content += delta_text
258
- streaming_chunk = StreamingChunk(content=delta_text, meta=None)
252
+ streaming_chunk = StreamingChunk(content=delta_text, meta={})
259
253
  await streaming_callback(streaming_chunk)
260
254
  elif "toolUse" in delta and current_tool_call:
261
255
  # Accumulate tool use input deltas