trustgraph-base 1.4.5__tar.gz → 1.4.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.

Potentially problematic release.


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

Files changed (135) hide show
  1. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/PKG-INFO +1 -1
  2. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/api/api.py +4 -0
  3. trustgraph_base-1.4.7/trustgraph/api/collection.py +90 -0
  4. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/api/flow.py +138 -2
  5. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/api/types.py +10 -0
  6. trustgraph_base-1.4.7/trustgraph/base_version.py +1 -0
  7. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/messaging/__init__.py +7 -0
  8. trustgraph_base-1.4.7/trustgraph/messaging/translators/collection.py +112 -0
  9. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/messaging/translators/diagnosis.py +2 -0
  10. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/schema/services/__init__.py +3 -1
  11. trustgraph_base-1.4.7/trustgraph/schema/services/collection.py +60 -0
  12. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/schema/services/diagnosis.py +5 -2
  13. trustgraph_base-1.4.7/trustgraph/schema/services/storage.py +42 -0
  14. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph_base.egg-info/PKG-INFO +1 -1
  15. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph_base.egg-info/SOURCES.txt +4 -0
  16. trustgraph_base-1.4.5/trustgraph/base_version.py +0 -1
  17. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/README.md +0 -0
  18. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/pyproject.toml +0 -0
  19. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/setup.cfg +0 -0
  20. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/api/__init__.py +0 -0
  21. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/api/config.py +0 -0
  22. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/api/exceptions.py +0 -0
  23. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/api/knowledge.py +0 -0
  24. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/api/library.py +0 -0
  25. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/base/__init__.py +0 -0
  26. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/base/agent_client.py +0 -0
  27. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/base/agent_service.py +0 -0
  28. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/base/async_processor.py +0 -0
  29. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/base/cassandra_config.py +0 -0
  30. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/base/consumer.py +0 -0
  31. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/base/consumer_spec.py +0 -0
  32. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/base/document_embeddings_client.py +0 -0
  33. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/base/document_embeddings_query_service.py +0 -0
  34. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/base/document_embeddings_store_service.py +0 -0
  35. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/base/embeddings_client.py +0 -0
  36. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/base/embeddings_service.py +0 -0
  37. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/base/flow.py +0 -0
  38. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/base/flow_processor.py +0 -0
  39. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/base/graph_embeddings_client.py +0 -0
  40. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/base/graph_embeddings_query_service.py +0 -0
  41. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/base/graph_embeddings_store_service.py +0 -0
  42. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/base/graph_rag_client.py +0 -0
  43. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/base/llm_service.py +0 -0
  44. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/base/metrics.py +0 -0
  45. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/base/producer.py +0 -0
  46. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/base/producer_spec.py +0 -0
  47. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/base/prompt_client.py +0 -0
  48. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/base/publisher.py +0 -0
  49. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/base/pubsub.py +0 -0
  50. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/base/request_response_spec.py +0 -0
  51. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/base/setting_spec.py +0 -0
  52. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/base/spec.py +0 -0
  53. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/base/structured_query_client.py +0 -0
  54. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/base/subscriber.py +0 -0
  55. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/base/subscriber_spec.py +0 -0
  56. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/base/text_completion_client.py +0 -0
  57. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/base/tool_client.py +0 -0
  58. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/base/tool_service.py +0 -0
  59. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/base/triples_client.py +0 -0
  60. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/base/triples_query_service.py +0 -0
  61. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/base/triples_store_service.py +0 -0
  62. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/clients/__init__.py +0 -0
  63. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/clients/agent_client.py +0 -0
  64. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/clients/base.py +0 -0
  65. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/clients/config_client.py +0 -0
  66. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/clients/document_embeddings_client.py +0 -0
  67. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/clients/document_rag_client.py +0 -0
  68. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/clients/embeddings_client.py +0 -0
  69. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/clients/graph_embeddings_client.py +0 -0
  70. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/clients/graph_rag_client.py +0 -0
  71. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/clients/llm_client.py +0 -0
  72. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/clients/prompt_client.py +0 -0
  73. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/clients/triples_query_client.py +0 -0
  74. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/exceptions.py +0 -0
  75. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/knowledge/__init__.py +0 -0
  76. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/knowledge/defs.py +0 -0
  77. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/knowledge/document.py +0 -0
  78. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/knowledge/identifier.py +0 -0
  79. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/knowledge/organization.py +0 -0
  80. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/knowledge/publication.py +0 -0
  81. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/log_level.py +0 -0
  82. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/messaging/registry.py +0 -0
  83. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/messaging/translators/__init__.py +0 -0
  84. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/messaging/translators/agent.py +0 -0
  85. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/messaging/translators/base.py +0 -0
  86. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/messaging/translators/config.py +0 -0
  87. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/messaging/translators/document_loading.py +0 -0
  88. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/messaging/translators/embeddings.py +0 -0
  89. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/messaging/translators/embeddings_query.py +0 -0
  90. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/messaging/translators/flow.py +0 -0
  91. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/messaging/translators/knowledge.py +0 -0
  92. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/messaging/translators/library.py +0 -0
  93. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/messaging/translators/metadata.py +0 -0
  94. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/messaging/translators/nlp_query.py +0 -0
  95. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/messaging/translators/objects_query.py +0 -0
  96. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/messaging/translators/primitives.py +0 -0
  97. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/messaging/translators/prompt.py +0 -0
  98. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/messaging/translators/retrieval.py +0 -0
  99. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/messaging/translators/structured_query.py +0 -0
  100. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/messaging/translators/text_completion.py +0 -0
  101. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/messaging/translators/tool.py +0 -0
  102. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/messaging/translators/triples.py +0 -0
  103. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/objects/__init__.py +0 -0
  104. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/objects/field.py +0 -0
  105. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/objects/object.py +0 -0
  106. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/rdf.py +0 -0
  107. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/schema/__init__.py +0 -0
  108. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/schema/core/__init__.py +0 -0
  109. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/schema/core/metadata.py +0 -0
  110. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/schema/core/primitives.py +0 -0
  111. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/schema/core/topic.py +0 -0
  112. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/schema/knowledge/__init__.py +0 -0
  113. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/schema/knowledge/document.py +0 -0
  114. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/schema/knowledge/embeddings.py +0 -0
  115. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/schema/knowledge/graph.py +0 -0
  116. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/schema/knowledge/knowledge.py +0 -0
  117. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/schema/knowledge/nlp.py +0 -0
  118. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/schema/knowledge/object.py +0 -0
  119. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/schema/knowledge/rows.py +0 -0
  120. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/schema/knowledge/structured.py +0 -0
  121. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/schema/services/agent.py +0 -0
  122. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/schema/services/config.py +0 -0
  123. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/schema/services/flow.py +0 -0
  124. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/schema/services/library.py +0 -0
  125. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/schema/services/llm.py +0 -0
  126. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/schema/services/lookup.py +0 -0
  127. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/schema/services/nlp_query.py +0 -0
  128. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/schema/services/objects_query.py +0 -0
  129. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/schema/services/prompt.py +0 -0
  130. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/schema/services/query.py +0 -0
  131. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/schema/services/retrieval.py +0 -0
  132. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph/schema/services/structured_query.py +0 -0
  133. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph_base.egg-info/dependency_links.txt +0 -0
  134. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph_base.egg-info/requires.txt +0 -0
  135. {trustgraph_base-1.4.5 → trustgraph_base-1.4.7}/trustgraph_base.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: trustgraph-base
3
- Version: 1.4.5
3
+ Version: 1.4.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
  Author-email: "trustgraph.ai" <security@trustgraph.ai>
6
6
  Project-URL: Homepage, https://github.com/trustgraph-ai/trustgraph
@@ -8,6 +8,7 @@ from . library import Library
8
8
  from . flow import Flow
9
9
  from . config import Config
10
10
  from . knowledge import Knowledge
11
+ from . collection import Collection
11
12
  from . exceptions import *
12
13
  from . types import *
13
14
 
@@ -68,3 +69,6 @@ class Api:
68
69
 
69
70
  def library(self):
70
71
  return Library(self)
72
+
73
+ def collection(self):
74
+ return Collection(self)
@@ -0,0 +1,90 @@
1
+ import datetime
2
+ import logging
3
+
4
+ from . types import CollectionMetadata
5
+ from . exceptions import *
6
+
7
+ logger = logging.getLogger(__name__)
8
+
9
+ class Collection:
10
+
11
+ def __init__(self, api):
12
+ self.api = api
13
+
14
+ def request(self, request):
15
+ return self.api.request(f"collection-management", request)
16
+
17
+ def list_collections(self, user, tag_filter=None):
18
+
19
+ input = {
20
+ "operation": "list-collections",
21
+ "user": user,
22
+ }
23
+
24
+ if tag_filter:
25
+ input["tag_filter"] = tag_filter
26
+
27
+ object = self.request(input)
28
+
29
+ try:
30
+ return [
31
+ CollectionMetadata(
32
+ user = v["user"],
33
+ collection = v["collection"],
34
+ name = v["name"],
35
+ description = v["description"],
36
+ tags = v["tags"],
37
+ created_at = v["created_at"],
38
+ updated_at = v["updated_at"]
39
+ )
40
+ for v in object["collections"]
41
+ ]
42
+ except Exception as e:
43
+ logger.error("Failed to parse collection list response", exc_info=True)
44
+ raise ProtocolException(f"Response not formatted correctly")
45
+
46
+ def update_collection(self, user, collection, name=None, description=None, tags=None):
47
+
48
+ input = {
49
+ "operation": "update-collection",
50
+ "user": user,
51
+ "collection": collection,
52
+ }
53
+
54
+ if name is not None:
55
+ input["name"] = name
56
+ if description is not None:
57
+ input["description"] = description
58
+ if tags is not None:
59
+ input["tags"] = tags
60
+
61
+ object = self.request(input)
62
+
63
+ try:
64
+ if "collections" in object and object["collections"]:
65
+ v = object["collections"][0]
66
+ return CollectionMetadata(
67
+ user = v["user"],
68
+ collection = v["collection"],
69
+ name = v["name"],
70
+ description = v["description"],
71
+ tags = v["tags"],
72
+ created_at = v["created_at"],
73
+ updated_at = v["updated_at"]
74
+ )
75
+ return None
76
+ except Exception as e:
77
+ logger.error("Failed to parse collection update response", exc_info=True)
78
+ raise ProtocolException(f"Response not formatted correctly")
79
+
80
+ def delete_collection(self, user, collection):
81
+
82
+ input = {
83
+ "operation": "delete-collection",
84
+ "user": user,
85
+ "collection": collection,
86
+ }
87
+
88
+ object = self.request(input)
89
+
90
+ return {}
@@ -492,12 +492,148 @@ class FlowInstance:
492
492
  "service/structured-query",
493
493
  input
494
494
  )
495
-
495
+
496
496
  # Check for system-level error
497
497
  if "error" in response and response["error"]:
498
498
  error_type = response["error"].get("type", "unknown")
499
499
  error_message = response["error"].get("message", "Unknown error")
500
500
  raise ProtocolException(f"{error_type}: {error_message}")
501
-
501
+
502
502
  return response
503
503
 
504
+ def detect_type(self, sample):
505
+ """
506
+ Detect the data type of a structured data sample.
507
+
508
+ Args:
509
+ sample: Data sample to analyze (string content)
510
+
511
+ Returns:
512
+ dict with detected_type, confidence, and optional metadata
513
+ """
514
+
515
+ input = {
516
+ "operation": "detect-type",
517
+ "sample": sample
518
+ }
519
+
520
+ response = self.request(
521
+ "service/structured-diag",
522
+ input
523
+ )
524
+
525
+ # Check for system-level error
526
+ if "error" in response and response["error"]:
527
+ error_type = response["error"].get("type", "unknown")
528
+ error_message = response["error"].get("message", "Unknown error")
529
+ raise ProtocolException(f"{error_type}: {error_message}")
530
+
531
+ return response["detected-type"]
532
+
533
+ def generate_descriptor(self, sample, data_type, schema_name, options=None):
534
+ """
535
+ Generate a descriptor for structured data mapping to a specific schema.
536
+
537
+ Args:
538
+ sample: Data sample to analyze (string content)
539
+ data_type: Data type (csv, json, xml)
540
+ schema_name: Target schema name for descriptor generation
541
+ options: Optional parameters (e.g., delimiter for CSV)
542
+
543
+ Returns:
544
+ dict with descriptor and metadata
545
+ """
546
+
547
+ input = {
548
+ "operation": "generate-descriptor",
549
+ "sample": sample,
550
+ "type": data_type,
551
+ "schema-name": schema_name
552
+ }
553
+
554
+ if options:
555
+ input["options"] = options
556
+
557
+ response = self.request(
558
+ "service/structured-diag",
559
+ input
560
+ )
561
+
562
+ # Check for system-level error
563
+ if "error" in response and response["error"]:
564
+ error_type = response["error"].get("type", "unknown")
565
+ error_message = response["error"].get("message", "Unknown error")
566
+ raise ProtocolException(f"{error_type}: {error_message}")
567
+
568
+ return response["descriptor"]
569
+
570
+ def diagnose_data(self, sample, schema_name=None, options=None):
571
+ """
572
+ Perform combined data diagnosis: detect type and generate descriptor.
573
+
574
+ Args:
575
+ sample: Data sample to analyze (string content)
576
+ schema_name: Optional target schema name for descriptor generation
577
+ options: Optional parameters (e.g., delimiter for CSV)
578
+
579
+ Returns:
580
+ dict with detected_type, confidence, descriptor, and metadata
581
+ """
582
+
583
+ input = {
584
+ "operation": "diagnose",
585
+ "sample": sample
586
+ }
587
+
588
+ if schema_name:
589
+ input["schema-name"] = schema_name
590
+
591
+ if options:
592
+ input["options"] = options
593
+
594
+ response = self.request(
595
+ "service/structured-diag",
596
+ input
597
+ )
598
+
599
+ # Check for system-level error
600
+ if "error" in response and response["error"]:
601
+ error_type = response["error"].get("type", "unknown")
602
+ error_message = response["error"].get("message", "Unknown error")
603
+ raise ProtocolException(f"{error_type}: {error_message}")
604
+
605
+ return response
606
+
607
+ def schema_selection(self, sample, options=None):
608
+ """
609
+ Select matching schemas for a data sample using prompt analysis.
610
+
611
+ Args:
612
+ sample: Data sample to analyze (string content)
613
+ options: Optional parameters
614
+
615
+ Returns:
616
+ dict with schema_matches array and metadata
617
+ """
618
+
619
+ input = {
620
+ "operation": "schema-selection",
621
+ "sample": sample
622
+ }
623
+
624
+ if options:
625
+ input["options"] = options
626
+
627
+ response = self.request(
628
+ "service/structured-diag",
629
+ input
630
+ )
631
+
632
+ # Check for system-level error
633
+ if "error" in response and response["error"]:
634
+ error_type = response["error"].get("type", "unknown")
635
+ error_message = response["error"].get("message", "Unknown error")
636
+ raise ProtocolException(f"{error_type}: {error_message}")
637
+
638
+ return response["schema-matches"]
639
+
@@ -41,3 +41,13 @@ class ProcessingMetadata:
41
41
  user : str
42
42
  collection : str
43
43
  tags : List[str]
44
+
45
+ @dataclasses.dataclass
46
+ class CollectionMetadata:
47
+ user : str
48
+ collection : str
49
+ name : str
50
+ description : str
51
+ tags : List[str]
52
+ created_at : str
53
+ updated_at : str
@@ -0,0 +1 @@
1
+ __version__ = "1.4.7"
@@ -25,6 +25,7 @@ from .translators.objects_query import ObjectsQueryRequestTranslator, ObjectsQue
25
25
  from .translators.nlp_query import QuestionToStructuredQueryRequestTranslator, QuestionToStructuredQueryResponseTranslator
26
26
  from .translators.structured_query import StructuredQueryRequestTranslator, StructuredQueryResponseTranslator
27
27
  from .translators.diagnosis import StructuredDataDiagnosisRequestTranslator, StructuredDataDiagnosisResponseTranslator
28
+ from .translators.collection import CollectionManagementRequestTranslator, CollectionManagementResponseTranslator
28
29
 
29
30
  # Register all service translators
30
31
  TranslatorRegistry.register_service(
@@ -135,6 +136,12 @@ TranslatorRegistry.register_service(
135
136
  StructuredDataDiagnosisResponseTranslator()
136
137
  )
137
138
 
139
+ TranslatorRegistry.register_service(
140
+ "collection-management",
141
+ CollectionManagementRequestTranslator(),
142
+ CollectionManagementResponseTranslator()
143
+ )
144
+
138
145
  # Register single-direction translators for document loading
139
146
  TranslatorRegistry.register_request("document", DocumentTranslator())
140
147
  TranslatorRegistry.register_request("text-document", TextDocumentTranslator())
@@ -0,0 +1,112 @@
1
+ from typing import Dict, Any, List
2
+ from ...schema import CollectionManagementRequest, CollectionManagementResponse, CollectionMetadata, Error
3
+ from .base import MessageTranslator
4
+
5
+
6
+ class CollectionManagementRequestTranslator(MessageTranslator):
7
+ """Translator for CollectionManagementRequest schema objects"""
8
+
9
+ def to_pulsar(self, data: Dict[str, Any]) -> CollectionManagementRequest:
10
+ return CollectionManagementRequest(
11
+ operation=data.get("operation", ""),
12
+ user=data.get("user", ""),
13
+ collection=data.get("collection", ""),
14
+ timestamp=data.get("timestamp", ""),
15
+ name=data.get("name", ""),
16
+ description=data.get("description", ""),
17
+ tags=data.get("tags", []),
18
+ created_at=data.get("created_at", ""),
19
+ updated_at=data.get("updated_at", ""),
20
+ tag_filter=data.get("tag_filter", []),
21
+ limit=data.get("limit", 50)
22
+ )
23
+
24
+ def from_pulsar(self, obj: CollectionManagementRequest) -> Dict[str, Any]:
25
+ result = {}
26
+
27
+ if obj.operation:
28
+ result["operation"] = obj.operation
29
+ if obj.user:
30
+ result["user"] = obj.user
31
+ if obj.collection:
32
+ result["collection"] = obj.collection
33
+ if obj.timestamp:
34
+ result["timestamp"] = obj.timestamp
35
+ if obj.name:
36
+ result["name"] = obj.name
37
+ if obj.description:
38
+ result["description"] = obj.description
39
+ if obj.tags:
40
+ result["tags"] = list(obj.tags)
41
+ if obj.created_at:
42
+ result["created_at"] = obj.created_at
43
+ if obj.updated_at:
44
+ result["updated_at"] = obj.updated_at
45
+ if obj.tag_filter:
46
+ result["tag_filter"] = list(obj.tag_filter)
47
+ if obj.limit:
48
+ result["limit"] = obj.limit
49
+
50
+ return result
51
+
52
+
53
+ class CollectionManagementResponseTranslator(MessageTranslator):
54
+ """Translator for CollectionManagementResponse schema objects"""
55
+
56
+ def to_pulsar(self, data: Dict[str, Any]) -> CollectionManagementResponse:
57
+ # Handle error
58
+ error = None
59
+ if "error" in data and data["error"]:
60
+ error_data = data["error"]
61
+ error = Error(
62
+ type=error_data.get("type", ""),
63
+ message=error_data.get("message", "")
64
+ )
65
+
66
+ # Handle collections array
67
+ collections = []
68
+ if "collections" in data:
69
+ for coll_data in data["collections"]:
70
+ collections.append(CollectionMetadata(
71
+ user=coll_data.get("user", ""),
72
+ collection=coll_data.get("collection", ""),
73
+ name=coll_data.get("name", ""),
74
+ description=coll_data.get("description", ""),
75
+ tags=coll_data.get("tags", []),
76
+ created_at=coll_data.get("created_at", ""),
77
+ updated_at=coll_data.get("updated_at", "")
78
+ ))
79
+
80
+ return CollectionManagementResponse(
81
+ success=data.get("success", ""),
82
+ error=error,
83
+ timestamp=data.get("timestamp", ""),
84
+ collections=collections
85
+ )
86
+
87
+ def from_pulsar(self, obj: CollectionManagementResponse) -> Dict[str, Any]:
88
+ result = {}
89
+
90
+ if obj.success:
91
+ result["success"] = obj.success
92
+ if obj.error:
93
+ result["error"] = {
94
+ "type": obj.error.type,
95
+ "message": obj.error.message
96
+ }
97
+ if obj.timestamp:
98
+ result["timestamp"] = obj.timestamp
99
+ if obj.collections:
100
+ result["collections"] = []
101
+ for coll in obj.collections:
102
+ result["collections"].append({
103
+ "user": coll.user,
104
+ "collection": coll.collection,
105
+ "name": coll.name,
106
+ "description": coll.description,
107
+ "tags": list(coll.tags) if coll.tags else [],
108
+ "created_at": coll.created_at,
109
+ "updated_at": coll.updated_at
110
+ })
111
+
112
+ return result
@@ -57,6 +57,8 @@ class StructuredDataDiagnosisResponseTranslator(MessageTranslator):
57
57
  result["descriptor"] = obj.descriptor
58
58
  if obj.metadata:
59
59
  result["metadata"] = obj.metadata
60
+ if obj.schema_matches is not None:
61
+ result["schema-matches"] = obj.schema_matches
60
62
 
61
63
  return result
62
64
 
@@ -10,4 +10,6 @@ from .lookup import *
10
10
  from .nlp_query import *
11
11
  from .structured_query import *
12
12
  from .objects_query import *
13
- from .diagnosis import *
13
+ from .diagnosis import *
14
+ from .collection import *
15
+ from .storage import *
@@ -0,0 +1,60 @@
1
+ from pulsar.schema import Record, String, Integer, Array
2
+ from datetime import datetime
3
+
4
+ from ..core.primitives import Error
5
+ from ..core.topic import topic
6
+
7
+ ############################################################################
8
+
9
+ # Collection management operations
10
+
11
+ # Collection metadata operations (for librarian service)
12
+
13
+ class CollectionMetadata(Record):
14
+ """Collection metadata record"""
15
+ user = String()
16
+ collection = String()
17
+ name = String()
18
+ description = String()
19
+ tags = Array(String())
20
+ created_at = String() # ISO timestamp
21
+ updated_at = String() # ISO timestamp
22
+
23
+ ############################################################################
24
+
25
+ class CollectionManagementRequest(Record):
26
+ """Request for collection management operations"""
27
+ operation = String() # e.g., "delete-collection"
28
+
29
+ # For 'list-collections'
30
+ user = String()
31
+ collection = String()
32
+ timestamp = String() # ISO timestamp
33
+ name = String()
34
+ description = String()
35
+ tags = Array(String())
36
+ created_at = String() # ISO timestamp
37
+ updated_at = String() # ISO timestamp
38
+
39
+ # For list
40
+ tag_filter = Array(String()) # Optional filter by tags
41
+ limit = Integer()
42
+
43
+ class CollectionManagementResponse(Record):
44
+ """Response for collection management operations"""
45
+ success = String() # "true" or "false"
46
+ error = Error() # Only populated if success is "false"
47
+ timestamp = String() # ISO timestamp
48
+ collections = Array(CollectionMetadata())
49
+
50
+
51
+ ############################################################################
52
+
53
+ # Topics
54
+
55
+ collection_request_queue = topic(
56
+ 'collection', kind='non-persistent', namespace='request'
57
+ )
58
+ collection_response_queue = topic(
59
+ 'collection', kind='non-persistent', namespace='response'
60
+ )
@@ -1,4 +1,4 @@
1
- from pulsar.schema import Record, String, Map, Double
1
+ from pulsar.schema import Record, String, Map, Double, Array
2
2
  from ..core.primitives import Error
3
3
 
4
4
  ############################################################################
@@ -6,7 +6,7 @@ from ..core.primitives import Error
6
6
  # Structured data diagnosis services
7
7
 
8
8
  class StructuredDataDiagnosisRequest(Record):
9
- operation = String() # "detect-type", "generate-descriptor", or "diagnose"
9
+ operation = String() # "detect-type", "generate-descriptor", "diagnose", or "schema-selection"
10
10
  sample = String() # Data sample to analyze (text content)
11
11
  type = String() # Data type (csv, json, xml) - optional, required for generate-descriptor
12
12
  schema_name = String() # Target schema name for descriptor generation - optional
@@ -27,4 +27,7 @@ class StructuredDataDiagnosisResponse(Record):
27
27
  # JSON encoded additional metadata (e.g., field count, sample records)
28
28
  metadata = Map(String())
29
29
 
30
+ # Array of matching schema IDs (for schema-selection operation) - optional
31
+ schema_matches = Array(String())
32
+
30
33
  ############################################################################
@@ -0,0 +1,42 @@
1
+ from pulsar.schema import Record, String
2
+
3
+ from ..core.primitives import Error
4
+ from ..core.topic import topic
5
+
6
+ ############################################################################
7
+
8
+ # Storage management operations
9
+
10
+ class StorageManagementRequest(Record):
11
+ """Request for storage management operations sent to store processors"""
12
+ operation = String() # e.g., "delete-collection"
13
+ user = String()
14
+ collection = String()
15
+
16
+ class StorageManagementResponse(Record):
17
+ """Response from storage processors for management operations"""
18
+ error = Error() # Only populated if there's an error, if null success
19
+
20
+ ############################################################################
21
+
22
+ # Storage management topics
23
+
24
+ # Topics for sending collection management requests to different storage types
25
+ vector_storage_management_topic = topic(
26
+ 'vector-storage-management', kind='non-persistent', namespace='request'
27
+ )
28
+
29
+ object_storage_management_topic = topic(
30
+ 'object-storage-management', kind='non-persistent', namespace='request'
31
+ )
32
+
33
+ triples_storage_management_topic = topic(
34
+ 'triples-storage-management', kind='non-persistent', namespace='request'
35
+ )
36
+
37
+ # Topic for receiving responses from storage processors
38
+ storage_management_response_topic = topic(
39
+ 'storage-management', kind='non-persistent', namespace='response'
40
+ )
41
+
42
+ ############################################################################
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: trustgraph-base
3
- Version: 1.4.5
3
+ Version: 1.4.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
  Author-email: "trustgraph.ai" <security@trustgraph.ai>
6
6
  Project-URL: Homepage, https://github.com/trustgraph-ai/trustgraph
@@ -6,6 +6,7 @@ trustgraph/log_level.py
6
6
  trustgraph/rdf.py
7
7
  trustgraph/api/__init__.py
8
8
  trustgraph/api/api.py
9
+ trustgraph/api/collection.py
9
10
  trustgraph/api/config.py
10
11
  trustgraph/api/exceptions.py
11
12
  trustgraph/api/flow.py
@@ -72,6 +73,7 @@ trustgraph/messaging/registry.py
72
73
  trustgraph/messaging/translators/__init__.py
73
74
  trustgraph/messaging/translators/agent.py
74
75
  trustgraph/messaging/translators/base.py
76
+ trustgraph/messaging/translators/collection.py
75
77
  trustgraph/messaging/translators/config.py
76
78
  trustgraph/messaging/translators/diagnosis.py
77
79
  trustgraph/messaging/translators/document_loading.py
@@ -109,6 +111,7 @@ trustgraph/schema/knowledge/rows.py
109
111
  trustgraph/schema/knowledge/structured.py
110
112
  trustgraph/schema/services/__init__.py
111
113
  trustgraph/schema/services/agent.py
114
+ trustgraph/schema/services/collection.py
112
115
  trustgraph/schema/services/config.py
113
116
  trustgraph/schema/services/diagnosis.py
114
117
  trustgraph/schema/services/flow.py
@@ -120,6 +123,7 @@ trustgraph/schema/services/objects_query.py
120
123
  trustgraph/schema/services/prompt.py
121
124
  trustgraph/schema/services/query.py
122
125
  trustgraph/schema/services/retrieval.py
126
+ trustgraph/schema/services/storage.py
123
127
  trustgraph/schema/services/structured_query.py
124
128
  trustgraph_base.egg-info/PKG-INFO
125
129
  trustgraph_base.egg-info/SOURCES.txt
@@ -1 +0,0 @@
1
- __version__ = "1.4.5"