my-aws-helpers 4.8.0__tar.gz → 5.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.
Potentially problematic release.
This version of my-aws-helpers might be problematic. Click here for more details.
- {my_aws_helpers-4.8.0 → my_aws_helpers-5.0.0}/PKG-INFO +1 -1
- {my_aws_helpers-4.8.0 → my_aws_helpers-5.0.0}/my_aws_helpers/bedrock.py +6 -1
- {my_aws_helpers-4.8.0 → my_aws_helpers-5.0.0}/my_aws_helpers/s3.py +38 -3
- {my_aws_helpers-4.8.0 → my_aws_helpers-5.0.0}/my_aws_helpers.egg-info/PKG-INFO +1 -1
- {my_aws_helpers-4.8.0 → my_aws_helpers-5.0.0}/setup.py +1 -1
- {my_aws_helpers-4.8.0 → my_aws_helpers-5.0.0}/MANIFEST.in +0 -0
- {my_aws_helpers-4.8.0 → my_aws_helpers-5.0.0}/README.md +0 -0
- {my_aws_helpers-4.8.0 → my_aws_helpers-5.0.0}/my_aws_helpers/api.py +0 -0
- {my_aws_helpers-4.8.0 → my_aws_helpers-5.0.0}/my_aws_helpers/auth.py +0 -0
- {my_aws_helpers-4.8.0 → my_aws_helpers-5.0.0}/my_aws_helpers/cognito.py +0 -0
- {my_aws_helpers-4.8.0 → my_aws_helpers-5.0.0}/my_aws_helpers/dynamo.py +0 -0
- {my_aws_helpers-4.8.0 → my_aws_helpers-5.0.0}/my_aws_helpers/errors.py +0 -0
- {my_aws_helpers-4.8.0 → my_aws_helpers-5.0.0}/my_aws_helpers/event.py +0 -0
- {my_aws_helpers-4.8.0 → my_aws_helpers-5.0.0}/my_aws_helpers/logging.py +0 -0
- {my_aws_helpers-4.8.0 → my_aws_helpers-5.0.0}/my_aws_helpers/prompts/__init__.py +0 -0
- {my_aws_helpers-4.8.0 → my_aws_helpers-5.0.0}/my_aws_helpers/prompts/markdown_system_prompt.txt +0 -0
- {my_aws_helpers-4.8.0 → my_aws_helpers-5.0.0}/my_aws_helpers/prompts/transactions_headers_prompt.txt +0 -0
- {my_aws_helpers-4.8.0 → my_aws_helpers-5.0.0}/my_aws_helpers/prompts/transactions_headers_prompt_v2.txt +0 -0
- {my_aws_helpers-4.8.0 → my_aws_helpers-5.0.0}/my_aws_helpers/prompts/transactions_prompt.txt +0 -0
- {my_aws_helpers-4.8.0 → my_aws_helpers-5.0.0}/my_aws_helpers/sfn.py +0 -0
- {my_aws_helpers-4.8.0 → my_aws_helpers-5.0.0}/my_aws_helpers.egg-info/SOURCES.txt +0 -0
- {my_aws_helpers-4.8.0 → my_aws_helpers-5.0.0}/my_aws_helpers.egg-info/dependency_links.txt +0 -0
- {my_aws_helpers-4.8.0 → my_aws_helpers-5.0.0}/my_aws_helpers.egg-info/requires.txt +0 -0
- {my_aws_helpers-4.8.0 → my_aws_helpers-5.0.0}/my_aws_helpers.egg-info/top_level.txt +0 -0
- {my_aws_helpers-4.8.0 → my_aws_helpers-5.0.0}/my_aws_helpers.egg-info/zip-safe +0 -0
- {my_aws_helpers-4.8.0 → my_aws_helpers-5.0.0}/setup.cfg +0 -0
- {my_aws_helpers-4.8.0 → my_aws_helpers-5.0.0}/tests/test_cognito.py +0 -0
- {my_aws_helpers-4.8.0 → my_aws_helpers-5.0.0}/tests/test_event.py +0 -0
|
@@ -264,7 +264,12 @@ class Bedrock:
|
|
|
264
264
|
message = [
|
|
265
265
|
{
|
|
266
266
|
"role": "user",
|
|
267
|
-
"content": [
|
|
267
|
+
"content": [
|
|
268
|
+
self._get_image_block(
|
|
269
|
+
image=image, image_content_type=image_content_type
|
|
270
|
+
)
|
|
271
|
+
for image in images
|
|
272
|
+
],
|
|
268
273
|
}
|
|
269
274
|
]
|
|
270
275
|
response = self.client.converse(
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
1
2
|
import boto3
|
|
2
3
|
import io
|
|
3
4
|
import json
|
|
5
|
+
from abc import ABC, abstractmethod
|
|
4
6
|
from typing import Optional, Any, Dict, List
|
|
5
7
|
from datetime import datetime, date
|
|
6
8
|
from copy import copy
|
|
@@ -31,6 +33,8 @@ class S3Serialiser:
|
|
|
31
33
|
def _serialise(obj: Any):
|
|
32
34
|
if isinstance(obj, datetime) or isinstance(obj, date):
|
|
33
35
|
return obj.isoformat()
|
|
36
|
+
if isinstance(obj, S3Location):
|
|
37
|
+
return obj.location
|
|
34
38
|
return obj
|
|
35
39
|
|
|
36
40
|
@staticmethod
|
|
@@ -97,9 +101,7 @@ class S3:
|
|
|
97
101
|
|
|
98
102
|
def list_objects_by_prefix(self, bucket_name: str, prefix: str) -> List[Dict]:
|
|
99
103
|
try:
|
|
100
|
-
response = self.client.list_objects_v2(
|
|
101
|
-
Bucket=bucket_name, Prefix=prefix
|
|
102
|
-
)
|
|
104
|
+
response = self.client.list_objects_v2(Bucket=bucket_name, Prefix=prefix)
|
|
103
105
|
return response["Contents"]
|
|
104
106
|
except Exception as e:
|
|
105
107
|
logger.exception(
|
|
@@ -266,3 +268,36 @@ class S3:
|
|
|
266
268
|
return json.loads(
|
|
267
269
|
self.read_binary_from_s3(s3_location=s3_location).decode("utf-8")
|
|
268
270
|
)
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
class BaseS3Object(ABC):
|
|
274
|
+
def to_s3_representation(self) -> dict:
|
|
275
|
+
obj = copy(vars(self))
|
|
276
|
+
return S3Serialiser.object_serialiser(obj=obj)
|
|
277
|
+
|
|
278
|
+
@classmethod
|
|
279
|
+
def from_s3_representation(cls, obj: dict) -> BaseS3Object:
|
|
280
|
+
return cls(**obj)
|
|
281
|
+
|
|
282
|
+
@abstractmethod
|
|
283
|
+
def get_save_location(self, bucket_name: str) -> S3Location:
|
|
284
|
+
pass
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
class BaseS3Queries:
|
|
288
|
+
s3_client: S3
|
|
289
|
+
bucket_name: str
|
|
290
|
+
|
|
291
|
+
def __init__(self, s3_client: S3, bucket_name: str):
|
|
292
|
+
self.s3_client = s3_client
|
|
293
|
+
self.bucket_name = bucket_name
|
|
294
|
+
|
|
295
|
+
def save_s3_object_to_s3(self, object: BaseS3Object) -> Optional[S3Location]:
|
|
296
|
+
try:
|
|
297
|
+
obj = object.to_s3_representation()
|
|
298
|
+
return self.s3_client.save_dict_to_s3(
|
|
299
|
+
content=obj, s3_location=object.get_save_location()
|
|
300
|
+
)
|
|
301
|
+
except Exception as e:
|
|
302
|
+
logger.exception(f"Failed to save s3 object to s3 due to {e}")
|
|
303
|
+
return None
|
|
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
|
{my_aws_helpers-4.8.0 → my_aws_helpers-5.0.0}/my_aws_helpers/prompts/markdown_system_prompt.txt
RENAMED
|
File without changes
|
{my_aws_helpers-4.8.0 → my_aws_helpers-5.0.0}/my_aws_helpers/prompts/transactions_headers_prompt.txt
RENAMED
|
File without changes
|
|
File without changes
|
{my_aws_helpers-4.8.0 → my_aws_helpers-5.0.0}/my_aws_helpers/prompts/transactions_prompt.txt
RENAMED
|
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
|