amazon-bedrock-haystack 6.0.0__py3-none-any.whl → 6.1.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.
- {amazon_bedrock_haystack-6.0.0.dist-info → amazon_bedrock_haystack-6.1.1.dist-info}/METADATA +1 -1
- {amazon_bedrock_haystack-6.0.0.dist-info → amazon_bedrock_haystack-6.1.1.dist-info}/RECORD +7 -7
- haystack_integrations/components/embedders/amazon_bedrock/document_embedder.py +7 -4
- haystack_integrations/components/generators/amazon_bedrock/generator.py +10 -7
- haystack_integrations/components/rankers/amazon_bedrock/ranker.py +2 -2
- {amazon_bedrock_haystack-6.0.0.dist-info → amazon_bedrock_haystack-6.1.1.dist-info}/WHEEL +0 -0
- {amazon_bedrock_haystack-6.0.0.dist-info → amazon_bedrock_haystack-6.1.1.dist-info}/licenses/LICENSE.txt +0 -0
{amazon_bedrock_haystack-6.0.0.dist-info → amazon_bedrock_haystack-6.1.1.dist-info}/METADATA
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: amazon-bedrock-haystack
|
|
3
|
-
Version: 6.
|
|
3
|
+
Version: 6.1.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
|
|
@@ -10,20 +10,20 @@ haystack_integrations/components/downloaders/s3/__init__.py,sha256=2BOd3_N0kGqRJ
|
|
|
10
10
|
haystack_integrations/components/downloaders/s3/s3_downloader.py,sha256=xRvQMXEUi7ysOTX3ylC3qw9t0GU2JzGGt7DQEu5Eu8s,12475
|
|
11
11
|
haystack_integrations/components/embedders/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
12
12
|
haystack_integrations/components/embedders/amazon_bedrock/__init__.py,sha256=7GlhHJ4jFHCxq5QN5losGuGtrGNjvEx2dSQvEYD2yG0,408
|
|
13
|
-
haystack_integrations/components/embedders/amazon_bedrock/document_embedder.py,sha256=
|
|
13
|
+
haystack_integrations/components/embedders/amazon_bedrock/document_embedder.py,sha256=s3BxQL_EuSAs9IFHn5qf-4eKelg1lDn6ij7YTvBDVpg,13359
|
|
14
14
|
haystack_integrations/components/embedders/amazon_bedrock/document_image_embedder.py,sha256=qBUo4P2Ccw6ltRXHdrB1HuUo8-9GQLDcuO7VDfBORlQ,16175
|
|
15
15
|
haystack_integrations/components/embedders/amazon_bedrock/text_embedder.py,sha256=RE4rdnUZOm0PL_uf2HTLmsstA2hdMB0Rpz9Ga3VWlF4,9315
|
|
16
16
|
haystack_integrations/components/generators/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
17
17
|
haystack_integrations/components/generators/amazon_bedrock/__init__.py,sha256=lv4NouIVm78YavUssWQrHHP_81u-7j21qW8v1kZMJPQ,284
|
|
18
18
|
haystack_integrations/components/generators/amazon_bedrock/adapters.py,sha256=4-gIWfw70hGaXMNS30UbJFNFCWK2KG6RMnT_4z5RHxc,19625
|
|
19
|
-
haystack_integrations/components/generators/amazon_bedrock/generator.py,sha256=
|
|
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
21
|
haystack_integrations/components/generators/amazon_bedrock/chat/chat_generator.py,sha256=KJqeKFzM1thG2GSVm51pY5aX6gctmtnJvF_kwOH8gqQ,26143
|
|
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
|
-
haystack_integrations/components/rankers/amazon_bedrock/ranker.py,sha256=
|
|
26
|
-
amazon_bedrock_haystack-6.
|
|
27
|
-
amazon_bedrock_haystack-6.
|
|
28
|
-
amazon_bedrock_haystack-6.
|
|
29
|
-
amazon_bedrock_haystack-6.
|
|
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,,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import json
|
|
2
|
+
from dataclasses import replace
|
|
2
3
|
from typing import Any
|
|
3
4
|
|
|
4
5
|
from botocore.config import Config
|
|
@@ -186,10 +187,11 @@ class AmazonBedrockDocumentEmbedder:
|
|
|
186
187
|
)
|
|
187
188
|
all_embeddings.extend(embeddings_list)
|
|
188
189
|
|
|
190
|
+
new_documents = []
|
|
189
191
|
for doc, emb in zip(documents, all_embeddings, strict=True):
|
|
190
|
-
doc
|
|
192
|
+
new_documents.append(replace(doc, embedding=emb))
|
|
191
193
|
|
|
192
|
-
return
|
|
194
|
+
return new_documents
|
|
193
195
|
|
|
194
196
|
def _embed_titan(self, documents: list[Document]) -> list[Document]:
|
|
195
197
|
"""
|
|
@@ -214,10 +216,11 @@ class AmazonBedrockDocumentEmbedder:
|
|
|
214
216
|
embedding = response_body["embedding"]
|
|
215
217
|
all_embeddings.append(embedding)
|
|
216
218
|
|
|
219
|
+
new_documents = []
|
|
217
220
|
for doc, emb in zip(documents, all_embeddings, strict=True):
|
|
218
|
-
doc
|
|
221
|
+
new_documents.append(replace(doc, embedding=emb))
|
|
219
222
|
|
|
220
|
-
return
|
|
223
|
+
return new_documents
|
|
221
224
|
|
|
222
225
|
@component.output_types(documents=list[Document])
|
|
223
226
|
def run(self, documents: list[Document]) -> dict[str, list[Document]]:
|
|
@@ -63,14 +63,17 @@ class AmazonBedrockGenerator:
|
|
|
63
63
|
supports Amazon Bedrock.
|
|
64
64
|
"""
|
|
65
65
|
|
|
66
|
+
# Regex pattern for supported AWS Bedrock region prefixes
|
|
67
|
+
_REGION_PREFIX_PATTERN = r"((?:global|us-gov|us|eu|apac|au|ca|jp)\.)?"
|
|
68
|
+
|
|
66
69
|
SUPPORTED_MODEL_PATTERNS: ClassVar[dict[str, type[BedrockModelAdapter]]] = {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
70
|
+
rf"{_REGION_PREFIX_PATTERN}amazon.titan-text.*": AmazonTitanAdapter,
|
|
71
|
+
rf"{_REGION_PREFIX_PATTERN}ai21.j2.*": AI21LabsJurassic2Adapter,
|
|
72
|
+
rf"{_REGION_PREFIX_PATTERN}cohere.command-[^r].*": CohereCommandAdapter,
|
|
73
|
+
rf"{_REGION_PREFIX_PATTERN}cohere.command-r.*": CohereCommandRAdapter,
|
|
74
|
+
rf"{_REGION_PREFIX_PATTERN}anthropic.claude.*": AnthropicClaudeAdapter,
|
|
75
|
+
rf"{_REGION_PREFIX_PATTERN}meta.llama.*": MetaLlamaAdapter,
|
|
76
|
+
rf"{_REGION_PREFIX_PATTERN}mistral.*": MistralAdapter,
|
|
74
77
|
}
|
|
75
78
|
|
|
76
79
|
SUPPORTED_MODEL_FAMILIES: ClassVar[dict[str, type[BedrockModelAdapter]]] = {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
from dataclasses import replace
|
|
1
2
|
from typing import Any
|
|
2
3
|
|
|
3
4
|
from botocore.exceptions import ClientError
|
|
@@ -251,8 +252,7 @@ class AmazonBedrockRanker:
|
|
|
251
252
|
idx = result["index"]
|
|
252
253
|
score = result["relevanceScore"]
|
|
253
254
|
doc = documents[idx]
|
|
254
|
-
doc
|
|
255
|
-
sorted_docs.append(doc)
|
|
255
|
+
sorted_docs.append(replace(doc, score=score))
|
|
256
256
|
|
|
257
257
|
return {"documents": sorted_docs}
|
|
258
258
|
except ClientError as client_error:
|
|
File without changes
|
|
File without changes
|