trustgraph-base 2.2.24__tar.gz → 2.2.26__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 (164) hide show
  1. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/PKG-INFO +1 -1
  2. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/base/backend.py +12 -0
  3. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/base/chunking_service.py +2 -2
  4. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/base/pulsar_backend.py +10 -0
  5. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/base/rabbitmq_backend.py +12 -0
  6. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/base/subscriber.py +74 -0
  7. trustgraph_base-2.2.26/trustgraph/base_version.py +1 -0
  8. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/messaging/translators/document_loading.py +1 -1
  9. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/messaging/translators/knowledge.py +1 -1
  10. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph_base.egg-info/PKG-INFO +1 -1
  11. trustgraph_base-2.2.24/trustgraph/base_version.py +0 -1
  12. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/README.md +0 -0
  13. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/pyproject.toml +0 -0
  14. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/setup.cfg +0 -0
  15. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/api/__init__.py +0 -0
  16. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/api/api.py +0 -0
  17. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/api/async_bulk_client.py +0 -0
  18. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/api/async_flow.py +0 -0
  19. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/api/async_metrics.py +0 -0
  20. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/api/async_socket_client.py +0 -0
  21. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/api/bulk_client.py +0 -0
  22. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/api/collection.py +0 -0
  23. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/api/config.py +0 -0
  24. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/api/exceptions.py +0 -0
  25. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/api/explainability.py +0 -0
  26. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/api/flow.py +0 -0
  27. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/api/knowledge.py +0 -0
  28. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/api/library.py +0 -0
  29. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/api/metrics.py +0 -0
  30. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/api/socket_client.py +0 -0
  31. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/api/types.py +0 -0
  32. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/base/__init__.py +0 -0
  33. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/base/agent_client.py +0 -0
  34. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/base/agent_service.py +0 -0
  35. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/base/async_processor.py +0 -0
  36. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/base/cassandra_config.py +0 -0
  37. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/base/collection_config_handler.py +0 -0
  38. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/base/consumer.py +0 -0
  39. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/base/consumer_spec.py +0 -0
  40. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/base/document_embeddings_client.py +0 -0
  41. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/base/document_embeddings_query_service.py +0 -0
  42. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/base/document_embeddings_store_service.py +0 -0
  43. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/base/dynamic_tool_service.py +0 -0
  44. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/base/embeddings_client.py +0 -0
  45. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/base/embeddings_service.py +0 -0
  46. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/base/flow.py +0 -0
  47. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/base/flow_processor.py +0 -0
  48. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/base/graph_embeddings_client.py +0 -0
  49. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/base/graph_embeddings_query_service.py +0 -0
  50. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/base/graph_embeddings_store_service.py +0 -0
  51. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/base/graph_rag_client.py +0 -0
  52. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/base/librarian_client.py +0 -0
  53. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/base/llm_service.py +0 -0
  54. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/base/logging.py +0 -0
  55. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/base/metrics.py +0 -0
  56. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/base/parameter_spec.py +0 -0
  57. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/base/producer.py +0 -0
  58. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/base/producer_spec.py +0 -0
  59. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/base/prompt_client.py +0 -0
  60. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/base/publisher.py +0 -0
  61. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/base/pubsub.py +0 -0
  62. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/base/request_response_spec.py +0 -0
  63. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/base/row_embeddings_query_client.py +0 -0
  64. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/base/serialization.py +0 -0
  65. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/base/spec.py +0 -0
  66. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/base/structured_query_client.py +0 -0
  67. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/base/subscriber_spec.py +0 -0
  68. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/base/text_completion_client.py +0 -0
  69. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/base/tool_client.py +0 -0
  70. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/base/tool_service.py +0 -0
  71. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/base/tool_service_client.py +0 -0
  72. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/base/triples_client.py +0 -0
  73. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/base/triples_query_service.py +0 -0
  74. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/base/triples_store_service.py +0 -0
  75. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/clients/__init__.py +0 -0
  76. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/clients/agent_client.py +0 -0
  77. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/clients/base.py +0 -0
  78. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/clients/config_client.py +0 -0
  79. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/clients/document_embeddings_client.py +0 -0
  80. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/clients/document_rag_client.py +0 -0
  81. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/clients/embeddings_client.py +0 -0
  82. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/clients/graph_embeddings_client.py +0 -0
  83. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/clients/graph_rag_client.py +0 -0
  84. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/clients/llm_client.py +0 -0
  85. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/clients/prompt_client.py +0 -0
  86. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/clients/row_embeddings_client.py +0 -0
  87. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/clients/triples_query_client.py +0 -0
  88. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/exceptions.py +0 -0
  89. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/knowledge/__init__.py +0 -0
  90. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/knowledge/defs.py +0 -0
  91. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/knowledge/document.py +0 -0
  92. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/knowledge/identifier.py +0 -0
  93. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/knowledge/organization.py +0 -0
  94. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/knowledge/publication.py +0 -0
  95. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/log_level.py +0 -0
  96. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/messaging/__init__.py +0 -0
  97. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/messaging/registry.py +0 -0
  98. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/messaging/translators/__init__.py +0 -0
  99. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/messaging/translators/agent.py +0 -0
  100. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/messaging/translators/base.py +0 -0
  101. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/messaging/translators/collection.py +0 -0
  102. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/messaging/translators/config.py +0 -0
  103. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/messaging/translators/diagnosis.py +0 -0
  104. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/messaging/translators/embeddings.py +0 -0
  105. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/messaging/translators/embeddings_query.py +0 -0
  106. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/messaging/translators/flow.py +0 -0
  107. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/messaging/translators/library.py +0 -0
  108. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/messaging/translators/metadata.py +0 -0
  109. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/messaging/translators/nlp_query.py +0 -0
  110. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/messaging/translators/primitives.py +0 -0
  111. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/messaging/translators/prompt.py +0 -0
  112. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/messaging/translators/retrieval.py +0 -0
  113. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/messaging/translators/rows_query.py +0 -0
  114. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/messaging/translators/sparql_query.py +0 -0
  115. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/messaging/translators/structured_query.py +0 -0
  116. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/messaging/translators/text_completion.py +0 -0
  117. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/messaging/translators/tool.py +0 -0
  118. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/messaging/translators/triples.py +0 -0
  119. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/objects/__init__.py +0 -0
  120. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/objects/field.py +0 -0
  121. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/objects/object.py +0 -0
  122. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/provenance/__init__.py +0 -0
  123. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/provenance/agent.py +0 -0
  124. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/provenance/namespaces.py +0 -0
  125. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/provenance/triples.py +0 -0
  126. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/provenance/uris.py +0 -0
  127. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/provenance/vocabulary.py +0 -0
  128. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/rdf.py +0 -0
  129. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/schema/__init__.py +0 -0
  130. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/schema/core/__init__.py +0 -0
  131. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/schema/core/metadata.py +0 -0
  132. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/schema/core/primitives.py +0 -0
  133. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/schema/core/topic.py +0 -0
  134. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/schema/knowledge/__init__.py +0 -0
  135. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/schema/knowledge/document.py +0 -0
  136. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/schema/knowledge/embeddings.py +0 -0
  137. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/schema/knowledge/graph.py +0 -0
  138. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/schema/knowledge/knowledge.py +0 -0
  139. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/schema/knowledge/nlp.py +0 -0
  140. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/schema/knowledge/object.py +0 -0
  141. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/schema/knowledge/rows.py +0 -0
  142. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/schema/knowledge/structured.py +0 -0
  143. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/schema/services/__init__.py +0 -0
  144. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/schema/services/agent.py +0 -0
  145. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/schema/services/collection.py +0 -0
  146. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/schema/services/config.py +0 -0
  147. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/schema/services/diagnosis.py +0 -0
  148. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/schema/services/flow.py +0 -0
  149. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/schema/services/library.py +0 -0
  150. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/schema/services/llm.py +0 -0
  151. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/schema/services/lookup.py +0 -0
  152. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/schema/services/nlp_query.py +0 -0
  153. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/schema/services/prompt.py +0 -0
  154. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/schema/services/query.py +0 -0
  155. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/schema/services/retrieval.py +0 -0
  156. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/schema/services/rows_query.py +0 -0
  157. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/schema/services/sparql_query.py +0 -0
  158. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/schema/services/storage.py +0 -0
  159. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/schema/services/structured_query.py +0 -0
  160. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph/schema/services/tool_service.py +0 -0
  161. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph_base.egg-info/SOURCES.txt +0 -0
  162. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph_base.egg-info/dependency_links.txt +0 -0
  163. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/trustgraph_base.egg-info/requires.txt +0 -0
  164. {trustgraph_base-2.2.24 → trustgraph_base-2.2.26}/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: 2.2.24
3
+ Version: 2.2.26
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
@@ -58,6 +58,18 @@ class BackendProducer(Protocol):
58
58
  class BackendConsumer(Protocol):
59
59
  """Protocol for backend-specific consumer."""
60
60
 
61
+ def ensure_connected(self) -> None:
62
+ """
63
+ Eagerly establish the underlying connection and bind the queue.
64
+
65
+ Backends that lazily connect on first receive() must implement this
66
+ so that callers can guarantee the consumer is fully bound — and
67
+ therefore able to receive responses — before any related request is
68
+ published. Backends that connect at construction time may make this
69
+ a no-op.
70
+ """
71
+ ...
72
+
61
73
  def receive(self, timeout_millis: int = 2000) -> Message:
62
74
  """
63
75
  Receive a message from the topic.
@@ -88,14 +88,14 @@ class ChunkingService(FlowProcessor):
88
88
  chunk_overlap = default_chunk_overlap
89
89
 
90
90
  try:
91
- cs = flow.parameters.get("chunk-size")
91
+ cs = flow("chunk-size")
92
92
  if cs is not None:
93
93
  chunk_size = int(cs)
94
94
  except Exception as e:
95
95
  logger.warning(f"Could not parse chunk-size parameter: {e}")
96
96
 
97
97
  try:
98
- co = flow.parameters.get("chunk-overlap")
98
+ co = flow("chunk-overlap")
99
99
  if co is not None:
100
100
  chunk_overlap = int(co)
101
101
  except Exception as e:
@@ -72,6 +72,16 @@ class PulsarBackendConsumer:
72
72
  self._consumer = pulsar_consumer
73
73
  self._schema_cls = schema_cls
74
74
 
75
+ def ensure_connected(self) -> None:
76
+ """No-op for Pulsar.
77
+
78
+ PulsarBackend.create_consumer() calls client.subscribe() which is
79
+ synchronous and returns a fully-subscribed consumer, so the
80
+ consumer is already ready by the time this object is constructed.
81
+ Defined for parity with the BackendConsumer protocol used by
82
+ Subscriber.start()'s readiness barrier."""
83
+ pass
84
+
75
85
  def receive(self, timeout_millis: int = 2000) -> Message:
76
86
  """Receive a message. Raises TimeoutError if no message available."""
77
87
  try:
@@ -214,6 +214,18 @@ class RabbitMQBackendConsumer:
214
214
  and self._channel.is_open
215
215
  )
216
216
 
217
+ def ensure_connected(self) -> None:
218
+ """Eagerly declare and bind the queue.
219
+
220
+ Without this, the queue is only declared lazily on the first
221
+ receive() call. For request/response with ephemeral per-subscriber
222
+ response queues that is a race: a request published before the
223
+ response queue is bound will have its reply silently dropped by
224
+ the broker. Subscriber.start() calls this so callers get a hard
225
+ readiness barrier."""
226
+ if not self._is_alive():
227
+ self._connect()
228
+
217
229
  def receive(self, timeout_millis: int = 2000) -> Message:
218
230
  """Receive a message. Raises TimeoutError if none available."""
219
231
  if not self._is_alive():
@@ -41,14 +41,55 @@ class Subscriber:
41
41
  self.consumer = None
42
42
  self.executor = None
43
43
 
44
+ # Readiness barrier — completed by run() once the underlying
45
+ # backend consumer is fully connected and bound. start() awaits
46
+ # this so callers know any subsequently published request will
47
+ # have a queue ready to receive its response. Without this,
48
+ # ephemeral per-subscriber response queues (RabbitMQ auto-delete
49
+ # exclusive queues) would race the request and lose the reply.
50
+ # A Future is used (rather than an Event) so that a first-attempt
51
+ # connection failure can be propagated to start() as an exception.
52
+ self._ready = None # created in start() so we have a running loop
53
+
44
54
  def __del__(self):
45
55
 
46
56
  self.running = False
47
57
 
48
58
  async def start(self):
49
59
 
60
+ self._ready = asyncio.get_event_loop().create_future()
50
61
  self.task = asyncio.create_task(self.run())
51
62
 
63
+ # Block until run() signals readiness OR exits. The future
64
+ # carries the outcome of the first connect attempt: a value on
65
+ # success, an exception on first-attempt failure. If run() exits
66
+ # without ever signalling (e.g. cancelled, or a code path bug),
67
+ # we surface that as a clear RuntimeError rather than hanging
68
+ # forever waiting on the future.
69
+ ready_wait = asyncio.ensure_future(
70
+ asyncio.shield(self._ready)
71
+ )
72
+ try:
73
+ await asyncio.wait(
74
+ {self.task, ready_wait},
75
+ return_when=asyncio.FIRST_COMPLETED,
76
+ )
77
+ finally:
78
+ ready_wait.cancel()
79
+
80
+ if self._ready.done():
81
+ # Re-raise first-attempt connect failure if any.
82
+ self._ready.result()
83
+ return
84
+
85
+ # run() exited before _ready was settled. Propagate its exception
86
+ # if it had one, otherwise raise a generic readiness error.
87
+ if self.task.done() and self.task.exception() is not None:
88
+ raise self.task.exception()
89
+ raise RuntimeError(
90
+ "Subscriber.run() exited before signalling readiness"
91
+ )
92
+
52
93
  async def stop(self):
53
94
  """Initiate graceful shutdown with draining"""
54
95
  self.running = False
@@ -66,6 +107,7 @@ class Subscriber:
66
107
 
67
108
  async def run(self):
68
109
  """Enhanced run method with integrated draining logic"""
110
+ first_attempt = True
69
111
  while self.running or self.draining:
70
112
 
71
113
  if self.metrics:
@@ -87,10 +129,27 @@ class Subscriber:
87
129
  ),
88
130
  )
89
131
 
132
+ # Eagerly bind the queue. For backends that connect
133
+ # lazily on first receive (RabbitMQ), this is what
134
+ # closes the request/response setup race — without
135
+ # it the response queue is not bound until later and
136
+ # any reply published in the meantime is dropped.
137
+ await loop.run_in_executor(
138
+ self.executor,
139
+ lambda: self.consumer.ensure_connected(),
140
+ )
141
+
90
142
  if self.metrics:
91
143
  self.metrics.state("running")
92
144
 
93
145
  logger.info("Subscriber running...")
146
+
147
+ # Signal start() that the consumer is ready. This must
148
+ # happen AFTER ensure_connected() above so callers can
149
+ # safely publish requests immediately after start() returns.
150
+ if first_attempt and not self._ready.done():
151
+ self._ready.set_result(None)
152
+ first_attempt = False
94
153
  drain_end_time = None
95
154
 
96
155
  while self.running or self.draining:
@@ -162,6 +221,16 @@ class Subscriber:
162
221
  except Exception as e:
163
222
  logger.error(f"Subscriber exception: {e}", exc_info=True)
164
223
 
224
+ # First-attempt connection failure: propagate to start()
225
+ # so the caller can decide what to do (retry, give up).
226
+ # Subsequent failures use the existing retry-with-backoff
227
+ # path so a long-lived subscriber survives broker blips.
228
+ if first_attempt and not self._ready.done():
229
+ self._ready.set_exception(e)
230
+ first_attempt = False
231
+ # Falls through into finally for cleanup, then the
232
+ # outer return below ends run() so start() unblocks.
233
+
165
234
  finally:
166
235
  # Negative acknowledge any pending messages
167
236
  for msg in self.pending_acks.values():
@@ -193,6 +262,11 @@ class Subscriber:
193
262
  if not self.running and not self.draining:
194
263
  return
195
264
 
265
+ # If start() has already returned with an exception there is
266
+ # nothing more to do — exit run() rather than busy-retry.
267
+ if self._ready.done() and self._ready.exception() is not None:
268
+ return
269
+
196
270
  # Sleep before retry
197
271
  await asyncio.sleep(1)
198
272
 
@@ -0,0 +1 @@
1
+ __version__ = "2.2.26"
@@ -151,7 +151,7 @@ class DocumentEmbeddingsTranslator(SendTranslator):
151
151
  chunks = [
152
152
  ChunkEmbeddings(
153
153
  chunk_id=chunk["chunk_id"],
154
- vectors=chunk["vectors"]
154
+ vector=chunk["vector"]
155
155
  )
156
156
  for chunk in data.get("chunks", [])
157
157
  ]
@@ -39,7 +39,7 @@ class KnowledgeRequestTranslator(MessageTranslator):
39
39
  entities=[
40
40
  EntityEmbeddings(
41
41
  entity=self.value_translator.decode(ent["entity"]),
42
- vectors=ent["vectors"],
42
+ vector=ent["vector"],
43
43
  )
44
44
  for ent in data["graph-embeddings"]["entities"]
45
45
  ]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: trustgraph-base
3
- Version: 2.2.24
3
+ Version: 2.2.26
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
@@ -1 +0,0 @@
1
- __version__ = "2.2.24"