trustgraph-vertexai 1.0.2__tar.gz → 1.0.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.

Potentially problematic release.


This version of trustgraph-vertexai might be problematic. Click here for more details.

@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: trustgraph-vertexai
3
- Version: 1.0.2
3
+ Version: 1.0.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
5
  Home-page: https://github.com/trustgraph-ai/trustgraph
6
- Download-URL: https://github.com/trustgraph-ai/trustgraph/archive/refs/tags/v1.0.2.tar.gz
6
+ Download-URL: https://github.com/trustgraph-ai/trustgraph/archive/refs/tags/v1.0.4.tar.gz
7
7
  Author: trustgraph.ai
8
8
  Author-email: security@trustgraph.ai
9
9
  Classifier: Programming Language :: Python :: 3
@@ -4,13 +4,26 @@ Simple LLM service, performs text prompt completion using VertexAI on
4
4
  Google Cloud. Input is prompt, output is response.
5
5
  """
6
6
 
7
+ #
8
+ # Somewhat perplexed by the Google Cloud SDK choices. We're going off this
9
+ # one, which uses the google-cloud-aiplatform library:
10
+ # https://cloud.google.com/python/docs/reference/vertexai/1.94.0
11
+ # It seems it is possible to invoke VertexAI from the google-genai
12
+ # SDK too:
13
+ # https://googleapis.github.io/python-genai/genai.html#module-genai.client
14
+ # That would make this code look very much like the GoogleAIStudio
15
+ # code. And maybe not reliant on the google-cloud-aiplatform library?
16
+ #
17
+ # This module's imports bring in a lot of libraries.
18
+
7
19
  from google.oauth2 import service_account
8
20
  import google
9
21
  import vertexai
10
22
 
11
- from vertexai.preview.generative_models import (
23
+ # Why is preview here?
24
+ from vertexai.generative_models import (
12
25
  Content, FunctionDeclaration, GenerativeModel, GenerationConfig,
13
- HarmCategory, HarmBlockThreshold, Part, Tool,
26
+ HarmCategory, HarmBlockThreshold, Part, Tool, SafetySetting,
14
27
  )
15
28
 
16
29
  from .... exceptions import TooManyRequests
@@ -18,7 +31,7 @@ from .... base import LlmService, LlmResult
18
31
 
19
32
  default_ident = "text-completion"
20
33
 
21
- default_model = 'gemini-1.0-pro-001'
34
+ default_model = 'gemini-2.0-flash-001'
22
35
  default_region = 'us-central1'
23
36
  default_temperature = 0.0
24
37
  default_max_output = 8192
@@ -59,12 +72,24 @@ class Processor(LlmService):
59
72
  block_level = HarmBlockThreshold.BLOCK_ONLY_HIGH
60
73
  # block_level = HarmBlockThreshold.BLOCK_NONE
61
74
 
62
- self.safety_settings = {
63
- HarmCategory.HARM_CATEGORY_HARASSMENT: block_level,
64
- HarmCategory.HARM_CATEGORY_HATE_SPEECH: block_level,
65
- HarmCategory.HARM_CATEGORY_SEXUALLY_EXPLICIT: block_level,
66
- HarmCategory.HARM_CATEGORY_DANGEROUS_CONTENT: block_level,
67
- }
75
+ self.safety_settings = [
76
+ SafetySetting(
77
+ category = HarmCategory.HARM_CATEGORY_HARASSMENT,
78
+ threshold = block_level,
79
+ ),
80
+ SafetySetting(
81
+ category = HarmCategory.HARM_CATEGORY_HATE_SPEECH,
82
+ threshold = block_level,
83
+ ),
84
+ SafetySetting(
85
+ category = HarmCategory.HARM_CATEGORY_SEXUALLY_EXPLICIT,
86
+ threshold = block_level,
87
+ ),
88
+ SafetySetting(
89
+ category = HarmCategory.HARM_CATEGORY_DANGEROUS_CONTENT,
90
+ threshold = block_level,
91
+ ),
92
+ ]
68
93
 
69
94
  print("Initialise VertexAI...", flush=True)
70
95
 
@@ -101,8 +126,8 @@ class Processor(LlmService):
101
126
  prompt = system + "\n\n" + prompt
102
127
 
103
128
  response = self.llm.generate_content(
104
- prompt, generation_config=self.generation_config,
105
- safety_settings=self.safety_settings
129
+ prompt, generation_config = self.generation_config,
130
+ safety_settings = self.safety_settings,
106
131
  )
107
132
 
108
133
  resp = LlmResult(
@@ -0,0 +1 @@
1
+ __version__ = "1.0.4"
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: trustgraph-vertexai
3
- Version: 1.0.2
3
+ Version: 1.0.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
5
  Home-page: https://github.com/trustgraph-ai/trustgraph
6
- Download-URL: https://github.com/trustgraph-ai/trustgraph/archive/refs/tags/v1.0.2.tar.gz
6
+ Download-URL: https://github.com/trustgraph-ai/trustgraph/archive/refs/tags/v1.0.4.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__ = "1.0.2"