amazon-bedrock-haystack 5.3.0__tar.gz → 5.3.1__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.
Files changed (49) hide show
  1. {amazon_bedrock_haystack-5.3.0 → amazon_bedrock_haystack-5.3.1}/CHANGELOG.md +20 -9
  2. {amazon_bedrock_haystack-5.3.0 → amazon_bedrock_haystack-5.3.1}/PKG-INFO +1 -1
  3. {amazon_bedrock_haystack-5.3.0 → amazon_bedrock_haystack-5.3.1}/src/haystack_integrations/components/embedders/amazon_bedrock/document_embedder.py +12 -26
  4. {amazon_bedrock_haystack-5.3.0 → amazon_bedrock_haystack-5.3.1}/src/haystack_integrations/components/embedders/amazon_bedrock/document_image_embedder.py +17 -25
  5. {amazon_bedrock_haystack-5.3.0 → amazon_bedrock_haystack-5.3.1}/src/haystack_integrations/components/embedders/amazon_bedrock/text_embedder.py +12 -25
  6. {amazon_bedrock_haystack-5.3.0 → amazon_bedrock_haystack-5.3.1}/.gitignore +0 -0
  7. {amazon_bedrock_haystack-5.3.0 → amazon_bedrock_haystack-5.3.1}/LICENSE.txt +0 -0
  8. {amazon_bedrock_haystack-5.3.0 → amazon_bedrock_haystack-5.3.1}/README.md +0 -0
  9. {amazon_bedrock_haystack-5.3.0 → amazon_bedrock_haystack-5.3.1}/examples/bedrock_ranker_example.py +0 -0
  10. {amazon_bedrock_haystack-5.3.0 → amazon_bedrock_haystack-5.3.1}/examples/chatgenerator_example.py +0 -0
  11. {amazon_bedrock_haystack-5.3.0 → amazon_bedrock_haystack-5.3.1}/examples/embedders_generator_with_rag_example.py +0 -0
  12. {amazon_bedrock_haystack-5.3.0 → amazon_bedrock_haystack-5.3.1}/examples/s3_downloader_example.py +0 -0
  13. {amazon_bedrock_haystack-5.3.0 → amazon_bedrock_haystack-5.3.1}/pydoc/config_docusaurus.yml +0 -0
  14. {amazon_bedrock_haystack-5.3.0 → amazon_bedrock_haystack-5.3.1}/pyproject.toml +0 -0
  15. {amazon_bedrock_haystack-5.3.0 → amazon_bedrock_haystack-5.3.1}/src/haystack_integrations/common/amazon_bedrock/__init__.py +0 -0
  16. {amazon_bedrock_haystack-5.3.0 → amazon_bedrock_haystack-5.3.1}/src/haystack_integrations/common/amazon_bedrock/errors.py +0 -0
  17. {amazon_bedrock_haystack-5.3.0 → amazon_bedrock_haystack-5.3.1}/src/haystack_integrations/common/amazon_bedrock/utils.py +0 -0
  18. {amazon_bedrock_haystack-5.3.0 → amazon_bedrock_haystack-5.3.1}/src/haystack_integrations/common/py.typed +0 -0
  19. {amazon_bedrock_haystack-5.3.0 → amazon_bedrock_haystack-5.3.1}/src/haystack_integrations/common/s3/__init__.py +0 -0
  20. {amazon_bedrock_haystack-5.3.0 → amazon_bedrock_haystack-5.3.1}/src/haystack_integrations/common/s3/errors.py +0 -0
  21. {amazon_bedrock_haystack-5.3.0 → amazon_bedrock_haystack-5.3.1}/src/haystack_integrations/common/s3/utils.py +0 -0
  22. {amazon_bedrock_haystack-5.3.0 → amazon_bedrock_haystack-5.3.1}/src/haystack_integrations/components/downloaders/py.typed +0 -0
  23. {amazon_bedrock_haystack-5.3.0 → amazon_bedrock_haystack-5.3.1}/src/haystack_integrations/components/downloaders/s3/__init__.py +0 -0
  24. {amazon_bedrock_haystack-5.3.0 → amazon_bedrock_haystack-5.3.1}/src/haystack_integrations/components/downloaders/s3/s3_downloader.py +0 -0
  25. {amazon_bedrock_haystack-5.3.0 → amazon_bedrock_haystack-5.3.1}/src/haystack_integrations/components/embedders/amazon_bedrock/__init__.py +0 -0
  26. {amazon_bedrock_haystack-5.3.0 → amazon_bedrock_haystack-5.3.1}/src/haystack_integrations/components/embedders/py.typed +0 -0
  27. {amazon_bedrock_haystack-5.3.0 → amazon_bedrock_haystack-5.3.1}/src/haystack_integrations/components/generators/amazon_bedrock/__init__.py +0 -0
  28. {amazon_bedrock_haystack-5.3.0 → amazon_bedrock_haystack-5.3.1}/src/haystack_integrations/components/generators/amazon_bedrock/adapters.py +0 -0
  29. {amazon_bedrock_haystack-5.3.0 → amazon_bedrock_haystack-5.3.1}/src/haystack_integrations/components/generators/amazon_bedrock/chat/__init__.py +0 -0
  30. {amazon_bedrock_haystack-5.3.0 → amazon_bedrock_haystack-5.3.1}/src/haystack_integrations/components/generators/amazon_bedrock/chat/chat_generator.py +0 -0
  31. {amazon_bedrock_haystack-5.3.0 → amazon_bedrock_haystack-5.3.1}/src/haystack_integrations/components/generators/amazon_bedrock/chat/utils.py +0 -0
  32. {amazon_bedrock_haystack-5.3.0 → amazon_bedrock_haystack-5.3.1}/src/haystack_integrations/components/generators/amazon_bedrock/generator.py +0 -0
  33. {amazon_bedrock_haystack-5.3.0 → amazon_bedrock_haystack-5.3.1}/src/haystack_integrations/components/generators/py.typed +0 -0
  34. {amazon_bedrock_haystack-5.3.0 → amazon_bedrock_haystack-5.3.1}/src/haystack_integrations/components/rankers/amazon_bedrock/__init__.py +0 -0
  35. {amazon_bedrock_haystack-5.3.0 → amazon_bedrock_haystack-5.3.1}/src/haystack_integrations/components/rankers/amazon_bedrock/ranker.py +0 -0
  36. {amazon_bedrock_haystack-5.3.0 → amazon_bedrock_haystack-5.3.1}/src/haystack_integrations/components/rankers/py.typed +0 -0
  37. {amazon_bedrock_haystack-5.3.0 → amazon_bedrock_haystack-5.3.1}/tests/__init__.py +0 -0
  38. {amazon_bedrock_haystack-5.3.0 → amazon_bedrock_haystack-5.3.1}/tests/conftest.py +0 -0
  39. {amazon_bedrock_haystack-5.3.0 → amazon_bedrock_haystack-5.3.1}/tests/test_chat_generator.py +0 -0
  40. {amazon_bedrock_haystack-5.3.0 → amazon_bedrock_haystack-5.3.1}/tests/test_chat_generator_utils.py +0 -0
  41. {amazon_bedrock_haystack-5.3.0 → amazon_bedrock_haystack-5.3.1}/tests/test_document_embedder.py +0 -0
  42. {amazon_bedrock_haystack-5.3.0 → amazon_bedrock_haystack-5.3.1}/tests/test_document_image_embedder.py +0 -0
  43. {amazon_bedrock_haystack-5.3.0 → amazon_bedrock_haystack-5.3.1}/tests/test_files/apple.jpg +0 -0
  44. {amazon_bedrock_haystack-5.3.0 → amazon_bedrock_haystack-5.3.1}/tests/test_files/haystack-logo.png +0 -0
  45. {amazon_bedrock_haystack-5.3.0 → amazon_bedrock_haystack-5.3.1}/tests/test_files/sample_pdf_1.pdf +0 -0
  46. {amazon_bedrock_haystack-5.3.0 → amazon_bedrock_haystack-5.3.1}/tests/test_generator.py +0 -0
  47. {amazon_bedrock_haystack-5.3.0 → amazon_bedrock_haystack-5.3.1}/tests/test_ranker.py +0 -0
  48. {amazon_bedrock_haystack-5.3.0 → amazon_bedrock_haystack-5.3.1}/tests/test_s3_downloader.py +0 -0
  49. {amazon_bedrock_haystack-5.3.0 → amazon_bedrock_haystack-5.3.1}/tests/test_text_embedder.py +0 -0
@@ -1,38 +1,49 @@
1
1
  # Changelog
2
2
 
3
- ## [integrations/amazon_bedrock-v5.2.0] - 2025-10-22
3
+ ## [integrations/amazon_bedrock-v5.3.0] - 2025-12-17
4
4
 
5
5
  ### 🚀 Features
6
6
 
7
7
  - `AmazonBedrockChatGenerator` update tools param to ToolsType (#2415)
8
+ - Cohere Embed v4 support in Bedrock (#2612)
8
9
 
9
- ## [integrations/amazon_bedrock-v5.1.0] - 2025-09-29
10
+ ### 📚 Documentation
10
11
 
11
- ### 🚀 Features
12
+ - Add pydoc configurations for Docusaurus (#2411)
12
13
 
13
- - S3Downloader - add `s3_key_generation_function` param to customize S3 key generation (#2343)
14
+ ### ⚙️ CI
14
15
 
15
- ## [integrations/amazon_bedrock-v5.0.0] - 2025-09-22
16
+ - Change pytest command (#2475)
16
17
 
17
18
  ### 🧹 Chores
18
19
 
19
- - [**breaking**] Remove deprecated `BedrockRanker` (use `AmazonBedrockRanker` instead) (#2287)
20
+ - Remove Readme API CI workflow and configs (#2573)
21
+
22
+ ### 🌀 Miscellaneous
23
+
24
+ - Adopt PEP 585 type hinting (part 2) (#2508)
20
25
 
21
- ## [integrations/amazon_bedrock-v4.2.0] - 2025-09-19
26
+ ## [integrations/amazon_bedrock-v5.1.0] - 2025-09-29
22
27
 
23
28
  ### 🚀 Features
24
29
 
25
- - Add a new `S3Downloader` component (#2192)
30
+ - S3Downloader - add `s3_key_generation_function` param to customize S3 key generation (#2343)
26
31
 
27
- ## [integrations/amazon_bedrock-v4.1.0] - 2025-09-19
32
+
33
+ ## [integrations/amazon_bedrock-v5.0.0] - 2025-09-22
28
34
 
29
35
  ### 🚀 Features
30
36
 
31
37
  - Support AWS Bedrock Guardrails in `AmazonBedrockChatGenerator` (#2284)
38
+ - Add a new `S3Downloader` component (#2192)
39
+
40
+ ### 📚 Documentation
41
+
32
42
 
33
43
  ### 🧹 Chores
34
44
 
35
45
  - Bedrock - remove unused `stop_words` init parameter (#2275)
46
+ - [**breaking**] Remove deprecated `BedrockRanker` (use `AmazonBedrockRanker` instead) (#2287)
36
47
 
37
48
  ### 🌀 Miscellaneous
38
49
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: amazon-bedrock-haystack
3
- Version: 5.3.0
3
+ Version: 5.3.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
@@ -1,5 +1,5 @@
1
1
  import json
2
- from typing import Any, Literal, Optional
2
+ from typing import Any, Optional
3
3
 
4
4
  from botocore.config import Config
5
5
  from botocore.exceptions import ClientError
@@ -16,15 +16,6 @@ from haystack_integrations.common.amazon_bedrock.utils import get_aws_session
16
16
 
17
17
  logger = logging.getLogger(__name__)
18
18
 
19
- SUPPORTED_EMBEDDING_MODELS = [
20
- "amazon.titan-embed-text-v1",
21
- "amazon.titan-embed-text-v2:0",
22
- "amazon.titan-embed-image-v1",
23
- "cohere.embed-english-v3",
24
- "cohere.embed-multilingual-v3",
25
- "cohere.embed-v4:0",
26
- ]
27
-
28
19
 
29
20
  @component
30
21
  class AmazonBedrockDocumentEmbedder:
@@ -58,14 +49,7 @@ class AmazonBedrockDocumentEmbedder:
58
49
 
59
50
  def __init__(
60
51
  self,
61
- model: Literal[
62
- "amazon.titan-embed-text-v1",
63
- "amazon.titan-embed-text-v2:0",
64
- "amazon.titan-embed-image-v1",
65
- "cohere.embed-english-v3",
66
- "cohere.embed-multilingual-v3",
67
- "cohere.embed-v4:0",
68
- ],
52
+ model: str,
69
53
  aws_access_key_id: Optional[Secret] = Secret.from_env_var("AWS_ACCESS_KEY_ID", strict=False), # noqa: B008
70
54
  aws_secret_access_key: Optional[Secret] = Secret.from_env_var( # noqa: B008
71
55
  "AWS_SECRET_ACCESS_KEY", strict=False
@@ -90,8 +74,13 @@ class AmazonBedrockDocumentEmbedder:
90
74
  constructor. Aside from model, three required parameters are `aws_access_key_id`, `aws_secret_access_key`,
91
75
  and `aws_region_name`.
92
76
 
93
- :param model: The embedding model to use. The model has to be specified in the format outlined in the Amazon
94
- Bedrock [documentation](https://docs.aws.amazon.com/bedrock/latest/userguide/model-ids.html).
77
+ :param model: The embedding model to use.
78
+ Amazon Titan and Cohere embedding models are supported, for example:
79
+ "amazon.titan-embed-text-v1", "amazon.titan-embed-text-v2:0", "amazon.titan-embed-image-v1",
80
+ "cohere.embed-english-v3", "cohere.embed-multilingual-v3", "cohere.embed-v4:0".
81
+ To find all supported models, refer to the Amazon Bedrock
82
+ [documentation](https://docs.aws.amazon.com/bedrock/latest/userguide/models-supported.html) and
83
+ filter for "embedding", then select models from the Amazon Titan and Cohere series.
95
84
  :param aws_access_key_id: AWS access key ID.
96
85
  :param aws_secret_access_key: AWS secret access key.
97
86
  :param aws_session_token: AWS session token.
@@ -109,11 +98,8 @@ class AmazonBedrockDocumentEmbedder:
109
98
  :raises ValueError: If the model is not supported.
110
99
  :raises AmazonBedrockConfigurationError: If the AWS environment is not configured correctly.
111
100
  """
112
-
113
- if not model or model not in SUPPORTED_EMBEDDING_MODELS:
114
- msg = "Please provide a valid model from the list of supported models: " + ", ".join(
115
- SUPPORTED_EMBEDDING_MODELS
116
- )
101
+ if "titan" not in model and "cohere" not in model:
102
+ msg = f"Model {model} is not supported. Only Amazon Titan and Cohere embedding models are supported."
117
103
  raise ValueError(msg)
118
104
 
119
105
  self.model = model
@@ -254,7 +240,7 @@ class AmazonBedrockDocumentEmbedder:
254
240
  elif "titan" in self.model:
255
241
  documents_with_embeddings = self._embed_titan(documents=documents)
256
242
  else:
257
- msg = f"Model {self.model} is not supported. Supported models are: {', '.join(SUPPORTED_EMBEDDING_MODELS)}."
243
+ msg = f"Model {self.model} is not supported. Only Amazon Titan and Cohere embedding models are supported."
258
244
  raise ValueError(msg)
259
245
 
260
246
  return {"documents": documents_with_embeddings}
@@ -4,7 +4,7 @@
4
4
 
5
5
  import json
6
6
  from dataclasses import replace
7
- from typing import Any, Literal, Optional
7
+ from typing import Any, Optional
8
8
 
9
9
  from botocore.config import Config
10
10
  from botocore.exceptions import ClientError
@@ -27,13 +27,6 @@ from haystack_integrations.common.amazon_bedrock.utils import get_aws_session
27
27
 
28
28
  logger = logging.getLogger(__name__)
29
29
 
30
- SUPPORTED_EMBEDDING_MODELS = [
31
- "amazon.titan-embed-image-v1",
32
- "cohere.embed-english-v3",
33
- "cohere.embed-multilingual-v3",
34
- "cohere.embed-v4:0",
35
- ]
36
-
37
30
 
38
31
  @component
39
32
  class AmazonBedrockDocumentImageEmbedder:
@@ -74,12 +67,7 @@ class AmazonBedrockDocumentImageEmbedder:
74
67
  def __init__(
75
68
  self,
76
69
  *,
77
- model: Literal[
78
- "amazon.titan-embed-image-v1",
79
- "cohere.embed-english-v3",
80
- "cohere.embed-multilingual-v3",
81
- "cohere.embed-v4:0",
82
- ],
70
+ model: str,
83
71
  aws_access_key_id: Optional[Secret] = Secret.from_env_var("AWS_ACCESS_KEY_ID", strict=False), # noqa: B008
84
72
  aws_secret_access_key: Optional[Secret] = Secret.from_env_var( # noqa: B008
85
73
  "AWS_SECRET_ACCESS_KEY", strict=False
@@ -97,13 +85,13 @@ class AmazonBedrockDocumentImageEmbedder:
97
85
  """
98
86
  Creates a AmazonBedrockDocumentImageEmbedder component.
99
87
 
100
- :param model:
101
- The Bedrock model to use for calculating embeddings. Pass a valid model ID.
102
- Supported models:
103
- - "amazon.titan-embed-image-v1"
104
- - "cohere.embed-english-v3"
105
- - "cohere.embed-multilingual-v3"
106
- - "cohere.embed-v4:0"
88
+ :param model: The embedding model to use.
89
+ Amazon Titan and Cohere multimodal embedding models are supported, for example:
90
+ "amazon.titan-embed-image-v1", "cohere.embed-english-v3", "cohere.embed-multilingual-v3",
91
+ "cohere.embed-v4:0".
92
+ To find all supported models, refer to the Amazon Bedrock
93
+ [documentation](https://docs.aws.amazon.com/bedrock/latest/userguide/models-supported.html) and
94
+ filter for "embedding", then select multimodal models from the Amazon Titan and Cohere series.
107
95
  :param aws_access_key_id: AWS access key ID.
108
96
  :param aws_secret_access_key: AWS secret access key.
109
97
  :param aws_session_token: AWS session token.
@@ -125,9 +113,10 @@ class AmazonBedrockDocumentImageEmbedder:
125
113
  :raises ValueError: If the model is not supported.
126
114
  :raises AmazonBedrockConfigurationError: If the AWS environment is not configured correctly.
127
115
  """
128
- if not model or model not in SUPPORTED_EMBEDDING_MODELS:
129
- msg = "Please provide a valid model from the list of supported models: " + ", ".join(
130
- SUPPORTED_EMBEDDING_MODELS
116
+ if "titan" not in model and "cohere" not in model:
117
+ msg = (
118
+ f"Model {model} is not supported. "
119
+ "Only Amazon Titan and Cohere multimodal embedding models are supported."
131
120
  )
132
121
  raise ValueError(msg)
133
122
 
@@ -291,7 +280,10 @@ class AmazonBedrockDocumentImageEmbedder:
291
280
  elif "titan" in self.model:
292
281
  embeddings = self._embed_titan(images=images_to_embed)
293
282
  else:
294
- msg = f"Model {self.model} is not supported. Supported models are: {', '.join(SUPPORTED_EMBEDDING_MODELS)}."
283
+ msg = (
284
+ f"Model {self.model} is not supported. "
285
+ "Only Amazon Titan and Cohere multimodal embedding models are supported."
286
+ )
295
287
  raise ValueError(msg)
296
288
 
297
289
  docs_with_embeddings = []
@@ -1,5 +1,5 @@
1
1
  import json
2
- from typing import Any, Literal, Optional
2
+ from typing import Any, Optional
3
3
 
4
4
  from botocore.config import Config
5
5
  from botocore.exceptions import ClientError
@@ -14,15 +14,6 @@ from haystack_integrations.common.amazon_bedrock.utils import get_aws_session
14
14
 
15
15
  logger = logging.getLogger(__name__)
16
16
 
17
- SUPPORTED_EMBEDDING_MODELS = [
18
- "amazon.titan-embed-text-v1",
19
- "amazon.titan-embed-text-v2:0",
20
- "amazon.titan-embed-image-v1",
21
- "cohere.embed-english-v3",
22
- "cohere.embed-multilingual-v3",
23
- "cohere.embed-v4:0",
24
- ]
25
-
26
17
 
27
18
  @component
28
19
  class AmazonBedrockTextEmbedder:
@@ -51,14 +42,7 @@ class AmazonBedrockTextEmbedder:
51
42
 
52
43
  def __init__(
53
44
  self,
54
- model: Literal[
55
- "amazon.titan-embed-text-v1",
56
- "amazon.titan-embed-text-v2:0",
57
- "amazon.titan-embed-image-v1",
58
- "cohere.embed-english-v3",
59
- "cohere.embed-multilingual-v3",
60
- "cohere.embed-v4:0",
61
- ],
45
+ model: str,
62
46
  aws_access_key_id: Optional[Secret] = Secret.from_env_var("AWS_ACCESS_KEY_ID", strict=False), # noqa: B008
63
47
  aws_secret_access_key: Optional[Secret] = Secret.from_env_var( # noqa: B008
64
48
  "AWS_SECRET_ACCESS_KEY", strict=False
@@ -79,8 +63,13 @@ class AmazonBedrockTextEmbedder:
79
63
  constructor. Aside from model, three required parameters are `aws_access_key_id`, `aws_secret_access_key`,
80
64
  and `aws_region_name`.
81
65
 
82
- :param model: The embedding model to use. The model has to be specified in the format outlined in the Amazon
83
- Bedrock [documentation](https://docs.aws.amazon.com/bedrock/latest/userguide/model-ids.html).
66
+ :param model: The embedding model to use.
67
+ Amazon Titan and Cohere embedding models are supported, for example:
68
+ "amazon.titan-embed-text-v1", "amazon.titan-embed-text-v2:0", "amazon.titan-embed-image-v1",
69
+ "cohere.embed-english-v3", "cohere.embed-multilingual-v3", "cohere.embed-v4:0".
70
+ To find all supported models, refer to the Amazon Bedrock
71
+ [documentation](https://docs.aws.amazon.com/bedrock/latest/userguide/models-supported.html) and
72
+ filter for "embedding", then select models from the Amazon Titan and Cohere series.
84
73
  :param aws_access_key_id: AWS access key ID.
85
74
  :param aws_secret_access_key: AWS secret access key.
86
75
  :param aws_session_token: AWS session token.
@@ -92,10 +81,8 @@ class AmazonBedrockTextEmbedder:
92
81
  :raises ValueError: If the model is not supported.
93
82
  :raises AmazonBedrockConfigurationError: If the AWS environment is not configured correctly.
94
83
  """
95
- if not model or model not in SUPPORTED_EMBEDDING_MODELS:
96
- msg = "Please provide a valid model from the list of supported models: " + ", ".join(
97
- SUPPORTED_EMBEDDING_MODELS
98
- )
84
+ if "titan" not in model and "cohere" not in model:
85
+ msg = f"Model {model} is not supported. Only Amazon Titan and Cohere embedding models are supported."
99
86
  raise ValueError(msg)
100
87
 
101
88
  self.model = model
@@ -179,7 +166,7 @@ class AmazonBedrockTextEmbedder:
179
166
  elif "titan" in self.model:
180
167
  embedding = response_body["embedding"]
181
168
  else:
182
- msg = f"Unsupported model {self.model}. Supported models are: {', '.join(SUPPORTED_EMBEDDING_MODELS)}"
169
+ msg = f"Model {self.model} is not supported. Only Amazon Titan and Cohere embedding models are supported."
183
170
  raise ValueError(msg)
184
171
 
185
172
  return {"embedding": embedding}