waldiez 0.4.8__tar.gz → 0.4.11__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.

Potentially problematic release.


This version of waldiez might be problematic. Click here for more details.

Files changed (212) hide show
  1. {waldiez-0.4.8 → waldiez-0.4.11}/.gitignore +1 -0
  2. {waldiez-0.4.8 → waldiez-0.4.11}/PKG-INFO +11 -11
  3. {waldiez-0.4.8 → waldiez-0.4.11}/pyproject.toml +14 -11
  4. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/__init__.py +1 -2
  5. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/_version.py +1 -1
  6. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/cli.py +90 -96
  7. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporter.py +64 -9
  8. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/agent/extras/rag/chroma_extras.py +21 -9
  9. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/core/context.py +12 -0
  10. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/core/extras/flow_extras.py +2 -14
  11. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/core/types.py +21 -0
  12. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/flow/exporter.py +4 -0
  13. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/flow/factory.py +16 -0
  14. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/flow/orchestrator.py +12 -0
  15. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/flow/utils/__init__.py +2 -0
  16. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/flow/utils/common.py +96 -2
  17. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/flow/utils/logging.py +5 -6
  18. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/io/mqtt.py +7 -3
  19. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/io/structured.py +26 -2
  20. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/models/common/method_utils.py +1 -1
  21. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/models/tool/tool.py +2 -1
  22. waldiez-0.4.11/waldiez/runner.py +496 -0
  23. waldiez-0.4.11/waldiez/running/__init__.py +13 -0
  24. waldiez-0.4.11/waldiez/running/base_runner.py +907 -0
  25. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/running/environment.py +74 -0
  26. waldiez-0.4.11/waldiez/running/import_runner.py +424 -0
  27. waldiez-0.4.11/waldiez/running/patch_io_stream.py +208 -0
  28. waldiez-0.4.11/waldiez/running/post_run.py +121 -0
  29. waldiez-0.4.11/waldiez/running/pre_run.py +105 -0
  30. waldiez-0.4.11/waldiez/running/protocol.py +281 -0
  31. waldiez-0.4.11/waldiez/running/run_results.py +22 -0
  32. waldiez-0.4.11/waldiez/running/subprocess_runner.py +100 -0
  33. waldiez-0.4.11/waldiez/running/utils.py +134 -0
  34. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/utils/__init__.py +2 -2
  35. waldiez-0.4.11/waldiez/utils/version.py +49 -0
  36. waldiez-0.4.8/waldiez/runner.py +0 -426
  37. waldiez-0.4.8/waldiez/running/__init__.py +0 -35
  38. waldiez-0.4.8/waldiez/running/running.py +0 -388
  39. waldiez-0.4.8/waldiez/utils/flaml_warnings.py +0 -17
  40. {waldiez-0.4.8 → waldiez-0.4.11}/LICENSE +0 -0
  41. {waldiez-0.4.8 → waldiez-0.4.11}/NOTICE.md +0 -0
  42. {waldiez-0.4.8 → waldiez-0.4.11}/README.md +0 -0
  43. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/__main__.py +0 -0
  44. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/__init__.py +0 -0
  45. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/agent/__init__.py +0 -0
  46. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/agent/code_execution.py +0 -0
  47. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/agent/exporter.py +0 -0
  48. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/agent/extras/__init__.py +0 -0
  49. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/agent/extras/captain_agent_extras.py +0 -0
  50. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/agent/extras/group/target.py +0 -0
  51. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/agent/extras/group_manager_agent_extas.py +0 -0
  52. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/agent/extras/group_member_extras.py +0 -0
  53. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/agent/extras/handoffs/__init__.py +0 -0
  54. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/agent/extras/handoffs/after_work.py +0 -0
  55. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/agent/extras/handoffs/available.py +0 -0
  56. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/agent/extras/handoffs/condition.py +0 -0
  57. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/agent/extras/handoffs/handoff.py +0 -0
  58. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/agent/extras/handoffs/target.py +0 -0
  59. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/agent/extras/rag/__init__.py +0 -0
  60. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/agent/extras/rag/mongo_extras.py +0 -0
  61. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/agent/extras/rag/pgvector_extras.py +0 -0
  62. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/agent/extras/rag/qdrant_extras.py +0 -0
  63. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/agent/extras/rag/vector_db_extras.py +0 -0
  64. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/agent/extras/rag_user_proxy_agent_extras.py +0 -0
  65. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/agent/extras/reasoning_agent_extras.py +0 -0
  66. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/agent/factory.py +0 -0
  67. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/agent/processor.py +0 -0
  68. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/agent/system_message.py +0 -0
  69. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/agent/termination.py +0 -0
  70. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/chats/__init__.py +0 -0
  71. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/chats/exporter.py +0 -0
  72. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/chats/factory.py +0 -0
  73. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/chats/processor.py +0 -0
  74. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/chats/utils/__init__.py +0 -0
  75. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/chats/utils/common.py +0 -0
  76. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/chats/utils/group.py +0 -0
  77. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/chats/utils/nested.py +0 -0
  78. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/chats/utils/sequential.py +0 -0
  79. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/chats/utils/single.py +0 -0
  80. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/core/__init__.py +0 -0
  81. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/core/constants.py +0 -0
  82. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/core/content.py +0 -0
  83. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/core/enums.py +0 -0
  84. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/core/errors.py +0 -0
  85. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/core/exporter.py +0 -0
  86. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/core/exporters.py +0 -0
  87. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/core/extras/__init__.py +0 -0
  88. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/core/extras/agent_extras/__init__.py +0 -0
  89. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/core/extras/agent_extras/captain_extras.py +0 -0
  90. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/core/extras/agent_extras/group_manager_extras.py +0 -0
  91. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/core/extras/agent_extras/rag_user_extras.py +0 -0
  92. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/core/extras/agent_extras/reasoning_extras.py +0 -0
  93. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/core/extras/agent_extras/standard_extras.py +0 -0
  94. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/core/extras/base.py +0 -0
  95. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/core/extras/chat_extras.py +0 -0
  96. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/core/extras/model_extras.py +0 -0
  97. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/core/extras/path_resolver.py +0 -0
  98. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/core/extras/serializer.py +0 -0
  99. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/core/extras/tool_extras.py +0 -0
  100. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/core/protocols.py +0 -0
  101. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/core/result.py +0 -0
  102. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/core/utils/__init__.py +0 -0
  103. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/core/utils/comment.py +0 -0
  104. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/core/utils/llm_config.py +0 -0
  105. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/core/validation.py +0 -0
  106. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/flow/__init__.py +0 -0
  107. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/flow/execution_generator.py +0 -0
  108. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/flow/file_generator.py +0 -0
  109. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/flow/merger.py +0 -0
  110. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/flow/utils/importing.py +0 -0
  111. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/flow/utils/linting.py +0 -0
  112. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/models/__init__.py +0 -0
  113. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/models/exporter.py +0 -0
  114. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/models/factory.py +0 -0
  115. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/models/processor.py +0 -0
  116. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/tools/__init__.py +0 -0
  117. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/tools/exporter.py +0 -0
  118. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/tools/factory.py +0 -0
  119. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/tools/processor.py +0 -0
  120. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/exporting/tools/registration.py +0 -0
  121. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/io/__init__.py +0 -0
  122. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/io/_ws.py +0 -0
  123. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/io/models/__init__.py +0 -0
  124. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/io/models/base.py +0 -0
  125. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/io/models/constants.py +0 -0
  126. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/io/models/content/__init__.py +0 -0
  127. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/io/models/content/audio.py +0 -0
  128. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/io/models/content/base.py +0 -0
  129. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/io/models/content/file.py +0 -0
  130. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/io/models/content/image.py +0 -0
  131. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/io/models/content/text.py +0 -0
  132. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/io/models/content/video.py +0 -0
  133. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/io/models/user_input.py +0 -0
  134. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/io/models/user_response.py +0 -0
  135. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/io/redis.py +0 -0
  136. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/io/utils.py +0 -0
  137. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/io/ws.py +0 -0
  138. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/logger.py +0 -0
  139. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/models/__init__.py +0 -0
  140. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/models/agents/__init__.py +0 -0
  141. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/models/agents/agent/__init__.py +0 -0
  142. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/models/agents/agent/agent.py +0 -0
  143. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/models/agents/agent/agent_data.py +0 -0
  144. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/models/agents/agent/agent_type.py +0 -0
  145. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/models/agents/agent/code_execution.py +0 -0
  146. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/models/agents/agent/human_input_mode.py +0 -0
  147. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/models/agents/agent/linked_tool.py +0 -0
  148. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/models/agents/agent/nested_chat.py +0 -0
  149. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/models/agents/agent/termination_message.py +0 -0
  150. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/models/agents/agent/update_system_message.py +0 -0
  151. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/models/agents/agents.py +0 -0
  152. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/models/agents/assistant/__init__.py +0 -0
  153. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/models/agents/assistant/assistant.py +0 -0
  154. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/models/agents/assistant/assistant_data.py +0 -0
  155. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/models/agents/captain/__init__.py +0 -0
  156. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/models/agents/captain/captain_agent.py +0 -0
  157. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/models/agents/captain/captain_agent_data.py +0 -0
  158. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/models/agents/captain/captain_agent_lib_entry.py +0 -0
  159. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/models/agents/extra_requirements.py +0 -0
  160. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/models/agents/group_manager/__init__.py +0 -0
  161. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/models/agents/group_manager/group_manager.py +0 -0
  162. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/models/agents/group_manager/group_manager_data.py +0 -0
  163. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/models/agents/group_manager/speakers.py +0 -0
  164. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/models/agents/rag_user_proxy/__init__.py +0 -0
  165. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/models/agents/rag_user_proxy/rag_user_proxy.py +0 -0
  166. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/models/agents/rag_user_proxy/rag_user_proxy_data.py +0 -0
  167. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/models/agents/rag_user_proxy/retrieve_config.py +0 -0
  168. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/models/agents/rag_user_proxy/vector_db_config.py +0 -0
  169. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/models/agents/reasoning/__init__.py +0 -0
  170. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/models/agents/reasoning/reasoning_agent.py +0 -0
  171. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/models/agents/reasoning/reasoning_agent_data.py +0 -0
  172. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/models/agents/reasoning/reasoning_agent_reason_config.py +0 -0
  173. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/models/agents/user_proxy/__init__.py +0 -0
  174. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/models/agents/user_proxy/user_proxy.py +0 -0
  175. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/models/agents/user_proxy/user_proxy_data.py +0 -0
  176. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/models/chat/__init__.py +0 -0
  177. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/models/chat/chat.py +0 -0
  178. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/models/chat/chat_data.py +0 -0
  179. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/models/chat/chat_message.py +0 -0
  180. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/models/chat/chat_nested.py +0 -0
  181. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/models/chat/chat_summary.py +0 -0
  182. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/models/common/__init__.py +0 -0
  183. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/models/common/ag2_version.py +0 -0
  184. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/models/common/base.py +0 -0
  185. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/models/common/date_utils.py +0 -0
  186. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/models/common/dict_utils.py +0 -0
  187. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/models/common/handoff.py +0 -0
  188. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/models/common/id_generator.py +0 -0
  189. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/models/common/naming.py +0 -0
  190. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/models/common/waldiez_version.py +0 -0
  191. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/models/flow/__init__.py +0 -0
  192. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/models/flow/connection.py +0 -0
  193. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/models/flow/flow.py +0 -0
  194. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/models/flow/flow_data.py +0 -0
  195. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/models/flow/info.py +0 -0
  196. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/models/flow/naming.py +0 -0
  197. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/models/model/__init__.py +0 -0
  198. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/models/model/extra_requirements.py +0 -0
  199. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/models/model/model.py +0 -0
  200. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/models/model/model_data.py +0 -0
  201. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/models/tool/__init__.py +0 -0
  202. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/models/tool/extra_requirements.py +0 -0
  203. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/models/tool/tool_data.py +0 -0
  204. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/models/tool/tool_type.py +0 -0
  205. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/models/waldiez.py +0 -0
  206. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/py.typed +0 -0
  207. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/running/gen_seq_diagram.py +0 -0
  208. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/utils/cli_extras/__init__.py +0 -0
  209. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/utils/cli_extras/jupyter.py +0 -0
  210. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/utils/cli_extras/runner.py +0 -0
  211. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/utils/cli_extras/studio.py +0 -0
  212. {waldiez-0.4.8 → waldiez-0.4.11}/waldiez/utils/conflict_checker.py +0 -0
@@ -29,6 +29,7 @@ dmypy.json
29
29
  .coverage
30
30
  **/*.coverage*
31
31
  **/*_db
32
+ **/*.db
32
33
  **/*cache
33
34
  **/*.log
34
35
  **/*.pid
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: waldiez
3
- Version: 0.4.8
3
+ Version: 0.4.11
4
4
  Dynamic: Keywords
5
5
  Summary: Make AG2 Agents Collaborate: Drag, Drop, and Orchestrate with Waldiez.
6
6
  Project-URL: Homepage, https://waldiez.io
@@ -33,7 +33,7 @@ Requires-Dist: aiofiles==24.1.0
33
33
  Requires-Dist: aiosqlite==0.21.0
34
34
  Requires-Dist: asyncer==0.0.8
35
35
  Requires-Dist: click<8.2
36
- Requires-Dist: graphviz<=0.20.3
36
+ Requires-Dist: graphviz<=0.21
37
37
  Requires-Dist: httpx<1
38
38
  Requires-Dist: jupytext
39
39
  Requires-Dist: nest-asyncio==1.6.0
@@ -80,7 +80,7 @@ Requires-Dist: ipython; extra == 'ag2-extras'
80
80
  Requires-Dist: langchain-community<1,>=0.3.12; extra == 'ag2-extras'
81
81
  Requires-Dist: litellm; extra == 'ag2-extras'
82
82
  Requires-Dist: markdownify; extra == 'ag2-extras'
83
- Requires-Dist: mcp<1.6,>=1.4.0; extra == 'ag2-extras'
83
+ Requires-Dist: mcp<2,>=1.4.0; extra == 'ag2-extras'
84
84
  Requires-Dist: mistralai>=1.8.1; extra == 'ag2-extras'
85
85
  Requires-Dist: networkx; (python_version < '3.11') and extra == 'ag2-extras'
86
86
  Requires-Dist: networkx>=3.5; (python_version >= '3.11') and extra == 'ag2-extras'
@@ -106,10 +106,10 @@ Provides-Extra: dev
106
106
  Requires-Dist: ag2[redis]==0.9.2; extra == 'dev'
107
107
  Requires-Dist: ag2[websockets]==0.9.2; extra == 'dev'
108
108
  Requires-Dist: autoflake==2.3.1; extra == 'dev'
109
- Requires-Dist: bandit==1.8.3; extra == 'dev'
109
+ Requires-Dist: bandit==1.8.5; extra == 'dev'
110
110
  Requires-Dist: black[jupyter]==25.1.0; extra == 'dev'
111
111
  Requires-Dist: build==1.2.2.post1; extra == 'dev'
112
- Requires-Dist: fakeredis>=2.28.1; extra == 'dev'
112
+ Requires-Dist: fakeredis<=3.30.0,>=2.28.1; extra == 'dev'
113
113
  Requires-Dist: fastjsonschema>=2.21; extra == 'dev'
114
114
  Requires-Dist: flake8==7.2.0; extra == 'dev'
115
115
  Requires-Dist: hatchling==1.27.0; extra == 'dev'
@@ -117,7 +117,7 @@ Requires-Dist: jsonschema==4.24.0; extra == 'dev'
117
117
  Requires-Dist: jupyter-server==2.16.0; extra == 'dev'
118
118
  Requires-Dist: jupyterlab<5.0,>=4.4.0; extra == 'dev'
119
119
  Requires-Dist: mypy-extensions>=1.1.0; extra == 'dev'
120
- Requires-Dist: mypy==1.16.0; extra == 'dev'
120
+ Requires-Dist: mypy==1.16.1; extra == 'dev'
121
121
  Requires-Dist: nbclient>=0.10.2; extra == 'dev'
122
122
  Requires-Dist: nbconvert>=7.16.6; extra == 'dev'
123
123
  Requires-Dist: nbformat>=5.10.4; extra == 'dev'
@@ -134,7 +134,7 @@ Requires-Dist: toml==0.10.2; (python_version <= '3.10') and extra == 'dev'
134
134
  Requires-Dist: types-jsonschema==4.24.0.20250528; extra == 'dev'
135
135
  Requires-Dist: types-pyyaml==6.0.12.20250516; extra == 'dev'
136
136
  Requires-Dist: types-redis==4.6.0.20241004; extra == 'dev'
137
- Requires-Dist: types-requests==2.32.0.20250602; extra == 'dev'
137
+ Requires-Dist: types-requests==2.32.4.20250611; extra == 'dev'
138
138
  Requires-Dist: types-toml==0.10.8.20240310; extra == 'dev'
139
139
  Requires-Dist: watchdog==6.0.0; extra == 'dev'
140
140
  Requires-Dist: yamllint==1.37.1; extra == 'dev'
@@ -157,19 +157,19 @@ Requires-Dist: natsort==8.4.0; extra == 'docs'
157
157
  Provides-Extra: jupyter
158
158
  Requires-Dist: jupyter-server==2.16.0; extra == 'jupyter'
159
159
  Requires-Dist: jupyterlab<5.0,>=4.3.0; extra == 'jupyter'
160
- Requires-Dist: waldiez-jupyter==0.4.8; extra == 'jupyter'
160
+ Requires-Dist: waldiez-jupyter==0.4.11; extra == 'jupyter'
161
161
  Provides-Extra: mqtt
162
162
  Requires-Dist: paho-mqtt<3.0,>=2.1.0; extra == 'mqtt'
163
163
  Provides-Extra: redis
164
164
  Requires-Dist: ag2[redis]==0.9.2; extra == 'redis'
165
165
  Provides-Extra: runner
166
- Requires-Dist: waldiez-runner==0.4.8; (python_version >= '3.11') and extra == 'runner'
166
+ Requires-Dist: waldiez-runner==0.4.11; (python_version >= '3.11') and extra == 'runner'
167
167
  Provides-Extra: studio
168
- Requires-Dist: waldiez-studio==0.4.8; extra == 'studio'
168
+ Requires-Dist: waldiez-studio==0.4.11; extra == 'studio'
169
169
  Provides-Extra: test
170
170
  Requires-Dist: ag2[redis]==0.9.2; extra == 'test'
171
171
  Requires-Dist: ag2[websockets]==0.9.2; extra == 'test'
172
- Requires-Dist: fakeredis>=2.28.1; extra == 'test'
172
+ Requires-Dist: fakeredis<=3.30.0,>=2.28.1; extra == 'test'
173
173
  Requires-Dist: paho-mqtt<3.0,>=2.1.0; extra == 'test'
174
174
  Requires-Dist: pytest-asyncio==1.0.0; extra == 'test'
175
175
  Requires-Dist: pytest-cov==6.1.1; extra == 'test'
@@ -34,7 +34,7 @@ dependencies = [
34
34
  "asyncer==0.0.8",
35
35
  "numpy<=2.3.0",
36
36
  "nest_asyncio==1.6.0",
37
- "graphviz<=0.20.3",
37
+ "graphviz<=0.21",
38
38
  "pandas>=2",
39
39
  "pillow",
40
40
  "pip>=25",
@@ -81,15 +81,15 @@ mqtt = [
81
81
  ]
82
82
  # jupyterlab extension
83
83
  jupyter = [
84
- "waldiez_jupyter==0.4.8",
84
+ "waldiez_jupyter==0.4.11",
85
85
  "jupyterlab>=4.3.0,<5.0",
86
86
  "jupyter_server==2.16.0",
87
87
  ]
88
88
  runner = [
89
- "waldiez_runner==0.4.8; python_version >= '3.11'",
89
+ "waldiez_runner==0.4.11; python_version >= '3.11'",
90
90
  ]
91
91
  studio = [
92
- "waldiez_studio==0.4.8",
92
+ "waldiez_studio==0.4.11",
93
93
  ]
94
94
  ag2_extras = [
95
95
  # models
@@ -154,16 +154,16 @@ ag2_extras = [
154
154
  "google-api-python-client>=2.163.0,<3.0",
155
155
  "google-auth-httplib2>=0.2.0,<0.3",
156
156
  "google-auth-oauthlib>=1.2.1,<2.0",
157
- "mcp>=1.4.0,<1.6",
157
+ "mcp>=1.4.0,<2",
158
158
  ]
159
159
  dev = [
160
160
  "ag2[redis]==0.9.2",
161
161
  "ag2[websockets]==0.9.2",
162
162
  "autoflake==2.3.1",
163
- "bandit==1.8.3",
163
+ "bandit==1.8.5",
164
164
  "black[jupyter]==25.1.0",
165
165
  "build==1.2.2.post1",
166
- "fakeredis>=2.28.1",
166
+ "fakeredis>=2.28.1,<=3.30.0",
167
167
  "flake8==7.2.0",
168
168
  "jsonschema==4.24.0",
169
169
  "jupyterlab>=4.4.0,<5.0",
@@ -174,7 +174,7 @@ dev = [
174
174
  "nbformat>=5.10.4",
175
175
  "nbconvert>=7.16.6",
176
176
  "hatchling==1.27.0",
177
- "mypy==1.16.0",
177
+ "mypy==1.16.1",
178
178
  "mypy-extensions>=1.1.0",
179
179
  "paho-mqtt>=2.1.0,<3.0",
180
180
  "pandas-stubs==2.2.3.250527",
@@ -188,7 +188,7 @@ dev = [
188
188
  "types-jsonschema==4.24.0.20250528",
189
189
  "types-redis==4.6.0.20241004",
190
190
  "types-toml==0.10.8.20240310",
191
- "types-requests==2.32.0.20250602",
191
+ "types-requests==2.32.4.20250611",
192
192
  "toml==0.10.2; python_version <= '3.10'",
193
193
  "watchdog==6.0.0",
194
194
  "yamllint==1.37.1",
@@ -213,9 +213,8 @@ docs = [
213
213
  test = [
214
214
  "ag2[redis]==0.9.2",
215
215
  "ag2[websockets]==0.9.2",
216
- "fakeredis>=2.28.1",
216
+ "fakeredis>=2.28.1,<=3.30.0",
217
217
  "paho-mqtt>=2.1.0,<3.0",
218
-
219
218
  "pytest==8.4.0",
220
219
  "pytest-asyncio==1.0.0",
221
220
  "pytest-cov==6.1.1",
@@ -284,6 +283,10 @@ test-io = """
284
283
  hatch run pre-test
285
284
  pytest -c pyproject.toml --cov=waldiez/io --cov-branch --cov-report=term-missing:skip-covered -vv tests/io
286
285
  """
286
+ test-running = """
287
+ hatch run pre-test
288
+ pytest -c pyproject.toml --cov=waldiez/running --cov-branch --cov-report=term-missing:skip-covered -vv tests/running
289
+ """
287
290
 
288
291
  format-black = "black --config pyproject.toml waldiez tests scripts"
289
292
  format-autoflake = "autoflake --in-place --remove-all-unused-imports --remove-unused-variables --recursive waldiez tests scripts"
@@ -5,7 +5,7 @@
5
5
  from .exporter import WaldiezExporter
6
6
  from .models import Waldiez
7
7
  from .runner import WaldiezRunner
8
- from .utils import check_conflicts, check_flaml_warnings
8
+ from .utils import check_conflicts
9
9
 
10
10
  # flake8: noqa: F401
11
11
  # pylint: disable=import-error,line-too-long
@@ -28,7 +28,6 @@ __waldiez_initialized = False
28
28
  if not __waldiez_initialized:
29
29
  __waldiez_initialized = True
30
30
  check_conflicts()
31
- check_flaml_warnings()
32
31
 
33
32
  __all__ = [
34
33
  "Waldiez",
@@ -5,4 +5,4 @@
5
5
  This file is automatically generated by Hatchling.
6
6
  Do not edit this file directly.
7
7
  """
8
- __version__ = VERSION = "0.4.8"
8
+ __version__ = VERSION = "0.4.11"
@@ -2,43 +2,24 @@
2
2
  # Copyright (c) 2024 - 2025 Waldiez and contributors.
3
3
  # flake8: noqa: E501
4
4
  # pylint: disable=missing-function-docstring,missing-param-doc,missing-raises-doc
5
+ # pylint: disable=line-too-long
5
6
  """Command line interface to convert or run a waldiez file."""
6
7
 
7
8
  import json
8
9
  import os
9
10
  from pathlib import Path
10
- from typing import TYPE_CHECKING, Any, Optional, Union
11
+ from typing import Optional
11
12
 
12
13
  import anyio
13
14
  import typer
14
15
  from dotenv import load_dotenv
15
16
  from typing_extensions import Annotated
16
17
 
17
- # pylint: disable=import-error,line-too-long
18
- # pyright: reportMissingImports=false
19
- try: # pragma: no cover
20
- # fmt: off
21
- from ._version import __version__ # type: ignore[unused-ignore, unused-import, import-not-found, import-untyped] # noqa
22
- # fmt: on
23
- except ImportError: # pragma: no cover
24
- import warnings
25
-
26
- warnings.warn(
27
- "Importing __version__ failed. Using 'dev' as version.", stacklevel=2
28
- )
29
- __version__ = "dev"
30
-
31
-
32
18
  from .exporter import WaldiezExporter
33
- from .io import StructuredIOStream
34
19
  from .logger import get_logger
35
20
  from .models import Waldiez
36
21
  from .runner import WaldiezRunner
37
- from .utils import add_cli_extras
38
-
39
- if TYPE_CHECKING:
40
- from autogen import ChatResult # type: ignore[import-untyped]
41
-
22
+ from .utils import add_cli_extras, get_waldiez_version
42
23
 
43
24
  load_dotenv()
44
25
  LOG = get_logger()
@@ -71,7 +52,7 @@ def show_version(
71
52
  ) -> None:
72
53
  """Show the version of the Waldiez package and exit."""
73
54
  if version:
74
- typer.echo(f"waldiez version: {__version__}")
55
+ typer.echo(f"waldiez version: {get_waldiez_version()}")
75
56
  raise typer.Exit()
76
57
 
77
58
 
@@ -115,6 +96,20 @@ def run(
115
96
  "If set, running the flow will use structured io stream instead of the default 'input/print' "
116
97
  ),
117
98
  ),
99
+ threaded: bool = typer.Option( # noqa: B008
100
+ False,
101
+ help=(
102
+ "If set, the flow will be run in a separate thread. "
103
+ "This is useful for running flows that require user input or print output."
104
+ ),
105
+ ),
106
+ patch_io: bool = typer.Option( # noqa: B008
107
+ False,
108
+ help=(
109
+ "If set, the flow will patch ag2's IOStream to safe print and input methods. "
110
+ "This is useful for running flows that require user input or print output."
111
+ ),
112
+ ),
118
113
  force: bool = typer.Option( # noqa: B008
119
114
  False,
120
115
  help="Override the output file if it already exists.",
@@ -124,33 +119,35 @@ def run(
124
119
  os.environ["AUTOGEN_USE_DOCKER"] = "0"
125
120
  os.environ["NEP50_DISABLE_WARNING"] = "1"
126
121
  output_path = _get_output_path(output, force)
127
- with file.open("r", encoding="utf-8") as _file:
128
- try:
129
- data = json.load(_file)
130
- except json.decoder.JSONDecodeError as error:
131
- typer.echo("Invalid .waldiez file. Not a valid json?")
132
- raise typer.Exit(code=1) from error
133
- results = _do_run(
134
- data,
135
- structured=structured,
136
- uploads_root=uploads_root,
137
- output_path=output_path,
138
- )
139
- if isinstance(results, list):
140
- LOG.info("Results:")
141
- for result in results:
142
- _log_result(result)
143
- sep = "-" * 80
144
- print("\n" + f"{sep}" + "\n")
145
- elif isinstance(results, dict):
146
- LOG.info("Results:")
147
- for key, result in results.items():
148
- LOG.info("Order: %s", key)
149
- _log_result(result)
150
- sep = "-" * 80
151
- print("\n" + f"{sep}" + "\n")
122
+ try:
123
+ runner = WaldiezRunner.load(file)
124
+ except FileNotFoundError as error:
125
+ typer.echo(f"File not found: {file}")
126
+ raise typer.Exit(code=1) from error
127
+ except json.decoder.JSONDecodeError as error:
128
+ typer.echo("Invalid .waldiez file. Not a valid json?")
129
+ raise typer.Exit(code=1) from error
130
+ except ValueError as error:
131
+ typer.echo(f"Invalid .waldiez file: {error}")
132
+ raise typer.Exit(code=1) from error
133
+ if runner.is_async:
134
+ anyio.run(
135
+ runner.a_run,
136
+ output_path,
137
+ uploads_root,
138
+ structured,
139
+ not patch_io, # skip_patch_io
140
+ False, # skip_mmd
141
+ )
152
142
  else:
153
- _log_result(results)
143
+ runner.run(
144
+ output_path=output_path,
145
+ uploads_root=uploads_root,
146
+ structured_io=structured,
147
+ threaded=threaded,
148
+ skip_patch_io=not patch_io,
149
+ skip_mmd=False,
150
+ )
154
151
 
155
152
 
156
153
  @app.command()
@@ -234,43 +231,50 @@ def check(
234
231
  LOG.success("Waldiez flow seems valid.")
235
232
 
236
233
 
237
- def _do_run(
238
- data: dict[str, Any],
239
- structured: bool,
240
- uploads_root: Optional[Path],
241
- output_path: Optional[Path],
242
- ) -> Union["ChatResult", list["ChatResult"], dict[int, "ChatResult"]]:
243
- """Run the Waldiez flow and get the results."""
244
- waldiez = Waldiez.from_dict(data)
245
- if structured:
246
- stream = StructuredIOStream(uploads_root=uploads_root)
247
- with StructuredIOStream.set_default(stream):
248
- runner = WaldiezRunner(waldiez)
249
- if waldiez.is_async:
250
- results = anyio.run(
251
- runner.a_run,
252
- output_path,
253
- uploads_root,
254
- )
255
- else:
256
- results = runner.run(
257
- output_path=output_path,
258
- uploads_root=uploads_root,
259
- )
260
- else:
261
- runner = WaldiezRunner(waldiez)
262
- if waldiez.is_async:
263
- results = anyio.run(
264
- runner.a_run,
265
- output_path,
266
- uploads_root,
267
- )
268
- else:
269
- results = runner.run(
270
- output_path=output_path,
271
- uploads_root=uploads_root,
272
- )
273
- return results
234
+ # def _do_run(
235
+ # data: dict[str, Any],
236
+ # structured: bool,
237
+ # uploads_root: Optional[Path],
238
+ # output_path: Optional[Path],
239
+ # ) -> None:
240
+ # """Run the Waldiez flow and get the results."""
241
+ # waldiez = Waldiez.from_dict(data)
242
+ # if structured:
243
+ # stream = StructuredIOStream(uploads_root=uploads_root)
244
+ # with StructuredIOStream.set_default(stream):
245
+ # runner = WaldiezRunner(waldiez)
246
+ # if waldiez.is_async:
247
+ # anyio.run(
248
+ # runner.a_run,
249
+ # output_path,
250
+ # uploads_root,
251
+ # True, # structured_io
252
+ # False, # skip_mmd
253
+ # )
254
+ # else:
255
+ # runner.run(
256
+ # output_path=output_path,
257
+ # uploads_root=uploads_root,
258
+ # structured_io=True,
259
+ # skip_mmd=False,
260
+ # )
261
+ # else:
262
+ # runner = WaldiezRunner(waldiez)
263
+ # if waldiez.is_async:
264
+ # anyio.run(
265
+ # runner.a_run,
266
+ # output_path,
267
+ # uploads_root,
268
+ # False, # structured_io
269
+ # False, # skip_mmd
270
+ # )
271
+ # else:
272
+ # runner.run(
273
+ # output_path=output_path,
274
+ # uploads_root=uploads_root,
275
+ # structured_io=False,
276
+ # skip_mmd=False,
277
+ # )
274
278
 
275
279
 
276
280
  def _get_output_path(output: Optional[Path], force: bool) -> Optional[Path]:
@@ -286,16 +290,6 @@ def _get_output_path(output: Optional[Path], force: bool) -> Optional[Path]:
286
290
  return output
287
291
 
288
292
 
289
- def _log_result(result: "ChatResult") -> None:
290
- """Log the result of the Waldiez flow."""
291
- LOG.info("Chat History:\n")
292
- LOG.info(result.chat_history)
293
- LOG.info("Summary:\n")
294
- LOG.info(result.summary)
295
- LOG.info("Cost:\n")
296
- LOG.info(result.cost)
297
-
298
-
299
293
  add_cli_extras(app)
300
294
 
301
295
  if __name__ == "__main__":
@@ -11,7 +11,6 @@ to trigger the chat(s).
11
11
  """
12
12
 
13
13
  from pathlib import Path
14
- from typing import Union
15
14
 
16
15
  import jupytext # type: ignore[import-untyped]
17
16
  from jupytext.config import ( # type: ignore[import-untyped]
@@ -61,7 +60,10 @@ class WaldiezExporter:
61
60
 
62
61
  def export(
63
62
  self,
64
- path: Union[str, Path],
63
+ path: str | Path,
64
+ structured_io: bool = False,
65
+ uploads_root: Path | None = None,
66
+ skip_patch_io: bool = True,
65
67
  force: bool = False,
66
68
  debug: bool = False,
67
69
  ) -> None:
@@ -69,8 +71,15 @@ class WaldiezExporter:
69
71
 
70
72
  Parameters
71
73
  ----------
72
- path : Union[str, Path]
74
+ path : str | Path
73
75
  The path to export to.
76
+ structured_io : bool, (optional)
77
+ Whether to use structured IO instead of the default 'input/print',
78
+ by default False.
79
+ uploads_root : str | Path | None, (optional)
80
+ The uploads root, to get user-uploaded files, by default None.
81
+ skip_patch_io : bool, (optional)
82
+ Whether to skip patching I/O, by default True.
74
83
  force : bool, (optional)
75
84
  Override the output file if it already exists, by default False.
76
85
  debug : bool, (optional)
@@ -99,23 +108,45 @@ class WaldiezExporter:
99
108
  if extension == ".waldiez":
100
109
  self.to_waldiez(path, debug=debug)
101
110
  elif extension == ".py":
102
- self.to_py(path, debug=debug)
111
+ self.to_py(
112
+ path,
113
+ structured_io=structured_io,
114
+ uploads_root=uploads_root,
115
+ skip_patch_io=skip_patch_io,
116
+ debug=debug,
117
+ )
103
118
  elif extension == ".ipynb":
104
- self.to_ipynb(path, debug=debug)
119
+ self.to_ipynb(
120
+ path,
121
+ structured_io=structured_io,
122
+ uploads_root=uploads_root,
123
+ skip_patch_io=skip_patch_io,
124
+ debug=debug,
125
+ )
105
126
  else:
106
127
  raise ValueError(f"Invalid extension: {extension}")
107
128
 
108
129
  def to_ipynb(
109
130
  self,
110
- path: Path,
131
+ path: str | Path,
132
+ structured_io: bool = False,
133
+ uploads_root: Path | None = None,
134
+ skip_patch_io: bool = True,
111
135
  debug: bool = False,
112
136
  ) -> None:
113
137
  """Export flow to jupyter notebook.
114
138
 
115
139
  Parameters
116
140
  ----------
117
- path : Path
141
+ path : str | Path
118
142
  The path to export to.
143
+ structured_io : bool, optional
144
+ Whether to use structured IO instead of the default 'input/print',
145
+ by default False.
146
+ uploads_root : Path | None, optional
147
+ The uploads root, to get user-uploaded files, by default None.
148
+ skip_patch_io : bool, optional
149
+ Whether to skip patching I/O, by default True.
119
150
  debug : bool, optional
120
151
  Whether to enable debug mode, by default False.
121
152
 
@@ -126,10 +157,15 @@ class WaldiezExporter:
126
157
  """
127
158
  # we first create a .py file with the content
128
159
  # and then convert it to a notebook using jupytext
160
+ if not isinstance(path, Path):
161
+ path = Path(path)
129
162
  exporter = create_flow_exporter(
130
163
  waldiez=self.waldiez,
131
164
  output_dir=path.parent,
165
+ uploads_root=uploads_root,
166
+ structured_io=structured_io,
132
167
  for_notebook=True,
168
+ skip_patch_io=skip_patch_io,
133
169
  debug=debug,
134
170
  )
135
171
  self.flow_extras = exporter.extras
@@ -161,13 +197,27 @@ class WaldiezExporter:
161
197
  Path(ipynb_path).rename(ipynb_path.replace(".tmp.ipynb", ".ipynb"))
162
198
  py_path.unlink(missing_ok=True)
163
199
 
164
- def to_py(self, path: Path, debug: bool = False) -> None:
200
+ def to_py(
201
+ self,
202
+ path: str | Path,
203
+ structured_io: bool = False,
204
+ uploads_root: Path | None = None,
205
+ skip_patch_io: bool = True,
206
+ debug: bool = False,
207
+ ) -> None:
165
208
  """Export waldiez flow to a python script.
166
209
 
167
210
  Parameters
168
211
  ----------
169
- path : Path
212
+ path : str | Path
170
213
  The path to export to.
214
+ structured_io : bool, optional
215
+ Whether to use structured IO instead of the default 'input/print',
216
+ by default False.
217
+ uploads_root : Path | None, optional
218
+ The uploads root, to get user-uploaded files, by default None.
219
+ skip_patch_io : bool, optional
220
+ Whether to skip patching I/O, by default True.
171
221
  debug : bool, optional
172
222
  Whether to enable debug mode, by default False.
173
223
 
@@ -176,10 +226,15 @@ class WaldiezExporter:
176
226
  RuntimeError
177
227
  If the python script could not be generated.
178
228
  """
229
+ if not isinstance(path, Path):
230
+ path = Path(path)
179
231
  exporter = create_flow_exporter(
180
232
  waldiez=self.waldiez,
181
233
  output_dir=path.parent,
182
234
  for_notebook=False,
235
+ uploads_root=uploads_root,
236
+ structured_io=structured_io,
237
+ skip_patch_io=skip_patch_io,
183
238
  debug=debug,
184
239
  )
185
240
  self.flow_extras = exporter.extras
@@ -65,15 +65,13 @@ def _get_chroma_embedding_function_string(
65
65
  to_import = ""
66
66
  embedding_function_arg = ""
67
67
  embedding_function_content = ""
68
- vector_db_model = agent.retrieve_config.db_config.model
69
68
  if not agent.retrieve_config.use_custom_embedding:
70
69
  to_import = (
71
70
  "from chromadb.utils.embedding_functions."
72
71
  "sentence_transformer_embedding_function import "
73
72
  "SentenceTransformerEmbeddingFunction"
74
73
  )
75
- embedding_function_arg = "SentenceTransformerEmbeddingFunction("
76
- embedding_function_arg += f'model_name="{vector_db_model}")'
74
+ embedding_function_arg = f"{agent_name}_embedding_function"
77
75
  else:
78
76
  embedding_function_content, embedding_function_arg = (
79
77
  agent.retrieve_config.get_custom_embedding_function(
@@ -124,21 +122,35 @@ def get_chroma_db_args(
124
122
  # manually initializing the collection before running the flow,
125
123
  # might be a workaround.
126
124
  content_before = f"{agent_name}_client = {client_str}" + "\n"
125
+ vector_db_model = agent.retrieve_config.db_config.model
126
+ if not embedding_function_body:
127
+ content_before += (
128
+ f"{agent_name}_embedding_function = "
129
+ "SentenceTransformerEmbeddingFunction(\n"
130
+ f' model_name="{vector_db_model}",' + "\n"
131
+ ")\n"
132
+ )
127
133
  collection_name = agent.retrieve_config.collection_name
128
134
  get_or_create = agent.retrieve_config.get_or_create
129
135
  if collection_name:
130
136
  if get_or_create:
131
137
  content_before += (
132
- f"{agent_name}_client.get_or_create_collection("
133
- f'"{collection_name}")' + "\n"
138
+ f"{agent_name}_client.get_or_create_collection" + "(\n"
139
+ f' "{collection_name}",' + "\n"
140
+ f" embedding_function={embedding_function_arg}," + "\n"
141
+ ")" + "\n"
134
142
  )
135
143
  else:
136
144
  content_before += (
137
145
  "try:\n"
138
- f' {agent_name}_client.get_collection("{collection_name}")'
139
- + "\n"
146
+ f" {agent_name}_client.get_collection(" + "\n"
147
+ f' "{collection_name}",' + "\n"
148
+ f" embedding_function={embedding_function_arg}," + "\n"
149
+ " )\n"
140
150
  "except ValueError:\n"
141
- f" {agent_name}_client.create_collection("
142
- f'"{collection_name}")' + "\n"
151
+ f" {agent_name}_client.create_collection(" + "\n"
152
+ f' "{collection_name}",' + "\n"
153
+ f" embedding_function={embedding_function_arg}," + "\n"
154
+ " )\n"
143
155
  )
144
156
  return kwarg_string, to_import, embedding_function_body, content_before