trustgraph-base 1.4.6__tar.gz → 1.4.8__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.6 → trustgraph_base-1.4.8}/PKG-INFO +1 -1
  2. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/api/api.py +4 -0
  3. trustgraph_base-1.4.8/trustgraph/api/collection.py +98 -0
  4. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/api/types.py +10 -0
  5. trustgraph_base-1.4.8/trustgraph/base_version.py +1 -0
  6. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/messaging/__init__.py +7 -0
  7. trustgraph_base-1.4.8/trustgraph/messaging/translators/collection.py +114 -0
  8. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/schema/services/__init__.py +3 -1
  9. trustgraph_base-1.4.8/trustgraph/schema/services/collection.py +59 -0
  10. trustgraph_base-1.4.8/trustgraph/schema/services/storage.py +42 -0
  11. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph_base.egg-info/PKG-INFO +1 -1
  12. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph_base.egg-info/SOURCES.txt +4 -0
  13. trustgraph_base-1.4.6/trustgraph/base_version.py +0 -1
  14. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/README.md +0 -0
  15. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/pyproject.toml +0 -0
  16. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/setup.cfg +0 -0
  17. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/api/__init__.py +0 -0
  18. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/api/config.py +0 -0
  19. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/api/exceptions.py +0 -0
  20. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/api/flow.py +0 -0
  21. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/api/knowledge.py +0 -0
  22. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/api/library.py +0 -0
  23. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/base/__init__.py +0 -0
  24. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/base/agent_client.py +0 -0
  25. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/base/agent_service.py +0 -0
  26. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/base/async_processor.py +0 -0
  27. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/base/cassandra_config.py +0 -0
  28. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/base/consumer.py +0 -0
  29. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/base/consumer_spec.py +0 -0
  30. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/base/document_embeddings_client.py +0 -0
  31. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/base/document_embeddings_query_service.py +0 -0
  32. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/base/document_embeddings_store_service.py +0 -0
  33. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/base/embeddings_client.py +0 -0
  34. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/base/embeddings_service.py +0 -0
  35. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/base/flow.py +0 -0
  36. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/base/flow_processor.py +0 -0
  37. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/base/graph_embeddings_client.py +0 -0
  38. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/base/graph_embeddings_query_service.py +0 -0
  39. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/base/graph_embeddings_store_service.py +0 -0
  40. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/base/graph_rag_client.py +0 -0
  41. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/base/llm_service.py +0 -0
  42. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/base/metrics.py +0 -0
  43. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/base/producer.py +0 -0
  44. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/base/producer_spec.py +0 -0
  45. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/base/prompt_client.py +0 -0
  46. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/base/publisher.py +0 -0
  47. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/base/pubsub.py +0 -0
  48. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/base/request_response_spec.py +0 -0
  49. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/base/setting_spec.py +0 -0
  50. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/base/spec.py +0 -0
  51. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/base/structured_query_client.py +0 -0
  52. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/base/subscriber.py +0 -0
  53. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/base/subscriber_spec.py +0 -0
  54. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/base/text_completion_client.py +0 -0
  55. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/base/tool_client.py +0 -0
  56. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/base/tool_service.py +0 -0
  57. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/base/triples_client.py +0 -0
  58. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/base/triples_query_service.py +0 -0
  59. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/base/triples_store_service.py +0 -0
  60. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/clients/__init__.py +0 -0
  61. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/clients/agent_client.py +0 -0
  62. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/clients/base.py +0 -0
  63. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/clients/config_client.py +0 -0
  64. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/clients/document_embeddings_client.py +0 -0
  65. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/clients/document_rag_client.py +0 -0
  66. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/clients/embeddings_client.py +0 -0
  67. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/clients/graph_embeddings_client.py +0 -0
  68. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/clients/graph_rag_client.py +0 -0
  69. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/clients/llm_client.py +0 -0
  70. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/clients/prompt_client.py +0 -0
  71. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/clients/triples_query_client.py +0 -0
  72. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/exceptions.py +0 -0
  73. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/knowledge/__init__.py +0 -0
  74. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/knowledge/defs.py +0 -0
  75. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/knowledge/document.py +0 -0
  76. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/knowledge/identifier.py +0 -0
  77. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/knowledge/organization.py +0 -0
  78. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/knowledge/publication.py +0 -0
  79. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/log_level.py +0 -0
  80. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/messaging/registry.py +0 -0
  81. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/messaging/translators/__init__.py +0 -0
  82. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/messaging/translators/agent.py +0 -0
  83. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/messaging/translators/base.py +0 -0
  84. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/messaging/translators/config.py +0 -0
  85. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/messaging/translators/diagnosis.py +0 -0
  86. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/messaging/translators/document_loading.py +0 -0
  87. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/messaging/translators/embeddings.py +0 -0
  88. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/messaging/translators/embeddings_query.py +0 -0
  89. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/messaging/translators/flow.py +0 -0
  90. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/messaging/translators/knowledge.py +0 -0
  91. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/messaging/translators/library.py +0 -0
  92. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/messaging/translators/metadata.py +0 -0
  93. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/messaging/translators/nlp_query.py +0 -0
  94. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/messaging/translators/objects_query.py +0 -0
  95. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/messaging/translators/primitives.py +0 -0
  96. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/messaging/translators/prompt.py +0 -0
  97. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/messaging/translators/retrieval.py +0 -0
  98. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/messaging/translators/structured_query.py +0 -0
  99. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/messaging/translators/text_completion.py +0 -0
  100. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/messaging/translators/tool.py +0 -0
  101. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/messaging/translators/triples.py +0 -0
  102. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/objects/__init__.py +0 -0
  103. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/objects/field.py +0 -0
  104. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/objects/object.py +0 -0
  105. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/rdf.py +0 -0
  106. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/schema/__init__.py +0 -0
  107. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/schema/core/__init__.py +0 -0
  108. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/schema/core/metadata.py +0 -0
  109. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/schema/core/primitives.py +0 -0
  110. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/schema/core/topic.py +0 -0
  111. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/schema/knowledge/__init__.py +0 -0
  112. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/schema/knowledge/document.py +0 -0
  113. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/schema/knowledge/embeddings.py +0 -0
  114. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/schema/knowledge/graph.py +0 -0
  115. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/schema/knowledge/knowledge.py +0 -0
  116. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/schema/knowledge/nlp.py +0 -0
  117. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/schema/knowledge/object.py +0 -0
  118. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/schema/knowledge/rows.py +0 -0
  119. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/schema/knowledge/structured.py +0 -0
  120. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/schema/services/agent.py +0 -0
  121. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/schema/services/config.py +0 -0
  122. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/schema/services/diagnosis.py +0 -0
  123. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/schema/services/flow.py +0 -0
  124. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/schema/services/library.py +0 -0
  125. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/schema/services/llm.py +0 -0
  126. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/schema/services/lookup.py +0 -0
  127. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/schema/services/nlp_query.py +0 -0
  128. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/schema/services/objects_query.py +0 -0
  129. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/schema/services/prompt.py +0 -0
  130. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/schema/services/query.py +0 -0
  131. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/schema/services/retrieval.py +0 -0
  132. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph/schema/services/structured_query.py +0 -0
  133. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph_base.egg-info/dependency_links.txt +0 -0
  134. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/trustgraph_base.egg-info/requires.txt +0 -0
  135. {trustgraph_base-1.4.6 → trustgraph_base-1.4.8}/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.6
3
+ Version: 1.4.8
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,98 @@
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
+ # Handle case where collections might be None or missing
31
+ if object is None or "collections" not in object:
32
+ return []
33
+
34
+ collections = object.get("collections", [])
35
+ if collections is None:
36
+ return []
37
+
38
+ return [
39
+ CollectionMetadata(
40
+ user = v["user"],
41
+ collection = v["collection"],
42
+ name = v["name"],
43
+ description = v["description"],
44
+ tags = v["tags"],
45
+ created_at = v["created_at"],
46
+ updated_at = v["updated_at"]
47
+ )
48
+ for v in collections
49
+ ]
50
+ except Exception as e:
51
+ logger.error("Failed to parse collection list response", exc_info=True)
52
+ raise ProtocolException(f"Response not formatted correctly")
53
+
54
+ def update_collection(self, user, collection, name=None, description=None, tags=None):
55
+
56
+ input = {
57
+ "operation": "update-collection",
58
+ "user": user,
59
+ "collection": collection,
60
+ }
61
+
62
+ if name is not None:
63
+ input["name"] = name
64
+ if description is not None:
65
+ input["description"] = description
66
+ if tags is not None:
67
+ input["tags"] = tags
68
+
69
+ object = self.request(input)
70
+
71
+ try:
72
+ if "collections" in object and object["collections"]:
73
+ v = object["collections"][0]
74
+ return CollectionMetadata(
75
+ user = v["user"],
76
+ collection = v["collection"],
77
+ name = v["name"],
78
+ description = v["description"],
79
+ tags = v["tags"],
80
+ created_at = v["created_at"],
81
+ updated_at = v["updated_at"]
82
+ )
83
+ return None
84
+ except Exception as e:
85
+ logger.error("Failed to parse collection update response", exc_info=True)
86
+ raise ProtocolException(f"Response not formatted correctly")
87
+
88
+ def delete_collection(self, user, collection):
89
+
90
+ input = {
91
+ "operation": "delete-collection",
92
+ "user": user,
93
+ "collection": collection,
94
+ }
95
+
96
+ object = self.request(input)
97
+
98
+ return {}
@@ -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.8"
@@ -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,114 @@
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")
22
+ )
23
+
24
+ def from_pulsar(self, obj: CollectionManagementRequest) -> Dict[str, Any]:
25
+ result = {}
26
+
27
+ if obj.operation is not None:
28
+ result["operation"] = obj.operation
29
+ if obj.user is not None:
30
+ result["user"] = obj.user
31
+ if obj.collection is not None:
32
+ result["collection"] = obj.collection
33
+ if obj.timestamp is not None:
34
+ result["timestamp"] = obj.timestamp
35
+ if obj.name is not None:
36
+ result["name"] = obj.name
37
+ if obj.description is not None:
38
+ result["description"] = obj.description
39
+ if obj.tags is not None:
40
+ result["tags"] = list(obj.tags)
41
+ if obj.created_at is not None:
42
+ result["created_at"] = obj.created_at
43
+ if obj.updated_at is not None:
44
+ result["updated_at"] = obj.updated_at
45
+ if obj.tag_filter is not None:
46
+ result["tag_filter"] = list(obj.tag_filter)
47
+ if obj.limit is not None:
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
+
58
+ # Handle error
59
+ error = None
60
+ if "error" in data and data["error"]:
61
+ error_data = data["error"]
62
+ error = Error(
63
+ type=error_data.get("type"),
64
+ message=error_data.get("message")
65
+ )
66
+
67
+ # Handle collections array
68
+ collections = []
69
+ if "collections" in data:
70
+ for coll_data in data["collections"]:
71
+ collections.append(CollectionMetadata(
72
+ user=coll_data.get("user"),
73
+ collection=coll_data.get("collection"),
74
+ name=coll_data.get("name"),
75
+ description=coll_data.get("description"),
76
+ tags=coll_data.get("tags"),
77
+ created_at=coll_data.get("created_at"),
78
+ updated_at=coll_data.get("updated_at")
79
+ ))
80
+
81
+ return CollectionManagementResponse(
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
+ print("COLLECTIONMGMT", obj, flush=True)
91
+
92
+ if obj.error is not None:
93
+ result["error"] = {
94
+ "type": obj.error.type,
95
+ "message": obj.error.message
96
+ }
97
+ if obj.timestamp is not None:
98
+ result["timestamp"] = obj.timestamp
99
+ if obj.collections is not None:
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
+ print("RESULT IS", result, flush=True)
113
+
114
+ return result
@@ -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,59 @@
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
+ error = Error() # Only populated if there's an error
46
+ timestamp = String() # ISO timestamp
47
+ collections = Array(CollectionMetadata())
48
+
49
+
50
+ ############################################################################
51
+
52
+ # Topics
53
+
54
+ collection_request_queue = topic(
55
+ 'collection', kind='non-persistent', namespace='request'
56
+ )
57
+ collection_response_queue = topic(
58
+ 'collection', kind='non-persistent', namespace='response'
59
+ )
@@ -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.6
3
+ Version: 1.4.8
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.6"