model-compose 0.3.10__tar.gz → 0.3.12__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 (229) hide show
  1. {model_compose-0.3.10/src/model_compose.egg-info → model_compose-0.3.12}/PKG-INFO +7 -7
  2. {model_compose-0.3.10 → model_compose-0.3.12}/README.md +6 -6
  3. {model_compose-0.3.10 → model_compose-0.3.12}/pyproject.toml +1 -1
  4. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/component/base.py +13 -12
  5. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/component/component.py +9 -8
  6. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/component/context.py +3 -3
  7. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/component/services/http_client.py +33 -2
  8. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/component/services/http_server.py +34 -3
  9. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/component/services/model/tasks/image_to_text.py +3 -2
  10. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/component/services/model/tasks/summarization.py +3 -2
  11. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/component/services/model/tasks/text_classification.py +5 -6
  12. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/component/services/model/tasks/text_embedding.py +5 -6
  13. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/component/services/model/tasks/text_generation.py +3 -2
  14. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/component/services/model/tasks/translation.py +3 -2
  15. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/controller/base.py +5 -5
  16. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/controller/controller.py +2 -2
  17. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/controller/runtime/specs.py +9 -11
  18. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/controller/services/http_server.py +12 -29
  19. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/controller/services/mcp_server.py +2 -2
  20. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/controller/webui/webui.py +2 -2
  21. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/listener/services/http_callback.py +1 -1
  22. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/utils/http_client.py +26 -15
  23. model_compose-0.3.12/src/mindor/core/utils/http_response.py +25 -0
  24. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/utils/renderers.py +5 -6
  25. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/workflow/job/impl/__init__.py +2 -1
  26. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/workflow/job/impl/delay.py +4 -4
  27. model_compose-0.3.12/src/mindor/core/workflow/job/impl/filter.py +13 -0
  28. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/workflow/job/impl/if_.py +3 -3
  29. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/workflow/job/impl/random_router.py +3 -3
  30. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/workflow/job/impl/switch.py +3 -3
  31. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/workflow/schema.py +23 -23
  32. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/workflow/workflow.py +11 -10
  33. model_compose-0.3.12/src/mindor/dsl/schema/action/impl/common.py +7 -0
  34. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/action/impl/http_client.py +4 -1
  35. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/action/impl/http_server.py +4 -1
  36. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/component/impl/common.py +2 -1
  37. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/component/impl/http_client.py +7 -7
  38. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/component/impl/http_server.py +3 -3
  39. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/component/impl/mcp_client.py +3 -3
  40. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/component/impl/mcp_server.py +3 -3
  41. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/component/impl/model/impl/common.py +1 -1
  42. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/component/impl/model/impl/image_to_text.py +3 -3
  43. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/component/impl/model/impl/summarization.py +3 -3
  44. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/component/impl/model/impl/text_classification.py +3 -3
  45. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/component/impl/model/impl/text_embedding.py +3 -3
  46. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/component/impl/model/impl/text_generation.py +3 -3
  47. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/component/impl/model/impl/translation.py +3 -3
  48. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/component/impl/shell.py +4 -4
  49. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/component/impl/text_splitter.py +3 -3
  50. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/component/impl/workflow.py +3 -3
  51. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/compose.py +5 -5
  52. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/job/impl/__init__.py +1 -0
  53. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/job/impl/common.py +2 -1
  54. model_compose-0.3.12/src/mindor/dsl/schema/job/impl/filter.py +8 -0
  55. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/job/impl/if_.py +1 -1
  56. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/job/impl/switch.py +1 -1
  57. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/job/impl/types.py +1 -0
  58. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/job/job.py +2 -1
  59. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/listener/impl/http_callback.py +2 -2
  60. model_compose-0.3.12/src/mindor/dsl/schema/transport/http.py +8 -0
  61. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/workflow.py +13 -12
  62. {model_compose-0.3.10 → model_compose-0.3.12/src/model_compose.egg-info}/PKG-INFO +7 -7
  63. {model_compose-0.3.10 → model_compose-0.3.12}/src/model_compose.egg-info/SOURCES.txt +4 -0
  64. model_compose-0.3.10/src/mindor/dsl/schema/action/impl/common.py +0 -6
  65. {model_compose-0.3.10 → model_compose-0.3.12}/LICENSE +0 -0
  66. {model_compose-0.3.10 → model_compose-0.3.12}/setup.cfg +0 -0
  67. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/__init__.py +0 -0
  68. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/cli/__init__.py +0 -0
  69. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/cli/compose.py +0 -0
  70. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/__init__.py +0 -0
  71. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/component/__init__.py +0 -0
  72. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/component/services/__init__.py +0 -0
  73. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/component/services/mcp_client.py +0 -0
  74. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/component/services/mcp_server.py +0 -0
  75. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/component/services/model/__init__.py +0 -0
  76. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/component/services/model/base.py +0 -0
  77. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/component/services/model/model.py +0 -0
  78. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/component/services/model/tasks/__init__.py +0 -0
  79. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/component/services/shell.py +0 -0
  80. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/component/services/text_splitter.py +0 -0
  81. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/component/services/workflow.py +0 -0
  82. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/compose/__init__.py +0 -0
  83. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/compose/compose.py +0 -0
  84. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/compose/manager.py +0 -0
  85. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/controller/__init__.py +0 -0
  86. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/controller/runner/__init__.py +0 -0
  87. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/controller/runner/client.py +0 -0
  88. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/controller/runner/http_client.py +0 -0
  89. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/controller/runner/mcp_client.py +0 -0
  90. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/controller/runner/runner.py +0 -0
  91. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/controller/runtime/__init__.py +0 -0
  92. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/controller/runtime/docker/__init__.py +0 -0
  93. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/controller/runtime/docker/context/Dockerfile +0 -0
  94. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/controller/runtime/docker/docker.py +0 -0
  95. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/controller/runtime/native/__init__.py +0 -0
  96. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/controller/runtime/native/native.py +0 -0
  97. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/controller/services/__init__.py +0 -0
  98. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/controller/webui/__init__.py +0 -0
  99. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/controller/webui/gradio.py +0 -0
  100. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/gateway/__init__.py +0 -0
  101. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/gateway/base.py +0 -0
  102. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/gateway/gateway.py +0 -0
  103. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/gateway/services/__init__.py +0 -0
  104. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/gateway/services/http_tunnel.py +0 -0
  105. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/gateway/services/ssh_tunnel.py +0 -0
  106. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/listener/__init__.py +0 -0
  107. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/listener/base.py +0 -0
  108. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/listener/listener.py +0 -0
  109. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/listener/services/__init__.py +0 -0
  110. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/logger/__init__.py +0 -0
  111. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/logger/base.py +0 -0
  112. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/logger/logger.py +0 -0
  113. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/logger/logging.py +0 -0
  114. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/logger/services/__init__.py +0 -0
  115. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/logger/services/console.py +0 -0
  116. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/logger/services/file.py +0 -0
  117. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/runtime/__init__.py +0 -0
  118. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/runtime/docker/__init__.py +0 -0
  119. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/runtime/docker/docker.py +0 -0
  120. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/runtime/env.py +0 -0
  121. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/services/__init__.py +0 -0
  122. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/services/async_service.py +0 -0
  123. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/utils/__init__.py +0 -0
  124. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/utils/caching.py +0 -0
  125. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/utils/http_request.py +0 -0
  126. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/utils/http_status.py +0 -0
  127. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/utils/image.py +0 -0
  128. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/utils/mcp_client.py +0 -0
  129. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/utils/resolvers.py +0 -0
  130. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/utils/shell.py +0 -0
  131. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/utils/ssh_client.py +0 -0
  132. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/utils/streamer.py +0 -0
  133. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/utils/streaming.py +0 -0
  134. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/utils/time.py +0 -0
  135. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/utils/workqueue.py +0 -0
  136. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/workflow/__init__.py +0 -0
  137. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/workflow/context.py +0 -0
  138. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/workflow/job/__init__.py +0 -0
  139. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/workflow/job/base.py +0 -0
  140. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/workflow/job/impl/action.py +0 -0
  141. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/core/workflow/job/job.py +0 -0
  142. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/__init__.py +0 -0
  143. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/loader.py +0 -0
  144. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/__init__.py +0 -0
  145. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/action/__init__.py +0 -0
  146. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/action/action.py +0 -0
  147. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/action/impl/__init__.py +0 -0
  148. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/action/impl/mcp_client.py +0 -0
  149. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/action/impl/mcp_server.py +0 -0
  150. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/action/impl/model/__init__.py +0 -0
  151. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/action/impl/model/impl/__init__.py +0 -0
  152. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/action/impl/model/impl/common.py +0 -0
  153. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/action/impl/model/impl/image_to_text.py +0 -0
  154. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/action/impl/model/impl/summarization.py +0 -0
  155. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/action/impl/model/impl/text_classification.py +0 -0
  156. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/action/impl/model/impl/text_embedding.py +0 -0
  157. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/action/impl/model/impl/text_generation.py +0 -0
  158. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/action/impl/model/impl/translation.py +0 -0
  159. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/action/impl/model/model.py +0 -0
  160. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/action/impl/shell.py +0 -0
  161. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/action/impl/text_splitter.py +0 -0
  162. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/action/impl/workflow.py +0 -0
  163. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/component/__init__.py +0 -0
  164. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/component/component.py +0 -0
  165. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/component/impl/__init__.py +0 -0
  166. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/component/impl/model/__init__.py +0 -0
  167. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/component/impl/model/impl/__init__.py +0 -0
  168. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/component/impl/model/impl/types.py +0 -0
  169. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/component/impl/model/model.py +0 -0
  170. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/component/impl/types.py +0 -0
  171. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/controller/__init__.py +0 -0
  172. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/controller/controller.py +0 -0
  173. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/controller/impl/__init__.py +0 -0
  174. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/controller/impl/common.py +0 -0
  175. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/controller/impl/http_server.py +0 -0
  176. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/controller/impl/mcp_server.py +0 -0
  177. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/controller/impl/types.py +0 -0
  178. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/controller/webui/__init__.py +0 -0
  179. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/controller/webui/impl/__init__.py +0 -0
  180. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/controller/webui/impl/common.py +0 -0
  181. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/controller/webui/impl/dynamic.py +0 -0
  182. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/controller/webui/impl/gradio.py +0 -0
  183. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/controller/webui/impl/static.py +0 -0
  184. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/controller/webui/webui.py +0 -0
  185. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/gateway/__init__.py +0 -0
  186. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/gateway/gateway.py +0 -0
  187. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/gateway/impl/__init__.py +0 -0
  188. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/gateway/impl/common.py +0 -0
  189. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/gateway/impl/http_tunnel/__init__.py +0 -0
  190. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/gateway/impl/http_tunnel/http_tunnel.py +0 -0
  191. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/gateway/impl/http_tunnel/impl/__init__.py +0 -0
  192. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/gateway/impl/http_tunnel/impl/cloudflare.py +0 -0
  193. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/gateway/impl/http_tunnel/impl/common.py +0 -0
  194. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/gateway/impl/http_tunnel/impl/ngrok.py +0 -0
  195. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/gateway/impl/ssh_tunnel.py +0 -0
  196. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/gateway/impl/types.py +0 -0
  197. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/job/__init__.py +0 -0
  198. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/job/impl/action.py +0 -0
  199. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/job/impl/delay.py +0 -0
  200. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/job/impl/random_router.py +0 -0
  201. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/listener/__init__.py +0 -0
  202. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/listener/impl/__init__.py +0 -0
  203. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/listener/impl/common.py +0 -0
  204. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/listener/impl/types.py +0 -0
  205. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/listener/listener.py +0 -0
  206. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/logger/__init__.py +0 -0
  207. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/logger/impl/__init__.py +0 -0
  208. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/logger/impl/common.py +0 -0
  209. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/logger/impl/console.py +0 -0
  210. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/logger/impl/file.py +0 -0
  211. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/logger/impl/types.py +0 -0
  212. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/logger/logger.py +0 -0
  213. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/runtime/__init__.py +0 -0
  214. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/runtime/impl/__init__.py +0 -0
  215. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/runtime/impl/common.py +0 -0
  216. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/runtime/impl/docker.py +0 -0
  217. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/runtime/impl/native.py +0 -0
  218. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/runtime/impl/types.py +0 -0
  219. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/runtime/runtime.py +0 -0
  220. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/transport/__init__.py +0 -0
  221. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/schema/transport/ssh.py +0 -0
  222. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/utils/__init__.py +0 -0
  223. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/utils/annotation.py +0 -0
  224. {model_compose-0.3.10 → model_compose-0.3.12}/src/mindor/dsl/utils/enum.py +0 -0
  225. {model_compose-0.3.10 → model_compose-0.3.12}/src/model_compose.egg-info/dependency_links.txt +0 -0
  226. {model_compose-0.3.10 → model_compose-0.3.12}/src/model_compose.egg-info/entry_points.txt +0 -0
  227. {model_compose-0.3.10 → model_compose-0.3.12}/src/model_compose.egg-info/requires.txt +0 -0
  228. {model_compose-0.3.10 → model_compose-0.3.12}/src/model_compose.egg-info/top_level.txt +0 -0
  229. {model_compose-0.3.10 → model_compose-0.3.12}/tests/test_cli.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: model-compose
3
- Version: 0.3.10
3
+ Version: 0.3.12
4
4
  Summary: model-compose: Declarative AI Model and Workflow Orchestrator
5
5
  Author-email: Hanyeol Cho <hanyeol.cho@gmail.com>
6
6
  License-Expression: MIT
@@ -165,7 +165,7 @@ controller:
165
165
  port: 8081
166
166
 
167
167
  components:
168
- chatgpt:
168
+ - id: chatgpt
169
169
  type: http-client
170
170
  base_url: https://api.openai.com/v1
171
171
  path: /chat/completions
@@ -182,10 +182,10 @@ components:
182
182
  quote: ${response.choices[0].message.content}
183
183
 
184
184
  workflows:
185
- generate-quote:
185
+ - id: generate-quote
186
186
  default: true
187
187
  jobs:
188
- get-quote:
188
+ - id: get-quote
189
189
  component: chatgpt
190
190
  ```
191
191
 
@@ -302,7 +302,7 @@ controller:
302
302
  base_path: /mcp
303
303
 
304
304
  components:
305
- chatgpt:
305
+ - id: chatgpt
306
306
  type: http-client
307
307
  base_url: https://api.openai.com/v1
308
308
  path: /chat/completions
@@ -319,10 +319,10 @@ components:
319
319
  quote: ${response.choices[0].message.content}
320
320
 
321
321
  workflows:
322
- generate-quote:
322
+ - id: generate-quote
323
323
  default: true
324
324
  jobs:
325
- get-quote:
325
+ - id: get-quote
326
326
  component: chatgpt
327
327
  ```
328
328
  This configuration launches the controller as an **MCP server**, which listens on port 8080 and exposes your workflows over a **JSON-RPC API**.
@@ -136,7 +136,7 @@ controller:
136
136
  port: 8081
137
137
 
138
138
  components:
139
- chatgpt:
139
+ - id: chatgpt
140
140
  type: http-client
141
141
  base_url: https://api.openai.com/v1
142
142
  path: /chat/completions
@@ -153,10 +153,10 @@ components:
153
153
  quote: ${response.choices[0].message.content}
154
154
 
155
155
  workflows:
156
- generate-quote:
156
+ - id: generate-quote
157
157
  default: true
158
158
  jobs:
159
- get-quote:
159
+ - id: get-quote
160
160
  component: chatgpt
161
161
  ```
162
162
 
@@ -273,7 +273,7 @@ controller:
273
273
  base_path: /mcp
274
274
 
275
275
  components:
276
- chatgpt:
276
+ - id: chatgpt
277
277
  type: http-client
278
278
  base_url: https://api.openai.com/v1
279
279
  path: /chat/completions
@@ -290,10 +290,10 @@ components:
290
290
  quote: ${response.choices[0].message.content}
291
291
 
292
292
  workflows:
293
- generate-quote:
293
+ - id: generate-quote
294
294
  default: true
295
295
  jobs:
296
- get-quote:
296
+ - id: get-quote
297
297
  component: chatgpt
298
298
  ```
299
299
  This configuration launches the controller as an **MCP server**, which listens on port 8080 and exposes your workflows over a **JSON-RPC API**.
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "model-compose"
3
- version = "0.3.10"
3
+ version = "0.3.12"
4
4
  description = "model-compose: Declarative AI Model and Workflow Orchestrator"
5
5
  authors = [
6
6
  { name = "Hanyeol Cho", email = "hanyeol.cho@gmail.com" }
@@ -10,40 +10,41 @@ from mindor.core.utils.workqueue import WorkQueue
10
10
  from .context import ComponentActionContext
11
11
 
12
12
  class ActionResolver:
13
- def __init__(self, actions: Dict[str, ActionConfig]):
14
- self.actions = actions
13
+ def __init__(self, actions: List[ActionConfig]):
14
+ self.actions: List[ActionConfig] = actions
15
15
 
16
16
  def resolve(self, action_id: Optional[str]) -> Tuple[str, ActionConfig]:
17
17
  action_id = action_id or self._find_default_id(self.actions)
18
+ action = next((action for action in self.actions if action.id == action_id), None)
18
19
 
19
- if not action_id in self.actions:
20
+ if action is None:
20
21
  raise ValueError(f"Action not found: {action_id}")
21
22
 
22
- return action_id, self.actions[action_id]
23
+ return action_id, action
23
24
 
24
- def _find_default_id(self, actions: Dict[str, ActionConfig]) -> str:
25
- default_ids = [ action_id for action_id, action in actions.items() if action.default ]
25
+ def _find_default_id(self, actions: List[ActionConfig]) -> str:
26
+ default_ids = [ action.id for action in actions if action.default or action.id == "__default__" ]
26
27
 
27
28
  if len(default_ids) > 1:
28
29
  raise ValueError("Multiple actions have default: true")
29
30
 
30
- if not default_ids and "__default__" not in actions:
31
+ if not default_ids:
31
32
  raise ValueError("No default action defined.")
32
33
 
33
- return default_ids[0] if default_ids else "__default__"
34
+ return default_ids[0]
34
35
 
35
36
  class ComponentGlobalConfigs:
36
37
  def __init__(
37
38
  self,
38
- components: Dict[str, ComponentConfig],
39
+ components: List[ComponentConfig],
39
40
  listeners: List[ListenerConfig],
40
41
  gateways: List[GatewayConfig],
41
- workflows: Dict[str, WorkflowConfig]
42
+ workflows: List[WorkflowConfig]
42
43
  ):
43
- self.components: Dict[str, ComponentConfig] = components
44
+ self.components: List[ComponentConfig] = components
44
45
  self.listeners: List[ListenerConfig] = listeners
45
46
  self.gateways: List[GatewayConfig] = gateways
46
- self.workflows: Dict[str, WorkflowConfig] = workflows
47
+ self.workflows: List[WorkflowConfig] = workflows
47
48
 
48
49
  class ComponentService(AsyncService):
49
50
  def __init__(self, id: str, config: ComponentConfig, global_configs: ComponentGlobalConfigs, daemon: bool):
@@ -5,27 +5,28 @@ from .base import ComponentService, ComponentGlobalConfigs, ComponentRegistry
5
5
  ComponentInstances: Dict[str, ComponentService] = {}
6
6
 
7
7
  class ComponentResolver:
8
- def __init__(self, components: Dict[str, ComponentConfig]):
9
- self.components: Dict[str, ComponentConfig] = components
8
+ def __init__(self, components: List[ComponentConfig]):
9
+ self.components: List[ComponentConfig] = components
10
10
 
11
11
  def resolve(self, component_id: Optional[str]) -> Tuple[str, ComponentConfig]:
12
12
  component_id = component_id or self._find_default_id(self.components)
13
+ component = next((component for component in self.components if component.id == component_id), None)
13
14
 
14
- if not component_id in self.components:
15
+ if component is None:
15
16
  raise ValueError(f"Component not found: {component_id}")
16
17
 
17
- return component_id, self.components[component_id]
18
+ return component_id, component
18
19
 
19
- def _find_default_id(self, components: Dict[str, ComponentConfig]) -> str:
20
- default_ids = [ component_id for component_id, component in components.items() if component.default ]
20
+ def _find_default_id(self, components: List[ComponentConfig]) -> str:
21
+ default_ids = [ component.id for component in components if component.default or component.id == "__default__" ]
21
22
 
22
23
  if len(default_ids) > 1:
23
24
  raise ValueError("Multiple components have default: true")
24
25
 
25
- if not default_ids and "__default__" not in components:
26
+ if not default_ids:
26
27
  raise ValueError("No default component defined.")
27
28
 
28
- return default_ids[0] if default_ids else "__default__"
29
+ return default_ids[0]
29
30
 
30
31
  def create_component(id: str, config: ComponentConfig, global_configs: ComponentGlobalConfigs, daemon: bool) -> ComponentService:
31
32
  try:
@@ -13,15 +13,15 @@ class ComponentActionContext:
13
13
  def register_source(self, key: str, source: Any) -> None:
14
14
  self.sources[key] = source
15
15
 
16
- def has_reference(self, key: str, value: Any) -> bool:
17
- return self.renderer.has_reference(key, value)
18
-
19
16
  async def render_variable(self, value: Any, ignore_files: bool = False) -> Any:
20
17
  return await self.renderer.render(value, ignore_files)
21
18
 
22
19
  async def render_image(self, value: Any) -> Any:
23
20
  return await ImageValueRenderer().render(await self.render_variable(value))
24
21
 
22
+ def contains_variable_reference(self, key: str, value: Any) -> bool:
23
+ return self.renderer.contains_reference(key, value)
24
+
25
25
  async def _resolve_source(self, key: str, index: Optional[int]) -> Any:
26
26
  if key in self.sources:
27
27
  return self.sources[key][index] if index is not None else self.sources[key]
@@ -2,14 +2,15 @@ from typing import Type, Union, Literal, Optional, Dict, List, Tuple, Set, Annot
2
2
  from abc import ABC, abstractmethod
3
3
  from mindor.dsl.schema.component import HttpClientComponentConfig
4
4
  from mindor.dsl.schema.action import ActionConfig, HttpClientActionConfig, HttpClientCompletionType, HttpClientCompletionConfig
5
+ from mindor.dsl.schema.transport.http import HttpStreamFormat
5
6
  from mindor.core.listener import HttpCallbackListener
6
- from mindor.core.utils.http_client import HttpClient
7
+ from mindor.core.utils.http_client import HttpClient, HttpEventStreamResource
7
8
  from mindor.core.utils.http_status import is_status_code_matched
8
9
  from mindor.core.utils.time import parse_duration
9
10
  from ..base import ComponentService, ComponentType, ComponentGlobalConfigs, register_component
10
11
  from ..context import ComponentActionContext
11
12
  from datetime import datetime, timezone
12
- import asyncio
13
+ import asyncio, json
13
14
 
14
15
  class HttpClientCompletion(ABC):
15
16
  def __init__(self, config: HttpClientCompletionConfig):
@@ -94,10 +95,28 @@ class HttpClientAction:
94
95
  headers = await context.render_variable(self.config.headers)
95
96
 
96
97
  response, result = await client.request(url_or_path, method, params, body, headers), None
98
+
99
+ if isinstance(response, HttpEventStreamResource) and context.contains_variable_reference("response[]", self.config.output):
100
+ async def _stream_generator(stream: HttpEventStreamResource):
101
+ async for chunk in stream:
102
+ context.register_source("response[]", self._convert_stream_chunk(chunk))
103
+ yield await context.render_variable(self.config.output, ignore_files=True)
104
+
105
+ return _stream_generator(response)
106
+
97
107
  context.register_source("response", response)
98
108
 
99
109
  if self.completion:
100
110
  result = await self.completion.run(context, client)
111
+
112
+ if isinstance(result, HttpEventStreamResource) and context.contains_variable_reference("result[]", self.config.output):
113
+ async def _stream_generator(stream: HttpEventStreamResource):
114
+ async for chunk in stream:
115
+ context.register_source("result[]", self._convert_stream_chunk(chunk))
116
+ yield await context.render_variable(self.config.output, ignore_files=True)
117
+
118
+ return _stream_generator(result)
119
+
101
120
  context.register_source("result", result)
102
121
 
103
122
  return (await context.render_variable(self.config.output, ignore_files=True)) if self.config.output else (result or response)
@@ -108,6 +127,18 @@ class HttpClientAction:
108
127
 
109
128
  return await context.render_variable(self.config.endpoint)
110
129
 
130
+ def _convert_stream_chunk(self, chunk: bytes) -> Any:
131
+ if self.config.stream_format == HttpStreamFormat.JSON:
132
+ try:
133
+ return json.loads(chunk)
134
+ except:
135
+ return None
136
+
137
+ if self.config.stream_format == HttpStreamFormat.TEXT:
138
+ return chunk.decode("utf-8", errors="replace")
139
+
140
+ return chunk
141
+
111
142
  @register_component(ComponentType.HTTP_CLIENT)
112
143
  class HttpClientComponent(ComponentService):
113
144
  def __init__(self, id: str, config: HttpClientComponentConfig, global_configs: ComponentGlobalConfigs, daemon: bool):
@@ -2,15 +2,16 @@ from typing import Type, Union, Literal, Optional, Dict, List, Tuple, Set, Annot
2
2
  from abc import ABC, abstractmethod
3
3
  from mindor.dsl.schema.component import HttpServerComponentConfig
4
4
  from mindor.dsl.schema.action import ActionConfig, HttpServerActionConfig, HttpServerCompletionType, HttpServerCompletionConfig
5
+ from mindor.dsl.schema.transport.http import HttpStreamFormat
5
6
  from mindor.core.listener import HttpCallbackListener
6
- from mindor.core.utils.http_client import HttpClient
7
+ from mindor.core.utils.http_client import HttpClient, HttpEventStreamResource
7
8
  from mindor.core.utils.http_status import is_status_code_matched
8
9
  from mindor.core.utils.time import parse_duration
9
10
  from mindor.core.utils.shell import run_command_streaming
10
11
  from ..base import ComponentService, ComponentType, ComponentGlobalConfigs, register_component
11
12
  from ..context import ComponentActionContext
12
13
  from datetime import datetime, timezone
13
- import asyncio
14
+ import asyncio, json
14
15
 
15
16
  class HttpServerCompletion(ABC):
16
17
  def __init__(self, config: HttpServerCompletionConfig):
@@ -56,7 +57,7 @@ class HttpServerPollingCompletion(HttpServerCompletion):
56
57
 
57
58
  class HttpServerCallbackCompletion(HttpServerCompletion):
58
59
  async def run(self, context: ComponentActionContext, client: HttpClient) -> Any:
59
- callback_id = await context.render_variable(self.config.wait_for)
60
+ callback_id = await context.render_variable(self.config.wait_for) if self.config.wait_for else "__default__"
60
61
  future: asyncio.Future = asyncio.get_running_loop().create_future()
61
62
  HttpCallbackListener.register_pending_future(callback_id, future)
62
63
 
@@ -89,14 +90,44 @@ class HttpServerAction:
89
90
  headers = await context.render_variable(self.config.headers)
90
91
 
91
92
  response, result = await client.request(path or "", method, params, body, headers), None
93
+
94
+ if isinstance(response, HttpEventStreamResource) and context.contains_variable_reference("response[]", self.config.output):
95
+ async def _stream_generator(stream: HttpEventStreamResource):
96
+ async for chunk in stream:
97
+ context.register_source("response[]", self._convert_stream_chunk(chunk))
98
+ yield await context.render_variable(self.config.output, ignore_files=True)
99
+
100
+ return _stream_generator(response)
101
+
92
102
  context.register_source("response", response)
93
103
 
94
104
  if self.completion:
95
105
  result = await self.completion.run(context, client)
106
+
107
+ if isinstance(result, HttpEventStreamResource) and context.contains_variable_reference("result[]", self.config.output):
108
+ async def _stream_generator(stream: HttpEventStreamResource):
109
+ async for chunk in stream:
110
+ context.register_source("result[]", self._convert_stream_chunk(chunk))
111
+ yield await context.render_variable(self.config.output, ignore_files=True)
112
+
113
+ return _stream_generator(result)
114
+
96
115
  context.register_source("result", result)
97
116
 
98
117
  return (await context.render_variable(self.config.output, ignore_files=True)) if self.config.output else (result or response)
99
118
 
119
+ def _convert_stream_chunk(self, chunk: bytes) -> Any:
120
+ if self.config.stream_format == HttpStreamFormat.JSON:
121
+ try:
122
+ return json.loads(chunk)
123
+ except:
124
+ return None
125
+
126
+ if self.config.stream_format == HttpStreamFormat.TEXT:
127
+ return chunk.decode("utf-8", errors="replace")
128
+
129
+ return chunk
130
+
100
131
  @register_component(ComponentType.HTTP_SERVER)
101
132
  class HttpServerComponent(ComponentService):
102
133
  def __init__(self, id: str, config: HttpServerComponentConfig, global_configs: ComponentGlobalConfigs, daemon: bool):
@@ -63,8 +63,9 @@ class ImageToTextTaskAction:
63
63
  if stream:
64
64
  async def _stream_generator():
65
65
  async for chunk in AsyncStreamer(streamer, loop):
66
- context.register_source("result", chunk)
67
- yield (await context.render_variable(self.config.output, ignore_files=True)) if self.config.output else chunk
66
+ if chunk:
67
+ context.register_source("result[]", chunk)
68
+ yield (await context.render_variable(self.config.output, ignore_files=True)) if self.config.output else chunk
68
69
 
69
70
  return _stream_generator()
70
71
  else:
@@ -75,8 +75,9 @@ class SummarizationTaskAction:
75
75
  if stream:
76
76
  async def _stream_generator():
77
77
  async for chunk in AsyncStreamer(streamer, loop):
78
- context.register_source("result", chunk)
79
- yield (await context.render_variable(self.config.output, ignore_files=True)) if self.config.output else chunk
78
+ if chunk:
79
+ context.register_source("result[]", chunk)
80
+ yield (await context.render_variable(self.config.output, ignore_files=True)) if self.config.output else chunk
80
81
 
81
82
  return _stream_generator()
82
83
  else:
@@ -1,7 +1,6 @@
1
1
  from typing import Type, Union, Literal, Optional, Dict, List, Tuple, Set, Annotated, Any
2
2
  from mindor.dsl.schema.component import ModelComponentConfig
3
3
  from mindor.dsl.schema.action import ModelActionConfig, TextClassificationModelActionConfig
4
- from mindor.core.utils.streamer import AsyncStreamer
5
4
  from mindor.core.logger import logging
6
5
  from ..base import ModelTaskService, ModelTaskType, register_model_task_service
7
6
  from ..base import ComponentActionContext
@@ -26,7 +25,7 @@ class TextClassificationTaskAction:
26
25
  stream = await context.render_variable(self.config.stream)
27
26
 
28
27
  is_single_input: bool = True if not isinstance(text, list) else False
29
- has_iterable_result: bool = context.has_reference("result[]", self.config.output)
28
+ is_output_array_mode: bool = context.contains_variable_reference("result[]", self.config.output)
30
29
  texts: List[str] = [ text ] if is_single_input else text
31
30
  results = []
32
31
 
@@ -38,7 +37,7 @@ class TextClassificationTaskAction:
38
37
 
39
38
  with torch.inference_mode():
40
39
  outputs: SequenceClassifierOutput = self.model(**inputs)
41
- logits = outputs.logits # shape: (batch_size, num_classes)
40
+ logits = outputs.logits # shape: (batch_size, num_classes)
42
41
  predictions = []
43
42
 
44
43
  if return_probabilities:
@@ -54,7 +53,7 @@ class TextClassificationTaskAction:
54
53
  for predicted_index in predicted_indices:
55
54
  predictions.append(labels[predicted_index] if labels else predicted_index)
56
55
 
57
- if self.config.output and has_iterable_result:
56
+ if self.config.output and is_output_array_mode:
58
57
  rendered_outputs = []
59
58
  for prediction in predictions:
60
59
  context.register_source("result[]", prediction)
@@ -67,7 +66,7 @@ class TextClassificationTaskAction:
67
66
  if stream:
68
67
  async def _stream_generator():
69
68
  async for predictions in _predict():
70
- if not has_iterable_result:
69
+ if not is_output_array_mode:
71
70
  for prediction in predictions:
72
71
  context.register_source("result", prediction)
73
72
  yield (await context.render_variable(self.config.output, ignore_files=True)) if self.config.output else result
@@ -80,7 +79,7 @@ class TextClassificationTaskAction:
80
79
  async for predictions in _predict():
81
80
  results.extend(predictions)
82
81
 
83
- if not has_iterable_result:
82
+ if not is_output_array_mode:
84
83
  result = results[0] if is_single_input else results
85
84
  context.register_source("result", result)
86
85
 
@@ -1,7 +1,6 @@
1
1
  from typing import Type, Union, Literal, Optional, Dict, List, Tuple, Set, Annotated, Any
2
2
  from mindor.dsl.schema.component import ModelComponentConfig
3
3
  from mindor.dsl.schema.action import ModelActionConfig, TextEmbeddingModelActionConfig
4
- from mindor.core.utils.streamer import AsyncStreamer
5
4
  from mindor.core.logger import logging
6
5
  from ..base import ModelTaskService, ModelTaskType, register_model_task_service
7
6
  from ..base import ComponentActionContext
@@ -27,7 +26,7 @@ class TextEmbeddingTaskAction:
27
26
  stream = await context.render_variable(self.config.stream)
28
27
 
29
28
  is_single_input: bool = True if not isinstance(text, list) else False
30
- has_iterable_result: bool = context.has_reference("result[]", self.config.output)
29
+ is_output_array_mode: bool = context.contains_variable_reference("result[]", self.config.output)
31
30
  texts: List[str] = [ text ] if is_single_input else text
32
31
  results = []
33
32
 
@@ -39,7 +38,7 @@ class TextEmbeddingTaskAction:
39
38
 
40
39
  with torch.inference_mode():
41
40
  outputs: BaseModelOutput = self.model(**inputs)
42
- last_hidden_state = outputs.last_hidden_state # (batch_size, seq_len, hidden_size)
41
+ last_hidden_state = outputs.last_hidden_state # (batch_size, seq_len, hidden_size)
43
42
 
44
43
  attention_mask = inputs.get("attention_mask", None)
45
44
  embeddings = self._pool_hidden_state(last_hidden_state, attention_mask, pooling)
@@ -49,7 +48,7 @@ class TextEmbeddingTaskAction:
49
48
 
50
49
  embeddings = embeddings.cpu().tolist()
51
50
 
52
- if self.config.output and has_iterable_result:
51
+ if self.config.output and is_output_array_mode:
53
52
  rendered_outputs = []
54
53
  for embedding in embeddings:
55
54
  context.register_source("result[]", embedding)
@@ -62,7 +61,7 @@ class TextEmbeddingTaskAction:
62
61
  if stream:
63
62
  async def _stream_generator():
64
63
  async for embeddings in _embed():
65
- if not has_iterable_result:
64
+ if not is_output_array_mode:
66
65
  for embedding in embeddings:
67
66
  context.register_source("result", embedding)
68
67
  yield (await context.render_variable(self.config.output, ignore_files=True)) if self.config.output else result
@@ -75,7 +74,7 @@ class TextEmbeddingTaskAction:
75
74
  async for embeddings in _embed():
76
75
  results.extend(embeddings)
77
76
 
78
- if not has_iterable_result:
77
+ if not is_output_array_mode:
79
78
  result = results[0] if is_single_input else results
80
79
  context.register_source("result", result)
81
80
 
@@ -67,8 +67,9 @@ class TextGenerationTaskAction:
67
67
  if stream:
68
68
  async def _stream_generator():
69
69
  async for chunk in AsyncStreamer(streamer, loop):
70
- context.register_source("result", chunk)
71
- yield (await context.render_variable(self.config.output, ignore_files=True)) if self.config.output else chunk
70
+ if chunk:
71
+ context.register_source("result[]", chunk)
72
+ yield (await context.render_variable(self.config.output, ignore_files=True)) if self.config.output else chunk
72
73
 
73
74
  return _stream_generator()
74
75
  else:
@@ -75,8 +75,9 @@ class TranslationTaskAction:
75
75
  if stream:
76
76
  async def _stream_generator():
77
77
  async for chunk in AsyncStreamer(streamer, loop):
78
- context.register_source("result", chunk)
79
- yield (await context.render_variable(self.config.output, ignore_files=True)) if self.config.output else chunk
78
+ if chunk:
79
+ context.register_source("result[]", chunk)
80
+ yield (await context.render_variable(self.config.output, ignore_files=True)) if self.config.output else chunk
80
81
 
81
82
  return _stream_generator()
82
83
  else:
@@ -42,8 +42,8 @@ class ControllerService(AsyncService):
42
42
  def __init__(
43
43
  self,
44
44
  config: ControllerConfig,
45
- workflows: Dict[str, WorkflowConfig],
46
- components: Dict[str, ComponentConfig],
45
+ workflows: List[WorkflowConfig],
46
+ components: List[ComponentConfig],
47
47
  listeners: List[ListenerConfig],
48
48
  gateways: List[GatewayConfig],
49
49
  loggers: List[LoggerConfig],
@@ -52,8 +52,8 @@ class ControllerService(AsyncService):
52
52
  super().__init__(daemon)
53
53
 
54
54
  self.config: ControllerConfig = config
55
- self.workflows: Dict[str, WorkflowConfig] = workflows
56
- self.components: Dict[str, ComponentConfig] = components
55
+ self.workflows: List[WorkflowConfig] = workflows
56
+ self.components: List[ComponentConfig] = components
57
57
  self.listeners: List[ListenerConfig] = listeners
58
58
  self.gateways: List[GatewayConfig] = gateways
59
59
  self.loggers: List[LoggerConfig] = loggers
@@ -233,7 +233,7 @@ class ControllerService(AsyncService):
233
233
 
234
234
  def _create_components(self) -> List[ComponentService]:
235
235
  global_configs = self._get_component_global_configs()
236
- return [ create_component(component_id, config, global_configs, self.daemon) for component_id, config in self.components.items() ]
236
+ return [ create_component(component.id, component, global_configs, self.daemon) for component in self.components ]
237
237
 
238
238
  def _create_loggers(self) -> List[LoggerService]:
239
239
  return [ create_logger(f"logger-{index}", config, self.daemon) for index, config in enumerate(self.loggers or [ self._get_default_logger_config() ]) ]
@@ -9,8 +9,8 @@ from .base import ControllerService, ControllerRegistry, TaskStatus
9
9
 
10
10
  def create_controller(
11
11
  config: ControllerConfig,
12
- workflows: Dict[str, WorkflowConfig],
13
- components: Dict[str, ComponentConfig],
12
+ workflows: List[WorkflowConfig],
13
+ components: List[ComponentConfig],
14
14
  listeners: List[ListenerConfig],
15
15
  gateways: List[GatewayConfig],
16
16
  loggers: List[LoggerConfig],
@@ -11,22 +11,21 @@ class ControllerRuntimeSpecs:
11
11
  def __init__(
12
12
  self,
13
13
  controller: ControllerConfig,
14
- components: Dict[str, ComponentConfig],
14
+ components: List[ComponentConfig],
15
15
  listeners: List[ListenerConfig],
16
16
  gateways: List[GatewayConfig],
17
- workflows: Dict[str, WorkflowConfig]
17
+ workflows: List[WorkflowConfig]
18
18
  ):
19
19
  self.controller: ControllerConfig = controller
20
- self.components: Dict[str, ComponentConfig] = components
20
+ self.components: List[ComponentConfig] = components
21
21
  self.listeners: List[ListenerConfig] = listeners
22
22
  self.gateways: List[GatewayConfig] = gateways
23
- self.workflows: Dict[str, WorkflowConfig] = workflows
23
+ self.workflows: List[WorkflowConfig] = workflows
24
24
 
25
25
  def generate_native_runtime_specs(self) -> Dict[str, Any]:
26
26
  specs: Dict[str, Any] = {}
27
27
 
28
- specs["controller"] = self.controller.model_dump()
29
- specs["controller"]["runtime"] = "native"
28
+ specs["controller"] = { **self.controller.model_dump(), "runtime": "native" }
30
29
 
31
30
  if getattr(self.controller.webui, "server_dir", None):
32
31
  specs["controller"]["webui"]["server_dir"] = "webui/server"
@@ -34,13 +33,12 @@ class ControllerRuntimeSpecs:
34
33
  if getattr(self.controller.webui, "static_dir", None):
35
34
  specs["controller"]["webui"]["static_dir"] = "webui/static"
36
35
 
37
- specs["components"] = {}
38
- for id, component in self.components.items():
39
- specs["components"][id] = component.model_dump()
40
- specs["components"][id]["runtime"] = "native"
36
+ specs["components"] = [
37
+ { **component.model_dump(), "runtime": "native" } for component in self.components
38
+ ]
41
39
 
42
40
  specs["listeners"] = [ listener.model_dump() for listener in self.listeners ]
43
41
  specs["gateways" ] = [ gateway.model_dump() for gateway in self.gateways ]
44
- specs["workflows"] = { id: workflow.model_dump() for id, workflow in self.workflows.items() }
42
+ specs["workflows"] = [ workflow.model_dump() for workflow in self.workflows ]
45
43
 
46
44
  return enum_union_to_str(specs)