fabricatio 0.2.11.dev2__tar.gz → 0.2.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 (168) hide show
  1. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/.gitignore +2 -0
  2. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/Cargo.lock +32 -0
  3. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/Cargo.toml +1 -0
  4. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/PKG-INFO +4 -2
  5. fabricatio-0.2.12/examples/write_article/.gitignore +4 -0
  6. fabricatio-0.2.12/examples/write_article/write_article.py +197 -0
  7. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/examples/write_outline/write_outline.py +5 -2
  8. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/pyproject.toml +7 -3
  9. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/python/fabricatio/actions/article.py +20 -4
  10. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/python/fabricatio/actions/article_rag.py +176 -73
  11. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/python/fabricatio/actions/output.py +43 -2
  12. fabricatio-0.2.12/python/fabricatio/capabilities/advanced_rag.py +56 -0
  13. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/python/fabricatio/capabilities/rag.py +4 -4
  14. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/python/fabricatio/config.py +3 -3
  15. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/python/fabricatio/fs/curd.py +1 -1
  16. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/python/fabricatio/models/action.py +18 -13
  17. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/python/fabricatio/models/extra/aricle_rag.py +42 -19
  18. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/python/fabricatio/models/extra/article_base.py +79 -37
  19. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/python/fabricatio/models/extra/article_main.py +89 -45
  20. fabricatio-0.2.12/python/fabricatio/models/extra/article_outline.py +78 -0
  21. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/python/fabricatio/models/generic.py +10 -6
  22. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/python/fabricatio/models/kwargs_types.py +1 -1
  23. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/python/fabricatio/models/role.py +5 -4
  24. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/python/fabricatio/models/task.py +13 -1
  25. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/python/fabricatio/models/usages.py +1 -1
  26. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/python/fabricatio/rust.pyi +34 -1
  27. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/python/fabricatio/utils.py +5 -5
  28. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/src/templates.rs +1 -1
  29. fabricatio-0.2.12/src/typst_tools.rs +159 -0
  30. fabricatio-0.2.12/templates.tar.gz +0 -0
  31. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/tests/test_models/test_problem.py +17 -37
  32. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/uv.lock +136 -100
  33. fabricatio-0.2.11.dev2/examples/write_article/.gitignore +0 -3
  34. fabricatio-0.2.11.dev2/examples/write_article/write_article.py +0 -90
  35. fabricatio-0.2.11.dev2/python/fabricatio/models/extra/article_outline.py +0 -40
  36. fabricatio-0.2.11.dev2/src/typst_tools.rs +0 -80
  37. fabricatio-0.2.11.dev2/templates.tar.gz +0 -0
  38. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/.github/workflows/build-package.yaml +0 -0
  39. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/.github/workflows/ruff.yaml +0 -0
  40. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/.github/workflows/tests.yaml +0 -0
  41. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/.python-version +0 -0
  42. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/LICENSE +0 -0
  43. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/Makefile +0 -0
  44. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/README.md +0 -0
  45. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/examples/correct/correct.py +0 -0
  46. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/examples/correct/correct_loop.py +0 -0
  47. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/examples/extract_and_inject/.gitignore +0 -0
  48. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/examples/extract_and_inject/article_rag.py +0 -0
  49. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/examples/extract_and_inject/ask.py +0 -0
  50. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/examples/extract_and_inject/chunk_article.py +0 -0
  51. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/examples/extract_and_inject/extract_and_inject.py +0 -0
  52. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/examples/extract_article/extract.py +0 -0
  53. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/examples/llm_usages/llm_usage.py +0 -0
  54. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/examples/make_a_rating/rating.py +0 -0
  55. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/examples/make_diary/commits.json +0 -0
  56. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/examples/make_diary/diary.py +0 -0
  57. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/examples/minor/hello_fabricatio.py +0 -0
  58. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/examples/minor/write_a_poem.py +0 -0
  59. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/examples/propose_task/.gitignore +0 -0
  60. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/examples/propose_task/propose.py +0 -0
  61. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/examples/reviewer/censor.py +0 -0
  62. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/examples/reviewer/review.py +0 -0
  63. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/examples/rules/.gitignore +0 -0
  64. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/examples/rules/draft_ruleset.py +0 -0
  65. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/examples/search_bibtex/.gitignore +0 -0
  66. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/examples/search_bibtex/search.py +0 -0
  67. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/examples/simple_chat/chat.py +0 -0
  68. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/examples/simple_rag/simple_rag.py +0 -0
  69. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/examples/task_handle/handle_task.py +0 -0
  70. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/examples/write_article/article_rag.py +0 -0
  71. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/examples/write_article/post_process.py +0 -0
  72. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/examples/write_outline/.gitignore +0 -0
  73. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/examples/write_outline/write_outline_corrected.py +0 -0
  74. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/python/fabricatio/__init__.py +0 -0
  75. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/python/fabricatio/actions/__init__.py +0 -0
  76. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/python/fabricatio/actions/fs.py +0 -0
  77. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/python/fabricatio/actions/rag.py +0 -0
  78. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/python/fabricatio/actions/rules.py +0 -0
  79. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/python/fabricatio/capabilities/__init__.py +0 -0
  80. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/python/fabricatio/capabilities/advanced_judge.py +0 -0
  81. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/python/fabricatio/capabilities/censor.py +0 -0
  82. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/python/fabricatio/capabilities/check.py +0 -0
  83. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/python/fabricatio/capabilities/correct.py +0 -0
  84. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/python/fabricatio/capabilities/extract.py +0 -0
  85. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/python/fabricatio/capabilities/propose.py +0 -0
  86. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/python/fabricatio/capabilities/rating.py +0 -0
  87. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/python/fabricatio/capabilities/review.py +0 -0
  88. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/python/fabricatio/capabilities/task.py +0 -0
  89. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/python/fabricatio/constants.py +0 -0
  90. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/python/fabricatio/core.py +0 -0
  91. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/python/fabricatio/decorators.py +0 -0
  92. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/python/fabricatio/fs/__init__.py +0 -0
  93. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/python/fabricatio/fs/readers.py +0 -0
  94. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/python/fabricatio/journal.py +0 -0
  95. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/python/fabricatio/models/adv_kwargs_types.py +0 -0
  96. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/python/fabricatio/models/events.py +0 -0
  97. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/python/fabricatio/models/extra/__init__.py +0 -0
  98. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/python/fabricatio/models/extra/advanced_judge.py +0 -0
  99. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/python/fabricatio/models/extra/article_essence.py +0 -0
  100. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/python/fabricatio/models/extra/article_proposal.py +0 -0
  101. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/python/fabricatio/models/extra/patches.py +0 -0
  102. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/python/fabricatio/models/extra/problem.py +0 -0
  103. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/python/fabricatio/models/extra/rag.py +0 -0
  104. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/python/fabricatio/models/extra/rule.py +0 -0
  105. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/python/fabricatio/models/tool.py +0 -0
  106. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/python/fabricatio/parser.py +0 -0
  107. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/python/fabricatio/py.typed +0 -0
  108. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/python/fabricatio/rust_instances.py +0 -0
  109. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/python/fabricatio/toolboxes/__init__.py +0 -0
  110. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/python/fabricatio/toolboxes/arithmetic.py +0 -0
  111. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/python/fabricatio/toolboxes/fs.py +0 -0
  112. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/python/fabricatio/workflows/__init__.py +0 -0
  113. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/python/fabricatio/workflows/articles.py +0 -0
  114. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/python/fabricatio/workflows/rag.py +0 -0
  115. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/src/bib_tools.rs +0 -0
  116. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/src/hash.rs +0 -0
  117. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/src/hbs_helpers.rs +0 -0
  118. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/src/language.rs +0 -0
  119. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/src/lib.rs +0 -0
  120. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/src/word_split.rs +0 -0
  121. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/templates/built-in/as_prompt.hbs +0 -0
  122. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/templates/built-in/binary-exploitation-ctf-solver.hbs +0 -0
  123. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/templates/built-in/check_string.hbs +0 -0
  124. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/templates/built-in/claude-xml.hbs +0 -0
  125. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/templates/built-in/clean-up-code.hbs +0 -0
  126. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/templates/built-in/co_validation.hbs +0 -0
  127. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/templates/built-in/create_json_obj.hbs +0 -0
  128. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/templates/built-in/cryptography-ctf-solver.hbs +0 -0
  129. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/templates/built-in/dependencies.hbs +0 -0
  130. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/templates/built-in/document-the-code.hbs +0 -0
  131. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/templates/built-in/draft_rating_criteria.hbs +0 -0
  132. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/templates/built-in/draft_rating_manual.hbs +0 -0
  133. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/templates/built-in/draft_rating_weights_klee.hbs +0 -0
  134. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/templates/built-in/draft_tool_usage_code.hbs +0 -0
  135. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/templates/built-in/extract.hbs +0 -0
  136. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/templates/built-in/extract_criteria_from_reasons.hbs +0 -0
  137. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/templates/built-in/extract_reasons_from_examples.hbs +0 -0
  138. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/templates/built-in/find-security-vulnerabilities.hbs +0 -0
  139. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/templates/built-in/fix-bugs.hbs +0 -0
  140. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/templates/built-in/fix_troubled_obj.hbs +0 -0
  141. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/templates/built-in/fix_troubled_string.hbs +0 -0
  142. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/templates/built-in/generic_string.hbs +0 -0
  143. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/templates/built-in/improve-performance.hbs +0 -0
  144. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/templates/built-in/liststr.hbs +0 -0
  145. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/templates/built-in/make_choice.hbs +0 -0
  146. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/templates/built-in/make_judgment.hbs +0 -0
  147. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/templates/built-in/pathstr.hbs +0 -0
  148. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/templates/built-in/rate_fine_grind.hbs +0 -0
  149. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/templates/built-in/refactor.hbs +0 -0
  150. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/templates/built-in/refined_query.hbs +0 -0
  151. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/templates/built-in/retrieved_display.hbs +0 -0
  152. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/templates/built-in/reverse-engineering-ctf-solver.hbs +0 -0
  153. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/templates/built-in/review_string.hbs +0 -0
  154. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/templates/built-in/rule_requirement.hbs +0 -0
  155. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/templates/built-in/ruleset_requirement_breakdown.hbs +0 -0
  156. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/templates/built-in/task_briefing.hbs +0 -0
  157. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/templates/built-in/web-ctf-solver.hbs +0 -0
  158. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/templates/built-in/write-git-commit.hbs +0 -0
  159. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/templates/built-in/write-github-pull-request.hbs +0 -0
  160. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/templates/built-in/write-github-readme.hbs +0 -0
  161. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/tests/test_config.py +0 -0
  162. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/tests/test_models/test_action.py +0 -0
  163. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/tests/test_models/test_advanced.py +0 -0
  164. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/tests/test_models/test_generic.py +0 -0
  165. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/tests/test_models/test_role.py +0 -0
  166. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/tests/test_models/test_task.py +0 -0
  167. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/tests/test_models/test_tool.py +0 -0
  168. {fabricatio-0.2.11.dev2 → fabricatio-0.2.12}/tests/test_models/test_usages.py +0 -0
@@ -166,3 +166,5 @@ cython_debug/
166
166
  extra/scripts/*
167
167
  output/
168
168
  .vscode/
169
+ templates/customed
170
+ *.typ
@@ -76,6 +76,12 @@ dependencies = [
76
76
  "windows-sys 0.59.0",
77
77
  ]
78
78
 
79
+ [[package]]
80
+ name = "anyhow"
81
+ version = "1.0.98"
82
+ source = "registry+https://github.com/rust-lang/crates.io-index"
83
+ checksum = "e16d2d3311acee920a9eb8d33b8cbc1787ce4a264e85f964c2404b969bdcd487"
84
+
79
85
  [[package]]
80
86
  name = "arrayref"
81
87
  version = "0.3.9"
@@ -462,6 +468,7 @@ dependencies = [
462
468
  "rayon",
463
469
  "regex",
464
470
  "serde_json",
471
+ "serde_yml",
465
472
  "tex2typst-rs",
466
473
  "unicode-segmentation",
467
474
  "walkdir",
@@ -980,6 +987,16 @@ dependencies = [
980
987
  "redox_syscall",
981
988
  ]
982
989
 
990
+ [[package]]
991
+ name = "libyml"
992
+ version = "0.0.5"
993
+ source = "registry+https://github.com/rust-lang/crates.io-index"
994
+ checksum = "3302702afa434ffa30847a83305f0a69d6abd74293b6554c18ec85c7ef30c980"
995
+ dependencies = [
996
+ "anyhow",
997
+ "version_check",
998
+ ]
999
+
983
1000
  [[package]]
984
1001
  name = "linux-raw-sys"
985
1002
  version = "0.9.3"
@@ -1670,6 +1687,21 @@ dependencies = [
1670
1687
  "serde",
1671
1688
  ]
1672
1689
 
1690
+ [[package]]
1691
+ name = "serde_yml"
1692
+ version = "0.0.12"
1693
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1694
+ checksum = "59e2dd588bf1597a252c3b920e0143eb99b0f76e4e082f4c92ce34fbc9e71ddd"
1695
+ dependencies = [
1696
+ "indexmap",
1697
+ "itoa",
1698
+ "libyml",
1699
+ "memchr",
1700
+ "ryu",
1701
+ "serde",
1702
+ "version_check",
1703
+ ]
1704
+
1673
1705
  [[package]]
1674
1706
  name = "sha2"
1675
1707
  version = "0.10.8"
@@ -15,6 +15,7 @@ pythonize = "0.23.0"
15
15
  rayon = "1.10.0"
16
16
  regex = "1.11.1"
17
17
  serde_json = "1.0.138"
18
+ serde_yml = "0.0.12"
18
19
  tex2typst-rs = "0.4.1"
19
20
  unicode-segmentation = "1.12.0"
20
21
  walkdir = "2.5.0"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fabricatio
3
- Version: 0.2.11.dev2
3
+ Version: 0.2.12
4
4
  Classifier: License :: OSI Approved :: MIT License
5
5
  Classifier: Programming Language :: Rust
6
6
  Classifier: Programming Language :: Python :: 3.12
@@ -20,18 +20,20 @@ Requires-Dist: pydantic-settings>=2.7.1
20
20
  Requires-Dist: pymitter>=1.0.0
21
21
  Requires-Dist: rich>=13.9.4
22
22
  Requires-Dist: ujson>=5.10.0
23
- Requires-Dist: fabricatio[calc,ftd,plot,qa,rag] ; extra == 'full'
23
+ Requires-Dist: fabricatio[calc,ftd,plot,qa,rag,cli] ; extra == 'full'
24
24
  Requires-Dist: pymilvus>=2.5.4 ; extra == 'rag'
25
25
  Requires-Dist: sympy>=1.13.3 ; extra == 'calc'
26
26
  Requires-Dist: matplotlib>=3.10.1 ; extra == 'plot'
27
27
  Requires-Dist: questionary>=2.1.0 ; extra == 'qa'
28
28
  Requires-Dist: magika>=0.6.1 ; extra == 'ftd'
29
+ Requires-Dist: typer-slim[standard]>=0.15.2 ; extra == 'cli'
29
30
  Provides-Extra: full
30
31
  Provides-Extra: rag
31
32
  Provides-Extra: calc
32
33
  Provides-Extra: plot
33
34
  Provides-Extra: qa
34
35
  Provides-Extra: ftd
36
+ Provides-Extra: cli
35
37
  License-File: LICENSE
36
38
  Summary: A LLM multi-agent framework.
37
39
  Keywords: ai,agents,multi-agent,llm,pyo3
@@ -0,0 +1,4 @@
1
+ article_briefing.txt
2
+ article_outline_raw.txt
3
+ out.typ
4
+ persistent*
@@ -0,0 +1,197 @@
1
+ """Example of using the library."""
2
+
3
+ import asyncio
4
+ from pathlib import Path
5
+
6
+ import typer
7
+ from fabricatio import Event, Role, WorkFlow, logger
8
+ from fabricatio.actions.article import ExtractOutlineFromRaw, GenerateArticleProposal, GenerateInitialOutline
9
+ from fabricatio.actions.article_rag import ArticleConsultRAG, WriteArticleContentRAG
10
+ from fabricatio.actions.output import DumpFinalizedOutput, PersistentAll, RenderedDump
11
+ from fabricatio.models.extra.article_outline import ArticleOutline
12
+ from fabricatio.models.task import Task
13
+ from fabricatio.utils import ok
14
+ from typer import Typer
15
+
16
+ # from pydantic import HttpUrl
17
+
18
+ Role(
19
+ name="Undergraduate Researcher",
20
+ description="Write an outline for an article in typst format.",
21
+ llm_model="openai/deepseek-v3-250324",
22
+ llm_temperature=0.45,
23
+ # llm_api_endpoint=HttpUrl("https://dashscope.aliyuncs.com/compatible-mode/v1"),
24
+ llm_top_p=0.95,
25
+ llm_max_tokens=8191,
26
+ llm_rpm=600,
27
+ llm_tpm=900000,
28
+ llm_timeout=600,
29
+ registry={
30
+ Event.quick_instantiate(ns := "article"): WorkFlow(
31
+ name="Generate Article",
32
+ description="Generate an article. dump the outline to the given path. in typst format.",
33
+ steps=(
34
+ GenerateArticleProposal,
35
+ GenerateInitialOutline(output_key="article_outline"),
36
+ PersistentAll,
37
+ (
38
+ a := WriteArticleContentRAG(
39
+ output_key="to_dump",
40
+ ref_limit=18,
41
+ threshold=0.58,
42
+ result_per_query=2,
43
+ extractor_model={"model": "openai/qwen-max"},
44
+ query_model={"model": "openai/qwen-turbo", "temperature": 0.3, "top_p": 0.85},
45
+ )
46
+ ),
47
+ PersistentAll,
48
+ DumpFinalizedOutput(dump_path="median.typ"),
49
+ RenderedDump(template_name="article").to_task_output(),
50
+ ),
51
+ ),
52
+ Event.quick_instantiate(ns2 := "complete"): WorkFlow(
53
+ name="Generate Article",
54
+ description="Generate an article with given raw article outline. dump the outline to the given path. in typst format.",
55
+ steps=(
56
+ ExtractOutlineFromRaw(output_key="article_outline"),
57
+ PersistentAll,
58
+ a,
59
+ PersistentAll,
60
+ DumpFinalizedOutput(dump_path="median.typ"),
61
+ RenderedDump(template_name="article").to_task_output(),
62
+ ),
63
+ ),
64
+ Event.quick_instantiate(ns3 := "finish"): WorkFlow(
65
+ name="Finish Article",
66
+ description="Finish an article with given article outline. dump the outline to the given path. in typst format.",
67
+ steps=(
68
+ a,
69
+ PersistentAll,
70
+ DumpFinalizedOutput(dump_path="median.typ"),
71
+ RenderedDump(template_name="article").to_task_output(),
72
+ ),
73
+ ),
74
+ Event.quick_instantiate(ns4 := "consult"): WorkFlow(
75
+ name="Consult Article",
76
+ description="Consult an article with given article outline. dump the outline to the given path. in typst format.",
77
+ steps=(ArticleConsultRAG(ref_q_model={"model":"openai/qwen-turbo"}).to_task_output(),),
78
+ ),
79
+ },
80
+ )
81
+
82
+
83
+ app = Typer()
84
+
85
+
86
+ @app.command()
87
+ def consult(
88
+ collection_name: str = typer.Option("article_chunks", "-c", "--collection-name", help="Name of the collection."),
89
+ ) -> None:
90
+ """Consult an article based on a given article outline."""
91
+ _ = asyncio.run(
92
+ Task(name="Answer Question")
93
+ .update_init_context(
94
+ collection_name=collection_name,
95
+ )
96
+ .delegate(ns4)
97
+ )
98
+
99
+ logger.info("Finished")
100
+
101
+
102
+ @app.command()
103
+ def finish(
104
+ article_outline_path: Path = typer.Argument( # noqa: B008
105
+ help="Path to the article outline raw file."
106
+ ),
107
+ dump_path: Path = typer.Option(Path("out.typ"), "-d", "--dump-path", help="Path to dump the final output."), # noqa: B008
108
+ persist_dir: Path = typer.Option( # noqa: B008
109
+ Path("persistent"), "-p", "--persist-dir", help="Directory to persist the output."
110
+ ),
111
+ collection_name: str = typer.Option("article_chunks", "-c", "--collection-name", help="Name of the collection."),
112
+ supervisor: bool = typer.Option(False, "-s", "--supervisor", help="Whether to use the supervisor mode."),
113
+ ) -> None:
114
+ """Finish an article based on a given article outline."""
115
+ path = ok(
116
+ asyncio.run(
117
+ Task(name="write an article")
118
+ .update_init_context(
119
+ article_outline=ArticleOutline.from_persistent(article_outline_path),
120
+ dump_path=dump_path,
121
+ persist_dir=persist_dir,
122
+ collection_name=collection_name,
123
+ supervisor=supervisor,
124
+ )
125
+ .delegate(ns3)
126
+ ),
127
+ "Failed to generate an article ",
128
+ )
129
+ logger.success(f"The outline is saved in:\n{path}")
130
+
131
+
132
+ @app.command()
133
+ def completion(
134
+ article_outline_raw_path: Path = typer.Option( # noqa: B008
135
+ Path("article_outline_raw.txt"), "-a", "--article-outline-raw", help="Path to the article outline raw file."
136
+ ),
137
+ dump_path: Path = typer.Option(Path("out.typ"), "-d", "--dump-path", help="Path to dump the final output."), # noqa: B008
138
+ persist_dir: Path = typer.Option( # noqa: B008
139
+ Path("persistent"), "-p", "--persist-dir", help="Directory to persist the output."
140
+ ),
141
+ collection_name: str = typer.Option("article_chunks", "-c", "--collection-name", help="Name of the collection."),
142
+ supervisor: bool = typer.Option(False, "-s", "--supervisor", help="Whether to use the supervisor mode."),
143
+ ) -> None:
144
+ """Write an article based on a raw article outline."""
145
+ path = ok(
146
+ asyncio.run(
147
+ Task(name="write an article")
148
+ .update_init_context(
149
+ article_outline_raw_path=article_outline_raw_path,
150
+ dump_path=dump_path,
151
+ persist_dir=persist_dir,
152
+ collection_name=collection_name,
153
+ supervisor=supervisor,
154
+ )
155
+ .delegate(ns2)
156
+ ),
157
+ "Failed to generate an article ",
158
+ )
159
+ logger.success(f"The outline is saved in:\n{path}")
160
+
161
+
162
+ @app.command()
163
+ def write(
164
+ article_briefing: Path = typer.Option( # noqa: B008
165
+ Path("article_briefing.txt"), "-a", "--article-briefing", help="Path to the article briefing file."
166
+ ),
167
+ dump_path: Path = typer.Option(Path("out.typ"), "-d", "--dump-path", help="Path to dump the final output."), # noqa: B008
168
+ persist_dir: Path = typer.Option( # noqa: B008
169
+ Path("persistent"), "-p", "--persist-dir", help="Directory to persist the output."
170
+ ),
171
+ collection_name: str = typer.Option("article_chunks", "-c", "--collection-name", help="Name of the collection."),
172
+ supervisor: bool = typer.Option(False, "-s", "--supervisor", help="Whether to use the supervisor mode."),
173
+ ) -> None:
174
+ """Write an article based on a briefing.
175
+
176
+ This function generates an article outline and content based on the provided briefing.
177
+ The outline and content are then dumped to the specified path and persisted in the given directory.
178
+ """
179
+ path = ok(
180
+ asyncio.run(
181
+ Task(name="write an article")
182
+ .update_init_context(
183
+ article_briefing=article_briefing.read_text(),
184
+ dump_path=dump_path,
185
+ persist_dir=persist_dir,
186
+ collection_name=collection_name,
187
+ supervisor=supervisor,
188
+ )
189
+ .delegate(ns)
190
+ ),
191
+ "Failed to generate an article ",
192
+ )
193
+ logger.success(f"The outline is saved in:\n{path}")
194
+
195
+
196
+ if __name__ == "__main__":
197
+ app()
@@ -3,6 +3,8 @@
3
3
  import asyncio
4
4
 
5
5
  from fabricatio import Event, Role, logger
6
+ from fabricatio.models.task import Task
7
+ from fabricatio.utils import ok
6
8
  from fabricatio.workflows.articles import WriteOutlineCorrectedWorkFlow
7
9
 
8
10
 
@@ -14,10 +16,11 @@ async def main() -> None:
14
16
  registry={Event.quick_instantiate(ns := "article"): WriteOutlineCorrectedWorkFlow},
15
17
  )
16
18
 
17
- proposed_task = await role.propose_task(
19
+ proposed_task = await role.propose(
20
+ Task,
18
21
  "You need to read the `./article_briefing.txt` file and write an outline for the article in typst format. The outline should be saved in the `./out.typ` file.",
19
22
  )
20
- path = await proposed_task.delegate(ns)
23
+ path = await ok(proposed_task).delegate(ns)
21
24
  logger.success(f"The outline is saved in:\n{path}")
22
25
 
23
26
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "fabricatio"
3
- version = "0.2.11-dev2"
3
+ version = "0.2.12"
4
4
  description = "A LLM multi-agent framework."
5
5
  readme = "README.md"
6
6
  license = { file = "LICENSE" }
@@ -74,7 +74,7 @@ dev = [
74
74
 
75
75
  [project.optional-dependencies]
76
76
  full = [
77
- "fabricatio[calc,ftd,plot,qa,rag]",
77
+ "fabricatio[calc,ftd,plot,qa,rag,cli]",
78
78
  ]
79
79
  rag = [
80
80
  "pymilvus>=2.5.4",
@@ -92,6 +92,9 @@ qa = [
92
92
  ftd = [
93
93
  "magika>=0.6.1",
94
94
  ]
95
+ cli = [
96
+ "typer-slim[standard]>=0.15.2",
97
+ ]
95
98
 
96
99
  [tool.ruff]
97
100
  include = ["pyproject.toml", "python/fabricatio/*.py", "python/fabricatio/*.pyi", "examples/*.py"]
@@ -134,7 +137,8 @@ ignore = [
134
137
  "PYI063",
135
138
  "PYI021",
136
139
  "ASYNC109",
137
- "RUF001"
140
+ "RUF001",
141
+ "PYI019"
138
142
  ]
139
143
  [tool.ruff.lint.pydocstyle]
140
144
  convention = "google"
@@ -149,10 +149,10 @@ class GenerateInitialOutline(Action, Extract):
149
149
  async def _execute(
150
150
  self,
151
151
  article_proposal: ArticleProposal,
152
+ supervisor: Optional[bool] = None,
152
153
  **_,
153
154
  ) -> Optional[ArticleOutline]:
154
- raw_outline = await self.aask(
155
- f"{(article_proposal.as_prompt())}\n"
155
+ req = (
156
156
  f"Design each chapter of a proper and academic and ready for release manner.\n"
157
157
  f"You Must make sure every chapter have sections, and every section have subsections.\n"
158
158
  f"Make the chapter and sections and subsections bing divided into a specific enough article component.\n"
@@ -160,14 +160,16 @@ class GenerateInitialOutline(Action, Extract):
160
160
  f"Note that you SHALL use `{article_proposal.language}` as written language",
161
161
  )
162
162
 
163
- if self.supervisor:
163
+ raw_outline = await self.aask(f"{(article_proposal.as_prompt())}\n{req}")
164
+
165
+ if supervisor or (supervisor is None and self.supervisor):
164
166
  from questionary import confirm, text
165
167
 
166
168
  r_print(raw_outline)
167
169
  while not await confirm("Accept this version and continue?", default=True).ask_async():
168
170
  imp = await text("Enter the improvement:").ask_async()
169
171
  raw_outline = await self.aask(
170
- f"{article_proposal.as_prompt()}\n{wrapp_in_block(raw_outline, 'Previous ArticleOutline')}\n{imp}"
172
+ f"{article_proposal.as_prompt()}\n{wrapp_in_block(raw_outline, 'Previous ArticleOutline')}\n{req}\n{wrapp_in_block(imp, title='Improvement')}"
171
173
  )
172
174
  r_print(raw_outline)
173
175
 
@@ -177,6 +179,20 @@ class GenerateInitialOutline(Action, Extract):
177
179
  ).update_ref(article_proposal)
178
180
 
179
181
 
182
+ class ExtractOutlineFromRaw(Action, Extract):
183
+ """Extract the outline from the raw outline."""
184
+
185
+ output_key: str = "article_outline_from_raw"
186
+
187
+ async def _execute(self, article_outline_raw_path: str | Path, **cxt) -> ArticleOutline:
188
+ logger.info(f"Extracting outline from raw: {Path(article_outline_raw_path).as_posix()}")
189
+
190
+ return ok(
191
+ await self.extract(ArticleOutline, safe_text_read(article_outline_raw_path)),
192
+ "Could not extract the outline from raw.",
193
+ )
194
+
195
+
180
196
  class FixIntrospectedErrors(Action, Censor):
181
197
  """Fix introspected errors in the article outline."""
182
198