trustgraph-bedrock 0.20.5__tar.gz → 0.20.7__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.
- {trustgraph-bedrock-0.20.5 → trustgraph-bedrock-0.20.7}/PKG-INFO +2 -2
- trustgraph-bedrock-0.20.7/trustgraph/bedrock_version.py +1 -0
- {trustgraph-bedrock-0.20.5 → trustgraph-bedrock-0.20.7}/trustgraph/model/text_completion/bedrock/llm.py +49 -30
- {trustgraph-bedrock-0.20.5 → trustgraph-bedrock-0.20.7}/trustgraph_bedrock.egg-info/PKG-INFO +2 -2
- trustgraph-bedrock-0.20.5/trustgraph/bedrock_version.py +0 -1
- {trustgraph-bedrock-0.20.5 → trustgraph-bedrock-0.20.7}/README.md +0 -0
- {trustgraph-bedrock-0.20.5 → trustgraph-bedrock-0.20.7}/scripts/text-completion-bedrock +0 -0
- {trustgraph-bedrock-0.20.5 → trustgraph-bedrock-0.20.7}/setup.cfg +0 -0
- {trustgraph-bedrock-0.20.5 → trustgraph-bedrock-0.20.7}/setup.py +0 -0
- {trustgraph-bedrock-0.20.5 → trustgraph-bedrock-0.20.7}/trustgraph/model/text_completion/bedrock/__init__.py +0 -0
- {trustgraph-bedrock-0.20.5 → trustgraph-bedrock-0.20.7}/trustgraph/model/text_completion/bedrock/__main__.py +0 -0
- {trustgraph-bedrock-0.20.5 → trustgraph-bedrock-0.20.7}/trustgraph_bedrock.egg-info/SOURCES.txt +0 -0
- {trustgraph-bedrock-0.20.5 → trustgraph-bedrock-0.20.7}/trustgraph_bedrock.egg-info/dependency_links.txt +0 -0
- {trustgraph-bedrock-0.20.5 → trustgraph-bedrock-0.20.7}/trustgraph_bedrock.egg-info/requires.txt +0 -0
- {trustgraph-bedrock-0.20.5 → trustgraph-bedrock-0.20.7}/trustgraph_bedrock.egg-info/top_level.txt +0 -0
@@ -1,9 +1,9 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: trustgraph-bedrock
|
3
|
-
Version: 0.20.
|
3
|
+
Version: 0.20.7
|
4
4
|
Summary: TrustGraph provides a means to run a pipeline of flexible AI processing components in a flexible means to achieve a processing pipeline.
|
5
5
|
Home-page: https://github.com/trustgraph-ai/trustgraph
|
6
|
-
Download-URL: https://github.com/trustgraph-ai/trustgraph/archive/refs/tags/v0.20.
|
6
|
+
Download-URL: https://github.com/trustgraph-ai/trustgraph/archive/refs/tags/v0.20.7.tar.gz
|
7
7
|
Author: trustgraph.ai
|
8
8
|
Author-email: security@trustgraph.ai
|
9
9
|
Classifier: Programming Language :: Python :: 3
|
@@ -0,0 +1 @@
|
|
1
|
+
__version__ = "0.20.7"
|
@@ -5,6 +5,7 @@ Input is prompt, output is response. Mistral is default.
|
|
5
5
|
"""
|
6
6
|
|
7
7
|
import boto3
|
8
|
+
from botocore.errorfactory import ThrottlingException
|
8
9
|
import json
|
9
10
|
from prometheus_client import Histogram
|
10
11
|
import os
|
@@ -24,32 +25,48 @@ default_subscriber = module
|
|
24
25
|
default_model = 'mistral.mistral-large-2407-v1:0'
|
25
26
|
default_temperature = 0.0
|
26
27
|
default_max_output = 2048
|
27
|
-
|
28
|
-
|
29
|
-
|
28
|
+
|
29
|
+
# Actually, these could all just be None, no need to get environment
|
30
|
+
# variables, as Boto3 would pick all these up if not passed in as args
|
31
|
+
default_access_key_id = os.getenv("AWS_ACCESS_KEY_ID", None)
|
32
|
+
default_secret_access_key = os.getenv("AWS_SECRET_ACCESS_KEY", None)
|
33
|
+
default_session_token = os.getenv("AWS_SESSION_TOKEN", None)
|
34
|
+
default_profile = os.getenv("AWS_PROFILE", None)
|
35
|
+
default_region = os.getenv("AWS_DEFAULT_REGION", None)
|
30
36
|
|
31
37
|
class Processor(ConsumerProducer):
|
32
38
|
|
33
39
|
def __init__(self, **params):
|
40
|
+
|
41
|
+
print(params)
|
34
42
|
|
35
43
|
input_queue = params.get("input_queue", default_input_queue)
|
36
44
|
output_queue = params.get("output_queue", default_output_queue)
|
37
45
|
subscriber = params.get("subscriber", default_subscriber)
|
46
|
+
|
38
47
|
model = params.get("model", default_model)
|
39
|
-
aws_id_key = params.get("aws_id_key", default_aws_id_key)
|
40
|
-
aws_secret = params.get("aws_secret", default_aws_secret)
|
41
|
-
aws_region = params.get("aws_region", default_aws_region)
|
42
48
|
temperature = params.get("temperature", default_temperature)
|
43
49
|
max_output = params.get("max_output", default_max_output)
|
44
50
|
|
45
|
-
|
46
|
-
|
51
|
+
aws_access_key_id = params.get(
|
52
|
+
"aws_access_key_id", default_access_key_id
|
53
|
+
)
|
54
|
+
|
55
|
+
aws_secret_access_key = params.get(
|
56
|
+
"aws_secret_access_key", default_secret_access_key
|
57
|
+
)
|
47
58
|
|
48
|
-
|
49
|
-
|
59
|
+
aws_session_token = params.get(
|
60
|
+
"aws_session_token", default_session_token
|
61
|
+
)
|
50
62
|
|
51
|
-
|
52
|
-
|
63
|
+
aws_region = params.get(
|
64
|
+
"aws_region", default_region
|
65
|
+
)
|
66
|
+
|
67
|
+
aws_profile = params.get(
|
68
|
+
"aws_profile", default_profile
|
69
|
+
)
|
53
70
|
|
54
71
|
super(Processor, self).__init__(
|
55
72
|
**params | {
|
@@ -82,9 +99,11 @@ class Processor(ConsumerProducer):
|
|
82
99
|
self.max_output = max_output
|
83
100
|
|
84
101
|
self.session = boto3.Session(
|
85
|
-
aws_access_key_id=
|
86
|
-
aws_secret_access_key=
|
87
|
-
|
102
|
+
aws_access_key_id=aws_access_key_id,
|
103
|
+
aws_secret_access_key=aws_secret_access_key,
|
104
|
+
aws_session_token=aws_session_token,
|
105
|
+
profile_name=aws_profile,
|
106
|
+
region_name=aws_region,
|
88
107
|
)
|
89
108
|
|
90
109
|
self.bedrock = self.session.client(service_name='bedrock-runtime')
|
@@ -179,9 +198,6 @@ class Processor(ConsumerProducer):
|
|
179
198
|
accept = 'application/json'
|
180
199
|
contentType = 'application/json'
|
181
200
|
|
182
|
-
# FIXME: Consider catching request limits and raise TooManyRequests
|
183
|
-
# See https://boto3.amazonaws.com/v1/documentation/api/latest/guide/retries.html
|
184
|
-
|
185
201
|
with __class__.text_completion_metric.time():
|
186
202
|
response = self.bedrock.invoke_model(
|
187
203
|
body=promptbody, modelId=self.model, accept=accept,
|
@@ -243,10 +259,7 @@ class Processor(ConsumerProducer):
|
|
243
259
|
|
244
260
|
print("Done.", flush=True)
|
245
261
|
|
246
|
-
|
247
|
-
# FIXME: Wrong exception, don't know what Bedrock throws
|
248
|
-
# for a rate limit
|
249
|
-
except TooManyRequests:
|
262
|
+
except ThrottlingException:
|
250
263
|
|
251
264
|
print("Send rate limit response...", flush=True)
|
252
265
|
|
@@ -300,21 +313,27 @@ class Processor(ConsumerProducer):
|
|
300
313
|
)
|
301
314
|
|
302
315
|
parser.add_argument(
|
303
|
-
'-z', '--aws-
|
304
|
-
default=
|
305
|
-
help=f'AWS ID
|
316
|
+
'-z', '--aws-access-key-id',
|
317
|
+
default=default_access_key_id,
|
318
|
+
help=f'AWS access key ID'
|
306
319
|
)
|
307
320
|
|
308
321
|
parser.add_argument(
|
309
|
-
'-k', '--aws-secret',
|
310
|
-
default=
|
311
|
-
help=f'AWS
|
322
|
+
'-k', '--aws-secret-access-key',
|
323
|
+
default=default_secret_access_key,
|
324
|
+
help=f'AWS secret access key'
|
312
325
|
)
|
313
326
|
|
314
327
|
parser.add_argument(
|
315
328
|
'-r', '--aws-region',
|
316
|
-
default=
|
317
|
-
help=f'AWS
|
329
|
+
default=default_region,
|
330
|
+
help=f'AWS region'
|
331
|
+
)
|
332
|
+
|
333
|
+
parser.add_argument(
|
334
|
+
'--aws-profile', '--profile',
|
335
|
+
default=default_profile,
|
336
|
+
help=f'AWS profile name'
|
318
337
|
)
|
319
338
|
|
320
339
|
parser.add_argument(
|
{trustgraph-bedrock-0.20.5 → trustgraph-bedrock-0.20.7}/trustgraph_bedrock.egg-info/PKG-INFO
RENAMED
@@ -1,9 +1,9 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: trustgraph-bedrock
|
3
|
-
Version: 0.20.
|
3
|
+
Version: 0.20.7
|
4
4
|
Summary: TrustGraph provides a means to run a pipeline of flexible AI processing components in a flexible means to achieve a processing pipeline.
|
5
5
|
Home-page: https://github.com/trustgraph-ai/trustgraph
|
6
|
-
Download-URL: https://github.com/trustgraph-ai/trustgraph/archive/refs/tags/v0.20.
|
6
|
+
Download-URL: https://github.com/trustgraph-ai/trustgraph/archive/refs/tags/v0.20.7.tar.gz
|
7
7
|
Author: trustgraph.ai
|
8
8
|
Author-email: security@trustgraph.ai
|
9
9
|
Classifier: Programming Language :: Python :: 3
|
@@ -1 +0,0 @@
|
|
1
|
-
__version__ = "0.20.5"
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{trustgraph-bedrock-0.20.5 → trustgraph-bedrock-0.20.7}/trustgraph_bedrock.egg-info/SOURCES.txt
RENAMED
File without changes
|
File without changes
|
{trustgraph-bedrock-0.20.5 → trustgraph-bedrock-0.20.7}/trustgraph_bedrock.egg-info/requires.txt
RENAMED
File without changes
|
{trustgraph-bedrock-0.20.5 → trustgraph-bedrock-0.20.7}/trustgraph_bedrock.egg-info/top_level.txt
RENAMED
File without changes
|