trustgraph-base 2.7.4__tar.gz → 2.7.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 (198) hide show
  1. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/PKG-INFO +1 -1
  2. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/api/__init__.py +2 -0
  3. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/api/api.py +2 -2
  4. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/api/async_flow.py +54 -3
  5. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/api/async_socket_client.py +36 -3
  6. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/api/bulk_client.py +4 -4
  7. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/api/config.py +2 -2
  8. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/api/flow.py +49 -1
  9. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/api/socket_client.py +34 -1
  10. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/api/types.py +18 -0
  11. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/base/__init__.py +1 -0
  12. trustgraph_base-2.7.6/trustgraph/base/image_to_text_service.py +170 -0
  13. trustgraph_base-2.7.6/trustgraph/base_version.py +1 -0
  14. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/messaging/__init__.py +7 -0
  15. trustgraph_base-2.7.6/trustgraph/messaging/translators/image_to_text.py +52 -0
  16. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/schema/services/__init__.py +2 -1
  17. trustgraph_base-2.7.6/trustgraph/schema/services/image_to_text.py +24 -0
  18. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph_base.egg-info/PKG-INFO +1 -1
  19. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph_base.egg-info/SOURCES.txt +3 -0
  20. trustgraph_base-2.7.4/trustgraph/base_version.py +0 -1
  21. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/README.md +0 -0
  22. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/pyproject.toml +0 -0
  23. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/setup.cfg +0 -0
  24. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/api/async_bulk_client.py +0 -0
  25. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/api/async_metrics.py +0 -0
  26. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/api/collection.py +0 -0
  27. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/api/exceptions.py +0 -0
  28. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/api/explainability.py +0 -0
  29. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/api/knowledge.py +0 -0
  30. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/api/library.py +0 -0
  31. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/api/metrics.py +0 -0
  32. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/base/agent_client.py +0 -0
  33. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/base/agent_service.py +0 -0
  34. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/base/async_processor.py +0 -0
  35. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/base/audit_publisher.py +0 -0
  36. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/base/backend.py +0 -0
  37. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/base/cassandra_config.py +0 -0
  38. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/base/chunking_service.py +0 -0
  39. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/base/collection_config_handler.py +0 -0
  40. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/base/config_client.py +0 -0
  41. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/base/consumer.py +0 -0
  42. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/base/consumer_spec.py +0 -0
  43. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/base/document_embeddings_client.py +0 -0
  44. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/base/document_embeddings_query_service.py +0 -0
  45. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/base/document_embeddings_store_service.py +0 -0
  46. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/base/dynamic_tool_service.py +0 -0
  47. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/base/embeddings_client.py +0 -0
  48. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/base/embeddings_service.py +0 -0
  49. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/base/flow.py +0 -0
  50. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/base/flow_processor.py +0 -0
  51. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/base/graph_embeddings_client.py +0 -0
  52. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/base/graph_embeddings_query_service.py +0 -0
  53. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/base/graph_embeddings_store_service.py +0 -0
  54. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/base/graph_rag_client.py +0 -0
  55. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/base/iam_client.py +0 -0
  56. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/base/kafka_backend.py +0 -0
  57. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/base/keyword_index_client.py +0 -0
  58. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/base/keyword_index_service.py +0 -0
  59. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/base/librarian_client.py +0 -0
  60. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/base/librarian_spec.py +0 -0
  61. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/base/llm_service.py +0 -0
  62. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/base/logging.py +0 -0
  63. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/base/metrics.py +0 -0
  64. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/base/parameter_spec.py +0 -0
  65. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/base/processor_group.py +0 -0
  66. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/base/producer.py +0 -0
  67. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/base/producer_spec.py +0 -0
  68. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/base/prompt_client.py +0 -0
  69. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/base/publisher.py +0 -0
  70. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/base/pubsub.py +0 -0
  71. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/base/pulsar_backend.py +0 -0
  72. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/base/qdrant_config.py +0 -0
  73. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/base/rabbitmq_backend.py +0 -0
  74. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/base/request_response_spec.py +0 -0
  75. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/base/reranker_client.py +0 -0
  76. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/base/reranker_service.py +0 -0
  77. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/base/row_embeddings_query_client.py +0 -0
  78. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/base/schema_compatibility.py +0 -0
  79. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/base/serialization.py +0 -0
  80. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/base/spec.py +0 -0
  81. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/base/structured_query_client.py +0 -0
  82. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/base/subscriber.py +0 -0
  83. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/base/subscriber_spec.py +0 -0
  84. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/base/text_completion_client.py +0 -0
  85. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/base/tool_client.py +0 -0
  86. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/base/tool_service.py +0 -0
  87. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/base/tool_service_client.py +0 -0
  88. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/base/triples_client.py +0 -0
  89. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/base/triples_query_service.py +0 -0
  90. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/base/triples_store_service.py +0 -0
  91. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/base/workspace_processor.py +0 -0
  92. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/clients/__init__.py +0 -0
  93. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/clients/agent_client.py +0 -0
  94. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/clients/base.py +0 -0
  95. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/clients/config_client.py +0 -0
  96. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/clients/document_embeddings_client.py +0 -0
  97. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/clients/document_rag_client.py +0 -0
  98. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/clients/embeddings_client.py +0 -0
  99. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/clients/graph_embeddings_client.py +0 -0
  100. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/clients/graph_rag_client.py +0 -0
  101. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/clients/llm_client.py +0 -0
  102. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/clients/prompt_client.py +0 -0
  103. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/clients/row_embeddings_client.py +0 -0
  104. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/clients/triples_query_client.py +0 -0
  105. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/exceptions.py +0 -0
  106. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/i18n/__init__.py +0 -0
  107. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/i18n/packs/__init__.py +0 -0
  108. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/i18n/packs/ar.json +0 -0
  109. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/i18n/packs/en.json +0 -0
  110. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/i18n/packs/es.json +0 -0
  111. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/i18n/packs/he.json +0 -0
  112. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/i18n/packs/hi.json +0 -0
  113. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/i18n/packs/pt.json +0 -0
  114. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/i18n/packs/ru.json +0 -0
  115. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/i18n/packs/sw.json +0 -0
  116. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/i18n/packs/tr.json +0 -0
  117. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/i18n/packs/zh-cn.json +0 -0
  118. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/knowledge/__init__.py +0 -0
  119. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/knowledge/defs.py +0 -0
  120. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/knowledge/document.py +0 -0
  121. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/knowledge/identifier.py +0 -0
  122. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/knowledge/organization.py +0 -0
  123. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/knowledge/publication.py +0 -0
  124. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/log_level.py +0 -0
  125. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/messaging/registry.py +0 -0
  126. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/messaging/translators/__init__.py +0 -0
  127. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/messaging/translators/agent.py +0 -0
  128. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/messaging/translators/base.py +0 -0
  129. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/messaging/translators/collection.py +0 -0
  130. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/messaging/translators/config.py +0 -0
  131. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/messaging/translators/diagnosis.py +0 -0
  132. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/messaging/translators/document_loading.py +0 -0
  133. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/messaging/translators/embeddings.py +0 -0
  134. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/messaging/translators/embeddings_query.py +0 -0
  135. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/messaging/translators/flow.py +0 -0
  136. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/messaging/translators/iam.py +0 -0
  137. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/messaging/translators/knowledge.py +0 -0
  138. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/messaging/translators/library.py +0 -0
  139. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/messaging/translators/metadata.py +0 -0
  140. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/messaging/translators/nlp_query.py +0 -0
  141. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/messaging/translators/primitives.py +0 -0
  142. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/messaging/translators/prompt.py +0 -0
  143. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/messaging/translators/reranker.py +0 -0
  144. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/messaging/translators/retrieval.py +0 -0
  145. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/messaging/translators/rows_query.py +0 -0
  146. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/messaging/translators/sparql_query.py +0 -0
  147. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/messaging/translators/structured_query.py +0 -0
  148. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/messaging/translators/text_completion.py +0 -0
  149. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/messaging/translators/tool.py +0 -0
  150. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/messaging/translators/triples.py +0 -0
  151. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/objects/__init__.py +0 -0
  152. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/objects/field.py +0 -0
  153. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/objects/object.py +0 -0
  154. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/provenance/__init__.py +0 -0
  155. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/provenance/agent.py +0 -0
  156. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/provenance/namespaces.py +0 -0
  157. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/provenance/triples.py +0 -0
  158. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/provenance/uris.py +0 -0
  159. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/provenance/vocabulary.py +0 -0
  160. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/rdf.py +0 -0
  161. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/schema/__init__.py +0 -0
  162. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/schema/core/__init__.py +0 -0
  163. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/schema/core/metadata.py +0 -0
  164. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/schema/core/primitives.py +0 -0
  165. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/schema/core/topic.py +0 -0
  166. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/schema/knowledge/__init__.py +0 -0
  167. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/schema/knowledge/document.py +0 -0
  168. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/schema/knowledge/embeddings.py +0 -0
  169. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/schema/knowledge/graph.py +0 -0
  170. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/schema/knowledge/knowledge.py +0 -0
  171. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/schema/knowledge/nlp.py +0 -0
  172. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/schema/knowledge/object.py +0 -0
  173. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/schema/knowledge/rows.py +0 -0
  174. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/schema/knowledge/structured.py +0 -0
  175. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/schema/services/agent.py +0 -0
  176. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/schema/services/audit.py +0 -0
  177. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/schema/services/collection.py +0 -0
  178. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/schema/services/config.py +0 -0
  179. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/schema/services/diagnosis.py +0 -0
  180. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/schema/services/flow.py +0 -0
  181. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/schema/services/iam.py +0 -0
  182. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/schema/services/library.py +0 -0
  183. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/schema/services/llm.py +0 -0
  184. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/schema/services/lookup.py +0 -0
  185. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/schema/services/nlp_query.py +0 -0
  186. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/schema/services/prompt.py +0 -0
  187. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/schema/services/query.py +0 -0
  188. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/schema/services/reranker.py +0 -0
  189. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/schema/services/retrieval.py +0 -0
  190. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/schema/services/rows_query.py +0 -0
  191. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/schema/services/sparql_query.py +0 -0
  192. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/schema/services/storage.py +0 -0
  193. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/schema/services/structured_query.py +0 -0
  194. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph/schema/services/tool_service.py +0 -0
  195. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph_base.egg-info/dependency_links.txt +0 -0
  196. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph_base.egg-info/entry_points.txt +0 -0
  197. {trustgraph_base-2.7.4 → trustgraph_base-2.7.6}/trustgraph_base.egg-info/requires.txt +0 -0
  198. {trustgraph_base-2.7.4 → trustgraph_base-2.7.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.7.4
3
+ Version: 2.7.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
@@ -107,6 +107,7 @@ from .types import (
107
107
  AgentAnswer,
108
108
  RAGChunk,
109
109
  TextCompletionResult,
110
+ ImageToTextResult,
110
111
  ProvenanceEvent,
111
112
  )
112
113
 
@@ -186,6 +187,7 @@ __all__ = [
186
187
  "AgentAnswer",
187
188
  "RAGChunk",
188
189
  "TextCompletionResult",
190
+ "ImageToTextResult",
189
191
  "ProvenanceEvent",
190
192
 
191
193
  # Exceptions
@@ -25,7 +25,7 @@ def check_error(response):
25
25
  try:
26
26
  msg = response["error"]["message"]
27
27
  tp = response["error"]["type"]
28
- except:
28
+ except KeyError:
29
29
  raise ApplicationException(response["error"])
30
30
 
31
31
  raise ApplicationException(f"{tp}: {msg}")
@@ -208,7 +208,7 @@ class Api:
208
208
  try:
209
209
  # Parse the response as JSON
210
210
  object = resp.json()
211
- except:
211
+ except ValueError:
212
212
  raise ProtocolException(f"Expected JSON response")
213
213
 
214
214
  check_error(object)
@@ -12,9 +12,10 @@ AsyncSocketClient instead.
12
12
 
13
13
  import aiohttp
14
14
  import json
15
+ import base64
15
16
  from typing import Optional, Dict, Any, List
16
17
 
17
- from . types import TextCompletionResult
18
+ from . types import TextCompletionResult, ImageToTextResult
18
19
 
19
20
  from . exceptions import ProtocolException, ApplicationException
20
21
 
@@ -24,7 +25,7 @@ def check_error(response):
24
25
  try:
25
26
  msg = response["error"]["message"]
26
27
  tp = response["error"]["type"]
27
- except:
28
+ except KeyError:
28
29
  raise ApplicationException(response["error"])
29
30
 
30
31
  raise ApplicationException(f"{tp}: {msg}")
@@ -87,7 +88,7 @@ class AsyncFlow:
87
88
 
88
89
  try:
89
90
  obj = await resp.json()
90
- except:
91
+ except (ValueError, aiohttp.ContentTypeError):
91
92
  raise ProtocolException(f"Expected JSON response")
92
93
 
93
94
  check_error(obj)
@@ -476,6 +477,56 @@ class AsyncFlowInstance:
476
477
  model=result.get("model"),
477
478
  )
478
479
 
480
+ async def image_to_text(self, image: bytes, mime_type: str,
481
+ prompt: Optional[str] = None,
482
+ system: Optional[str] = None,
483
+ **kwargs: Any) -> ImageToTextResult:
484
+ """
485
+ Describe an image using the image-to-text service (non-streaming).
486
+
487
+ Args:
488
+ image: Image content as bytes
489
+ mime_type: Image MIME type (e.g. "image/jpeg")
490
+ prompt: Optional user prompt (backend default used if None)
491
+ system: Optional system prompt
492
+ **kwargs: Additional service-specific parameters
493
+
494
+ Returns:
495
+ ImageToTextResult: Result with text, in_token, out_token, model
496
+
497
+ Example:
498
+ ```python
499
+ async_flow = await api.async_flow()
500
+ flow = async_flow.id("default")
501
+
502
+ with open("photo.jpg", "rb") as f:
503
+ result = await flow.image_to_text(
504
+ image=f.read(),
505
+ mime_type="image/jpeg",
506
+ )
507
+ print(result.text)
508
+ print(f"Tokens: {result.in_token} in, {result.out_token} out")
509
+ ```
510
+ """
511
+ # The image rides the JSON wire format as base64 text
512
+ request_data = {
513
+ "image": base64.b64encode(image).decode("utf-8"),
514
+ "mime_type": mime_type,
515
+ }
516
+ if prompt is not None:
517
+ request_data["prompt"] = prompt
518
+ if system is not None:
519
+ request_data["system"] = system
520
+ request_data.update(kwargs)
521
+
522
+ result = await self.request("image-to-text", request_data)
523
+ return ImageToTextResult(
524
+ text=result.get("description", ""),
525
+ in_token=result.get("in_token"),
526
+ out_token=result.get("out_token"),
527
+ model=result.get("model"),
528
+ )
529
+
479
530
  async def graph_rag(self, query: str, collection: str,
480
531
  max_subgraph_size: int = 1000, max_subgraph_count: int = 5,
481
532
  max_entity_distance: int = 3, **kwargs: Any) -> str:
@@ -1,11 +1,12 @@
1
1
 
2
2
  import json
3
+ import base64
3
4
  import asyncio
4
5
  import websockets
5
6
  from typing import Optional, Dict, Any, AsyncIterator, Union
6
7
 
7
- from . types import AgentThought, AgentObservation, AgentAnswer, RAGChunk, TextCompletionResult
8
- from . exceptions import ProtocolException, ApplicationException
8
+ from . types import AgentThought, AgentObservation, AgentAnswer, RAGChunk, TextCompletionResult, ImageToTextResult
9
+ from . exceptions import ProtocolException, ApplicationException, raise_from_error_dict
9
10
 
10
11
 
11
12
  class AsyncSocketClient:
@@ -141,7 +142,7 @@ class AsyncSocketClient:
141
142
  for queue in self._pending.values():
142
143
  try:
143
144
  await queue.put({"error": str(e)})
144
- except:
145
+ except asyncio.CancelledError :
145
146
  pass
146
147
  finally:
147
148
  self._connected = False
@@ -353,6 +354,38 @@ class AsyncSocketFlowInstance:
353
354
  if isinstance(chunk, RAGChunk):
354
355
  yield chunk
355
356
 
357
+ async def image_to_text(self, image: bytes, mime_type: str,
358
+ prompt: Optional[str] = None,
359
+ system: Optional[str] = None,
360
+ **kwargs) -> ImageToTextResult:
361
+ """Describe an image using the image-to-text service (non-streaming).
362
+
363
+ Returns an ImageToTextResult with the description text and token counts.
364
+ """
365
+ # The image rides the JSON wire format as base64 text
366
+ request = {
367
+ "image": base64.b64encode(image).decode("utf-8"),
368
+ "mime_type": mime_type,
369
+ }
370
+ if prompt is not None:
371
+ request["prompt"] = prompt
372
+ if system is not None:
373
+ request["system"] = system
374
+ request.update(kwargs)
375
+
376
+ result = await self.client._send_request("image-to-text", self.flow_id, request)
377
+
378
+ # Service errors arrive inside the response body
379
+ if isinstance(result, dict) and result.get("error"):
380
+ raise_from_error_dict(result["error"])
381
+
382
+ return ImageToTextResult(
383
+ text=result.get("description", ""),
384
+ in_token=result.get("in_token"),
385
+ out_token=result.get("out_token"),
386
+ model=result.get("model"),
387
+ )
388
+
356
389
  async def graph_rag(self, query: str, collection: str,
357
390
  max_subgraph_size: int = 1000, max_subgraph_count: int = 5,
358
391
  max_entity_distance: int = 3, streaming: bool = False, **kwargs):
@@ -201,7 +201,7 @@ class BulkClient:
201
201
  finally:
202
202
  try:
203
203
  loop.run_until_complete(async_gen.aclose())
204
- except:
204
+ except Exception:
205
205
  pass
206
206
 
207
207
  async def _export_triples_async(self, flow: str) -> Iterator[Triple]:
@@ -299,7 +299,7 @@ class BulkClient:
299
299
  finally:
300
300
  try:
301
301
  loop.run_until_complete(async_gen.aclose())
302
- except:
302
+ except Exception:
303
303
  pass
304
304
 
305
305
  async def _export_graph_embeddings_async(self, flow: str) -> Iterator[Dict[str, Any]]:
@@ -393,7 +393,7 @@ class BulkClient:
393
393
  finally:
394
394
  try:
395
395
  loop.run_until_complete(async_gen.aclose())
396
- except:
396
+ except Exception:
397
397
  pass
398
398
 
399
399
  async def _export_document_embeddings_async(self, flow: str) -> Iterator[Dict[str, Any]]:
@@ -517,7 +517,7 @@ class BulkClient:
517
517
  finally:
518
518
  try:
519
519
  loop.run_until_complete(async_gen.aclose())
520
- except:
520
+ except Exception:
521
521
  pass
522
522
 
523
523
  async def _export_entity_contexts_async(self, flow: str) -> Iterator[Dict[str, Any]]:
@@ -254,7 +254,7 @@ class Config:
254
254
  )
255
255
  for v in object["values"]
256
256
  ]
257
- except:
257
+ except (KeyError, TypeError):
258
258
  raise ProtocolException(f"Response not formatted correctly")
259
259
 
260
260
  def get_values_all_workspaces(self, type):
@@ -330,6 +330,6 @@ class Config:
330
330
 
331
331
  try:
332
332
  return object["config"], object["version"]
333
- except:
333
+ except KeyError:
334
334
  raise ProtocolException(f"Response not formatted correctly")
335
335
 
@@ -11,7 +11,7 @@ import base64
11
11
 
12
12
  from .. knowledge import hash, Uri, Literal, QuotedTriple
13
13
  from .. schema import IRI, LITERAL, TRIPLE
14
- from . types import Triple, TextCompletionResult
14
+ from . types import Triple, TextCompletionResult, ImageToTextResult
15
15
  from . exceptions import ProtocolException
16
16
 
17
17
 
@@ -296,6 +296,54 @@ class FlowInstance:
296
296
  model=result.get("model"),
297
297
  )
298
298
 
299
+ def image_to_text(self, image, mime_type, prompt=None, system=None):
300
+ """
301
+ Describe an image using the flow's image-to-text service.
302
+
303
+ Args:
304
+ image: Image content as bytes
305
+ mime_type: Image MIME type (e.g. "image/jpeg")
306
+ prompt: Optional user prompt (backend default used if None)
307
+ system: Optional system prompt
308
+
309
+ Returns:
310
+ ImageToTextResult: Result with text, in_token, out_token, model
311
+
312
+ Example:
313
+ ```python
314
+ flow = api.flow().id("default")
315
+ with open("photo.jpg", "rb") as f:
316
+ result = flow.image_to_text(
317
+ image=f.read(),
318
+ mime_type="image/jpeg",
319
+ )
320
+ print(result.text)
321
+ print(f"Tokens: {result.in_token} in, {result.out_token} out")
322
+ ```
323
+ """
324
+
325
+ # The image rides the JSON wire format as base64 text
326
+ input = {
327
+ "image": base64.b64encode(image).decode("utf-8"),
328
+ "mime_type": mime_type,
329
+ }
330
+ if prompt is not None:
331
+ input["prompt"] = prompt
332
+ if system is not None:
333
+ input["system"] = system
334
+
335
+ result = self.request(
336
+ "service/image-to-text",
337
+ input
338
+ )
339
+
340
+ return ImageToTextResult(
341
+ text=result.get("description", ""),
342
+ in_token=result.get("in_token"),
343
+ out_token=result.get("out_token"),
344
+ model=result.get("model"),
345
+ )
346
+
299
347
  def agent(self, question,state=None, group=None, history=None):
300
348
  """
301
349
  Execute an agent operation with reasoning and tool use capabilities.
@@ -9,13 +9,14 @@ multiplexes requests by ID.
9
9
  """
10
10
 
11
11
  import json
12
+ import base64
12
13
  import asyncio
13
14
  import websockets
14
15
  from websockets.exceptions import ConnectionClosed
15
16
  from typing import Optional, Dict, Any, Iterator, Union, List
16
17
  from threading import Lock
17
18
 
18
- from . types import AgentThought, AgentObservation, AgentAnswer, RAGChunk, StreamingChunk, ProvenanceEvent, TextCompletionResult
19
+ from . types import AgentThought, AgentObservation, AgentAnswer, RAGChunk, StreamingChunk, ProvenanceEvent, TextCompletionResult, ImageToTextResult
19
20
  from . exceptions import ProtocolException, raise_from_error_dict
20
21
 
21
22
 
@@ -673,6 +674,38 @@ class SocketFlowInstance:
673
674
  if isinstance(chunk, RAGChunk):
674
675
  yield chunk
675
676
 
677
+ def image_to_text(self, image: bytes, mime_type: str,
678
+ prompt: Optional[str] = None,
679
+ system: Optional[str] = None,
680
+ **kwargs: Any) -> ImageToTextResult:
681
+ """Describe an image using the image-to-text service (non-streaming).
682
+
683
+ Returns an ImageToTextResult with the description text and token counts.
684
+ """
685
+ # The image rides the JSON wire format as base64 text
686
+ request = {
687
+ "image": base64.b64encode(image).decode("utf-8"),
688
+ "mime_type": mime_type,
689
+ }
690
+ if prompt is not None:
691
+ request["prompt"] = prompt
692
+ if system is not None:
693
+ request["system"] = system
694
+ request.update(kwargs)
695
+
696
+ result = self.client._send_request_sync("image-to-text", self.flow_id, request, False)
697
+
698
+ # Service errors arrive inside the response body
699
+ if isinstance(result, dict) and result.get("error"):
700
+ raise_from_error_dict(result["error"])
701
+
702
+ return ImageToTextResult(
703
+ text=result.get("description", ""),
704
+ in_token=result.get("in_token"),
705
+ out_token=result.get("out_token"),
706
+ model=result.get("model"),
707
+ )
708
+
676
709
  def graph_rag(
677
710
  self,
678
711
  query: str,
@@ -240,6 +240,24 @@ class TextCompletionResult:
240
240
  model: Optional[str] = None
241
241
  sources: List[Dict[str, str]] = dataclasses.field(default_factory=list)
242
242
 
243
+ @dataclasses.dataclass
244
+ class ImageToTextResult:
245
+ """
246
+ Result from an image-to-text request.
247
+
248
+ Returned by image_to_text(). Non-streaming only.
249
+
250
+ Attributes:
251
+ text: Text description of the image
252
+ in_token: Input token count (None if not available)
253
+ out_token: Output token count (None if not available)
254
+ model: Model identifier (None if not available)
255
+ """
256
+ text: Optional[str]
257
+ in_token: Optional[int] = None
258
+ out_token: Optional[int] = None
259
+ model: Optional[str] = None
260
+
243
261
  @dataclasses.dataclass
244
262
  class ProvenanceEvent:
245
263
  """
@@ -44,6 +44,7 @@ from . agent_client import AgentClientSpec
44
44
  from . structured_query_client import StructuredQueryClientSpec
45
45
  from . reranker_client import RerankerClientSpec
46
46
  from . reranker_service import RerankerService
47
+ from . image_to_text_service import ImageToTextService, ImageDescriptionResult
47
48
  from . keyword_index_service import KeywordIndexService
48
49
  from . keyword_index_client import KeywordIndexClientSpec, KeywordIndexClient
49
50
  from . row_embeddings_query_client import RowEmbeddingsQueryClientSpec
@@ -0,0 +1,170 @@
1
+ """
2
+ Image-to-text description base class
3
+ """
4
+
5
+ from __future__ import annotations
6
+
7
+ from argparse import ArgumentParser
8
+
9
+ import logging
10
+ from prometheus_client import Histogram, Info
11
+
12
+ from .. schema import ImageToTextRequest, ImageToTextResponse, Error
13
+ from .. exceptions import TooManyRequests
14
+ from .. base import FlowProcessor, ConsumerSpec, ProducerSpec, ParameterSpec
15
+
16
+ # Module logger
17
+ logger = logging.getLogger(__name__)
18
+
19
+ default_ident = "image-to-text"
20
+ default_concurrency = 1
21
+
22
+ class ImageDescriptionResult:
23
+ def __init__(
24
+ self, text = None, in_token = None, out_token = None,
25
+ model = None,
26
+ ):
27
+ self.text = text
28
+ self.in_token = in_token
29
+ self.out_token = out_token
30
+ self.model = model
31
+ __slots__ = ["text", "in_token", "out_token", "model"]
32
+
33
+ class ImageToTextService(FlowProcessor):
34
+ """
35
+ Extensible service processing image description requests.
36
+
37
+ This class handles the core logic of dispatching image-to-text
38
+ requests to integrated underlying vision model providers
39
+ (e.g. OpenAI).
40
+ """
41
+
42
+ def __init__(self, **params):
43
+
44
+ id = params.get("id", default_ident)
45
+ concurrency = params.get("concurrency", 1)
46
+
47
+ super(ImageToTextService, self).__init__(**params | {
48
+ "id": id,
49
+ "concurrency": concurrency,
50
+ })
51
+
52
+ self.register_specification(
53
+ ConsumerSpec(
54
+ name = "request",
55
+ schema = ImageToTextRequest,
56
+ handler = self.on_request,
57
+ concurrency = concurrency,
58
+ )
59
+ )
60
+
61
+ self.register_specification(
62
+ ProducerSpec(
63
+ name = "response",
64
+ schema = ImageToTextResponse
65
+ )
66
+ )
67
+
68
+ self.register_specification(
69
+ ParameterSpec(
70
+ name = "model",
71
+ )
72
+ )
73
+
74
+ if not hasattr(__class__, "image_to_text_metric"):
75
+ __class__.image_to_text_metric = Histogram(
76
+ 'image_to_text_duration',
77
+ 'Image-to-text duration (seconds)',
78
+ ["id", "flow"],
79
+ buckets=[
80
+ 0.25, 0.5, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0,
81
+ 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0,
82
+ 17.0, 18.0, 19.0, 20.0, 21.0, 22.0, 23.0, 24.0, 25.0,
83
+ 30.0, 35.0, 40.0, 45.0, 50.0, 60.0, 80.0, 100.0,
84
+ 120.0
85
+ ]
86
+ )
87
+
88
+ if not hasattr(__class__, "image_to_text_model_metric"):
89
+ __class__.image_to_text_model_metric = Info(
90
+ 'image_to_text_model',
91
+ 'Image-to-text model',
92
+ ["processor", "flow"]
93
+ )
94
+
95
+ async def on_request(self, msg, consumer, flow):
96
+
97
+ try:
98
+
99
+ request = msg.value()
100
+
101
+ # Sender-produced ID
102
+
103
+ id = msg.properties()["id"]
104
+
105
+ model = flow("model")
106
+
107
+ with __class__.image_to_text_metric.labels(
108
+ id=self.id,
109
+ flow=f"{flow.name}-{consumer.name}",
110
+ ).time():
111
+
112
+ response = await self.describe_image(
113
+ request.image, request.mime_type,
114
+ request.prompt, request.system, model,
115
+ )
116
+
117
+ await flow("response").send(
118
+ ImageToTextResponse(
119
+ error=None,
120
+ description=response.text,
121
+ in_token=response.in_token,
122
+ out_token=response.out_token,
123
+ model=response.model,
124
+ ),
125
+ properties={"id": id}
126
+ )
127
+
128
+ __class__.image_to_text_model_metric.labels(
129
+ processor = self.id,
130
+ flow = flow.name
131
+ ).info({
132
+ "model": str(model) if model is not None else "",
133
+ })
134
+
135
+ except TooManyRequests as e:
136
+ raise e
137
+
138
+ except Exception as e:
139
+
140
+ # Apart from rate limits, treat all exceptions as unrecoverable
141
+
142
+ logger.error(f"Image-to-text service exception: {e}", exc_info=True)
143
+
144
+ logger.debug("Sending error response...")
145
+
146
+ await flow.producer["response"].send(
147
+ ImageToTextResponse(
148
+ error=Error(
149
+ type = "image-to-text-error",
150
+ message = str(e),
151
+ ),
152
+ description=None,
153
+ in_token=None,
154
+ out_token=None,
155
+ model=None,
156
+ ),
157
+ properties={"id": id}
158
+ )
159
+
160
+ @staticmethod
161
+ def add_args(parser: ArgumentParser) -> None:
162
+
163
+ parser.add_argument(
164
+ '-c', '--concurrency',
165
+ type=int,
166
+ default=default_concurrency,
167
+ help=f'Concurrent processing threads (default: {default_concurrency})'
168
+ )
169
+
170
+ FlowProcessor.add_args(parser)
@@ -0,0 +1 @@
1
+ __version__ = "2.7.6"
@@ -5,6 +5,7 @@ from .translators import *
5
5
  from .translators.agent import AgentRequestTranslator, AgentResponseTranslator
6
6
  from .translators.embeddings import EmbeddingsRequestTranslator, EmbeddingsResponseTranslator
7
7
  from .translators.text_completion import TextCompletionRequestTranslator, TextCompletionResponseTranslator
8
+ from .translators.image_to_text import ImageToTextRequestTranslator, ImageToTextResponseTranslator
8
9
  from .translators.retrieval import (
9
10
  DocumentRagRequestTranslator, DocumentRagResponseTranslator,
10
11
  GraphRagRequestTranslator, GraphRagResponseTranslator
@@ -50,6 +51,12 @@ TranslatorRegistry.register_service(
50
51
  TextCompletionResponseTranslator()
51
52
  )
52
53
 
54
+ TranslatorRegistry.register_service(
55
+ "image-to-text",
56
+ ImageToTextRequestTranslator(),
57
+ ImageToTextResponseTranslator()
58
+ )
59
+
53
60
  TranslatorRegistry.register_service(
54
61
  "document-rag",
55
62
  DocumentRagRequestTranslator(),
@@ -0,0 +1,52 @@
1
+ import base64
2
+ from typing import Dict, Any, Tuple
3
+ from ...schema import ImageToTextRequest, ImageToTextResponse
4
+ from .base import MessageTranslator
5
+
6
+
7
+ class ImageToTextRequestTranslator(MessageTranslator):
8
+ """Translator for ImageToTextRequest schema objects"""
9
+
10
+ def decode(self, data: Dict[str, Any]) -> ImageToTextRequest:
11
+ # Base64 content validation only. The image field carries
12
+ # base64 text end-to-end: raw binary can't ride the JSON wire
13
+ # format, and the payload passes through unchanged
14
+ base64.b64decode(data["image"], validate=True)
15
+
16
+ return ImageToTextRequest(
17
+ image=data["image"],
18
+ mime_type=data["mime_type"],
19
+ prompt=data.get("prompt", ""),
20
+ system=data.get("system", ""),
21
+ )
22
+
23
+ def encode(self, obj: ImageToTextRequest) -> Dict[str, Any]:
24
+ return {
25
+ "image": obj.image,
26
+ "mime_type": obj.mime_type,
27
+ "prompt": obj.prompt,
28
+ "system": obj.system,
29
+ }
30
+
31
+
32
+ class ImageToTextResponseTranslator(MessageTranslator):
33
+ """Translator for ImageToTextResponse schema objects"""
34
+
35
+ def decode(self, data: Dict[str, Any]) -> ImageToTextResponse:
36
+ raise NotImplementedError("Response translation to Pulsar not typically needed")
37
+
38
+ def encode(self, obj: ImageToTextResponse) -> Dict[str, Any]:
39
+ result = {"description": obj.description}
40
+
41
+ if obj.in_token is not None:
42
+ result["in_token"] = obj.in_token
43
+ if obj.out_token is not None:
44
+ result["out_token"] = obj.out_token
45
+ if obj.model is not None:
46
+ result["model"] = obj.model
47
+
48
+ return result
49
+
50
+ def encode_with_completion(self, obj: ImageToTextResponse) -> Tuple[Dict[str, Any], bool]:
51
+ """Returns (response_dict, is_final). Image-to-text is non-streaming."""
52
+ return self.encode(obj), True
@@ -17,4 +17,5 @@ from .storage import *
17
17
  from .tool_service import *
18
18
  from .sparql_query import *
19
19
  from .reranker import *
20
- from .audit import *
20
+ from .audit import *
21
+ from .image_to_text import *
@@ -0,0 +1,24 @@
1
+
2
+ from dataclasses import dataclass
3
+
4
+ from ..core.primitives import Error
5
+
6
+ ############################################################################
7
+
8
+ # Image to text
9
+
10
+ @dataclass
11
+ class ImageToTextRequest:
12
+ # Image payload: base64-encoded image data
13
+ image: str = ""
14
+ mime_type: str = ""
15
+ prompt: str = ""
16
+ system: str = ""
17
+
18
+ @dataclass
19
+ class ImageToTextResponse:
20
+ error: Error | None = None
21
+ description: str = ""
22
+ in_token: int | None = None
23
+ out_token: int | None = None
24
+ model: str | None = None