fabricatio 0.3.14.dev0__tar.gz → 0.3.14.dev1__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 (166) hide show
  1. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/PKG-INFO +7 -7
  2. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/README.md +6 -6
  3. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/examples/llm_usages/llm_usage.py +1 -2
  4. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/examples/minor/hello_fabricatio.py +1 -1
  5. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/examples/minor/write_a_poem.py +6 -4
  6. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/pyproject.toml +1 -1
  7. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/python/fabricatio/__init__.py +2 -3
  8. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/python/fabricatio/journal.py +0 -3
  9. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/python/fabricatio/models/action.py +1 -1
  10. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/python/fabricatio/models/generic.py +5 -5
  11. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/python/fabricatio/models/role.py +2 -4
  12. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/python/fabricatio/models/usages.py +12 -5
  13. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/python/fabricatio/rust.pyi +2 -2
  14. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/python/fabricatio/utils.py +32 -1
  15. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/src/config.rs +1 -1
  16. fabricatio-0.3.14.dev1/templates.tar.gz +0 -0
  17. fabricatio-0.3.14.dev1/uv.lock +1682 -0
  18. fabricatio-0.3.14.dev0/templates.tar.gz +0 -0
  19. fabricatio-0.3.14.dev0/uv.lock +0 -1682
  20. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/.github/workflows/build-package.yaml +0 -0
  21. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/.github/workflows/ruff.yaml +0 -0
  22. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/.github/workflows/tests.yaml +0 -0
  23. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/.gitignore +0 -0
  24. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/.python-version +0 -0
  25. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/Cargo.lock +0 -0
  26. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/Cargo.toml +0 -0
  27. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/LICENSE +0 -0
  28. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/Makefile +0 -0
  29. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/examples/correct/correct.py +0 -0
  30. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/examples/correct/correct_loop.py +0 -0
  31. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/examples/extract_and_inject/.gitignore +0 -0
  32. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/examples/extract_and_inject/article_rag.py +0 -0
  33. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/examples/extract_and_inject/ask.py +0 -0
  34. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/examples/extract_and_inject/chunk_article.py +0 -0
  35. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/examples/extract_and_inject/extract_and_inject.py +0 -0
  36. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/examples/extract_article/extract.py +0 -0
  37. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/examples/make_a_rating/rating.py +0 -0
  38. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/examples/make_diary/commits.json +0 -0
  39. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/examples/make_diary/diary.py +0 -0
  40. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/examples/propose_task/.gitignore +0 -0
  41. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/examples/propose_task/propose.py +0 -0
  42. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/examples/reviewer/censor.py +0 -0
  43. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/examples/reviewer/review.py +0 -0
  44. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/examples/rules/.gitignore +0 -0
  45. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/examples/rules/draft_ruleset.py +0 -0
  46. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/examples/search_bibtex/.gitignore +0 -0
  47. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/examples/search_bibtex/search.py +0 -0
  48. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/examples/simple_chat/chat.py +0 -0
  49. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/examples/simple_rag/simple_rag.py +0 -0
  50. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/examples/task_handle/handle_task.py +0 -0
  51. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/examples/write_article/.gitignore +0 -0
  52. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/examples/write_article/article_rag.py +0 -0
  53. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/examples/write_article/post_process.py +0 -0
  54. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/examples/write_article/write_article.py +0 -0
  55. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/examples/write_outline/.gitignore +0 -0
  56. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/examples/write_outline/write_outline.py +0 -0
  57. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/examples/write_outline/write_outline_corrected.py +0 -0
  58. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/python/fabricatio/actions/__init__.py +0 -0
  59. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/python/fabricatio/actions/article.py +0 -0
  60. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/python/fabricatio/actions/article_rag.py +0 -0
  61. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/python/fabricatio/actions/fs.py +0 -0
  62. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/python/fabricatio/actions/output.py +0 -0
  63. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/python/fabricatio/actions/rag.py +0 -0
  64. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/python/fabricatio/actions/rules.py +0 -0
  65. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/python/fabricatio/capabilities/__init__.py +0 -0
  66. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/python/fabricatio/capabilities/advanced_judge.py +0 -0
  67. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/python/fabricatio/capabilities/advanced_rag.py +0 -0
  68. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/python/fabricatio/capabilities/censor.py +0 -0
  69. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/python/fabricatio/capabilities/check.py +0 -0
  70. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/python/fabricatio/capabilities/correct.py +0 -0
  71. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/python/fabricatio/capabilities/extract.py +0 -0
  72. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/python/fabricatio/capabilities/propose.py +0 -0
  73. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/python/fabricatio/capabilities/rag.py +0 -0
  74. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/python/fabricatio/capabilities/rating.py +0 -0
  75. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/python/fabricatio/capabilities/review.py +0 -0
  76. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/python/fabricatio/capabilities/task.py +0 -0
  77. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/python/fabricatio/core.py +0 -0
  78. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/python/fabricatio/decorators.py +0 -0
  79. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/python/fabricatio/fs/__init__.py +0 -0
  80. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/python/fabricatio/fs/curd.py +0 -0
  81. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/python/fabricatio/fs/readers.py +0 -0
  82. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/python/fabricatio/models/adv_kwargs_types.py +0 -0
  83. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/python/fabricatio/models/extra/__init__.py +0 -0
  84. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/python/fabricatio/models/extra/advanced_judge.py +0 -0
  85. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/python/fabricatio/models/extra/aricle_rag.py +0 -0
  86. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/python/fabricatio/models/extra/article_base.py +0 -0
  87. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/python/fabricatio/models/extra/article_essence.py +0 -0
  88. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/python/fabricatio/models/extra/article_main.py +0 -0
  89. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/python/fabricatio/models/extra/article_outline.py +0 -0
  90. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/python/fabricatio/models/extra/article_proposal.py +0 -0
  91. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/python/fabricatio/models/extra/patches.py +0 -0
  92. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/python/fabricatio/models/extra/problem.py +0 -0
  93. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/python/fabricatio/models/extra/rag.py +0 -0
  94. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/python/fabricatio/models/extra/rule.py +0 -0
  95. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/python/fabricatio/models/kwargs_types.py +0 -0
  96. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/python/fabricatio/models/task.py +0 -0
  97. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/python/fabricatio/models/tool.py +0 -0
  98. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/python/fabricatio/parser.py +0 -0
  99. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/python/fabricatio/py.typed +0 -0
  100. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/python/fabricatio/toolboxes/__init__.py +0 -0
  101. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/python/fabricatio/toolboxes/arithmetic.py +0 -0
  102. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/python/fabricatio/toolboxes/fs.py +0 -0
  103. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/python/fabricatio/workflows/__init__.py +0 -0
  104. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/python/fabricatio/workflows/articles.py +0 -0
  105. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/python/fabricatio/workflows/rag.py +0 -0
  106. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/src/bib_tools.rs +0 -0
  107. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/src/event.rs +0 -0
  108. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/src/hash.rs +0 -0
  109. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/src/hbs_helpers.rs +0 -0
  110. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/src/language.rs +0 -0
  111. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/src/lib.rs +0 -0
  112. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/src/macro_utils/Cargo.toml +0 -0
  113. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/src/macro_utils/src/lib.rs +0 -0
  114. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/src/templates.rs +0 -0
  115. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/src/typst_tools.rs +0 -0
  116. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/src/word_split.rs +0 -0
  117. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/templates/built-in/as_prompt.hbs +0 -0
  118. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/templates/built-in/binary-exploitation-ctf-solver.hbs +0 -0
  119. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/templates/built-in/chap_summary.hbs +0 -0
  120. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/templates/built-in/check_string.hbs +0 -0
  121. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/templates/built-in/claude-xml.hbs +0 -0
  122. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/templates/built-in/clean-up-code.hbs +0 -0
  123. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/templates/built-in/co_validation.hbs +0 -0
  124. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/templates/built-in/create_json_obj.hbs +0 -0
  125. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/templates/built-in/cryptography-ctf-solver.hbs +0 -0
  126. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/templates/built-in/dependencies.hbs +0 -0
  127. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/templates/built-in/document-the-code.hbs +0 -0
  128. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/templates/built-in/draft_rating_criteria.hbs +0 -0
  129. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/templates/built-in/draft_rating_manual.hbs +0 -0
  130. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/templates/built-in/draft_rating_weights_klee.hbs +0 -0
  131. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/templates/built-in/draft_tool_usage_code.hbs +0 -0
  132. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/templates/built-in/extract.hbs +0 -0
  133. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/templates/built-in/extract_criteria_from_reasons.hbs +0 -0
  134. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/templates/built-in/extract_reasons_from_examples.hbs +0 -0
  135. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/templates/built-in/find-security-vulnerabilities.hbs +0 -0
  136. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/templates/built-in/fix-bugs.hbs +0 -0
  137. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/templates/built-in/fix_troubled_obj.hbs +0 -0
  138. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/templates/built-in/fix_troubled_string.hbs +0 -0
  139. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/templates/built-in/generic_string.hbs +0 -0
  140. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/templates/built-in/improve-performance.hbs +0 -0
  141. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/templates/built-in/liststr.hbs +0 -0
  142. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/templates/built-in/make_choice.hbs +0 -0
  143. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/templates/built-in/make_judgment.hbs +0 -0
  144. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/templates/built-in/pathstr.hbs +0 -0
  145. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/templates/built-in/rate_fine_grind.hbs +0 -0
  146. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/templates/built-in/refactor.hbs +0 -0
  147. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/templates/built-in/refined_query.hbs +0 -0
  148. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/templates/built-in/retrieved_display.hbs +0 -0
  149. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/templates/built-in/reverse-engineering-ctf-solver.hbs +0 -0
  150. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/templates/built-in/review_string.hbs +0 -0
  151. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/templates/built-in/rule_requirement.hbs +0 -0
  152. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/templates/built-in/ruleset_requirement_breakdown.hbs +0 -0
  153. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/templates/built-in/task_briefing.hbs +0 -0
  154. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/templates/built-in/web-ctf-solver.hbs +0 -0
  155. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/templates/built-in/write-git-commit.hbs +0 -0
  156. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/templates/built-in/write-github-pull-request.hbs +0 -0
  157. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/templates/built-in/write-github-readme.hbs +0 -0
  158. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/tests/test_config.py +0 -0
  159. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/tests/test_models/test_action.py +0 -0
  160. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/tests/test_models/test_advanced.py +0 -0
  161. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/tests/test_models/test_generic.py +0 -0
  162. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/tests/test_models/test_problem.py +0 -0
  163. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/tests/test_models/test_role.py +0 -0
  164. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/tests/test_models/test_task.py +0 -0
  165. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/tests/test_models/test_tool.py +0 -0
  166. {fabricatio-0.3.14.dev0 → fabricatio-0.3.14.dev1}/tests/test_models/test_usages.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fabricatio
3
- Version: 0.3.14.dev0
3
+ Version: 0.3.14.dev1
4
4
  Classifier: License :: OSI Approved :: MIT License
5
5
  Classifier: Programming Language :: Rust
6
6
  Classifier: Programming Language :: Python :: 3.12
@@ -86,7 +86,7 @@ make bdist
86
86
 
87
87
  ```python
88
88
  import asyncio
89
- from fabricatio import Action, Role, Task, logger, WorkFlow
89
+ from fabricatio import Action, Role, Task, logger, WorkFlow, Event
90
90
  from typing import Any
91
91
 
92
92
 
@@ -101,14 +101,14 @@ class Hello(Action):
101
101
 
102
102
 
103
103
  async def main() -> None:
104
- role = Role(
104
+ Role(
105
105
  name="talker",
106
106
  description="talker role",
107
- registry={Task.pending_label: WorkFlow(name="talk", steps=(Hello,))}
107
+ registry={Event.quick_instantiate("talk"): WorkFlow(name="talk", steps=(Hello,))}
108
108
  )
109
109
 
110
- task = Task(name="say hello", goals="say hello", description="say hello to the world")
111
- result = await task.delegate()
110
+ task = Task(name="say hello", goals=["say hello"], description="say hello to the world")
111
+ result = await task.delegate("talk")
112
112
  logger.success(f"Result: {result}")
113
113
 
114
114
 
@@ -163,11 +163,11 @@ max_tokens = 8192
163
163
  ```bash
164
164
  make test
165
165
  ```
166
+
166
167
  ## TODO
167
168
 
168
169
  - Add an element based format strategy
169
170
 
170
-
171
171
  ## Contributing
172
172
 
173
173
  Contributions are welcome! Follow these steps:
@@ -42,7 +42,7 @@ make bdist
42
42
 
43
43
  ```python
44
44
  import asyncio
45
- from fabricatio import Action, Role, Task, logger, WorkFlow
45
+ from fabricatio import Action, Role, Task, logger, WorkFlow, Event
46
46
  from typing import Any
47
47
 
48
48
 
@@ -57,14 +57,14 @@ class Hello(Action):
57
57
 
58
58
 
59
59
  async def main() -> None:
60
- role = Role(
60
+ Role(
61
61
  name="talker",
62
62
  description="talker role",
63
- registry={Task.pending_label: WorkFlow(name="talk", steps=(Hello,))}
63
+ registry={Event.quick_instantiate("talk"): WorkFlow(name="talk", steps=(Hello,))}
64
64
  )
65
65
 
66
- task = Task(name="say hello", goals="say hello", description="say hello to the world")
67
- result = await task.delegate()
66
+ task = Task(name="say hello", goals=["say hello"], description="say hello to the world")
67
+ result = await task.delegate("talk")
68
68
  logger.success(f"Result: {result}")
69
69
 
70
70
 
@@ -119,11 +119,11 @@ max_tokens = 8192
119
119
  ```bash
120
120
  make test
121
121
  ```
122
+
122
123
  ## TODO
123
124
 
124
125
  - Add an element based format strategy
125
126
 
126
-
127
127
  ## Contributing
128
128
 
129
129
  Contributions are welcome! Follow these steps:
@@ -2,9 +2,8 @@
2
2
 
3
3
  import asyncio
4
4
 
5
- from fabricatio import Action, Role, Task, WorkFlow
5
+ from fabricatio import Action, Event, Role, Task, WorkFlow
6
6
  from fabricatio.journal import logger
7
- from fabricatio.models.events import Event
8
7
  from fabricatio.parser import PythonCapture
9
8
 
10
9
 
@@ -3,7 +3,7 @@
3
3
  import asyncio
4
4
  from typing import Any
5
5
 
6
- from fabricatio import Action, Role, Task, WorkFlow, logger, Event
6
+ from fabricatio import Action, Event, Role, Task, WorkFlow, logger
7
7
 
8
8
  task = Task(name="say hello")
9
9
 
@@ -3,15 +3,17 @@
3
3
  import asyncio
4
4
  from typing import Any
5
5
 
6
- from fabricatio import Action, Role, Task, WorkFlow, logger
6
+ from fabricatio import Action, Event, Role, Task, WorkFlow, logger
7
+ from fabricatio.models.usages import LLMUsage
7
8
 
8
9
  task = Task(name="write poem")
9
10
 
10
11
 
11
- class WritePoem(Action):
12
+ class WritePoem(Action, LLMUsage):
12
13
  """Action that generates a poem."""
13
14
 
14
15
  output_key: str = "task_output"
16
+ llm_stream: bool = False
15
17
 
16
18
  async def _execute(self, **_) -> Any:
17
19
  logger.info("Generating poem about the sea")
@@ -25,10 +27,10 @@ async def main() -> None:
25
27
  Role(
26
28
  name="poet",
27
29
  description="A role that creates poetic content",
28
- registry={task.pending_label: WorkFlow(name="poetry_creation", steps=(WritePoem,))},
30
+ registry={Event.quick_instantiate(ns := 'poem'): WorkFlow(name="poetry_creation", steps=(WritePoem,))},
29
31
  )
30
32
 
31
- poem = await task.delegate()
33
+ poem = await task.delegate(ns)
32
34
  logger.success(f"Poem:\n\n{poem}")
33
35
 
34
36
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "fabricatio"
3
- version = "0.3.14-dev0"
3
+ version = "0.3.14-dev1"
4
4
  description = "A LLM multi-agent framework."
5
5
  readme = "README.md"
6
6
  license = { file = "LICENSE" }
@@ -2,8 +2,7 @@
2
2
 
3
3
  from fabricatio.rust import CONFIG, TEMPLATE_MANAGER, BibManager, Event
4
4
 
5
- from fabricatio import actions, capabilities, toolboxes, workflows
6
- from fabricatio import parser
5
+ from fabricatio import actions, capabilities, parser, toolboxes, workflows
7
6
  from fabricatio.journal import logger
8
7
  from fabricatio.models import extra
9
8
  from fabricatio.models.action import Action, WorkFlow
@@ -16,7 +15,6 @@ __all__ = [
16
15
  "TEMPLATE_MANAGER",
17
16
  "Action",
18
17
  "BibManager",
19
- "parser",
20
18
  "Event",
21
19
  "Role",
22
20
  "Task",
@@ -26,6 +24,7 @@ __all__ = [
26
24
  "capabilities",
27
25
  "extra",
28
26
  "logger",
27
+ "parser",
29
28
  "toolboxes",
30
29
  "workflows",
31
30
  ]
@@ -4,10 +4,7 @@ import sys
4
4
 
5
5
  from fabricatio.rust import CONFIG
6
6
  from loguru import logger
7
- from rich import pretty, traceback
8
7
 
9
- pretty.install()
10
- traceback.install()
11
8
  logger.remove()
12
9
  logger.add(sys.stderr, level=CONFIG.debug.log_level)
13
10
 
@@ -12,7 +12,7 @@ Classes:
12
12
  import traceback
13
13
  from abc import abstractmethod
14
14
  from asyncio import Queue, create_task
15
- from typing import Any, ClassVar, Dict, Self, Sequence, Tuple, Type, Union, final, Generator
15
+ from typing import Any, ClassVar, Dict, Generator, Self, Sequence, Tuple, Type, Union, final
16
16
 
17
17
  from pydantic import Field, PrivateAttr
18
18
 
@@ -11,7 +11,6 @@ from pydantic import (
11
11
  BaseModel,
12
12
  ConfigDict,
13
13
  Field,
14
- HttpUrl,
15
14
  NonNegativeFloat,
16
15
  PositiveFloat,
17
16
  PositiveInt,
@@ -23,7 +22,6 @@ from pydantic.json_schema import GenerateJsonSchema, JsonSchemaValue
23
22
  from fabricatio.fs import dump_text
24
23
  from fabricatio.fs.readers import safe_text_read
25
24
  from fabricatio.journal import logger
26
- from fabricatio.parser import JsonCapture
27
25
  from fabricatio.utils import ok
28
26
 
29
27
 
@@ -496,6 +494,8 @@ class InstantiateFromString(Base):
496
494
  Returns:
497
495
  Self | None: The instance of the class or None if the string is not valid.
498
496
  """
497
+ from fabricatio.parser import JsonCapture
498
+
499
499
  obj = JsonCapture.convert_with(string, cls.model_validate_json)
500
500
  logger.debug(f"Instantiate `{cls.__name__}` from string, {'Failed' if obj is None else 'Success'}.")
501
501
  return obj
@@ -682,7 +682,7 @@ class ScopedConfig(Base):
682
682
  Allows configuration values to be overridden in a hierarchical manner.
683
683
  """
684
684
 
685
- llm_api_endpoint: Optional[HttpUrl] = None
685
+ llm_api_endpoint: Optional[str] = None
686
686
  """The OpenAI API endpoint."""
687
687
 
688
688
  llm_api_key: Optional[SecretStr] = None
@@ -727,7 +727,7 @@ class ScopedConfig(Base):
727
727
  llm_frequency_penalty: Optional[PositiveFloat] = None
728
728
  """The frequency penalty of the LLM model."""
729
729
 
730
- embedding_api_endpoint: Optional[HttpUrl] = None
730
+ embedding_api_endpoint: Optional[str] = None
731
731
  """The OpenAI API endpoint."""
732
732
 
733
733
  embedding_api_key: Optional[SecretStr] = None
@@ -748,7 +748,7 @@ class ScopedConfig(Base):
748
748
  embedding_caching: Optional[bool] = False
749
749
  """Whether to cache the embedding result."""
750
750
 
751
- milvus_uri: Optional[HttpUrl] = Field(default=None)
751
+ milvus_uri: Optional[str] = Field(default=None)
752
752
  """The URI of the Milvus server."""
753
753
 
754
754
  milvus_token: Optional[SecretStr] = Field(default=None)
@@ -1,9 +1,9 @@
1
1
  """Module that contains the Role class for managing workflows and their event registrations."""
2
2
  from functools import partial
3
- from typing import Any, Self, Dict
3
+ from typing import Any, Dict, Self
4
4
 
5
5
  from fabricatio.rust import Event
6
- from pydantic import Field, ConfigDict
6
+ from pydantic import ConfigDict, Field
7
7
 
8
8
  from fabricatio.core import env
9
9
  from fabricatio.journal import logger
@@ -69,7 +69,6 @@ class Role(WithBriefing):
69
69
 
70
70
  def _configure_scoped_config(self, workflow) -> None:
71
71
  """Configure scoped configuration for workflow and its actions."""
72
-
73
72
  if not is_scoped_config(self.__class__):
74
73
  return
75
74
 
@@ -83,7 +82,6 @@ class Role(WithBriefing):
83
82
 
84
83
  def _configure_toolbox_usage(self, workflow) -> None:
85
84
  """Configure toolbox usage for workflow and its actions."""
86
-
87
85
  if not is_toolbox_usage(self.__class__):
88
86
  return
89
87
 
@@ -26,8 +26,7 @@ from fabricatio.models.generic import ScopedConfig, WithBriefing
26
26
  from fabricatio.models.kwargs_types import ChooseKwargs, EmbeddingKwargs, GenerateKwargs, LLMKwargs, ValidateKwargs
27
27
  from fabricatio.models.task import Task
28
28
  from fabricatio.models.tool import Tool, ToolBox
29
- from fabricatio.parser import GenericCapture, JsonCapture
30
- from fabricatio.utils import ok
29
+ from fabricatio.utils import first_available, ok
31
30
 
32
31
  ROUTER = Router(
33
32
  routing_strategy="usage-based-routing-v2",
@@ -91,7 +90,7 @@ class LLMUsage(ScopedConfig):
91
90
  api_base=ok(
92
91
  self.llm_api_endpoint or CONFIG.llm.api_endpoint,
93
92
  "llm api endpoint is not set at any place",
94
- ).unicode_string(),
93
+ ),
95
94
  model=m_name,
96
95
  tpm=self.llm_tpm or CONFIG.llm.tpm,
97
96
  rpm=self.llm_rpm or CONFIG.llm.rpm,
@@ -109,7 +108,8 @@ class LLMUsage(ScopedConfig):
109
108
  stop=kwargs.get("stop") or self.llm_stop_sign or CONFIG.llm.stop_sign,
110
109
  top_p=kwargs.get("top_p") or self.llm_top_p or CONFIG.llm.top_p,
111
110
  max_tokens=kwargs.get("max_tokens") or self.llm_max_tokens or CONFIG.llm.max_tokens,
112
- stream=ok(kwargs.get("stream") or self.llm_stream or CONFIG.llm.stream, "stream is not set at any place"),
111
+ stream=first_available((kwargs.get("stream"), self.llm_stream, CONFIG.llm.stream),
112
+ "stream is not set at any place"),
113
113
  cache={
114
114
  "no-cache": kwargs.get("no_cache"),
115
115
  "no-store": kwargs.get("no_store"),
@@ -337,6 +337,8 @@ class LLMUsage(ScopedConfig):
337
337
  Returns:
338
338
  Optional[List[str]]: The validated response as a list of strings.
339
339
  """
340
+ from fabricatio.parser import JsonCapture
341
+
340
342
  return await self.aask_validate(
341
343
  TEMPLATE_MANAGER.render_template(
342
344
  CONFIG.templates.liststr_template,
@@ -393,6 +395,8 @@ class LLMUsage(ScopedConfig):
393
395
  Returns:
394
396
  Optional[str]: The generated string.
395
397
  """
398
+ from fabricatio.parser import GenericCapture
399
+
396
400
  return await self.aask_validate( # pyright: ignore [reportReturnType]
397
401
  TEMPLATE_MANAGER.render_template(
398
402
  CONFIG.templates.generic_string_template,
@@ -420,6 +424,8 @@ class LLMUsage(ScopedConfig):
420
424
  Returns:
421
425
  Optional[List[T]]: The final validated selection result list, with element types matching the input `choices`.
422
426
  """
427
+ from fabricatio.parser import JsonCapture
428
+
423
429
  if dup := duplicates_everseen(choices, key=lambda x: x.name):
424
430
  logger.error(err := f"Redundant choices: {dup}")
425
431
  raise ValueError(err)
@@ -495,6 +501,8 @@ class LLMUsage(ScopedConfig):
495
501
  Returns:
496
502
  bool: The judgment result (True or False) based on the AI's response.
497
503
  """
504
+ from fabricatio.parser import JsonCapture
505
+
498
506
  return await self.aask_validate(
499
507
  question=TEMPLATE_MANAGER.render_template(
500
508
  CONFIG.templates.make_judgment_template,
@@ -556,7 +564,6 @@ class EmbeddingUsage(LLMUsage):
556
564
  or self.llm_api_endpoint
557
565
  or CONFIG.llm.api_endpoint
558
566
  )
559
- .unicode_string()
560
567
  .rstrip("/"),
561
568
  # seems embedding function takes no base_url end with a slash
562
569
  )
@@ -11,7 +11,7 @@ Key Features:
11
11
  - Text utilities: Word boundary splitting and word counting.
12
12
  """
13
13
  from enum import StrEnum
14
- from typing import Any, Dict, List, Optional, Self, Tuple, overload, Union
14
+ from typing import Any, Dict, List, Optional, Self, Tuple, Union, overload
15
15
 
16
16
  from pydantic import JsonValue
17
17
 
@@ -724,7 +724,7 @@ class SecretStr:
724
724
 
725
725
  def __init__(self, source: str) -> None: ...
726
726
 
727
- def expose(self) -> str:
727
+ def get_secret_value(self) -> str:
728
728
  """Expose the secret string."""
729
729
 
730
730
 
@@ -1,6 +1,6 @@
1
1
  """A collection of utility functions for the fabricatio package."""
2
2
 
3
- from typing import Any, Dict, List, Mapping, Optional, TypedDict, Unpack, overload, Type, Tuple
3
+ from typing import Any, Dict, Iterable, List, Mapping, Optional, Tuple, Type, TypedDict, Unpack, overload
4
4
 
5
5
  from fabricatio.decorators import precheck_package
6
6
  from fabricatio.journal import logger
@@ -116,6 +116,37 @@ def ok[T](val: Optional[T], msg: str = "Value is None") -> T:
116
116
  return val
117
117
 
118
118
 
119
+ def first_available[T](iterable: Iterable[T], msg: str = "No available item found in the iterable.") -> T:
120
+ """Return the first available item in the iterable that's not None.
121
+
122
+ This function searches through the provided iterable and returns the first
123
+ item that is not None. If all items are None or the iterable is empty,
124
+ it raises a ValueError.
125
+
126
+ Args:
127
+ iterable: The iterable collection to search through.
128
+ msg: The message to include in the ValueError if no non-None item is found.
129
+
130
+ Returns:
131
+ T: The first non-None item found in the iterable.
132
+ If no non-None item is found, it raises a ValueError.
133
+
134
+ Raises:
135
+ ValueError: If no non-None item is found in the iterable.
136
+
137
+ Examples:
138
+ >>> first_available([None, None, "value", "another"])
139
+ 'value'
140
+ >>> first_available([1, 2, 3])
141
+ 1
142
+ >>> assert (first_available([None, None]))
143
+ ValueError: No available item found in the iterable.
144
+ """
145
+ if (first := next((item for item in iterable if item is not None), None)) is not None:
146
+ return first
147
+ raise ValueError(msg)
148
+
149
+
119
150
  def wrapp_in_block(string: str, title: str, style: str = "-") -> str:
120
151
  """Wraps a string in a block with a title.
121
152
 
@@ -82,7 +82,7 @@ impl SecretStr {
82
82
  pub fn new(source: &str) -> Self {
83
83
  source.into()
84
84
  }
85
- fn expose(&self) -> &str {
85
+ fn get_secret_value(&self) -> &str {
86
86
  self.source.as_str()
87
87
  }
88
88
 
Binary file