amazon-bedrock-haystack 6.1.1__py3-none-any.whl → 6.2.1__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: 6.1.1
3
+ Version: 6.2.1
4
4
  Summary: An integration of AWS S3 and Bedrock as a Downloader and Generator components.
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
@@ -18,12 +18,12 @@ haystack_integrations/components/generators/amazon_bedrock/__init__.py,sha256=lv
18
18
  haystack_integrations/components/generators/amazon_bedrock/adapters.py,sha256=4-gIWfw70hGaXMNS30UbJFNFCWK2KG6RMnT_4z5RHxc,19625
19
19
  haystack_integrations/components/generators/amazon_bedrock/generator.py,sha256=jz9hT3ZMJtUsQnyeCa1sbeEf7e37t3EktQLAT8J2qpM,14901
20
20
  haystack_integrations/components/generators/amazon_bedrock/chat/__init__.py,sha256=6GZ8Y3Lw0rLOsOAqi6Tu5mZC977UzQvgDxKpOWr8IQw,110
21
- haystack_integrations/components/generators/amazon_bedrock/chat/chat_generator.py,sha256=KJqeKFzM1thG2GSVm51pY5aX6gctmtnJvF_kwOH8gqQ,26143
21
+ haystack_integrations/components/generators/amazon_bedrock/chat/chat_generator.py,sha256=C2hB0Wg_oxSnvPAIrTB4eHqjn8a732HfhbhYmS9eGjc,27731
22
22
  haystack_integrations/components/generators/amazon_bedrock/chat/utils.py,sha256=juOaTi8DuXr-i68zzjCnYoc5eNxO1DxcTI9fcNfg4rE,27214
23
23
  haystack_integrations/components/rankers/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
24
24
  haystack_integrations/components/rankers/amazon_bedrock/__init__.py,sha256=mJQKShAP5AfZvfKQisSh7kfKu6RIXzsYdk4eqMtcaEk,75
25
25
  haystack_integrations/components/rankers/amazon_bedrock/ranker.py,sha256=L-1AzmsWR8PYb8CEJsfoYK9MBrE2qXFjenfiiGxa6iw,11769
26
- amazon_bedrock_haystack-6.1.1.dist-info/METADATA,sha256=okatp8ksYtYJPhChO3F17zUct7P-xe-ASokzWSCWYjo,2179
27
- amazon_bedrock_haystack-6.1.1.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
28
- amazon_bedrock_haystack-6.1.1.dist-info/licenses/LICENSE.txt,sha256=B05uMshqTA74s-0ltyHKI6yoPfJ3zYgQbvcXfDVGFf8,10280
29
- amazon_bedrock_haystack-6.1.1.dist-info/RECORD,,
26
+ amazon_bedrock_haystack-6.2.1.dist-info/METADATA,sha256=Fr8kZsEebhQpC-g0uj6-h6cUMv0ZIi5dwTYq2HZSt7w,2179
27
+ amazon_bedrock_haystack-6.2.1.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
28
+ amazon_bedrock_haystack-6.2.1.dist-info/licenses/LICENSE.txt,sha256=B05uMshqTA74s-0ltyHKI6yoPfJ3zYgQbvcXfDVGFf8,10280
29
+ amazon_bedrock_haystack-6.2.1.dist-info/RECORD,,
@@ -372,6 +372,8 @@ class AmazonBedrockChatGenerator:
372
372
  merged_kwargs = self.generation_kwargs.copy()
373
373
  merged_kwargs.update(generation_kwargs)
374
374
 
375
+ merged_kwargs = self._resolve_flattened_generation_kwargs(merged_kwargs)
376
+
375
377
  # Extract known inference parameters
376
378
  # See https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_InferenceConfiguration.html
377
379
  inference_config = {
@@ -419,6 +421,36 @@ class AmazonBedrockChatGenerator:
419
421
 
420
422
  return params, callback
421
423
 
424
+ def _resolve_flattened_generation_kwargs(self, generation_kwargs: dict[str, Any]) -> dict[str, Any]:
425
+ generation_kwargs = generation_kwargs.copy()
426
+
427
+ disable_parallel_tool_use = generation_kwargs.pop("disable_parallel_tool_use", None)
428
+ parallel_tool_use = generation_kwargs.pop("parallel_tool_use", None)
429
+
430
+ if disable_parallel_tool_use is not None and parallel_tool_use is not None:
431
+ msg = "Cannot set both disable_parallel_tool_use and parallel_tool_use"
432
+ raise ValueError(msg)
433
+ elif parallel_tool_use is not None:
434
+ disable_parallel_tool_use = not parallel_tool_use
435
+
436
+ if disable_parallel_tool_use is not None:
437
+ tool_choice = generation_kwargs.setdefault("tool_choice", {})
438
+ tool_choice["disable_parallel_tool_use"] = disable_parallel_tool_use
439
+ tool_choice.setdefault("type", "auto") # default value
440
+
441
+ tool_choice_type = generation_kwargs.pop("tool_choice_type", None)
442
+ if tool_choice_type is not None:
443
+ tool_choice = generation_kwargs.setdefault("tool_choice", {})
444
+ tool_choice["type"] = tool_choice_type
445
+
446
+ thinking_budget_tokens = generation_kwargs.pop("thinking_budget_tokens", None)
447
+ if thinking_budget_tokens is not None:
448
+ thinking = generation_kwargs.setdefault("thinking", {})
449
+ thinking["budget_tokens"] = thinking_budget_tokens
450
+ thinking.setdefault("type", "enabled")
451
+
452
+ return generation_kwargs
453
+
422
454
  @component.output_types(replies=list[ChatMessage])
423
455
  def run(
424
456
  self,