trustgraph-flow 0.21.4__tar.gz → 0.21.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 (287) hide show
  1. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/PKG-INFO +2 -2
  2. trustgraph-flow-0.21.6/scripts/text-completion-mistral +6 -0
  3. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/setup.py +2 -0
  4. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/document_rag.py +12 -7
  5. trustgraph-flow-0.21.6/trustgraph/flow_version.py +1 -0
  6. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/gateway/document_embeddings_load.py +1 -1
  7. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/gateway/document_rag.py +1 -0
  8. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/gateway/graph_embeddings_load.py +2 -2
  9. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/gateway/graph_rag.py +4 -0
  10. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/gateway/requestor.py +0 -2
  11. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/gateway/socket.py +2 -2
  12. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/gateway/triples_load.py +1 -1
  13. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/graph_rag.py +73 -50
  14. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/model/text_completion/azure_openai/llm.py +11 -6
  15. trustgraph-flow-0.21.6/trustgraph/model/text_completion/mistral/llm.py +201 -0
  16. trustgraph-flow-0.21.6/trustgraph/model/text_completion/openai/__init__.py +3 -0
  17. trustgraph-flow-0.21.6/trustgraph/model/text_completion/openai/__main__.py +7 -0
  18. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/retrieval/document_rag/rag.py +17 -1
  19. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/retrieval/graph_rag/rag.py +48 -13
  20. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph_flow.egg-info/PKG-INFO +2 -2
  21. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph_flow.egg-info/SOURCES.txt +4 -0
  22. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph_flow.egg-info/requires.txt +1 -1
  23. trustgraph-flow-0.21.4/trustgraph/flow_version.py +0 -1
  24. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/README.md +0 -0
  25. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/scripts/agent-manager-react +0 -0
  26. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/scripts/api-gateway +0 -0
  27. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/scripts/chunker-recursive +0 -0
  28. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/scripts/chunker-token +0 -0
  29. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/scripts/de-query-milvus +0 -0
  30. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/scripts/de-query-pinecone +0 -0
  31. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/scripts/de-query-qdrant +0 -0
  32. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/scripts/de-write-milvus +0 -0
  33. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/scripts/de-write-pinecone +0 -0
  34. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/scripts/de-write-qdrant +0 -0
  35. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/scripts/document-embeddings +0 -0
  36. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/scripts/document-rag +0 -0
  37. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/scripts/embeddings-fastembed +0 -0
  38. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/scripts/embeddings-ollama +0 -0
  39. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/scripts/ge-query-milvus +0 -0
  40. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/scripts/ge-query-pinecone +0 -0
  41. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/scripts/ge-query-qdrant +0 -0
  42. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/scripts/ge-write-milvus +0 -0
  43. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/scripts/ge-write-pinecone +0 -0
  44. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/scripts/ge-write-qdrant +0 -0
  45. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/scripts/graph-embeddings +0 -0
  46. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/scripts/graph-rag +0 -0
  47. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/scripts/kg-extract-definitions +0 -0
  48. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/scripts/kg-extract-relationships +0 -0
  49. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/scripts/kg-extract-topics +0 -0
  50. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/scripts/librarian +0 -0
  51. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/scripts/metering +0 -0
  52. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/scripts/object-extract-row +0 -0
  53. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/scripts/oe-write-milvus +0 -0
  54. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/scripts/pdf-decoder +0 -0
  55. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/scripts/prompt-generic +0 -0
  56. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/scripts/prompt-template +0 -0
  57. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/scripts/rows-write-cassandra +0 -0
  58. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/scripts/run-processing +0 -0
  59. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/scripts/text-completion-azure +0 -0
  60. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/scripts/text-completion-azure-openai +0 -0
  61. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/scripts/text-completion-claude +0 -0
  62. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/scripts/text-completion-cohere +0 -0
  63. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/scripts/text-completion-googleaistudio +0 -0
  64. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/scripts/text-completion-llamafile +0 -0
  65. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/scripts/text-completion-ollama +0 -0
  66. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/scripts/text-completion-openai +0 -0
  67. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/scripts/triples-query-cassandra +0 -0
  68. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/scripts/triples-query-falkordb +0 -0
  69. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/scripts/triples-query-memgraph +0 -0
  70. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/scripts/triples-query-neo4j +0 -0
  71. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/scripts/triples-write-cassandra +0 -0
  72. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/scripts/triples-write-falkordb +0 -0
  73. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/scripts/triples-write-memgraph +0 -0
  74. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/scripts/triples-write-neo4j +0 -0
  75. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/scripts/wikipedia-lookup +0 -0
  76. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/setup.cfg +0 -0
  77. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/__init__.py +0 -0
  78. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/agent/__init__.py +0 -0
  79. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/agent/react/__init__.py +0 -0
  80. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/agent/react/__main__.py +0 -0
  81. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/agent/react/agent_manager.py +0 -0
  82. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/agent/react/service.py +0 -0
  83. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/agent/react/tools.py +0 -0
  84. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/agent/react/types.py +0 -0
  85. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/chunking/__init__.py +0 -0
  86. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/chunking/recursive/__init__.py +0 -0
  87. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/chunking/recursive/__main__.py +0 -0
  88. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/chunking/recursive/chunker.py +0 -0
  89. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/chunking/token/__init__.py +0 -0
  90. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/chunking/token/__main__.py +0 -0
  91. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/chunking/token/chunker.py +0 -0
  92. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/decoding/__init__.py +0 -0
  93. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/decoding/pdf/__init__.py +0 -0
  94. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/decoding/pdf/__main__.py +0 -0
  95. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/decoding/pdf/pdf_decoder.py +0 -0
  96. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/direct/__init__.py +0 -0
  97. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/direct/cassandra.py +0 -0
  98. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/direct/milvus_doc_embeddings.py +0 -0
  99. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/direct/milvus_graph_embeddings.py +0 -0
  100. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/direct/milvus_object_embeddings.py +0 -0
  101. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/embeddings/__init__.py +0 -0
  102. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/embeddings/document_embeddings/__init__.py +0 -0
  103. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/embeddings/document_embeddings/__main__.py +0 -0
  104. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/embeddings/document_embeddings/embeddings.py +0 -0
  105. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/embeddings/fastembed/__init__.py +0 -0
  106. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/embeddings/fastembed/__main__.py +0 -0
  107. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/embeddings/fastembed/processor.py +0 -0
  108. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/embeddings/graph_embeddings/__init__.py +0 -0
  109. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/embeddings/graph_embeddings/__main__.py +0 -0
  110. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/embeddings/graph_embeddings/embeddings.py +0 -0
  111. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/embeddings/ollama/__init__.py +0 -0
  112. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/embeddings/ollama/__main__.py +0 -0
  113. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/embeddings/ollama/processor.py +0 -0
  114. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/external/__init__.py +0 -0
  115. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/external/wikipedia/__init__.py +0 -0
  116. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/external/wikipedia/__main__.py +0 -0
  117. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/external/wikipedia/service.py +0 -0
  118. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/extract/__init__.py +0 -0
  119. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/extract/kg/__init__.py +0 -0
  120. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/extract/kg/definitions/__init__.py +0 -0
  121. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/extract/kg/definitions/__main__.py +0 -0
  122. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/extract/kg/definitions/extract.py +0 -0
  123. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/extract/kg/relationships/__init__.py +0 -0
  124. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/extract/kg/relationships/__main__.py +0 -0
  125. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/extract/kg/relationships/extract.py +0 -0
  126. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/extract/kg/topics/__init__.py +0 -0
  127. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/extract/kg/topics/__main__.py +0 -0
  128. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/extract/kg/topics/extract.py +0 -0
  129. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/extract/object/__init__.py +0 -0
  130. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/extract/object/row/__init__.py +0 -0
  131. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/extract/object/row/__main__.py +0 -0
  132. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/extract/object/row/extract.py +0 -0
  133. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/gateway/__init__.py +0 -0
  134. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/gateway/__main__.py +0 -0
  135. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/gateway/agent.py +0 -0
  136. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/gateway/auth.py +0 -0
  137. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/gateway/dbpedia.py +0 -0
  138. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/gateway/document_embeddings_stream.py +0 -0
  139. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/gateway/document_load.py +0 -0
  140. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/gateway/embeddings.py +0 -0
  141. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/gateway/encyclopedia.py +0 -0
  142. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/gateway/endpoint.py +0 -0
  143. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/gateway/graph_embeddings_query.py +0 -0
  144. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/gateway/graph_embeddings_stream.py +0 -0
  145. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/gateway/internet_search.py +0 -0
  146. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/gateway/librarian.py +0 -0
  147. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/gateway/metrics.py +0 -0
  148. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/gateway/mux.py +0 -0
  149. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/gateway/prompt.py +0 -0
  150. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/gateway/running.py +0 -0
  151. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/gateway/sender.py +0 -0
  152. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/gateway/serialize.py +0 -0
  153. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/gateway/service.py +0 -0
  154. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/gateway/text_completion.py +0 -0
  155. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/gateway/text_load.py +0 -0
  156. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/gateway/triples_query.py +0 -0
  157. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/gateway/triples_stream.py +0 -0
  158. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/librarian/__init__.py +0 -0
  159. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/librarian/__main__.py +0 -0
  160. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/librarian/blob_store.py +0 -0
  161. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/librarian/librarian.py +0 -0
  162. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/librarian/service.py +0 -0
  163. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/librarian/table_store.py +0 -0
  164. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/metering/__init__.py +0 -0
  165. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/metering/__main__.py +0 -0
  166. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/metering/counter.py +0 -0
  167. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/metering/pricelist.py +0 -0
  168. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/model/__init__.py +0 -0
  169. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/model/prompt/__init__.py +0 -0
  170. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/model/prompt/generic/__init__.py +0 -0
  171. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/model/prompt/generic/__main__.py +0 -0
  172. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/model/prompt/generic/prompts.py +0 -0
  173. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/model/prompt/generic/service.py +0 -0
  174. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/model/prompt/template/__init__.py +0 -0
  175. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/model/prompt/template/__main__.py +0 -0
  176. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/model/prompt/template/prompt_manager.py +0 -0
  177. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/model/prompt/template/service.py +0 -0
  178. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/model/text_completion/__init__.py +0 -0
  179. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/model/text_completion/azure/__init__.py +0 -0
  180. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/model/text_completion/azure/__main__.py +0 -0
  181. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/model/text_completion/azure/llm.py +0 -0
  182. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/model/text_completion/azure_openai/__init__.py +0 -0
  183. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/model/text_completion/azure_openai/__main__.py +0 -0
  184. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/model/text_completion/claude/__init__.py +0 -0
  185. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/model/text_completion/claude/__main__.py +0 -0
  186. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/model/text_completion/claude/llm.py +0 -0
  187. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/model/text_completion/cohere/__init__.py +0 -0
  188. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/model/text_completion/cohere/__main__.py +0 -0
  189. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/model/text_completion/cohere/llm.py +0 -0
  190. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/model/text_completion/googleaistudio/__init__.py +0 -0
  191. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/model/text_completion/googleaistudio/__main__.py +0 -0
  192. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/model/text_completion/googleaistudio/llm.py +0 -0
  193. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/model/text_completion/llamafile/__init__.py +0 -0
  194. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/model/text_completion/llamafile/__main__.py +0 -0
  195. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/model/text_completion/llamafile/llm.py +0 -0
  196. {trustgraph-flow-0.21.4/trustgraph/model/text_completion/ollama → trustgraph-flow-0.21.6/trustgraph/model/text_completion/mistral}/__init__.py +0 -0
  197. {trustgraph-flow-0.21.4/trustgraph/model/text_completion/ollama → trustgraph-flow-0.21.6/trustgraph/model/text_completion/mistral}/__main__.py +0 -0
  198. {trustgraph-flow-0.21.4/trustgraph/model/text_completion/openai → trustgraph-flow-0.21.6/trustgraph/model/text_completion/ollama}/__init__.py +0 -0
  199. {trustgraph-flow-0.21.4/trustgraph/model/text_completion/openai → trustgraph-flow-0.21.6/trustgraph/model/text_completion/ollama}/__main__.py +0 -0
  200. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/model/text_completion/ollama/llm.py +0 -0
  201. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/model/text_completion/openai/llm.py +0 -0
  202. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/processing/__init__.py +0 -0
  203. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/processing/__main__.py +0 -0
  204. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/processing/processing.py +0 -0
  205. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/query/__init__.py +0 -0
  206. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/query/doc_embeddings/__init__.py +0 -0
  207. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/query/doc_embeddings/milvus/__init__.py +0 -0
  208. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/query/doc_embeddings/milvus/__main__.py +0 -0
  209. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/query/doc_embeddings/milvus/service.py +0 -0
  210. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/query/doc_embeddings/pinecone/__init__.py +0 -0
  211. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/query/doc_embeddings/pinecone/__main__.py +0 -0
  212. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/query/doc_embeddings/pinecone/service.py +0 -0
  213. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/query/doc_embeddings/qdrant/__init__.py +0 -0
  214. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/query/doc_embeddings/qdrant/__main__.py +0 -0
  215. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/query/doc_embeddings/qdrant/service.py +0 -0
  216. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/query/graph_embeddings/__init__.py +0 -0
  217. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/query/graph_embeddings/milvus/__init__.py +0 -0
  218. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/query/graph_embeddings/milvus/__main__.py +0 -0
  219. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/query/graph_embeddings/milvus/service.py +0 -0
  220. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/query/graph_embeddings/pinecone/__init__.py +0 -0
  221. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/query/graph_embeddings/pinecone/__main__.py +0 -0
  222. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/query/graph_embeddings/pinecone/service.py +0 -0
  223. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/query/graph_embeddings/qdrant/__init__.py +0 -0
  224. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/query/graph_embeddings/qdrant/__main__.py +0 -0
  225. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/query/graph_embeddings/qdrant/service.py +0 -0
  226. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/query/triples/__init__.py +0 -0
  227. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/query/triples/cassandra/__init__.py +0 -0
  228. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/query/triples/cassandra/__main__.py +0 -0
  229. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/query/triples/cassandra/service.py +0 -0
  230. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/query/triples/falkordb/__init__.py +0 -0
  231. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/query/triples/falkordb/__main__.py +0 -0
  232. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/query/triples/falkordb/service.py +0 -0
  233. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/query/triples/memgraph/__init__.py +0 -0
  234. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/query/triples/memgraph/__main__.py +0 -0
  235. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/query/triples/memgraph/service.py +0 -0
  236. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/query/triples/neo4j/__init__.py +0 -0
  237. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/query/triples/neo4j/__main__.py +0 -0
  238. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/query/triples/neo4j/service.py +0 -0
  239. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/retrieval/__init__.py +0 -0
  240. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/retrieval/document_rag/__init__.py +0 -0
  241. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/retrieval/document_rag/__main__.py +0 -0
  242. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/retrieval/graph_rag/__init__.py +0 -0
  243. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/retrieval/graph_rag/__main__.py +0 -0
  244. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/storage/__init__.py +0 -0
  245. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/storage/doc_embeddings/__init__.py +0 -0
  246. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/storage/doc_embeddings/milvus/__init__.py +0 -0
  247. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/storage/doc_embeddings/milvus/__main__.py +0 -0
  248. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/storage/doc_embeddings/milvus/write.py +0 -0
  249. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/storage/doc_embeddings/pinecone/__init__.py +0 -0
  250. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/storage/doc_embeddings/pinecone/__main__.py +0 -0
  251. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/storage/doc_embeddings/pinecone/write.py +0 -0
  252. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/storage/doc_embeddings/qdrant/__init__.py +0 -0
  253. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/storage/doc_embeddings/qdrant/__main__.py +0 -0
  254. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/storage/doc_embeddings/qdrant/write.py +0 -0
  255. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/storage/graph_embeddings/__init__.py +0 -0
  256. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/storage/graph_embeddings/milvus/__init__.py +0 -0
  257. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/storage/graph_embeddings/milvus/__main__.py +0 -0
  258. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/storage/graph_embeddings/milvus/write.py +0 -0
  259. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/storage/graph_embeddings/pinecone/__init__.py +0 -0
  260. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/storage/graph_embeddings/pinecone/__main__.py +0 -0
  261. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/storage/graph_embeddings/pinecone/write.py +0 -0
  262. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/storage/graph_embeddings/qdrant/__init__.py +0 -0
  263. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/storage/graph_embeddings/qdrant/__main__.py +0 -0
  264. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/storage/graph_embeddings/qdrant/write.py +0 -0
  265. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/storage/object_embeddings/__init__.py +0 -0
  266. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/storage/object_embeddings/milvus/__init__.py +0 -0
  267. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/storage/object_embeddings/milvus/__main__.py +0 -0
  268. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/storage/object_embeddings/milvus/write.py +0 -0
  269. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/storage/rows/__init__.py +0 -0
  270. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/storage/rows/cassandra/__init__.py +0 -0
  271. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/storage/rows/cassandra/__main__.py +0 -0
  272. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/storage/rows/cassandra/write.py +0 -0
  273. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/storage/triples/__init__.py +0 -0
  274. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/storage/triples/cassandra/__init__.py +0 -0
  275. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/storage/triples/cassandra/__main__.py +0 -0
  276. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/storage/triples/cassandra/write.py +0 -0
  277. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/storage/triples/falkordb/__init__.py +0 -0
  278. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/storage/triples/falkordb/__main__.py +0 -0
  279. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/storage/triples/falkordb/write.py +0 -0
  280. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/storage/triples/memgraph/__init__.py +0 -0
  281. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/storage/triples/memgraph/__main__.py +0 -0
  282. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/storage/triples/memgraph/write.py +0 -0
  283. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/storage/triples/neo4j/__init__.py +0 -0
  284. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/storage/triples/neo4j/__main__.py +0 -0
  285. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph/storage/triples/neo4j/write.py +0 -0
  286. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph_flow.egg-info/dependency_links.txt +0 -0
  287. {trustgraph-flow-0.21.4 → trustgraph-flow-0.21.6}/trustgraph_flow.egg-info/top_level.txt +0 -0
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: trustgraph-flow
3
- Version: 0.21.4
3
+ Version: 0.21.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
  Home-page: https://github.com/trustgraph-ai/trustgraph
6
- Download-URL: https://github.com/trustgraph-ai/trustgraph/archive/refs/tags/v0.21.4.tar.gz
6
+ Download-URL: https://github.com/trustgraph-ai/trustgraph/archive/refs/tags/v0.21.6.tar.gz
7
7
  Author: trustgraph.ai
8
8
  Author-email: security@trustgraph.ai
9
9
  Classifier: Programming Language :: Python :: 3
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env python3
2
+
3
+ from trustgraph.model.text_completion.mistral import run
4
+
5
+ run()
6
+
@@ -50,6 +50,7 @@ setuptools.setup(
50
50
  "langchain-core",
51
51
  "langchain-text-splitters",
52
52
  "minio",
53
+ "mistralai"
53
54
  "neo4j",
54
55
  "ollama",
55
56
  "openai",
@@ -107,6 +108,7 @@ setuptools.setup(
107
108
  "scripts/text-completion-cohere",
108
109
  "scripts/text-completion-googleaistudio",
109
110
  "scripts/text-completion-llamafile",
111
+ "scripts/text-completion-mistral",
110
112
  "scripts/text-completion-ollama",
111
113
  "scripts/text-completion-openai",
112
114
  "scripts/triples-query-cassandra",
@@ -18,11 +18,15 @@ DEFINITION="http://www.w3.org/2004/02/skos/core#definition"
18
18
 
19
19
  class Query:
20
20
 
21
- def __init__(self, rag, user, collection, verbose):
21
+ def __init__(
22
+ self, rag, user, collection, verbose,
23
+ doc_limit=20
24
+ ):
22
25
  self.rag = rag
23
26
  self.user = user
24
27
  self.collection = collection
25
28
  self.verbose = verbose
29
+ self.doc_limit = doc_limit
26
30
 
27
31
  def get_vector(self, query):
28
32
 
@@ -44,7 +48,7 @@ class Query:
44
48
  print("Get entities...", flush=True)
45
49
 
46
50
  docs = self.rag.de_client.request(
47
- vectors, limit=self.rag.doc_limit
51
+ vectors, limit=self.doc_limit
48
52
  )
49
53
 
50
54
  if self.verbose:
@@ -93,9 +97,6 @@ class DocumentRag:
93
97
  if self.verbose:
94
98
  print("Initialising...", flush=True)
95
99
 
96
- # FIXME: Configurable
97
- self.doc_limit = 20
98
-
99
100
  self.de_client = DocumentEmbeddingsClient(
100
101
  pulsar_host=pulsar_host,
101
102
  subscriber=module + "-de",
@@ -123,13 +124,17 @@ class DocumentRag:
123
124
  if self.verbose:
124
125
  print("Initialised", flush=True)
125
126
 
126
- def query(self, query, user="trustgraph", collection="default"):
127
+ def query(
128
+ self, query, user="trustgraph", collection="default",
129
+ doc_limit=20,
130
+ ):
127
131
 
128
132
  if self.verbose:
129
133
  print("Construct prompt...", flush=True)
130
134
 
131
135
  q = Query(
132
- rag=self, user=user, collection=collection, verbose=self.verbose
136
+ rag=self, user=user, collection=collection, verbose=self.verbose,
137
+ doc_limit=doc_limit
133
138
  )
134
139
 
135
140
  docs = q.get_docs(query)
@@ -0,0 +1 @@
1
+ __version__ = "0.21.6"
@@ -59,6 +59,6 @@ class DocumentEmbeddingsLoadEndpoint(SocketEndpoint):
59
59
  ],
60
60
  )
61
61
 
62
- await self.publisher.send(None, elt)
62
+ self.publisher.send(None, elt)
63
63
 
64
64
  running.stop()
@@ -23,6 +23,7 @@ class DocumentRagRequestor(ServiceRequestor):
23
23
  query=body["query"],
24
24
  user=body.get("user", "trustgraph"),
25
25
  collection=body.get("collection", "default"),
26
+ doc_limit=int(body.get("doc-limit", 20)),
26
27
  )
27
28
 
28
29
  def from_response(self, message):
@@ -36,6 +36,7 @@ class GraphEmbeddingsLoadEndpoint(SocketEndpoint):
36
36
  async def listener(self, ws, running):
37
37
 
38
38
  async for msg in ws:
39
+
39
40
  # On error, finish
40
41
  if msg.type == WSMsgType.ERROR:
41
42
  break
@@ -59,7 +60,6 @@ class GraphEmbeddingsLoadEndpoint(SocketEndpoint):
59
60
  ]
60
61
  )
61
62
 
62
- await self.publisher.send(None, elt)
63
-
63
+ self.publisher.send(None, elt)
64
64
 
65
65
  running.stop()
@@ -23,6 +23,10 @@ class GraphRagRequestor(ServiceRequestor):
23
23
  query=body["query"],
24
24
  user=body.get("user", "trustgraph"),
25
25
  collection=body.get("collection", "default"),
26
+ entity_limit=int(body.get("entity-limit", 50)),
27
+ triple_limit=int(body.get("triple-limit", 30)),
28
+ max_subgraph_size=int(body.get("max-subgraph-size", 1000)),
29
+ max_path_length=int(body.get("max-path-length", 2)),
26
30
  )
27
31
 
28
32
  def from_response(self, message):
@@ -53,11 +53,9 @@ class ServiceRequestor:
53
53
 
54
54
  q = self.sub.subscribe(id)
55
55
 
56
- print("BOUT TO SEDN")
57
56
  await asyncio.to_thread(
58
57
  self.pub.send, id, self.to_request(request)
59
58
  )
60
- print("SENT")
61
59
 
62
60
  while True:
63
61
 
@@ -19,7 +19,7 @@ class SocketEndpoint:
19
19
  self.operation = "socket"
20
20
 
21
21
  async def listener(self, ws, running):
22
-
22
+
23
23
  async for msg in ws:
24
24
  # On error, finish
25
25
  if msg.type == WSMsgType.TEXT:
@@ -53,7 +53,7 @@ class SocketEndpoint:
53
53
  try:
54
54
  await self.listener(ws, running)
55
55
  except Exception as e:
56
- print(e, flush=True)
56
+ print("Socket exception:", e, flush=True)
57
57
 
58
58
  running.stop()
59
59
 
@@ -51,7 +51,7 @@ class TriplesLoadEndpoint(SocketEndpoint):
51
51
  triples=to_subgraph(data["triples"]),
52
52
  )
53
53
 
54
- await self.publisher.send(None, elt)
54
+ self.publisher.send(None, elt)
55
55
 
56
56
 
57
57
  running.stop()
@@ -20,11 +20,19 @@ DEFINITION="http://www.w3.org/2004/02/skos/core#definition"
20
20
 
21
21
  class Query:
22
22
 
23
- def __init__(self, rag, user, collection, verbose):
23
+ def __init__(
24
+ self, rag, user, collection, verbose,
25
+ entity_limit=50, triple_limit=30, max_subgraph_size=1000,
26
+ max_path_length=2,
27
+ ):
24
28
  self.rag = rag
25
29
  self.user = user
26
30
  self.collection = collection
27
31
  self.verbose = verbose
32
+ self.entity_limit = entity_limit
33
+ self.triple_limit = triple_limit
34
+ self.max_subgraph_size = max_subgraph_size
35
+ self.max_path_length = max_path_length
28
36
 
29
37
  def get_vector(self, query):
30
38
 
@@ -47,7 +55,7 @@ class Query:
47
55
 
48
56
  entities = self.rag.ge_client.request(
49
57
  user=self.user, collection=self.collection,
50
- vectors=vectors, limit=self.rag.entity_limit,
58
+ vectors=vectors, limit=self.entity_limit,
51
59
  )
52
60
 
53
61
  entities = [
@@ -79,61 +87,66 @@ class Query:
79
87
  self.rag.label_cache[e] = res[0].o.value
80
88
  return self.rag.label_cache[e]
81
89
 
82
- def get_subgraph(self, query):
83
-
84
- entities = self.get_entities(query)
90
+ def follow_edges(self, ent, subgraph, path_length):
85
91
 
86
- subgraph = set()
92
+ # Not needed?
93
+ if path_length <= 0:
94
+ return
87
95
 
88
- if self.verbose:
89
- print("Get subgraph...", flush=True)
96
+ # Stop spanning around if the subgraph is already maxed out
97
+ if len(subgraph) >= self.max_subgraph_size:
98
+ return
90
99
 
91
- for e in entities:
100
+ res = self.rag.triples_client.request(
101
+ user=self.user, collection=self.collection,
102
+ s=ent, p=None, o=None,
103
+ limit=self.triple_limit
104
+ )
92
105
 
93
- res = self.rag.triples_client.request(
94
- user=self.user, collection=self.collection,
95
- s=e, p=None, o=None,
96
- limit=self.rag.query_limit
106
+ for triple in res:
107
+ subgraph.add(
108
+ (triple.s.value, triple.p.value, triple.o.value)
97
109
  )
110
+ if path_length > 1:
111
+ self.follow_edges(triple.o.value, subgraph, path_length-1)
98
112
 
99
- for triple in res:
100
- subgraph.add(
101
- (triple.s.value, triple.p.value, triple.o.value)
102
- )
113
+ res = self.rag.triples_client.request(
114
+ user=self.user, collection=self.collection,
115
+ s=None, p=ent, o=None,
116
+ limit=self.triple_limit
117
+ )
103
118
 
104
- res = self.rag.triples_client.request(
105
- user=self.user, collection=self.collection,
106
- s=None, p=e, o=None,
107
- limit=self.rag.query_limit
119
+ for triple in res:
120
+ subgraph.add(
121
+ (triple.s.value, triple.p.value, triple.o.value)
108
122
  )
109
123
 
110
- for triple in res:
111
- subgraph.add(
112
- (triple.s.value, triple.p.value, triple.o.value)
113
- )
124
+ res = self.rag.triples_client.request(
125
+ user=self.user, collection=self.collection,
126
+ s=None, p=None, o=ent,
127
+ limit=self.triple_limit,
128
+ )
114
129
 
115
- res = self.rag.triples_client.request(
116
- user=self.user, collection=self.collection,
117
- s=None, p=None, o=e,
118
- limit=self.rag.query_limit,
130
+ for triple in res:
131
+ subgraph.add(
132
+ (triple.s.value, triple.p.value, triple.o.value)
119
133
  )
134
+ if path_length > 1:
135
+ self.follow_edges(triple.s.value, subgraph, path_length-1)
120
136
 
121
- for triple in res:
122
- subgraph.add(
123
- (triple.s.value, triple.p.value, triple.o.value)
124
- )
125
-
126
- subgraph = list(subgraph)
137
+ def get_subgraph(self, query):
127
138
 
128
- subgraph = subgraph[0:self.rag.max_subgraph_size]
139
+ entities = self.get_entities(query)
129
140
 
130
141
  if self.verbose:
131
- print("Subgraph:", flush=True)
132
- for edge in subgraph:
133
- print(" ", str(edge), flush=True)
142
+ print("Get subgraph...", flush=True)
134
143
 
135
- if self.verbose:
136
- print("Done.", flush=True)
144
+ subgraph = set()
145
+
146
+ for ent in entities:
147
+ self.follow_edges(ent, subgraph, self.max_path_length)
148
+
149
+ subgraph = list(subgraph)
137
150
 
138
151
  return subgraph
139
152
 
@@ -154,6 +167,16 @@ class Query:
154
167
 
155
168
  sg2.append((s, p, o))
156
169
 
170
+ sg2 = sg2[0:self.max_subgraph_size]
171
+
172
+ if self.verbose:
173
+ print("Subgraph:", flush=True)
174
+ for edge in sg2:
175
+ print(" ", str(edge), flush=True)
176
+
177
+ if self.verbose:
178
+ print("Done.", flush=True)
179
+
157
180
  return sg2
158
181
 
159
182
  class GraphRag:
@@ -171,9 +194,6 @@ class GraphRag:
171
194
  tpl_request_queue=None,
172
195
  tpl_response_queue=None,
173
196
  verbose=False,
174
- entity_limit=50,
175
- triple_limit=30,
176
- max_subgraph_size=3000,
177
197
  module="test",
178
198
  ):
179
199
 
@@ -230,10 +250,6 @@ class GraphRag:
230
250
  subscriber=module + "-emb",
231
251
  )
232
252
 
233
- self.entity_limit=entity_limit
234
- self.query_limit=triple_limit
235
- self.max_subgraph_size=max_subgraph_size
236
-
237
253
  self.label_cache = {}
238
254
 
239
255
  self.prompt = PromptClient(
@@ -247,13 +263,20 @@ class GraphRag:
247
263
  if self.verbose:
248
264
  print("Initialised", flush=True)
249
265
 
250
- def query(self, query, user="trustgraph", collection="default"):
266
+ def query(
267
+ self, query, user="trustgraph", collection="default",
268
+ entity_limit=50, triple_limit=30, max_subgraph_size=1000,
269
+ max_path_length=2,
270
+ ):
251
271
 
252
272
  if self.verbose:
253
273
  print("Construct prompt...", flush=True)
254
274
 
255
275
  q = Query(
256
- rag=self, user=user, collection=collection, verbose=self.verbose
276
+ rag=self, user=user, collection=collection, verbose=self.verbose,
277
+ entity_limit=entity_limit, triple_limit=triple_limit,
278
+ max_subgraph_size=max_subgraph_size,
279
+ max_path_length=max_path_length,
257
280
  )
258
281
 
259
282
  kg = q.get_labelgraph(query)
@@ -23,9 +23,10 @@ default_output_queue = text_completion_response_queue
23
23
  default_subscriber = module
24
24
  default_temperature = 0.0
25
25
  default_max_output = 4192
26
- default_api = "2024-02-15-preview"
27
- default_endpoint = os.getenv("AZURE_ENDPOINT")
28
- default_token = os.getenv("AZURE_TOKEN")
26
+ default_api = "2024-12-01-preview"
27
+ default_endpoint = os.getenv("AZURE_ENDPOINT", None)
28
+ default_token = os.getenv("AZURE_TOKEN", None)
29
+ default_modeel = os.getenv("AZURE_MODEL", None)
29
30
 
30
31
  class Processor(ConsumerProducer):
31
32
 
@@ -34,12 +35,13 @@ class Processor(ConsumerProducer):
34
35
  input_queue = params.get("input_queue", default_input_queue)
35
36
  output_queue = params.get("output_queue", default_output_queue)
36
37
  subscriber = params.get("subscriber", default_subscriber)
37
- endpoint = params.get("endpoint", default_endpoint)
38
- token = params.get("token", default_token)
39
38
  temperature = params.get("temperature", default_temperature)
40
39
  max_output = params.get("max_output", default_max_output)
41
- model = params.get("model")
40
+
42
41
  api = params.get("api_version", default_api)
42
+ endpoint = params.get("endpoint", default_endpoint)
43
+ token = params.get("token", default_token)
44
+ model = params.get("model", default_model)
43
45
 
44
46
  if endpoint is None:
45
47
  raise RuntimeError("Azure endpoint not specified")
@@ -177,6 +179,7 @@ class Processor(ConsumerProducer):
177
179
 
178
180
  parser.add_argument(
179
181
  '-e', '--endpoint',
182
+ default=default_endpoint,
180
183
  help=f'LLM model endpoint'
181
184
  )
182
185
 
@@ -188,11 +191,13 @@ class Processor(ConsumerProducer):
188
191
 
189
192
  parser.add_argument(
190
193
  '-k', '--token',
194
+ default=default_token,
191
195
  help=f'LLM model token'
192
196
  )
193
197
 
194
198
  parser.add_argument(
195
199
  '-m', '--model',
200
+ default=default_model,
196
201
  help=f'LLM model'
197
202
  )
198
203
 
@@ -0,0 +1,201 @@
1
+
2
+ """
3
+ Simple LLM service, performs text prompt completion using Mistral.
4
+ Input is prompt, output is response.
5
+ """
6
+
7
+ from mistralai import Mistral, RateLimitError
8
+ from prometheus_client import Histogram
9
+ import os
10
+
11
+ from .... schema import TextCompletionRequest, TextCompletionResponse, Error
12
+ from .... schema import text_completion_request_queue
13
+ from .... schema import text_completion_response_queue
14
+ from .... log_level import LogLevel
15
+ from .... base import ConsumerProducer
16
+ from .... exceptions import TooManyRequests
17
+
18
+ module = ".".join(__name__.split(".")[1:-1])
19
+
20
+ default_input_queue = text_completion_request_queue
21
+ default_output_queue = text_completion_response_queue
22
+ default_subscriber = module
23
+ default_model = 'ministral-8b-latest'
24
+ default_temperature = 0.0
25
+ default_max_output = 4096
26
+ default_api_key = os.getenv("MISTRAL_TOKEN")
27
+
28
+ class Processor(ConsumerProducer):
29
+
30
+ def __init__(self, **params):
31
+
32
+ input_queue = params.get("input_queue", default_input_queue)
33
+ output_queue = params.get("output_queue", default_output_queue)
34
+ subscriber = params.get("subscriber", default_subscriber)
35
+ model = params.get("model", default_model)
36
+ api_key = params.get("api_key", default_api_key)
37
+ temperature = params.get("temperature", default_temperature)
38
+ max_output = params.get("max_output", default_max_output)
39
+
40
+ if api_key is None:
41
+ raise RuntimeError("Mistral API key not specified")
42
+
43
+ super(Processor, self).__init__(
44
+ **params | {
45
+ "input_queue": input_queue,
46
+ "output_queue": output_queue,
47
+ "subscriber": subscriber,
48
+ "input_schema": TextCompletionRequest,
49
+ "output_schema": TextCompletionResponse,
50
+ "model": model,
51
+ "temperature": temperature,
52
+ "max_output": max_output,
53
+ }
54
+ )
55
+
56
+ if not hasattr(__class__, "text_completion_metric"):
57
+ __class__.text_completion_metric = Histogram(
58
+ 'text_completion_duration',
59
+ 'Text completion duration (seconds)',
60
+ buckets=[
61
+ 0.25, 0.5, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0,
62
+ 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0,
63
+ 17.0, 18.0, 19.0, 20.0, 21.0, 22.0, 23.0, 24.0, 25.0,
64
+ 30.0, 35.0, 40.0, 45.0, 50.0, 60.0, 80.0, 100.0,
65
+ 120.0
66
+ ]
67
+ )
68
+
69
+ self.model = model
70
+ self.temperature = temperature
71
+ self.max_output = max_output
72
+ self.mistral = Mistral(api_key=api_key)
73
+
74
+ print("Initialised", flush=True)
75
+
76
+ async def handle(self, msg):
77
+
78
+ v = msg.value()
79
+
80
+ # Sender-produced ID
81
+
82
+ id = msg.properties()["id"]
83
+
84
+ print(f"Handling prompt {id}...", flush=True)
85
+
86
+ prompt = v.system + "\n\n" + v.prompt
87
+
88
+ try:
89
+
90
+ with __class__.text_completion_metric.time():
91
+
92
+ resp = self.mistral.chat.complete(
93
+ model=self.model,
94
+ messages=[
95
+ {
96
+ "role": "user",
97
+ "content": [
98
+ {
99
+ "type": "text",
100
+ "text": prompt
101
+ }
102
+ ]
103
+ }
104
+ ],
105
+ temperature=self.temperature,
106
+ max_tokens=self.max_output,
107
+ top_p=1,
108
+ frequency_penalty=0,
109
+ presence_penalty=0,
110
+ response_format={
111
+ "type": "text"
112
+ }
113
+ )
114
+
115
+ inputtokens = resp.usage.prompt_tokens
116
+ outputtokens = resp.usage.completion_tokens
117
+ print(resp.choices[0].message.content, flush=True)
118
+ print(f"Input Tokens: {inputtokens}", flush=True)
119
+ print(f"Output Tokens: {outputtokens}", flush=True)
120
+
121
+ print("Send response...", flush=True)
122
+ r = TextCompletionResponse(
123
+ response=resp.choices[0].message.content,
124
+ error=None,
125
+ in_token=inputtokens,
126
+ out_token=outputtokens,
127
+ model=self.model
128
+ )
129
+ await self.send(r, properties={"id": id})
130
+
131
+ print("Done.", flush=True)
132
+
133
+ # FIXME: Wrong exception, don't know what this LLM throws
134
+ # for a rate limit
135
+ except Mistral.RateLimitError:
136
+
137
+ # Leave rate limit retries to the base handler
138
+ raise TooManyRequests()
139
+
140
+ except Exception as e:
141
+
142
+ # Apart from rate limits, treat all exceptions as unrecoverable
143
+
144
+ print(f"Exception: {e}")
145
+
146
+ print("Send error response...", flush=True)
147
+
148
+ r = TextCompletionResponse(
149
+ error=Error(
150
+ type = "llm-error",
151
+ message = str(e),
152
+ ),
153
+ response=None,
154
+ in_token=None,
155
+ out_token=None,
156
+ model=None,
157
+ )
158
+
159
+ await self.send(r, properties={"id": id})
160
+
161
+ self.consumer.acknowledge(msg)
162
+
163
+ @staticmethod
164
+ def add_args(parser):
165
+
166
+ ConsumerProducer.add_args(
167
+ parser, default_input_queue, default_subscriber,
168
+ default_output_queue,
169
+ )
170
+
171
+ parser.add_argument(
172
+ '-m', '--model',
173
+ default=default_model,
174
+ help=f'LLM model (default: ministral-8b-latest)'
175
+ )
176
+
177
+ parser.add_argument(
178
+ '-k', '--api-key',
179
+ default=default_api_key,
180
+ help=f'Mistral API Key'
181
+ )
182
+
183
+ parser.add_argument(
184
+ '-t', '--temperature',
185
+ type=float,
186
+ default=default_temperature,
187
+ help=f'LLM temperature parameter (default: {default_temperature})'
188
+ )
189
+
190
+ parser.add_argument(
191
+ '-x', '--max-output',
192
+ type=int,
193
+ default=default_max_output,
194
+ help=f'LLM max output tokens (default: {default_max_output})'
195
+ )
196
+
197
+ def run():
198
+
199
+ Processor.launch(module, __doc__)
200
+
201
+
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env python3
2
+
3
+ from . llm import run
4
+
5
+ if __name__ == '__main__':
6
+ run()
7
+