my-aws-helpers 3.0.0.dev7__tar.gz → 3.1.0.dev1__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-3.0.0.dev7 → my_aws_helpers-3.1.0.dev1}/PKG-INFO +1 -1
- {my_aws_helpers-3.0.0.dev7 → my_aws_helpers-3.1.0.dev1}/my_aws_helpers/bedrock.py +19 -13
- {my_aws_helpers-3.0.0.dev7 → my_aws_helpers-3.1.0.dev1}/my_aws_helpers/prompts/transactions_headers_prompt_v2.txt +5 -1
- {my_aws_helpers-3.0.0.dev7 → my_aws_helpers-3.1.0.dev1}/my_aws_helpers.egg-info/PKG-INFO +1 -1
- {my_aws_helpers-3.0.0.dev7 → my_aws_helpers-3.1.0.dev1}/setup.py +1 -1
- {my_aws_helpers-3.0.0.dev7 → my_aws_helpers-3.1.0.dev1}/MANIFEST.in +0 -0
- {my_aws_helpers-3.0.0.dev7 → my_aws_helpers-3.1.0.dev1}/README.md +0 -0
- {my_aws_helpers-3.0.0.dev7 → my_aws_helpers-3.1.0.dev1}/my_aws_helpers/api.py +0 -0
- {my_aws_helpers-3.0.0.dev7 → my_aws_helpers-3.1.0.dev1}/my_aws_helpers/auth.py +0 -0
- {my_aws_helpers-3.0.0.dev7 → my_aws_helpers-3.1.0.dev1}/my_aws_helpers/cognito.py +0 -0
- {my_aws_helpers-3.0.0.dev7 → my_aws_helpers-3.1.0.dev1}/my_aws_helpers/dynamo.py +0 -0
- {my_aws_helpers-3.0.0.dev7 → my_aws_helpers-3.1.0.dev1}/my_aws_helpers/errors.py +0 -0
- {my_aws_helpers-3.0.0.dev7 → my_aws_helpers-3.1.0.dev1}/my_aws_helpers/event.py +0 -0
- {my_aws_helpers-3.0.0.dev7 → my_aws_helpers-3.1.0.dev1}/my_aws_helpers/logging.py +0 -0
- {my_aws_helpers-3.0.0.dev7 → my_aws_helpers-3.1.0.dev1}/my_aws_helpers/prompts/__init__.py +0 -0
- {my_aws_helpers-3.0.0.dev7 → my_aws_helpers-3.1.0.dev1}/my_aws_helpers/prompts/markdown_system_prompt.txt +0 -0
- {my_aws_helpers-3.0.0.dev7 → my_aws_helpers-3.1.0.dev1}/my_aws_helpers/prompts/transactions_headers_prompt.txt +0 -0
- {my_aws_helpers-3.0.0.dev7 → my_aws_helpers-3.1.0.dev1}/my_aws_helpers/prompts/transactions_prompt.txt +0 -0
- {my_aws_helpers-3.0.0.dev7 → my_aws_helpers-3.1.0.dev1}/my_aws_helpers/s3.py +0 -0
- {my_aws_helpers-3.0.0.dev7 → my_aws_helpers-3.1.0.dev1}/my_aws_helpers/sfn.py +0 -0
- {my_aws_helpers-3.0.0.dev7 → my_aws_helpers-3.1.0.dev1}/my_aws_helpers.egg-info/SOURCES.txt +0 -0
- {my_aws_helpers-3.0.0.dev7 → my_aws_helpers-3.1.0.dev1}/my_aws_helpers.egg-info/dependency_links.txt +0 -0
- {my_aws_helpers-3.0.0.dev7 → my_aws_helpers-3.1.0.dev1}/my_aws_helpers.egg-info/requires.txt +0 -0
- {my_aws_helpers-3.0.0.dev7 → my_aws_helpers-3.1.0.dev1}/my_aws_helpers.egg-info/top_level.txt +0 -0
- {my_aws_helpers-3.0.0.dev7 → my_aws_helpers-3.1.0.dev1}/my_aws_helpers.egg-info/zip-safe +0 -0
- {my_aws_helpers-3.0.0.dev7 → my_aws_helpers-3.1.0.dev1}/setup.cfg +0 -0
- {my_aws_helpers-3.0.0.dev7 → my_aws_helpers-3.1.0.dev1}/tests/test_event.py +0 -0
|
@@ -51,8 +51,9 @@ class OCRResult:
|
|
|
51
51
|
class Bedrock:
|
|
52
52
|
def __init__(
|
|
53
53
|
self,
|
|
54
|
-
model_id: str = "anthropic.claude-3-5-sonnet-20241022-v2:0",
|
|
54
|
+
model_id: str = "apac.anthropic.claude-3-5-sonnet-20241022-v2:0",
|
|
55
55
|
logger = None,
|
|
56
|
+
sleep_time: float = 1.0,
|
|
56
57
|
):
|
|
57
58
|
|
|
58
59
|
self.session = Bedrock._set_session_params()
|
|
@@ -60,7 +61,7 @@ class Bedrock:
|
|
|
60
61
|
region_name = "ap-southeast-2"
|
|
61
62
|
if self.session is None:
|
|
62
63
|
self.session = boto3.Session(region_name = region_name)
|
|
63
|
-
|
|
64
|
+
self.sleep_time = sleep_time
|
|
64
65
|
|
|
65
66
|
custom_config = Config(
|
|
66
67
|
retries={
|
|
@@ -133,6 +134,7 @@ class Bedrock:
|
|
|
133
134
|
except Exception as e:
|
|
134
135
|
self.logger.exception(f"Error during conversation due to {e}")
|
|
135
136
|
if i >= len(retries) - 1: raise Exception(e)
|
|
137
|
+
time.sleep(self.sleep_time)
|
|
136
138
|
continue
|
|
137
139
|
|
|
138
140
|
result = {}
|
|
@@ -150,14 +152,16 @@ class Bedrock:
|
|
|
150
152
|
results = list()
|
|
151
153
|
prompt = self._get_prompt(prompt_type=prompt_type)
|
|
152
154
|
with concurrent.futures.ThreadPoolExecutor(max_workers=max_workers) as executor:
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
155
|
+
for i, img in enumerate(image_bytes_list):
|
|
156
|
+
self.logger.info(f"Starting OCR for page: {i}")
|
|
157
|
+
time.sleep(self.sleep_time)
|
|
158
|
+
execution_futures = {
|
|
159
|
+
executor.map(
|
|
160
|
+
self._ocr,
|
|
161
|
+
prompt = prompt,
|
|
162
|
+
image_bytes = img,
|
|
163
|
+
)
|
|
164
|
+
}
|
|
161
165
|
for future in concurrent.futures.as_completed(execution_futures):
|
|
162
166
|
result = future.result()
|
|
163
167
|
if result:
|
|
@@ -204,9 +208,11 @@ class Bedrock:
|
|
|
204
208
|
self.logger.info("Got Prompt")
|
|
205
209
|
results = list()
|
|
206
210
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
211
|
+
results = self._parallel_ocr(image_bytes_list=image_bytes_list)
|
|
212
|
+
|
|
213
|
+
# for i, image_bytes in enumerate(image_bytes_list):
|
|
214
|
+
# self.logger.info(f"Starting OCR for page: {i}")
|
|
215
|
+
# results.append(self._ocr(image_bytes=image_bytes, prompt=transactions_prompt))
|
|
210
216
|
return results
|
|
211
217
|
except Exception as e:
|
|
212
218
|
self.logger.exception(e)
|
|
@@ -13,7 +13,11 @@ Return a JSON object in the following structure:
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
## Rules
|
|
16
|
-
|
|
16
|
+
- DO NOT USE DETAILS sections, DO NOT use Account Summary, Do NOT use Account Details, DO NOT use payment details
|
|
17
|
+
- ONLY Use tables that contain transaction to acquire headers, if you cannot find a table that contains a list of transactions, return:
|
|
18
|
+
{
|
|
19
|
+
"headers": []
|
|
20
|
+
}
|
|
17
21
|
- Only return headers **if there is a table with transaction-like data** (e.g. purchases, sales, account activity).
|
|
18
22
|
- There will likely be MORE THAN 1 transaction in this table name, if that is not the case, return:
|
|
19
23
|
{
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{my_aws_helpers-3.0.0.dev7 → my_aws_helpers-3.1.0.dev1}/my_aws_helpers.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
{my_aws_helpers-3.0.0.dev7 → my_aws_helpers-3.1.0.dev1}/my_aws_helpers.egg-info/requires.txt
RENAMED
|
File without changes
|
{my_aws_helpers-3.0.0.dev7 → my_aws_helpers-3.1.0.dev1}/my_aws_helpers.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|