trustgraph-base 0.22.1__tar.gz → 0.22.3__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.
Files changed (58) hide show
  1. {trustgraph-base-0.22.1 → trustgraph-base-0.22.3}/PKG-INFO +2 -2
  2. {trustgraph-base-0.22.1 → trustgraph-base-0.22.3}/trustgraph/api/api.py +161 -10
  3. {trustgraph-base-0.22.1 → trustgraph-base-0.22.3}/trustgraph/base/base_processor.py +1 -0
  4. trustgraph-base-0.22.3/trustgraph/base_version.py +1 -0
  5. {trustgraph-base-0.22.1 → trustgraph-base-0.22.3}/trustgraph/clients/config_client.py +11 -11
  6. {trustgraph-base-0.22.1 → trustgraph-base-0.22.3}/trustgraph_base.egg-info/PKG-INFO +2 -2
  7. trustgraph-base-0.22.1/trustgraph/base_version.py +0 -1
  8. {trustgraph-base-0.22.1 → trustgraph-base-0.22.3}/README.md +0 -0
  9. {trustgraph-base-0.22.1 → trustgraph-base-0.22.3}/setup.cfg +0 -0
  10. {trustgraph-base-0.22.1 → trustgraph-base-0.22.3}/setup.py +0 -0
  11. {trustgraph-base-0.22.1 → trustgraph-base-0.22.3}/trustgraph/api/__init__.py +0 -0
  12. {trustgraph-base-0.22.1 → trustgraph-base-0.22.3}/trustgraph/base/__init__.py +0 -0
  13. {trustgraph-base-0.22.1 → trustgraph-base-0.22.3}/trustgraph/base/consumer.py +0 -0
  14. {trustgraph-base-0.22.1 → trustgraph-base-0.22.3}/trustgraph/base/consumer_producer.py +0 -0
  15. {trustgraph-base-0.22.1 → trustgraph-base-0.22.3}/trustgraph/base/producer.py +0 -0
  16. {trustgraph-base-0.22.1 → trustgraph-base-0.22.3}/trustgraph/base/publisher.py +0 -0
  17. {trustgraph-base-0.22.1 → trustgraph-base-0.22.3}/trustgraph/base/subscriber.py +0 -0
  18. {trustgraph-base-0.22.1 → trustgraph-base-0.22.3}/trustgraph/clients/__init__.py +0 -0
  19. {trustgraph-base-0.22.1 → trustgraph-base-0.22.3}/trustgraph/clients/agent_client.py +0 -0
  20. {trustgraph-base-0.22.1 → trustgraph-base-0.22.3}/trustgraph/clients/base.py +0 -0
  21. {trustgraph-base-0.22.1 → trustgraph-base-0.22.3}/trustgraph/clients/document_embeddings_client.py +0 -0
  22. {trustgraph-base-0.22.1 → trustgraph-base-0.22.3}/trustgraph/clients/document_rag_client.py +0 -0
  23. {trustgraph-base-0.22.1 → trustgraph-base-0.22.3}/trustgraph/clients/embeddings_client.py +0 -0
  24. {trustgraph-base-0.22.1 → trustgraph-base-0.22.3}/trustgraph/clients/graph_embeddings_client.py +0 -0
  25. {trustgraph-base-0.22.1 → trustgraph-base-0.22.3}/trustgraph/clients/graph_rag_client.py +0 -0
  26. {trustgraph-base-0.22.1 → trustgraph-base-0.22.3}/trustgraph/clients/llm_client.py +0 -0
  27. {trustgraph-base-0.22.1 → trustgraph-base-0.22.3}/trustgraph/clients/prompt_client.py +0 -0
  28. {trustgraph-base-0.22.1 → trustgraph-base-0.22.3}/trustgraph/clients/triples_query_client.py +0 -0
  29. {trustgraph-base-0.22.1 → trustgraph-base-0.22.3}/trustgraph/exceptions.py +0 -0
  30. {trustgraph-base-0.22.1 → trustgraph-base-0.22.3}/trustgraph/knowledge/__init__.py +0 -0
  31. {trustgraph-base-0.22.1 → trustgraph-base-0.22.3}/trustgraph/knowledge/defs.py +0 -0
  32. {trustgraph-base-0.22.1 → trustgraph-base-0.22.3}/trustgraph/knowledge/document.py +0 -0
  33. {trustgraph-base-0.22.1 → trustgraph-base-0.22.3}/trustgraph/knowledge/identifier.py +0 -0
  34. {trustgraph-base-0.22.1 → trustgraph-base-0.22.3}/trustgraph/knowledge/organization.py +0 -0
  35. {trustgraph-base-0.22.1 → trustgraph-base-0.22.3}/trustgraph/knowledge/publication.py +0 -0
  36. {trustgraph-base-0.22.1 → trustgraph-base-0.22.3}/trustgraph/log_level.py +0 -0
  37. {trustgraph-base-0.22.1 → trustgraph-base-0.22.3}/trustgraph/objects/__init__.py +0 -0
  38. {trustgraph-base-0.22.1 → trustgraph-base-0.22.3}/trustgraph/objects/field.py +0 -0
  39. {trustgraph-base-0.22.1 → trustgraph-base-0.22.3}/trustgraph/objects/object.py +0 -0
  40. {trustgraph-base-0.22.1 → trustgraph-base-0.22.3}/trustgraph/rdf.py +0 -0
  41. {trustgraph-base-0.22.1 → trustgraph-base-0.22.3}/trustgraph/schema/__init__.py +0 -0
  42. {trustgraph-base-0.22.1 → trustgraph-base-0.22.3}/trustgraph/schema/agent.py +0 -0
  43. {trustgraph-base-0.22.1 → trustgraph-base-0.22.3}/trustgraph/schema/config.py +0 -0
  44. {trustgraph-base-0.22.1 → trustgraph-base-0.22.3}/trustgraph/schema/documents.py +0 -0
  45. {trustgraph-base-0.22.1 → trustgraph-base-0.22.3}/trustgraph/schema/graph.py +0 -0
  46. {trustgraph-base-0.22.1 → trustgraph-base-0.22.3}/trustgraph/schema/library.py +0 -0
  47. {trustgraph-base-0.22.1 → trustgraph-base-0.22.3}/trustgraph/schema/lookup.py +0 -0
  48. {trustgraph-base-0.22.1 → trustgraph-base-0.22.3}/trustgraph/schema/metadata.py +0 -0
  49. {trustgraph-base-0.22.1 → trustgraph-base-0.22.3}/trustgraph/schema/models.py +0 -0
  50. {trustgraph-base-0.22.1 → trustgraph-base-0.22.3}/trustgraph/schema/object.py +0 -0
  51. {trustgraph-base-0.22.1 → trustgraph-base-0.22.3}/trustgraph/schema/prompt.py +0 -0
  52. {trustgraph-base-0.22.1 → trustgraph-base-0.22.3}/trustgraph/schema/retrieval.py +0 -0
  53. {trustgraph-base-0.22.1 → trustgraph-base-0.22.3}/trustgraph/schema/topic.py +0 -0
  54. {trustgraph-base-0.22.1 → trustgraph-base-0.22.3}/trustgraph/schema/types.py +0 -0
  55. {trustgraph-base-0.22.1 → trustgraph-base-0.22.3}/trustgraph_base.egg-info/SOURCES.txt +0 -0
  56. {trustgraph-base-0.22.1 → trustgraph-base-0.22.3}/trustgraph_base.egg-info/dependency_links.txt +0 -0
  57. {trustgraph-base-0.22.1 → trustgraph-base-0.22.3}/trustgraph_base.egg-info/requires.txt +0 -0
  58. {trustgraph-base-0.22.1 → trustgraph-base-0.22.3}/trustgraph_base.egg-info/top_level.txt +0 -0
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: trustgraph-base
3
- Version: 0.22.1
3
+ Version: 0.22.3
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.22.1.tar.gz
6
+ Download-URL: https://github.com/trustgraph-ai/trustgraph/archive/refs/tags/v0.22.3.tar.gz
7
7
  Author: trustgraph.ai
8
8
  Author-email: security@trustgraph.ai
9
9
  Classifier: Programming Language :: Python :: 3
@@ -18,6 +18,17 @@ class Triple:
18
18
  p : str
19
19
  o : str
20
20
 
21
+ @dataclasses.dataclass
22
+ class ConfigKey:
23
+ type : str
24
+ key : str
25
+
26
+ @dataclasses.dataclass
27
+ class ConfigValue:
28
+ type : str
29
+ key : str
30
+ value : str
31
+
21
32
  class Api:
22
33
 
23
34
  def __init__(self, url="http://localhost:8088/"):
@@ -35,7 +46,7 @@ class Api:
35
46
 
36
47
  try:
37
48
  msg = response["error"]["message"]
38
- tp = response["error"]["message"]
49
+ tp = response["error"]["type"]
39
50
  except:
40
51
  raise ApplicationException(
41
52
  "Error, but the error object is broken"
@@ -66,7 +77,7 @@ class Api:
66
77
  except:
67
78
  raise ProtocolException(f"Expected JSON response")
68
79
 
69
- self.check_error(resp)
80
+ self.check_error(object)
70
81
 
71
82
  try:
72
83
  return object["response"]
@@ -95,7 +106,7 @@ class Api:
95
106
  except:
96
107
  raise ProtocolException(f"Expected JSON response")
97
108
 
98
- self.check_error(resp)
109
+ self.check_error(object)
99
110
 
100
111
  try:
101
112
  return object["answer"]
@@ -134,7 +145,7 @@ class Api:
134
145
  except:
135
146
  raise ProtocolException(f"Expected JSON response")
136
147
 
137
- self.check_error(resp)
148
+ self.check_error(object)
138
149
 
139
150
  try:
140
151
  return object["response"]
@@ -169,7 +180,7 @@ class Api:
169
180
  except:
170
181
  raise ProtocolException(f"Expected JSON response")
171
182
 
172
- self.check_error(resp)
183
+ self.check_error(object)
173
184
 
174
185
  try:
175
186
  return object["response"]
@@ -198,7 +209,7 @@ class Api:
198
209
  except:
199
210
  raise ProtocolException(f"Expected JSON response")
200
211
 
201
- self.check_error(resp)
212
+ self.check_error(object)
202
213
 
203
214
  try:
204
215
  return object["vectors"]
@@ -228,7 +239,7 @@ class Api:
228
239
  except:
229
240
  raise ProtocolException("Expected JSON response")
230
241
 
231
- self.check_error(resp)
242
+ self.check_error(object)
232
243
 
233
244
  if "text" in object:
234
245
  return object["text"]
@@ -280,7 +291,7 @@ class Api:
280
291
  except:
281
292
  raise ProtocolException("Expected JSON response")
282
293
 
283
- self.check_error(resp)
294
+ self.check_error(object)
284
295
 
285
296
  if "response" not in object:
286
297
  raise ProtocolException("Response not formatted correctly")
@@ -382,7 +393,7 @@ class Api:
382
393
  if resp.status_code != 200:
383
394
  raise ProtocolException(f"Status code {resp.status_code}")
384
395
 
385
- def get_config(self):
396
+ def config_all(self):
386
397
 
387
398
  # The input consists of system and prompt strings
388
399
  input = {
@@ -404,10 +415,150 @@ class Api:
404
415
  except:
405
416
  raise ProtocolException(f"Expected JSON response")
406
417
 
407
- self.check_error(resp)
418
+ self.check_error(object)
408
419
 
409
420
  try:
410
421
  return object["config"], object["version"]
411
422
  except:
412
423
  raise ProtocolException(f"Response not formatted correctly")
413
424
 
425
+ def config_get(self, keys):
426
+
427
+ # The input consists of system and prompt strings
428
+ input = {
429
+ "operation": "get",
430
+ "keys": [
431
+ { "type": k.type, "key": k.key }
432
+ for k in keys
433
+ ]
434
+ }
435
+
436
+ url = f"{self.url}config"
437
+
438
+ # Invoke the API, input is passed as JSON
439
+ resp = requests.post(url, json=input)
440
+
441
+ # Should be a 200 status code
442
+ if resp.status_code != 200:
443
+ raise ProtocolException(f"Status code {resp.status_code}")
444
+
445
+ try:
446
+ # Parse the response as JSON
447
+ object = resp.json()
448
+ except:
449
+ raise ProtocolException(f"Expected JSON response")
450
+
451
+ self.check_error(object)
452
+
453
+ try:
454
+ return [
455
+ ConfigValue(
456
+ type = v["type"],
457
+ key = v["key"],
458
+ value = v["value"]
459
+ )
460
+ for v in object["values"]
461
+ ]
462
+ except:
463
+ raise ProtocolException(f"Response not formatted correctly")
464
+
465
+ def config_put(self, values):
466
+
467
+ # The input consists of system and prompt strings
468
+ input = {
469
+ "operation": "put",
470
+ "values": [
471
+ { "type": v.type, "key": v.key, "value": v.value }
472
+ for v in values
473
+ ]
474
+ }
475
+
476
+ url = f"{self.url}config"
477
+
478
+ # Invoke the API, input is passed as JSON
479
+ resp = requests.post(url, json=input)
480
+
481
+ # Should be a 200 status code
482
+ if resp.status_code != 200:
483
+ raise ProtocolException(f"Status code {resp.status_code}")
484
+
485
+ try:
486
+ # Parse the response as JSON
487
+ object = resp.json()
488
+ except:
489
+ raise ProtocolException(f"Expected JSON response")
490
+
491
+ self.check_error(object)
492
+
493
+ try:
494
+ return None
495
+ except:
496
+ raise ProtocolException(f"Response not formatted correctly")
497
+
498
+ def config_list(self, type):
499
+
500
+ # The input consists of system and prompt strings
501
+ input = {
502
+ "operation": "list",
503
+ "type": type,
504
+ }
505
+
506
+ url = f"{self.url}config"
507
+
508
+ # Invoke the API, input is passed as JSON
509
+ resp = requests.post(url, json=input)
510
+
511
+ # Should be a 200 status code
512
+ if resp.status_code != 200:
513
+ raise ProtocolException(f"Status code {resp.status_code}")
514
+
515
+ try:
516
+ # Parse the response as JSON
517
+ object = resp.json()
518
+ except:
519
+ raise ProtocolException(f"Expected JSON response")
520
+
521
+ self.check_error(object)
522
+
523
+ try:
524
+ return object["directory"]
525
+ except:
526
+ raise ProtocolException(f"Response not formatted correctly")
527
+
528
+ def config_getvalues(self, type):
529
+
530
+ # The input consists of system and prompt strings
531
+ input = {
532
+ "operation": "getvalues",
533
+ "type": type,
534
+ }
535
+
536
+ url = f"{self.url}config"
537
+
538
+ # Invoke the API, input is passed as JSON
539
+ resp = requests.post(url, json=input)
540
+
541
+ # Should be a 200 status code
542
+ if resp.status_code != 200:
543
+ raise ProtocolException(f"Status code {resp.status_code}")
544
+
545
+ try:
546
+ # Parse the response as JSON
547
+ object = resp.json()
548
+ except:
549
+ raise ProtocolException(f"Expected JSON response")
550
+
551
+ self.check_error(object)
552
+
553
+ try:
554
+ return [
555
+ ConfigValue(
556
+ type = v["type"],
557
+ key = v["key"],
558
+ value = v["value"]
559
+ )
560
+ for v in object["values"]
561
+ ]
562
+ except:
563
+ raise ProtocolException(f"Response not formatted correctly")
564
+
@@ -67,6 +67,7 @@ class BaseProcessor:
67
67
  self.config_subscriber = self.client.subscribe(
68
68
  self.config_push_queue, config_subscriber_id,
69
69
  consumer_type=pulsar.ConsumerType.Shared,
70
+ initial_position=pulsar.InitialPosition.Earliest,
70
71
  schema=JsonSchema(ConfigPush),
71
72
  )
72
73
 
@@ -0,0 +1 @@
1
+ __version__ = "0.22.3"
@@ -61,7 +61,7 @@ class ConfigClient(BaseClient):
61
61
  listener=listener,
62
62
  )
63
63
 
64
- def request_get(self, keys, timeout=300):
64
+ def get(self, keys, timeout=300):
65
65
 
66
66
  resp = self.call(
67
67
  id=id,
@@ -85,7 +85,7 @@ class ConfigClient(BaseClient):
85
85
  for v in resp.values
86
86
  ]
87
87
 
88
- def request_list(self, type, timeout=300):
88
+ def list(self, type, timeout=300):
89
89
 
90
90
  resp = self.call(
91
91
  id=id,
@@ -96,7 +96,7 @@ class ConfigClient(BaseClient):
96
96
 
97
97
  return resp.directory
98
98
 
99
- def request_getvalues(self, type, timeout=300):
99
+ def getvalues(self, type, timeout=300):
100
100
 
101
101
  resp = self.call(
102
102
  id=id,
@@ -114,7 +114,7 @@ class ConfigClient(BaseClient):
114
114
  for v in resp.values
115
115
  ]
116
116
 
117
- def request_delete(self, keys, timeout=300):
117
+ def delete(self, keys, timeout=300):
118
118
 
119
119
  resp = self.call(
120
120
  id=id,
@@ -131,25 +131,25 @@ class ConfigClient(BaseClient):
131
131
 
132
132
  return None
133
133
 
134
- def request_put(self, value, timeout=300):
134
+ def put(self, values, timeout=300):
135
135
 
136
136
  resp = self.call(
137
137
  id=id,
138
138
  operation="put",
139
139
  values=[
140
140
  ConfigValue(
141
- type = k["type"],
142
- key = k["key"],
143
- value = k["value"]
141
+ type = v["type"],
142
+ key = v["key"],
143
+ value = v["value"]
144
144
  )
145
- for k in keys
145
+ for v in values
146
146
  ],
147
147
  timeout=timeout
148
148
  )
149
149
 
150
150
  return None
151
151
 
152
- def request_config(self, timeout=300):
152
+ def config(self, timeout=300):
153
153
 
154
154
  resp = self.call(
155
155
  id=id,
@@ -157,5 +157,5 @@ class ConfigClient(BaseClient):
157
157
  timeout=timeout
158
158
  )
159
159
 
160
- return resp.config
160
+ return resp.config, resp.version
161
161
 
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: trustgraph-base
3
- Version: 0.22.1
3
+ Version: 0.22.3
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.22.1.tar.gz
6
+ Download-URL: https://github.com/trustgraph-ai/trustgraph/archive/refs/tags/v0.22.3.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.22.1"