trustgraph-bedrock 1.2.0__tar.gz → 1.2.4__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.
@@ -1,15 +1,16 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: trustgraph-bedrock
3
- Version: 1.2.0
3
+ Version: 1.2.4
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
- Home-page: https://github.com/trustgraph-ai/trustgraph
6
- Download-URL: https://github.com/trustgraph-ai/trustgraph/archive/refs/tags/v1.2.0.tar.gz
7
- Author: trustgraph.ai
8
- Author-email: security@trustgraph.ai
5
+ Author-email: "trustgraph.ai" <security@trustgraph.ai>
6
+ Project-URL: Homepage, https://github.com/trustgraph-ai/trustgraph
9
7
  Classifier: Programming Language :: Python :: 3
10
- Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
11
8
  Classifier: Operating System :: OS Independent
12
9
  Requires-Python: >=3.8
13
10
  Description-Content-Type: text/markdown
11
+ Requires-Dist: trustgraph-base<1.3,>=1.2
12
+ Requires-Dist: pulsar-client
13
+ Requires-Dist: prometheus-client
14
+ Requires-Dist: boto3
14
15
 
15
16
  See https://trustgraph.ai/
@@ -0,0 +1,33 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "trustgraph-bedrock"
7
+ dynamic = ["version"]
8
+ authors = [{name = "trustgraph.ai", email = "security@trustgraph.ai"}]
9
+ description = "TrustGraph provides a means to run a pipeline of flexible AI processing components in a flexible means to achieve a processing pipeline."
10
+ readme = "README.md"
11
+ requires-python = ">=3.8"
12
+ dependencies = [
13
+ "trustgraph-base>=1.2,<1.3",
14
+ "pulsar-client",
15
+ "prometheus-client",
16
+ "boto3",
17
+ ]
18
+ classifiers = [
19
+ "Programming Language :: Python :: 3",
20
+ "Operating System :: OS Independent",
21
+ ]
22
+
23
+ [project.urls]
24
+ Homepage = "https://github.com/trustgraph-ai/trustgraph"
25
+
26
+ [project.scripts]
27
+ text-completion-bedrock = "trustgraph.model.text_completion.bedrock:run"
28
+
29
+ [tool.setuptools.packages.find]
30
+ include = ["trustgraph*"]
31
+
32
+ [tool.setuptools.dynamic]
33
+ version = {attr = "trustgraph.bedrock_version.__version__"}
@@ -0,0 +1 @@
1
+ __version__ = "1.2.4"
@@ -8,10 +8,14 @@ import boto3
8
8
  import json
9
9
  import os
10
10
  import enum
11
+ import logging
11
12
 
12
13
  from .... exceptions import TooManyRequests
13
14
  from .... base import LlmService, LlmResult
14
15
 
16
+ # Module logger
17
+ logger = logging.getLogger(__name__)
18
+
15
19
  default_ident = "text-completion"
16
20
 
17
21
  default_model = 'mistral.mistral-large-2407-v1:0'
@@ -145,7 +149,7 @@ class Processor(LlmService):
145
149
 
146
150
  def __init__(self, **params):
147
151
 
148
- print(params)
152
+ logger.debug(f"Bedrock LLM initialized with params: {params}")
149
153
 
150
154
  model = params.get("model", default_model)
151
155
  temperature = params.get("temperature", default_temperature)
@@ -197,7 +201,7 @@ class Processor(LlmService):
197
201
 
198
202
  self.bedrock = self.session.client(service_name='bedrock-runtime')
199
203
 
200
- print("Initialised", flush=True)
204
+ logger.info("Bedrock LLM service initialized")
201
205
 
202
206
  def determine_variant(self, model):
203
207
 
@@ -250,9 +254,9 @@ class Processor(LlmService):
250
254
  inputtokens = int(metadata['x-amzn-bedrock-input-token-count'])
251
255
  outputtokens = int(metadata['x-amzn-bedrock-output-token-count'])
252
256
 
253
- print(outputtext, flush=True)
254
- print(f"Input Tokens: {inputtokens}", flush=True)
255
- print(f"Output Tokens: {outputtokens}", flush=True)
257
+ logger.debug(f"LLM output: {outputtext}")
258
+ logger.info(f"Input Tokens: {inputtokens}")
259
+ logger.info(f"Output Tokens: {outputtokens}")
256
260
 
257
261
  resp = LlmResult(
258
262
  text = outputtext,
@@ -265,7 +269,7 @@ class Processor(LlmService):
265
269
 
266
270
  except self.bedrock.exceptions.ThrottlingException as e:
267
271
 
268
- print("Hit rate limit:", e, flush=True)
272
+ logger.warning(f"Hit rate limit: {e}")
269
273
 
270
274
  # Leave rate limit retries to the base handler
271
275
  raise TooManyRequests()
@@ -274,8 +278,7 @@ class Processor(LlmService):
274
278
 
275
279
  # Apart from rate limits, treat all exceptions as unrecoverable
276
280
 
277
- print(type(e))
278
- print(f"Exception: {e}")
281
+ logger.error(f"Bedrock LLM exception ({type(e).__name__}): {e}", exc_info=True)
279
282
  raise e
280
283
 
281
284
  @staticmethod
@@ -1,15 +1,16 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: trustgraph-bedrock
3
- Version: 1.2.0
3
+ Version: 1.2.4
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
- Home-page: https://github.com/trustgraph-ai/trustgraph
6
- Download-URL: https://github.com/trustgraph-ai/trustgraph/archive/refs/tags/v1.2.0.tar.gz
7
- Author: trustgraph.ai
8
- Author-email: security@trustgraph.ai
5
+ Author-email: "trustgraph.ai" <security@trustgraph.ai>
6
+ Project-URL: Homepage, https://github.com/trustgraph-ai/trustgraph
9
7
  Classifier: Programming Language :: Python :: 3
10
- Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
11
8
  Classifier: Operating System :: OS Independent
12
9
  Requires-Python: >=3.8
13
10
  Description-Content-Type: text/markdown
11
+ Requires-Dist: trustgraph-base<1.3,>=1.2
12
+ Requires-Dist: pulsar-client
13
+ Requires-Dist: prometheus-client
14
+ Requires-Dist: boto3
14
15
 
15
16
  See https://trustgraph.ai/
@@ -1,6 +1,5 @@
1
1
  README.md
2
- setup.py
3
- scripts/text-completion-bedrock
2
+ pyproject.toml
4
3
  trustgraph/bedrock_version.py
5
4
  trustgraph/model/text_completion/bedrock/__init__.py
6
5
  trustgraph/model/text_completion/bedrock/__main__.py
@@ -8,5 +7,6 @@ trustgraph/model/text_completion/bedrock/llm.py
8
7
  trustgraph_bedrock.egg-info/PKG-INFO
9
8
  trustgraph_bedrock.egg-info/SOURCES.txt
10
9
  trustgraph_bedrock.egg-info/dependency_links.txt
10
+ trustgraph_bedrock.egg-info/entry_points.txt
11
11
  trustgraph_bedrock.egg-info/requires.txt
12
12
  trustgraph_bedrock.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ text-completion-bedrock = trustgraph.model.text_completion.bedrock:run
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env python3
2
-
3
- from trustgraph.model.text_completion.bedrock import run
4
-
5
- run()
6
-
@@ -1,45 +0,0 @@
1
- import setuptools
2
- import os
3
- import importlib
4
-
5
- with open("README.md", "r") as fh:
6
- long_description = fh.read()
7
-
8
- # Load a version number module
9
- spec = importlib.util.spec_from_file_location(
10
- 'version', 'trustgraph/bedrock_version.py'
11
- )
12
- version_module = importlib.util.module_from_spec(spec)
13
- spec.loader.exec_module(version_module)
14
-
15
- version = version_module.__version__
16
-
17
- setuptools.setup(
18
- name="trustgraph-bedrock",
19
- version=version,
20
- author="trustgraph.ai",
21
- author_email="security@trustgraph.ai",
22
- description="TrustGraph provides a means to run a pipeline of flexible AI processing components in a flexible means to achieve a processing pipeline.",
23
- long_description=long_description,
24
- long_description_content_type="text/markdown",
25
- url="https://github.com/trustgraph-ai/trustgraph",
26
- packages=setuptools.find_namespace_packages(
27
- where='./',
28
- ),
29
- classifiers=[
30
- "Programming Language :: Python :: 3",
31
- "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
32
- "Operating System :: OS Independent",
33
- ],
34
- python_requires='>=3.8',
35
- download_url = "https://github.com/trustgraph-ai/trustgraph/archive/refs/tags/v" + version + ".tar.gz",
36
- install_requires=[
37
- "trustgraph-base>=1.2,<1.3",
38
- "pulsar-client",
39
- "prometheus-client",
40
- "boto3",
41
- ],
42
- scripts=[
43
- "scripts/text-completion-bedrock",
44
- ]
45
- )
@@ -1 +0,0 @@
1
- __version__ = "1.2.0"
@@ -1,4 +1,4 @@
1
- boto3
2
- prometheus-client
3
- pulsar-client
4
1
  trustgraph-base<1.3,>=1.2
2
+ pulsar-client
3
+ prometheus-client
4
+ boto3