trustgraph-base 2.11.4__tar.gz → 2.11.6__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 (180) hide show
  1. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/PKG-INFO +1 -1
  2. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/api/flow.py +123 -0
  3. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/api/socket_client.py +47 -0
  4. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/base/serialization.py +7 -1
  5. trustgraph_base-2.11.6/trustgraph/base_version.py +1 -0
  6. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/messaging/__init__.py +21 -0
  7. trustgraph_base-2.11.6/trustgraph/messaging/translators/nl_sparql.py +57 -0
  8. trustgraph_base-2.11.6/trustgraph/messaging/translators/ontology.py +70 -0
  9. trustgraph_base-2.11.6/trustgraph/messaging/translators/sparql_nl_query.py +61 -0
  10. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/schema/__init__.py +2 -0
  11. trustgraph_base-2.11.6/trustgraph/schema/nl_sparql.py +64 -0
  12. trustgraph_base-2.11.6/trustgraph/schema/ontology.py +50 -0
  13. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph_base.egg-info/PKG-INFO +1 -1
  14. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph_base.egg-info/SOURCES.txt +5 -0
  15. trustgraph_base-2.11.4/trustgraph/base_version.py +0 -1
  16. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/README.md +0 -0
  17. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/pyproject.toml +0 -0
  18. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/setup.cfg +0 -0
  19. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/api/__init__.py +0 -0
  20. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/api/api.py +0 -0
  21. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/api/async_bulk_client.py +0 -0
  22. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/api/async_flow.py +0 -0
  23. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/api/async_metrics.py +0 -0
  24. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/api/async_socket_client.py +0 -0
  25. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/api/bulk_client.py +0 -0
  26. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/api/collection.py +0 -0
  27. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/api/config.py +0 -0
  28. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/api/exceptions.py +0 -0
  29. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/api/explainability.py +0 -0
  30. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/api/knowledge.py +0 -0
  31. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/api/library.py +0 -0
  32. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/api/metrics.py +0 -0
  33. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/api/types.py +0 -0
  34. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/base/__init__.py +0 -0
  35. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/base/agent_client.py +0 -0
  36. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/base/agent_service.py +0 -0
  37. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/base/async_backend.py +0 -0
  38. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/base/async_config_client.py +0 -0
  39. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/base/async_kafka_backend.py +0 -0
  40. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/base/async_librarian_client.py +0 -0
  41. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/base/async_processor.py +0 -0
  42. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/base/async_pulsar_backend.py +0 -0
  43. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/base/async_rabbitmq_backend.py +0 -0
  44. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/base/async_rr_wrapper.py +0 -0
  45. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/base/audit_publisher.py +0 -0
  46. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/base/backend.py +0 -0
  47. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/base/cassandra_config.py +0 -0
  48. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/base/chunking_service.py +0 -0
  49. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/base/collection_config_handler.py +0 -0
  50. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/base/config_client.py +0 -0
  51. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/base/consumer_spec.py +0 -0
  52. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/base/document_embeddings_client.py +0 -0
  53. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/base/document_embeddings_query_service.py +0 -0
  54. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/base/document_embeddings_store_service.py +0 -0
  55. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/base/dynamic_tool_service.py +0 -0
  56. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/base/embeddings_client.py +0 -0
  57. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/base/embeddings_service.py +0 -0
  58. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/base/flow.py +0 -0
  59. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/base/flow_processor.py +0 -0
  60. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/base/graph_embeddings_client.py +0 -0
  61. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/base/graph_embeddings_query_service.py +0 -0
  62. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/base/graph_embeddings_store_service.py +0 -0
  63. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/base/graph_rag_client.py +0 -0
  64. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/base/iam_client.py +0 -0
  65. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/base/image_to_text_service.py +0 -0
  66. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/base/keyword_index_client.py +0 -0
  67. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/base/keyword_index_service.py +0 -0
  68. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/base/librarian_spec.py +0 -0
  69. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/base/llm_service.py +0 -0
  70. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/base/logging.py +0 -0
  71. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/base/metrics.py +0 -0
  72. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/base/parameter_spec.py +0 -0
  73. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/base/policy_event_publisher.py +0 -0
  74. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/base/processor_group.py +0 -0
  75. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/base/producer_spec.py +0 -0
  76. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/base/prompt_client.py +0 -0
  77. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/base/pubsub.py +0 -0
  78. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/base/qdrant_config.py +0 -0
  79. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/base/receiver_pool.py +0 -0
  80. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/base/request_response_client.py +0 -0
  81. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/base/request_response_spec.py +0 -0
  82. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/base/reranker_client.py +0 -0
  83. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/base/reranker_service.py +0 -0
  84. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/base/row_embeddings_query_client.py +0 -0
  85. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/base/schema_compatibility.py +0 -0
  86. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/base/sender_pool.py +0 -0
  87. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/base/sparql_client.py +0 -0
  88. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/base/spec.py +0 -0
  89. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/base/structured_query_client.py +0 -0
  90. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/base/text_completion_client.py +0 -0
  91. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/base/tool_client.py +0 -0
  92. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/base/tool_service.py +0 -0
  93. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/base/tool_service_client.py +0 -0
  94. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/base/triples_client.py +0 -0
  95. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/base/triples_query_service.py +0 -0
  96. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/base/triples_store_service.py +0 -0
  97. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/base/workspace_processor.py +0 -0
  98. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/exceptions.py +0 -0
  99. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/i18n/__init__.py +0 -0
  100. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/i18n/packs/__init__.py +0 -0
  101. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/i18n/packs/ar.json +0 -0
  102. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/i18n/packs/en.json +0 -0
  103. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/i18n/packs/es.json +0 -0
  104. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/i18n/packs/he.json +0 -0
  105. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/i18n/packs/hi.json +0 -0
  106. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/i18n/packs/pt.json +0 -0
  107. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/i18n/packs/ru.json +0 -0
  108. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/i18n/packs/sw.json +0 -0
  109. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/i18n/packs/tr.json +0 -0
  110. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/i18n/packs/zh-cn.json +0 -0
  111. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/knowledge/__init__.py +0 -0
  112. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/knowledge/defs.py +0 -0
  113. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/knowledge/document.py +0 -0
  114. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/knowledge/identifier.py +0 -0
  115. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/knowledge/organization.py +0 -0
  116. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/knowledge/publication.py +0 -0
  117. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/log_level.py +0 -0
  118. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/messaging/registry.py +0 -0
  119. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/messaging/translators/__init__.py +0 -0
  120. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/messaging/translators/agent.py +0 -0
  121. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/messaging/translators/base.py +0 -0
  122. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/messaging/translators/cloze.py +0 -0
  123. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/messaging/translators/collection.py +0 -0
  124. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/messaging/translators/config.py +0 -0
  125. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/messaging/translators/decision_scoring.py +0 -0
  126. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/messaging/translators/diagnosis.py +0 -0
  127. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/messaging/translators/document_loading.py +0 -0
  128. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/messaging/translators/embeddings.py +0 -0
  129. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/messaging/translators/embeddings_query.py +0 -0
  130. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/messaging/translators/field_extraction.py +0 -0
  131. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/messaging/translators/flow.py +0 -0
  132. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/messaging/translators/iam.py +0 -0
  133. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/messaging/translators/image_to_text.py +0 -0
  134. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/messaging/translators/knowledge.py +0 -0
  135. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/messaging/translators/library.py +0 -0
  136. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/messaging/translators/metadata.py +0 -0
  137. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/messaging/translators/nlp_query.py +0 -0
  138. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/messaging/translators/primitives.py +0 -0
  139. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/messaging/translators/prompt.py +0 -0
  140. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/messaging/translators/reranker.py +0 -0
  141. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/messaging/translators/retrieval.py +0 -0
  142. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/messaging/translators/rows_query.py +0 -0
  143. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/messaging/translators/sparql_query.py +0 -0
  144. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/messaging/translators/structured_query.py +0 -0
  145. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/messaging/translators/text_completion.py +0 -0
  146. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/messaging/translators/tool.py +0 -0
  147. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/messaging/translators/triples.py +0 -0
  148. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/objects/__init__.py +0 -0
  149. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/objects/field.py +0 -0
  150. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/objects/object.py +0 -0
  151. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/provenance/__init__.py +0 -0
  152. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/provenance/agent.py +0 -0
  153. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/provenance/namespaces.py +0 -0
  154. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/provenance/triples.py +0 -0
  155. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/provenance/uris.py +0 -0
  156. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/provenance/vocabulary.py +0 -0
  157. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/rdf.py +0 -0
  158. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/schema/agent.py +0 -0
  159. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/schema/audit.py +0 -0
  160. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/schema/cloze.py +0 -0
  161. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/schema/config.py +0 -0
  162. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/schema/core/__init__.py +0 -0
  163. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/schema/core/metadata.py +0 -0
  164. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/schema/core/primitives.py +0 -0
  165. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/schema/core/topic.py +0 -0
  166. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/schema/decision_scoring.py +0 -0
  167. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/schema/documents.py +0 -0
  168. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/schema/embeddings.py +0 -0
  169. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/schema/field_extraction.py +0 -0
  170. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/schema/iam.py +0 -0
  171. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/schema/llm.py +0 -0
  172. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/schema/policy_event.py +0 -0
  173. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/schema/retrieval.py +0 -0
  174. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/schema/structured.py +0 -0
  175. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/schema/triples.py +0 -0
  176. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph/schema/user_context.py +0 -0
  177. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph_base.egg-info/dependency_links.txt +0 -0
  178. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph_base.egg-info/entry_points.txt +0 -0
  179. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/trustgraph_base.egg-info/requires.txt +0 -0
  180. {trustgraph_base-2.11.4 → trustgraph_base-2.11.6}/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.11.4
3
+ Version: 2.11.6
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
@@ -1577,3 +1577,126 @@ class FlowInstance:
1577
1577
 
1578
1578
  return response
1579
1579
 
1580
+ def ontology_subset(self, text, top_k=10, similarity_threshold=0.3):
1581
+ """
1582
+ Select relevant ontology subset for the given text.
1583
+
1584
+ Args:
1585
+ text: Text to match against ontology elements
1586
+ top_k: Number of top elements to retrieve (default: 10)
1587
+ similarity_threshold: Minimum similarity (default: 0.3)
1588
+
1589
+ Returns:
1590
+ dict with ontology-id, classes, object-properties,
1591
+ datatype-properties, namespace
1592
+ """
1593
+
1594
+ input = {
1595
+ "operation": "subset",
1596
+ "text": text,
1597
+ "top-k": top_k,
1598
+ "similarity-threshold": similarity_threshold,
1599
+ }
1600
+
1601
+ response = self.request(
1602
+ "service/ontology",
1603
+ input
1604
+ )
1605
+
1606
+ if "error" in response and response["error"]:
1607
+ error_type = response["error"].get("type", "unknown")
1608
+ error_message = response["error"].get("message", "Unknown error")
1609
+ raise ProtocolException(f"{error_type}: {error_message}")
1610
+
1611
+ return response
1612
+
1613
+ def ontology_list(self):
1614
+ """
1615
+ List loaded ontologies and their status.
1616
+
1617
+ Returns:
1618
+ list[dict]: List of ontology info dicts with ontology-id,
1619
+ state, classes-total, properties-total, elements-embedded
1620
+ """
1621
+
1622
+ input = {
1623
+ "operation": "list",
1624
+ }
1625
+
1626
+ response = self.request(
1627
+ "service/ontology",
1628
+ input
1629
+ )
1630
+
1631
+ if "error" in response and response["error"]:
1632
+ error_type = response["error"].get("type", "unknown")
1633
+ error_message = response["error"].get("message", "Unknown error")
1634
+ raise ProtocolException(f"{error_type}: {error_message}")
1635
+
1636
+ return response.get("ontologies", [])
1637
+
1638
+ def nl_to_sparql(self, question, collection="default", limit=10):
1639
+ """
1640
+ Translate a natural language question to a SPARQL query.
1641
+
1642
+ Args:
1643
+ question: Natural language question
1644
+ collection: Collection identifier (default: "default")
1645
+ limit: Result limit hint for the generated query (default: 10)
1646
+
1647
+ Returns:
1648
+ dict with sparql, resolved-entities
1649
+ """
1650
+
1651
+ input = {
1652
+ "question": question,
1653
+ "collection": collection,
1654
+ "limit": limit,
1655
+ }
1656
+
1657
+ response = self.request(
1658
+ "service/nl-sparql",
1659
+ input
1660
+ )
1661
+
1662
+ if "error" in response and response["error"]:
1663
+ error_type = response["error"].get("type", "unknown")
1664
+ error_message = response["error"].get("message", "Unknown error")
1665
+ raise ProtocolException(f"{error_type}: {error_message}")
1666
+
1667
+ return response
1668
+
1669
+ def sparql_nl_query(self, question, collection="default", limit=10):
1670
+ """
1671
+ Answer a natural language question via SPARQL.
1672
+
1673
+ Chains NL-to-SPARQL translation with SPARQL execution.
1674
+
1675
+ Args:
1676
+ question: Natural language question
1677
+ collection: Collection identifier (default: "default")
1678
+ limit: Result limit hint (default: 10)
1679
+
1680
+ Returns:
1681
+ dict with sparql, resolved-entities, query-type,
1682
+ variables, bindings, ask-result
1683
+ """
1684
+
1685
+ input = {
1686
+ "question": question,
1687
+ "collection": collection,
1688
+ "limit": limit,
1689
+ }
1690
+
1691
+ response = self.request(
1692
+ "service/sparql-nl-query",
1693
+ input
1694
+ )
1695
+
1696
+ if "error" in response and response["error"]:
1697
+ error_type = response["error"].get("type", "unknown")
1698
+ error_message = response["error"].get("message", "Unknown error")
1699
+ raise ProtocolException(f"{error_type}: {error_message}")
1700
+
1701
+ return response
1702
+
@@ -1181,3 +1181,50 @@ class SocketFlowInstance:
1181
1181
  request.update(kwargs)
1182
1182
 
1183
1183
  return self.client._send_request_sync("field-extraction", self.flow_id, request, False)
1184
+
1185
+ def ontology_subset(self, text: str, top_k: int = 10,
1186
+ similarity_threshold: float = 0.3,
1187
+ **kwargs: Any) -> Dict[str, Any]:
1188
+ """Select relevant ontology subset for the given text."""
1189
+ request = {
1190
+ "operation": "subset",
1191
+ "text": text,
1192
+ "top-k": top_k,
1193
+ "similarity-threshold": similarity_threshold,
1194
+ }
1195
+ request.update(kwargs)
1196
+
1197
+ return self.client._send_request_sync("ontology", self.flow_id, request, False)
1198
+
1199
+ def ontology_list(self, **kwargs: Any) -> Dict[str, Any]:
1200
+ """List loaded ontologies and their status."""
1201
+ request = {
1202
+ "operation": "list",
1203
+ }
1204
+ request.update(kwargs)
1205
+
1206
+ return self.client._send_request_sync("ontology", self.flow_id, request, False)
1207
+
1208
+ def nl_to_sparql(self, question: str, collection: str = "default",
1209
+ limit: int = 10, **kwargs: Any) -> Dict[str, Any]:
1210
+ """Translate a natural language question to SPARQL."""
1211
+ request = {
1212
+ "question": question,
1213
+ "collection": collection,
1214
+ "limit": limit,
1215
+ }
1216
+ request.update(kwargs)
1217
+
1218
+ return self.client._send_request_sync("nl-sparql", self.flow_id, request, False)
1219
+
1220
+ def sparql_nl_query(self, question: str, collection: str = "default",
1221
+ limit: int = 10, **kwargs: Any) -> Dict[str, Any]:
1222
+ """Answer a natural language question via SPARQL."""
1223
+ request = {
1224
+ "question": question,
1225
+ "collection": collection,
1226
+ "limit": limit,
1227
+ }
1228
+ request.update(kwargs)
1229
+
1230
+ return self.client._send_request_sync("sparql-nl-query", self.flow_id, request, False)
@@ -83,9 +83,15 @@ def dict_to_dataclass(data: dict, cls: type) -> Any:
83
83
  kwargs[key] = value
84
84
  # Check if this is a generic type (list, dict, etc.)
85
85
  elif hasattr(field_type, '__origin__'):
86
- # Handle list[T]
86
+ # Handle list[T] and list[T | None]
87
87
  if field_type.__origin__ == list:
88
88
  item_type = field_type.__args__[0] if field_type.__args__ else None
89
+ # Unwrap Optional/union item types (e.g. list[Term | None] -> Term)
90
+ if item_type and isinstance(item_type, types.UnionType):
91
+ item_type = next(
92
+ (t for t in item_type.__args__ if t is not type(None)),
93
+ None,
94
+ )
89
95
  if item_type and is_dataclass(item_type) and isinstance(value, list):
90
96
  kwargs[key] = [
91
97
  dict_to_dataclass(item, item_type) if isinstance(item, dict) else item
@@ -0,0 +1 @@
1
+ __version__ = "2.11.6"
@@ -34,6 +34,9 @@ from .translators.decision_scoring import DecisionScoringRequestTranslator, Deci
34
34
  from .translators.field_extraction import FieldExtractionRequestTranslator, FieldExtractionResponseTranslator
35
35
  from .translators.collection import CollectionManagementRequestTranslator, CollectionManagementResponseTranslator
36
36
  from .translators.sparql_query import SparqlQueryRequestTranslator, SparqlQueryResponseTranslator
37
+ from .translators.ontology import OntologyRequestTranslator, OntologyResponseTranslator
38
+ from .translators.nl_sparql import QuestionToSparqlRequestTranslator, QuestionToSparqlResponseTranslator
39
+ from .translators.sparql_nl_query import SparqlNLQueryRequestTranslator, SparqlNLQueryResponseTranslator
37
40
 
38
41
  # Register all service translators
39
42
  TranslatorRegistry.register_service(
@@ -198,6 +201,24 @@ TranslatorRegistry.register_service(
198
201
  FieldExtractionResponseTranslator()
199
202
  )
200
203
 
204
+ TranslatorRegistry.register_service(
205
+ "ontology",
206
+ OntologyRequestTranslator(),
207
+ OntologyResponseTranslator()
208
+ )
209
+
210
+ TranslatorRegistry.register_service(
211
+ "nl-sparql",
212
+ QuestionToSparqlRequestTranslator(),
213
+ QuestionToSparqlResponseTranslator()
214
+ )
215
+
216
+ TranslatorRegistry.register_service(
217
+ "sparql-nl-query",
218
+ SparqlNLQueryRequestTranslator(),
219
+ SparqlNLQueryResponseTranslator()
220
+ )
221
+
201
222
  # Register single-direction translators for document loading
202
223
  TranslatorRegistry.register_request("document", DocumentTranslator())
203
224
  TranslatorRegistry.register_request("text-document", TextDocumentTranslator())
@@ -0,0 +1,57 @@
1
+ from typing import Dict, Any, Tuple
2
+ from ...schema import (
3
+ QuestionToSparqlRequest, QuestionToSparqlResponse, ResolvedEntity,
4
+ )
5
+ from .base import MessageTranslator
6
+
7
+
8
+ class QuestionToSparqlRequestTranslator(MessageTranslator):
9
+
10
+ def decode(self, data: Dict[str, Any]) -> QuestionToSparqlRequest:
11
+ return QuestionToSparqlRequest(
12
+ question=data.get("question", ""),
13
+ collection=data.get("collection", ""),
14
+ limit=int(data.get("limit", 10)),
15
+ )
16
+
17
+ def encode(self, obj: QuestionToSparqlRequest) -> Dict[str, Any]:
18
+ return {
19
+ "question": obj.question,
20
+ "collection": obj.collection,
21
+ "limit": obj.limit,
22
+ }
23
+
24
+
25
+ class QuestionToSparqlResponseTranslator(MessageTranslator):
26
+
27
+ def decode(self, data: Dict[str, Any]) -> QuestionToSparqlResponse:
28
+ raise NotImplementedError(
29
+ "Response translation to internal not typically needed"
30
+ )
31
+
32
+ def encode(self, obj: QuestionToSparqlResponse) -> Dict[str, Any]:
33
+ result = {
34
+ "sparql": obj.sparql,
35
+ "resolved-entities": [
36
+ {
37
+ "mention": e.mention,
38
+ "uri": e.uri,
39
+ "rdf-type": e.rdf_type,
40
+ "score": e.score,
41
+ }
42
+ for e in obj.resolved_entities
43
+ ],
44
+ }
45
+
46
+ if obj.error:
47
+ result["error"] = {
48
+ "type": obj.error.type,
49
+ "message": obj.error.message,
50
+ }
51
+
52
+ return result
53
+
54
+ def encode_with_completion(
55
+ self, obj: QuestionToSparqlResponse
56
+ ) -> Tuple[Dict[str, Any], bool]:
57
+ return self.encode(obj), True
@@ -0,0 +1,70 @@
1
+ from typing import Dict, Any, Tuple
2
+ from ...schema import OntologyRequest, OntologyResponse, OntologyInfo
3
+ from .base import MessageTranslator
4
+
5
+
6
+ class OntologyRequestTranslator(MessageTranslator):
7
+
8
+ def decode(self, data: Dict[str, Any]) -> OntologyRequest:
9
+ return OntologyRequest(
10
+ operation=data.get("operation", ""),
11
+ text=data.get("text", ""),
12
+ top_k=int(data.get("top-k", 10)),
13
+ similarity_threshold=float(
14
+ data.get("similarity-threshold", 0.3)
15
+ ),
16
+ )
17
+
18
+ def encode(self, obj: OntologyRequest) -> Dict[str, Any]:
19
+ return {
20
+ "operation": obj.operation,
21
+ "text": obj.text,
22
+ "top-k": obj.top_k,
23
+ "similarity-threshold": obj.similarity_threshold,
24
+ }
25
+
26
+
27
+ class OntologyResponseTranslator(MessageTranslator):
28
+
29
+ def decode(self, data: Dict[str, Any]) -> OntologyResponse:
30
+ raise NotImplementedError(
31
+ "Response translation to internal not typically needed"
32
+ )
33
+
34
+ def encode(self, obj: OntologyResponse) -> Dict[str, Any]:
35
+ result = {
36
+ "operation": obj.operation,
37
+ }
38
+
39
+ if obj.error:
40
+ result["error"] = {
41
+ "type": obj.error.type,
42
+ "message": obj.error.message,
43
+ }
44
+
45
+ if obj.operation == "subset":
46
+ result["ontology-id"] = obj.ontology_id
47
+ result["classes"] = obj.classes
48
+ result["object-properties"] = obj.object_properties
49
+ result["datatype-properties"] = obj.datatype_properties
50
+ result["namespace"] = obj.namespace
51
+
52
+ elif obj.operation == "list":
53
+ result["ontologies"] = [
54
+ {
55
+ "ontology-id": o.ontology_id,
56
+ "state": o.state,
57
+ "classes-total": o.classes_total,
58
+ "properties-total": o.properties_total,
59
+ "elements-embedded": o.elements_embedded,
60
+ "error-message": o.error_message,
61
+ }
62
+ for o in obj.ontologies
63
+ ]
64
+
65
+ return result
66
+
67
+ def encode_with_completion(
68
+ self, obj: OntologyResponse
69
+ ) -> Tuple[Dict[str, Any], bool]:
70
+ return self.encode(obj), True
@@ -0,0 +1,61 @@
1
+ from typing import Dict, Any, Tuple
2
+ from ...schema import (
3
+ SparqlNLQueryRequest, SparqlNLQueryResponse, ResolvedEntity,
4
+ )
5
+ from .base import MessageTranslator
6
+
7
+
8
+ class SparqlNLQueryRequestTranslator(MessageTranslator):
9
+
10
+ def decode(self, data: Dict[str, Any]) -> SparqlNLQueryRequest:
11
+ return SparqlNLQueryRequest(
12
+ question=data.get("question", ""),
13
+ collection=data.get("collection", ""),
14
+ limit=int(data.get("limit", 10)),
15
+ )
16
+
17
+ def encode(self, obj: SparqlNLQueryRequest) -> Dict[str, Any]:
18
+ return {
19
+ "question": obj.question,
20
+ "collection": obj.collection,
21
+ "limit": obj.limit,
22
+ }
23
+
24
+
25
+ class SparqlNLQueryResponseTranslator(MessageTranslator):
26
+
27
+ def decode(self, data: Dict[str, Any]) -> SparqlNLQueryResponse:
28
+ raise NotImplementedError(
29
+ "Response translation to internal not typically needed"
30
+ )
31
+
32
+ def encode(self, obj: SparqlNLQueryResponse) -> Dict[str, Any]:
33
+ result = {
34
+ "sparql": obj.sparql,
35
+ "resolved-entities": [
36
+ {
37
+ "mention": e.mention,
38
+ "uri": e.uri,
39
+ "rdf-type": e.rdf_type,
40
+ "score": e.score,
41
+ }
42
+ for e in obj.resolved_entities
43
+ ],
44
+ "query-type": obj.query_type,
45
+ "variables": obj.variables,
46
+ "bindings": obj.bindings,
47
+ "ask-result": obj.ask_result,
48
+ }
49
+
50
+ if obj.error:
51
+ result["error"] = {
52
+ "type": obj.error.type,
53
+ "message": obj.error.message,
54
+ }
55
+
56
+ return result
57
+
58
+ def encode_with_completion(
59
+ self, obj: SparqlNLQueryResponse
60
+ ) -> Tuple[Dict[str, Any], bool]:
61
+ return self.encode(obj), True
@@ -18,3 +18,5 @@ from .user_context import *
18
18
  from .cloze import *
19
19
  from .decision_scoring import *
20
20
  from .field_extraction import *
21
+ from .ontology import *
22
+ from .nl_sparql import *
@@ -0,0 +1,64 @@
1
+
2
+ from dataclasses import dataclass, field
3
+
4
+ from .core.primitives import Error
5
+ from .core.topic import queue
6
+
7
+ ############################################################################
8
+
9
+ # NL-to-SPARQL translation service - converts natural language questions
10
+ # to SPARQL queries using ontology context and entity resolution.
11
+
12
+ @dataclass
13
+ class ResolvedEntity:
14
+ mention: str = ""
15
+ uri: str = ""
16
+ rdf_type: str = ""
17
+ score: float = 0.0
18
+
19
+ @dataclass
20
+ class QuestionToSparqlRequest:
21
+ question: str = ""
22
+ collection: str = ""
23
+ limit: int = 10
24
+
25
+ @dataclass
26
+ class QuestionToSparqlResponse:
27
+ error: Error | None = None
28
+ sparql: str = ""
29
+ resolved_entities: list[ResolvedEntity] = field(default_factory=list)
30
+
31
+ ############################################################################
32
+
33
+ # Queue definitions
34
+
35
+ nl_sparql_request_queue = queue('nl-sparql', cls='request')
36
+ nl_sparql_response_queue = queue('nl-sparql', cls='response')
37
+
38
+ ############################################################################
39
+
40
+ # SPARQL NL Query orchestration service - chains NL-to-SPARQL translation
41
+ # with SPARQL execution to answer natural language questions via SPARQL.
42
+
43
+ @dataclass
44
+ class SparqlNLQueryRequest:
45
+ question: str = ""
46
+ collection: str = ""
47
+ limit: int = 10
48
+
49
+ @dataclass
50
+ class SparqlNLQueryResponse:
51
+ error: Error | None = None
52
+ sparql: str = ""
53
+ resolved_entities: list[ResolvedEntity] = field(default_factory=list)
54
+ query_type: str = ""
55
+ variables: list[str] = field(default_factory=list)
56
+ bindings: list[list[str]] = field(default_factory=list)
57
+ ask_result: bool = False
58
+
59
+ ############################################################################
60
+
61
+ # Queue definitions
62
+
63
+ sparql_nl_query_request_queue = queue('sparql-nl-query', cls='request')
64
+ sparql_nl_query_response_queue = queue('sparql-nl-query', cls='response')
@@ -0,0 +1,50 @@
1
+
2
+ from dataclasses import dataclass, field
3
+
4
+ from .core.primitives import Error
5
+ from .core.topic import queue
6
+
7
+ ############################################################################
8
+
9
+ # Ontology service - manages ontology parsing, embedding, and subset
10
+ # selection. Single request/response queue with an operation field.
11
+
12
+ @dataclass
13
+ class OntologyInfo:
14
+ ontology_id: str = ""
15
+ state: str = "" # "loading", "ready", or "error"
16
+ classes_total: int = 0
17
+ properties_total: int = 0
18
+ elements_embedded: int = 0
19
+ error_message: str = ""
20
+
21
+ @dataclass
22
+ class OntologyRequest:
23
+ operation: str = "" # "subset" or "list"
24
+
25
+ # For "subset" operation
26
+ text: str = ""
27
+ top_k: int = 10
28
+ similarity_threshold: float = 0.3
29
+
30
+ @dataclass
31
+ class OntologyResponse:
32
+ error: Error | None = None
33
+ operation: str = ""
34
+
35
+ # For "subset" operation
36
+ ontology_id: str = ""
37
+ classes: dict[str, str] = field(default_factory=dict)
38
+ object_properties: dict[str, str] = field(default_factory=dict)
39
+ datatype_properties: dict[str, str] = field(default_factory=dict)
40
+ namespace: str = ""
41
+
42
+ # For "list" operation
43
+ ontologies: list[OntologyInfo] = field(default_factory=list)
44
+
45
+ ############################################################################
46
+
47
+ # Queue definitions
48
+
49
+ ontology_request_queue = queue('ontology', cls='request')
50
+ ontology_response_queue = queue('ontology', cls='response')
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: trustgraph-base
3
- Version: 2.11.4
3
+ Version: 2.11.6
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
@@ -124,12 +124,15 @@ trustgraph/messaging/translators/image_to_text.py
124
124
  trustgraph/messaging/translators/knowledge.py
125
125
  trustgraph/messaging/translators/library.py
126
126
  trustgraph/messaging/translators/metadata.py
127
+ trustgraph/messaging/translators/nl_sparql.py
127
128
  trustgraph/messaging/translators/nlp_query.py
129
+ trustgraph/messaging/translators/ontology.py
128
130
  trustgraph/messaging/translators/primitives.py
129
131
  trustgraph/messaging/translators/prompt.py
130
132
  trustgraph/messaging/translators/reranker.py
131
133
  trustgraph/messaging/translators/retrieval.py
132
134
  trustgraph/messaging/translators/rows_query.py
135
+ trustgraph/messaging/translators/sparql_nl_query.py
133
136
  trustgraph/messaging/translators/sparql_query.py
134
137
  trustgraph/messaging/translators/structured_query.py
135
138
  trustgraph/messaging/translators/text_completion.py
@@ -155,6 +158,8 @@ trustgraph/schema/embeddings.py
155
158
  trustgraph/schema/field_extraction.py
156
159
  trustgraph/schema/iam.py
157
160
  trustgraph/schema/llm.py
161
+ trustgraph/schema/nl_sparql.py
162
+ trustgraph/schema/ontology.py
158
163
  trustgraph/schema/policy_event.py
159
164
  trustgraph/schema/retrieval.py
160
165
  trustgraph/schema/structured.py
@@ -1 +0,0 @@
1
- __version__ = "2.11.4"