fabricatio 0.2.10.dev1__tar.gz → 0.2.11.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 (168) hide show
  1. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/Cargo.lock +113 -0
  2. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/Cargo.toml +2 -0
  3. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/PKG-INFO +17 -8
  4. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/README.md +9 -2
  5. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/examples/extract_and_inject/chunk_article.py +2 -3
  6. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/examples/make_a_rating/rating.py +4 -4
  7. fabricatio-0.2.11.dev1/examples/propose_task/.gitignore +2 -0
  8. fabricatio-0.2.11.dev1/examples/propose_task/propose.py +49 -0
  9. fabricatio-0.2.11.dev1/examples/write_article/post_process.py +12 -0
  10. fabricatio-0.2.11.dev1/examples/write_article/write_article.py +207 -0
  11. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/pyproject.toml +13 -9
  12. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/python/fabricatio/actions/article.py +38 -9
  13. fabricatio-0.2.11.dev1/python/fabricatio/actions/article_rag.py +238 -0
  14. fabricatio-0.2.11.dev1/python/fabricatio/actions/fs.py +25 -0
  15. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/python/fabricatio/actions/output.py +17 -3
  16. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/python/fabricatio/actions/rag.py +3 -3
  17. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/python/fabricatio/actions/rules.py +14 -3
  18. fabricatio-0.2.11.dev1/python/fabricatio/capabilities/extract.py +70 -0
  19. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/python/fabricatio/capabilities/rating.py +5 -2
  20. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/python/fabricatio/capabilities/task.py +16 -16
  21. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/python/fabricatio/config.py +9 -2
  22. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/python/fabricatio/decorators.py +30 -30
  23. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/python/fabricatio/fs/__init__.py +9 -2
  24. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/python/fabricatio/fs/readers.py +6 -10
  25. fabricatio-0.2.11.dev1/python/fabricatio/models/extra/aricle_rag.py +236 -0
  26. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/python/fabricatio/models/extra/article_main.py +46 -2
  27. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/python/fabricatio/models/extra/problem.py +5 -1
  28. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/python/fabricatio/models/generic.py +29 -11
  29. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/python/fabricatio/models/kwargs_types.py +3 -1
  30. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/python/fabricatio/models/usages.py +9 -26
  31. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/python/fabricatio/parser.py +16 -12
  32. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/python/fabricatio/rust.pyi +124 -6
  33. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/python/fabricatio/utils.py +11 -3
  34. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/src/bib_tools.rs +16 -3
  35. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/src/hbs_helpers.rs +6 -0
  36. fabricatio-0.2.11.dev1/src/language.rs +126 -0
  37. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/src/lib.rs +3 -1
  38. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/src/templates.rs +58 -14
  39. fabricatio-0.2.11.dev1/src/typst_tools.rs +71 -0
  40. fabricatio-0.2.11.dev1/templates/built-in/extract.hbs +6 -0
  41. fabricatio-0.2.11.dev1/templates.tar.gz +0 -0
  42. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/uv.lock +119 -131
  43. fabricatio-0.2.10.dev1/examples/propose_task/propose.py +0 -32
  44. fabricatio-0.2.10.dev1/examples/write_article/write_article.py +0 -241
  45. fabricatio-0.2.10.dev1/python/fabricatio/actions/article_rag.py +0 -136
  46. fabricatio-0.2.10.dev1/python/fabricatio/models/extra/aricle_rag.py +0 -120
  47. fabricatio-0.2.10.dev1/src/language.rs +0 -40
  48. fabricatio-0.2.10.dev1/templates.tar.gz +0 -0
  49. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/.github/workflows/build-package.yaml +0 -0
  50. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/.github/workflows/ruff.yaml +0 -0
  51. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/.github/workflows/tests.yaml +0 -0
  52. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/.gitignore +0 -0
  53. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/.python-version +0 -0
  54. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/LICENSE +0 -0
  55. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/Makefile +0 -0
  56. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/examples/correct/correct.py +0 -0
  57. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/examples/correct/correct_loop.py +0 -0
  58. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/examples/extract_and_inject/.gitignore +0 -0
  59. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/examples/extract_and_inject/article_rag.py +0 -0
  60. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/examples/extract_and_inject/ask.py +0 -0
  61. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/examples/extract_and_inject/extract_and_inject.py +0 -0
  62. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/examples/extract_article/extract.py +0 -0
  63. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/examples/llm_usages/llm_usage.py +0 -0
  64. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/examples/make_diary/commits.json +0 -0
  65. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/examples/make_diary/diary.py +0 -0
  66. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/examples/minor/hello_fabricatio.py +0 -0
  67. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/examples/minor/write_a_poem.py +0 -0
  68. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/examples/reviewer/censor.py +0 -0
  69. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/examples/reviewer/review.py +0 -0
  70. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/examples/rules/.gitignore +0 -0
  71. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/examples/rules/draft_ruleset.py +0 -0
  72. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/examples/search_bibtex/.gitignore +0 -0
  73. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/examples/search_bibtex/search.py +0 -0
  74. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/examples/simple_chat/chat.py +0 -0
  75. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/examples/simple_rag/simple_rag.py +0 -0
  76. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/examples/task_handle/handle_task.py +0 -0
  77. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/examples/write_article/.gitignore +0 -0
  78. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/examples/write_article/article_rag.py +0 -0
  79. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/examples/write_outline/.gitignore +0 -0
  80. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/examples/write_outline/write_outline.py +0 -0
  81. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/examples/write_outline/write_outline_corrected.py +0 -0
  82. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/python/fabricatio/__init__.py +0 -0
  83. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/python/fabricatio/actions/__init__.py +0 -0
  84. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/python/fabricatio/capabilities/__init__.py +0 -0
  85. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/python/fabricatio/capabilities/advanced_judge.py +0 -0
  86. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/python/fabricatio/capabilities/censor.py +0 -0
  87. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/python/fabricatio/capabilities/check.py +0 -0
  88. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/python/fabricatio/capabilities/correct.py +0 -0
  89. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/python/fabricatio/capabilities/propose.py +0 -0
  90. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/python/fabricatio/capabilities/rag.py +0 -0
  91. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/python/fabricatio/capabilities/review.py +0 -0
  92. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/python/fabricatio/constants.py +0 -0
  93. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/python/fabricatio/core.py +0 -0
  94. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/python/fabricatio/fs/curd.py +0 -0
  95. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/python/fabricatio/journal.py +0 -0
  96. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/python/fabricatio/models/action.py +0 -0
  97. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/python/fabricatio/models/adv_kwargs_types.py +0 -0
  98. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/python/fabricatio/models/events.py +0 -0
  99. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/python/fabricatio/models/extra/__init__.py +0 -0
  100. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/python/fabricatio/models/extra/advanced_judge.py +0 -0
  101. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/python/fabricatio/models/extra/article_base.py +0 -0
  102. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/python/fabricatio/models/extra/article_essence.py +0 -0
  103. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/python/fabricatio/models/extra/article_outline.py +0 -0
  104. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/python/fabricatio/models/extra/article_proposal.py +0 -0
  105. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/python/fabricatio/models/extra/patches.py +0 -0
  106. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/python/fabricatio/models/extra/rag.py +0 -0
  107. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/python/fabricatio/models/extra/rule.py +0 -0
  108. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/python/fabricatio/models/role.py +0 -0
  109. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/python/fabricatio/models/task.py +0 -0
  110. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/python/fabricatio/models/tool.py +0 -0
  111. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/python/fabricatio/py.typed +0 -0
  112. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/python/fabricatio/rust_instances.py +0 -0
  113. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/python/fabricatio/toolboxes/__init__.py +0 -0
  114. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/python/fabricatio/toolboxes/arithmetic.py +0 -0
  115. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/python/fabricatio/toolboxes/fs.py +0 -0
  116. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/python/fabricatio/workflows/__init__.py +0 -0
  117. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/python/fabricatio/workflows/articles.py +0 -0
  118. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/python/fabricatio/workflows/rag.py +0 -0
  119. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/src/hash.rs +0 -0
  120. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/src/word_split.rs +0 -0
  121. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/templates/built-in/as_prompt.hbs +0 -0
  122. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/templates/built-in/binary-exploitation-ctf-solver.hbs +0 -0
  123. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/templates/built-in/check_string.hbs +0 -0
  124. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/templates/built-in/claude-xml.hbs +0 -0
  125. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/templates/built-in/clean-up-code.hbs +0 -0
  126. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/templates/built-in/co_validation.hbs +0 -0
  127. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/templates/built-in/create_json_obj.hbs +0 -0
  128. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/templates/built-in/cryptography-ctf-solver.hbs +0 -0
  129. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/templates/built-in/dependencies.hbs +0 -0
  130. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/templates/built-in/document-the-code.hbs +0 -0
  131. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/templates/built-in/draft_rating_criteria.hbs +0 -0
  132. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/templates/built-in/draft_rating_manual.hbs +0 -0
  133. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/templates/built-in/draft_rating_weights_klee.hbs +0 -0
  134. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/templates/built-in/draft_tool_usage_code.hbs +0 -0
  135. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/templates/built-in/extract_criteria_from_reasons.hbs +0 -0
  136. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/templates/built-in/extract_reasons_from_examples.hbs +0 -0
  137. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/templates/built-in/find-security-vulnerabilities.hbs +0 -0
  138. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/templates/built-in/fix-bugs.hbs +0 -0
  139. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/templates/built-in/fix_troubled_obj.hbs +0 -0
  140. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/templates/built-in/fix_troubled_string.hbs +0 -0
  141. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/templates/built-in/generic_string.hbs +0 -0
  142. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/templates/built-in/improve-performance.hbs +0 -0
  143. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/templates/built-in/liststr.hbs +0 -0
  144. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/templates/built-in/make_choice.hbs +0 -0
  145. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/templates/built-in/make_judgment.hbs +0 -0
  146. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/templates/built-in/pathstr.hbs +0 -0
  147. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/templates/built-in/rate_fine_grind.hbs +0 -0
  148. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/templates/built-in/refactor.hbs +0 -0
  149. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/templates/built-in/refined_query.hbs +0 -0
  150. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/templates/built-in/retrieved_display.hbs +0 -0
  151. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/templates/built-in/reverse-engineering-ctf-solver.hbs +0 -0
  152. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/templates/built-in/review_string.hbs +0 -0
  153. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/templates/built-in/rule_requirement.hbs +0 -0
  154. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/templates/built-in/ruleset_requirement_breakdown.hbs +0 -0
  155. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/templates/built-in/task_briefing.hbs +0 -0
  156. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/templates/built-in/web-ctf-solver.hbs +0 -0
  157. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/templates/built-in/write-git-commit.hbs +0 -0
  158. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/templates/built-in/write-github-pull-request.hbs +0 -0
  159. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/templates/built-in/write-github-readme.hbs +0 -0
  160. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/tests/test_config.py +0 -0
  161. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/tests/test_models/test_action.py +0 -0
  162. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/tests/test_models/test_advanced.py +0 -0
  163. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/tests/test_models/test_generic.py +0 -0
  164. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/tests/test_models/test_problem.py +0 -0
  165. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/tests/test_models/test_role.py +0 -0
  166. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/tests/test_models/test_task.py +0 -0
  167. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/tests/test_models/test_tool.py +0 -0
  168. {fabricatio-0.2.10.dev1 → fabricatio-0.2.11.dev1}/tests/test_models/test_usages.py +0 -0
@@ -17,6 +17,15 @@ version = "2.0.0"
17
17
  source = "registry+https://github.com/rust-lang/crates.io-index"
18
18
  checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627"
19
19
 
20
+ [[package]]
21
+ name = "aho-corasick"
22
+ version = "1.1.3"
23
+ source = "registry+https://github.com/rust-lang/crates.io-index"
24
+ checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916"
25
+ dependencies = [
26
+ "memchr",
27
+ ]
28
+
20
29
  [[package]]
21
30
  name = "anstream"
22
31
  version = "0.6.18"
@@ -451,7 +460,9 @@ dependencies = [
451
460
  "pyo3",
452
461
  "pythonize",
453
462
  "rayon",
463
+ "regex",
454
464
  "serde_json",
465
+ "tex2typst-rs",
455
466
  "unicode-segmentation",
456
467
  "walkdir",
457
468
  "whichlang",
@@ -1198,6 +1209,48 @@ dependencies = [
1198
1209
  "sha2",
1199
1210
  ]
1200
1211
 
1212
+ [[package]]
1213
+ name = "phf"
1214
+ version = "0.11.3"
1215
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1216
+ checksum = "1fd6780a80ae0c52cc120a26a1a42c1ae51b247a253e4e06113d23d2c2edd078"
1217
+ dependencies = [
1218
+ "phf_macros",
1219
+ "phf_shared",
1220
+ ]
1221
+
1222
+ [[package]]
1223
+ name = "phf_generator"
1224
+ version = "0.11.3"
1225
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1226
+ checksum = "3c80231409c20246a13fddb31776fb942c38553c51e871f8cbd687a4cfb5843d"
1227
+ dependencies = [
1228
+ "phf_shared",
1229
+ "rand",
1230
+ ]
1231
+
1232
+ [[package]]
1233
+ name = "phf_macros"
1234
+ version = "0.11.3"
1235
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1236
+ checksum = "f84ac04429c13a7ff43785d75ad27569f2951ce0ffd30a3321230db2fc727216"
1237
+ dependencies = [
1238
+ "phf_generator",
1239
+ "phf_shared",
1240
+ "proc-macro2",
1241
+ "quote",
1242
+ "syn",
1243
+ ]
1244
+
1245
+ [[package]]
1246
+ name = "phf_shared"
1247
+ version = "0.11.3"
1248
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1249
+ checksum = "67eabc2ef2a60eb7faa00097bd1ffdb5bd28e62bf39990626a582201b7a754e5"
1250
+ dependencies = [
1251
+ "siphasher",
1252
+ ]
1253
+
1201
1254
  [[package]]
1202
1255
  name = "pin-project-lite"
1203
1256
  version = "0.2.16"
@@ -1319,6 +1372,21 @@ version = "5.2.0"
1319
1372
  source = "registry+https://github.com/rust-lang/crates.io-index"
1320
1373
  checksum = "74765f6d916ee2faa39bc8e68e4f3ed8949b48cccdac59983d287a7cb71ce9c5"
1321
1374
 
1375
+ [[package]]
1376
+ name = "rand"
1377
+ version = "0.8.5"
1378
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1379
+ checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
1380
+ dependencies = [
1381
+ "rand_core",
1382
+ ]
1383
+
1384
+ [[package]]
1385
+ name = "rand_core"
1386
+ version = "0.6.4"
1387
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1388
+ checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
1389
+
1322
1390
  [[package]]
1323
1391
  name = "rayon"
1324
1392
  version = "1.10.0"
@@ -1359,6 +1427,35 @@ dependencies = [
1359
1427
  "thiserror",
1360
1428
  ]
1361
1429
 
1430
+ [[package]]
1431
+ name = "regex"
1432
+ version = "1.11.1"
1433
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1434
+ checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191"
1435
+ dependencies = [
1436
+ "aho-corasick",
1437
+ "memchr",
1438
+ "regex-automata",
1439
+ "regex-syntax",
1440
+ ]
1441
+
1442
+ [[package]]
1443
+ name = "regex-automata"
1444
+ version = "0.4.9"
1445
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1446
+ checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908"
1447
+ dependencies = [
1448
+ "aho-corasick",
1449
+ "memchr",
1450
+ "regex-syntax",
1451
+ ]
1452
+
1453
+ [[package]]
1454
+ name = "regex-syntax"
1455
+ version = "0.8.5"
1456
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1457
+ checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"
1458
+
1362
1459
  [[package]]
1363
1460
  name = "reqwest"
1364
1461
  version = "0.12.15"
@@ -1590,6 +1687,12 @@ version = "1.3.0"
1590
1687
  source = "registry+https://github.com/rust-lang/crates.io-index"
1591
1688
  checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
1592
1689
 
1690
+ [[package]]
1691
+ name = "siphasher"
1692
+ version = "1.0.1"
1693
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1694
+ checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d"
1695
+
1593
1696
  [[package]]
1594
1697
  name = "slab"
1595
1698
  version = "0.4.9"
@@ -1737,6 +1840,16 @@ dependencies = [
1737
1840
  "windows-sys 0.59.0",
1738
1841
  ]
1739
1842
 
1843
+ [[package]]
1844
+ name = "tex2typst-rs"
1845
+ version = "0.4.1"
1846
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1847
+ checksum = "3b0b6b6ad0966ace50ba5e817e4f48d759857c015f5936d4976232df786d432d"
1848
+ dependencies = [
1849
+ "phf",
1850
+ "regex",
1851
+ ]
1852
+
1740
1853
  [[package]]
1741
1854
  name = "thiserror"
1742
1855
  version = "2.0.12"
@@ -13,7 +13,9 @@ nucleo-matcher = "0.3.1"
13
13
  pyo3 = { version = "0.23.4", features = ["extension-module"] }
14
14
  pythonize = "0.23.0"
15
15
  rayon = "1.10.0"
16
+ regex = "1.11.1"
16
17
  serde_json = "1.0.138"
18
+ tex2typst-rs = "0.4.1"
17
19
  unicode-segmentation = "1.12.0"
18
20
  walkdir = "2.5.0"
19
21
  whichlang = "0.1.1"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fabricatio
3
- Version: 0.2.10.dev1
3
+ Version: 0.2.11.dev1
4
4
  Classifier: License :: OSI Approved :: MIT License
5
5
  Classifier: Programming Language :: Rust
6
6
  Classifier: Programming Language :: Python :: 3.12
@@ -14,23 +14,24 @@ Requires-Dist: asyncstdlib>=3.13.0
14
14
  Requires-Dist: json-repair>=0.39.1
15
15
  Requires-Dist: litellm>=1.60.0
16
16
  Requires-Dist: loguru>=0.7.3
17
- Requires-Dist: magika>=0.5.1
18
17
  Requires-Dist: more-itertools>=10.6.0
19
- Requires-Dist: orjson>=3.10.15
20
18
  Requires-Dist: pydantic>=2.10.6
21
19
  Requires-Dist: pydantic-settings>=2.7.1
22
20
  Requires-Dist: pymitter>=1.0.0
23
- Requires-Dist: questionary>=2.1.0
24
- Requires-Dist: regex>=2024.11.6
25
21
  Requires-Dist: rich>=13.9.4
22
+ Requires-Dist: ujson>=5.10.0
23
+ Requires-Dist: fabricatio[calc,ftd,plot,qa,rag] ; extra == 'full'
26
24
  Requires-Dist: pymilvus>=2.5.4 ; extra == 'rag'
27
- Requires-Dist: fabricatio[calc,plot,rag] ; extra == 'full'
28
25
  Requires-Dist: sympy>=1.13.3 ; extra == 'calc'
29
26
  Requires-Dist: matplotlib>=3.10.1 ; extra == 'plot'
30
- Provides-Extra: rag
27
+ Requires-Dist: questionary>=2.1.0 ; extra == 'qa'
28
+ Requires-Dist: magika>=0.6.1 ; extra == 'ftd'
31
29
  Provides-Extra: full
30
+ Provides-Extra: rag
32
31
  Provides-Extra: calc
33
32
  Provides-Extra: plot
33
+ Provides-Extra: qa
34
+ Provides-Extra: ftd
34
35
  License-File: LICENSE
35
36
  Summary: A LLM multi-agent framework.
36
37
  Keywords: ai,agents,multi-agent,llm,pyo3
@@ -47,7 +48,8 @@ Project-URL: Issues, https://github.com/Whth/fabricatio/issues
47
48
 
48
49
  ## Overview
49
50
 
50
- Fabricatio is a streamlined Python library for building LLM applications using an event-based agent structure. It leverages Rust for performance-critical tasks, Handlebars for templating, and PyO3 for Python bindings.
51
+ Fabricatio is a streamlined Python library for building LLM applications using an event-based agent structure. It
52
+ leverages Rust for performance-critical tasks, Handlebars for templating, and PyO3 for Python bindings.
51
53
 
52
54
  ## Features
53
55
 
@@ -87,6 +89,7 @@ import asyncio
87
89
  from fabricatio import Action, Role, Task, logger, WorkFlow
88
90
  from typing import Any
89
91
 
92
+
90
93
  class Hello(Action):
91
94
  name: str = "hello"
92
95
  output_key: str = "task_output"
@@ -96,6 +99,7 @@ class Hello(Action):
96
99
  logger.info("executing talk action")
97
100
  return ret
98
101
 
102
+
99
103
  async def main() -> None:
100
104
  role = Role(
101
105
  name="talker",
@@ -107,6 +111,7 @@ async def main() -> None:
107
111
  result = await task.delegate()
108
112
  logger.success(f"Result: {result}")
109
113
 
114
+
110
115
  if __name__ == "__main__":
111
116
  asyncio.run(main())
112
117
  ```
@@ -114,6 +119,7 @@ if __name__ == "__main__":
114
119
  ### Examples
115
120
 
116
121
  For various usage scenarios, refer to the following examples:
122
+
117
123
  - Simple Chat
118
124
  - Retrieval-Augmented Generation (RAG)
119
125
  - Article Extraction
@@ -161,6 +167,7 @@ max_tokens = 8192
161
167
  ## Contributing
162
168
 
163
169
  Contributions are welcome! Follow these steps:
170
+
164
171
  1. Fork the repository.
165
172
  2. Create your feature branch (`git checkout -b feature/new-feature`).
166
173
  3. Commit your changes (`git commit -am 'Add new feature'`).
@@ -174,6 +181,8 @@ Fabricatio is licensed under the MIT License. See [LICENSE](LICENSE) for details
174
181
  ## Acknowledgments
175
182
 
176
183
  Special thanks to the contributors and maintainers of:
184
+
177
185
  - [PyO3](https://github.com/PyO3/pyo3)
178
186
  - [Maturin](https://github.com/PyO3/maturin)
179
187
  - [Handlebars.rs](https://github.com/sunng87/handlebars-rust)
188
+
@@ -4,7 +4,8 @@
4
4
 
5
5
  ## Overview
6
6
 
7
- Fabricatio is a streamlined Python library for building LLM applications using an event-based agent structure. It leverages Rust for performance-critical tasks, Handlebars for templating, and PyO3 for Python bindings.
7
+ Fabricatio is a streamlined Python library for building LLM applications using an event-based agent structure. It
8
+ leverages Rust for performance-critical tasks, Handlebars for templating, and PyO3 for Python bindings.
8
9
 
9
10
  ## Features
10
11
 
@@ -44,6 +45,7 @@ import asyncio
44
45
  from fabricatio import Action, Role, Task, logger, WorkFlow
45
46
  from typing import Any
46
47
 
48
+
47
49
  class Hello(Action):
48
50
  name: str = "hello"
49
51
  output_key: str = "task_output"
@@ -53,6 +55,7 @@ class Hello(Action):
53
55
  logger.info("executing talk action")
54
56
  return ret
55
57
 
58
+
56
59
  async def main() -> None:
57
60
  role = Role(
58
61
  name="talker",
@@ -64,6 +67,7 @@ async def main() -> None:
64
67
  result = await task.delegate()
65
68
  logger.success(f"Result: {result}")
66
69
 
70
+
67
71
  if __name__ == "__main__":
68
72
  asyncio.run(main())
69
73
  ```
@@ -71,6 +75,7 @@ if __name__ == "__main__":
71
75
  ### Examples
72
76
 
73
77
  For various usage scenarios, refer to the following examples:
78
+
74
79
  - Simple Chat
75
80
  - Retrieval-Augmented Generation (RAG)
76
81
  - Article Extraction
@@ -118,6 +123,7 @@ max_tokens = 8192
118
123
  ## Contributing
119
124
 
120
125
  Contributions are welcome! Follow these steps:
126
+
121
127
  1. Fork the repository.
122
128
  2. Create your feature branch (`git checkout -b feature/new-feature`).
123
129
  3. Commit your changes (`git commit -am 'Add new feature'`).
@@ -131,6 +137,7 @@ Fabricatio is licensed under the MIT License. See [LICENSE](LICENSE) for details
131
137
  ## Acknowledgments
132
138
 
133
139
  Special thanks to the contributors and maintainers of:
140
+
134
141
  - [PyO3](https://github.com/PyO3/pyo3)
135
142
  - [Maturin](https://github.com/PyO3/maturin)
136
- - [Handlebars.rs](https://github.com/sunng87/handlebars-rust)
143
+ - [Handlebars.rs](https://github.com/sunng87/handlebars-rust)
@@ -14,8 +14,6 @@ async def main() -> None:
14
14
  Role(
15
15
  name="Researcher",
16
16
  description="chunk the article",
17
- llm_rpm=50,
18
- llm_tpm=100000,
19
17
  registry={
20
18
  Event.quick_instantiate(e := "Chunk"): WorkFlow(
21
19
  name="Chunk",
@@ -26,8 +24,9 @@ async def main() -> None:
26
24
  ).update_init_context(
27
25
  article_path=gather_files("bare_md", "md"),
28
26
  bib_manager=BibManager(path="ref.bib"),
29
- max_chunk_size=500,
27
+ max_chunk_size=600,
30
28
  max_overlapping_rate=0.3,
29
+ override_inject=True,
31
30
  ),
32
31
  },
33
32
  )
@@ -3,7 +3,7 @@
3
3
  import asyncio
4
4
  from typing import Dict, List, Set, Unpack
5
5
 
6
- import orjson
6
+ import ujson
7
7
  from fabricatio import Action, JsonCapture, Role, WorkFlow, logger
8
8
  from fabricatio.capabilities.rating import Rating
9
9
  from fabricatio.models.events import Event
@@ -33,9 +33,9 @@ class WhatToRate(Action):
33
33
  async def _execute(self, task_input: Task, rate_topic: str, **cxt: Unpack) -> List[str]:
34
34
  def _validate(resp: str) -> List[str] | None:
35
35
  if (
36
- (cap := JsonCapture.convert_with(resp, orjson.loads)) is not None
37
- and isinstance(cap, list)
38
- and all(isinstance(i, str) for i in cap)
36
+ (cap := JsonCapture.convert_with(resp, ujson.loads)) is not None
37
+ and isinstance(cap, list)
38
+ and all(isinstance(i, str) for i in cap)
39
39
  ):
40
40
  return cap
41
41
  return None
@@ -0,0 +1,2 @@
1
+ task_output
2
+ briefing.txt
@@ -0,0 +1,49 @@
1
+ """Example of proposing a task to a role."""
2
+
3
+ import asyncio
4
+ from typing import Any
5
+
6
+ from fabricatio import Action, Event, Role, Task, WorkFlow, logger
7
+ from fabricatio.actions.output import PersistentAll
8
+ from fabricatio.capabilities.propose import Propose
9
+ from fabricatio.fs import safe_text_read
10
+ from fabricatio.models.extra.article_outline import ArticleOutline
11
+ from fabricatio.utils import ok
12
+
13
+
14
+ class ProposeObj(Action, Propose):
15
+ """Action that says hello to the world."""
16
+
17
+ output_key: str = "task_output"
18
+
19
+ async def _execute(self, briefing: str, **_) -> Any:
20
+ return await self.propose(
21
+ ArticleOutline,
22
+ f"{briefing}\n\n\n\n\nAccording to the above plaintext article outline, "
23
+ f"I need you to create an `ArticleOutline` obj against it."
24
+ f"Note the heading shall not contain any heading numbers.",
25
+ )
26
+
27
+ async def main() -> None:
28
+ """Main function."""
29
+ Role(
30
+ name="talker",
31
+ description="talker role",
32
+ llm_model="openai/qwq-plus",
33
+ llm_max_tokens=8190,
34
+ llm_stream=True,
35
+ llm_temperature=0.6,
36
+ registry={
37
+ Event.quick_instantiate("talk"): WorkFlow(
38
+ name="talk", steps=(ProposeObj, PersistentAll(persist_dir="persis"))
39
+ ).update_init_context(briefing=safe_text_read("briefing.txt"))
40
+ },
41
+ )
42
+
43
+ task: Task[ArticleOutline] = Task(name="write outline")
44
+ article_outline = ok(await task.delegate("talk"))
45
+ logger.success(f"article_outline:\n{article_outline.display()}")
46
+
47
+
48
+ if __name__ == "__main__":
49
+ asyncio.run(main())
@@ -0,0 +1,12 @@
1
+ """Fix the article."""
2
+
3
+ from fabricatio.models.extra.article_main import Article
4
+
5
+ a = Article.from_persistent(
6
+ r"persistent\to_dump\Article_20250408_103051_51d822.json")
7
+ a.convert_tex()
8
+
9
+
10
+ from fabricatio.fs.curd import dump_text
11
+
12
+ dump_text("corrected.typ",a.finalized_dump())
@@ -0,0 +1,207 @@
1
+ """Example of using the library."""
2
+
3
+ import asyncio
4
+ from pathlib import Path
5
+ from typing import List
6
+
7
+ from fabricatio import Event, Role, WorkFlow, logger
8
+ from fabricatio.actions.article import (
9
+ GenerateArticleProposal,
10
+ GenerateInitialOutline,
11
+ LoadArticle,
12
+ )
13
+ from fabricatio.actions.article_rag import TweakArticleRAG, WriteArticleContentRAG
14
+ from fabricatio.actions.fs import ReadText
15
+ from fabricatio.actions.output import (
16
+ DumpFinalizedOutput,
17
+ GatherAsList,
18
+ PersistentAll,
19
+ RetrieveFromLatest,
20
+ RetrieveFromPersistent,
21
+ )
22
+ from fabricatio.actions.rules import DraftRuleSet, GatherRuleset
23
+ from fabricatio.models.action import Action
24
+ from fabricatio.models.extra.article_main import Article
25
+ from fabricatio.models.extra.article_outline import ArticleOutline
26
+ from fabricatio.models.extra.article_proposal import ArticleProposal
27
+ from fabricatio.models.extra.rule import RuleSet
28
+ from fabricatio.models.task import Task
29
+ from fabricatio.utils import ok
30
+
31
+
32
+ class Connect(Action):
33
+ """Connect the article with the article_outline and article_proposal."""
34
+
35
+ output_key: str = "article"
36
+ """Connect the article with the article_outline and article_proposal."""
37
+
38
+ async def _execute(
39
+ self,
40
+ article_briefing: str,
41
+ article_proposal: ArticleProposal,
42
+ article_outline: ArticleOutline,
43
+ article: Article,
44
+ **cxt,
45
+ ) -> Article:
46
+ """Connect the article with the article_outline and article_proposal."""
47
+ return article.update_ref(article_outline.update_ref(article_proposal.update_ref(article_briefing)))
48
+
49
+
50
+ async def main(article: bool, rule: bool = False, fintune: bool = False) -> None:
51
+ """Main function."""
52
+ Role(
53
+ name="Undergraduate Researcher",
54
+ description="Write an outline for an article in typst format.",
55
+ llm_model="openai/qwen-max",
56
+ llm_temperature=0.6,
57
+ llm_stream=True,
58
+ llm_top_p=0.53,
59
+ llm_max_tokens=8191,
60
+ llm_rpm=600,
61
+ llm_tpm=900000,
62
+ registry={
63
+ Event.quick_instantiate(ns := "article"): WorkFlow(
64
+ name="Generate Article Outline",
65
+ description="Generate an outline for an article. dump the outline to the given path. in typst format.",
66
+ steps=(
67
+ *RetrieveFromLatest.from_mapping(
68
+ retrieve_cls=RuleSet,
69
+ mapping={
70
+ "outline_ruleset": "persistent_ruleset/outline_ruleset",
71
+ "dep_ref_ruleset": "persistent_ruleset/dep_ref_ruleset",
72
+ "rev_dep_ref_ruleset": "persistent_ruleset/rev_dep_ref_ruleset",
73
+ "para_ruleset": "persistent_ruleset/para_ruleset",
74
+ "ref_ruleset": "persistent_ruleset/ref_ruleset",
75
+ "lang_ruleset": "persistent_ruleset/lang_ruleset",
76
+ "cite_ruleset": "persistent_ruleset/cite_ruleset",
77
+ "article_outline": "persistent/article_outline",
78
+ },
79
+ ),
80
+ RetrieveFromPersistent(
81
+ output_key="article_outline",
82
+ load_path=r"persistent/article_outline/ArticleOutline_20250407_203349_9c9353.json",
83
+ retrieve_cls=ArticleOutline,
84
+ ),
85
+ GenerateArticleProposal,
86
+ GenerateInitialOutline(output_key="article_outline", supervisor=False),
87
+ *GatherRuleset.from_mapping(
88
+ {
89
+ "intro_fix_ruleset": ["para_ruleset"],
90
+ "ref_fix_ruleset": ["ref_ruleset"],
91
+ "ref_twk_ruleset": ["dep_ref_ruleset", "ref_ruleset"],
92
+ "article_gen_ruleset": ["para_ruleset"],
93
+ "writing_ruleset": ["cite_ruleset"],
94
+ }
95
+ ),
96
+ WriteArticleContentRAG(
97
+ output_key="to_dump",
98
+ llm_top_p=0.46,
99
+ ref_limit=60,
100
+ llm_model="openai/qwq-plus",
101
+ target_collection="article_chunks",
102
+ extractor_model="openai/qwen-max",
103
+ query_model="openai/qwen-plus",
104
+ ),
105
+ DumpFinalizedOutput(output_key="task_output"),
106
+ PersistentAll,
107
+ ),
108
+ ).update_init_context(
109
+ article_briefing=Path("./article_briefing.txt").read_text(),
110
+ dump_path="out.typ",
111
+ persist_dir="persistent",
112
+ collection_name="article_chunks",
113
+ ),
114
+ Event.quick_instantiate(finetune := "article_finetune"): WorkFlow(
115
+ name="Generate Article Outline",
116
+ description="Generate an outline for an article. dump the outline to the given path. in typst format.",
117
+ steps=(
118
+ *RetrieveFromLatest.from_mapping(
119
+ retrieve_cls=RuleSet,
120
+ mapping={
121
+ "outline_ruleset": "persistent_ruleset/outline_ruleset",
122
+ "dep_ref_ruleset": "persistent_ruleset/dep_ref_ruleset",
123
+ "rev_dep_ref_ruleset": "persistent_ruleset/rev_dep_ref_ruleset",
124
+ "para_ruleset": "persistent_ruleset/para_ruleset",
125
+ "ref_ruleset": "persistent_ruleset/ref_ruleset",
126
+ "lang_ruleset": "persistent_ruleset/lang_ruleset",
127
+ "cite_ruleset": "persistent_ruleset/cite_ruleset",
128
+ "article_proposal": "persistent/article_proposal",
129
+ "article_outline": "persistent/article_outline",
130
+ "article": "persistent/article",
131
+ },
132
+ ),
133
+ ReadText(read_path="out.typ"),
134
+ LoadArticle,
135
+ Connect,
136
+ *GatherRuleset.from_mapping(
137
+ {
138
+ "intro_fix_ruleset": ["para_ruleset"],
139
+ "ref_fix_ruleset": ["ref_ruleset"],
140
+ "article_gen_ruleset": ["para_ruleset"],
141
+ "twk_rag_ruleset": ["para_ruleset", "cite_ruleset"],
142
+ }
143
+ ),
144
+ TweakArticleRAG(
145
+ output_key="to_dump",
146
+ ),
147
+ DumpFinalizedOutput(output_key="task_output"),
148
+ PersistentAll,
149
+ ),
150
+ ).update_init_context(
151
+ article_briefing=Path("./article_briefing.txt").read_text(),
152
+ dump_path="out_fix.typ",
153
+ persist_dir="persistent_fix",
154
+ collection_name="article_essence_0324",
155
+ ),
156
+ Event.quick_instantiate(rule_ns := "rule"): WorkFlow(
157
+ name="Generate Draft Rule Set",
158
+ description="Generate a draft rule set for the article.",
159
+ llm_model="openai/deepseek-v3-250324",
160
+ llm_stream=False,
161
+ steps=(
162
+ *DraftRuleSet.from_mapping(
163
+ {
164
+ "para_ruleset": (
165
+ 1,
166
+ "如果`paragraphs`字段为空列表,那么你就需要按照`expected_word_count`来为章节补充内容",
167
+ ),
168
+ "cite_ruleset": (
169
+ 1,
170
+ "1. 参考文献引用格式:(作者等, 年份)#cite(<bibtex_key>)\n2. #cite()必须用尖括号包裹单个BibTeX键,多引用需重复使用",
171
+ ),
172
+ "lang_ruleset": (
173
+ 1,
174
+ "1. 所有标题和正文内容必须使用中文,如果不为中文你需要翻译过来\n2. 术语和专业词汇需使用中文表述,英文缩写第一次出现的时候需要在其后面‘()’来辅助说明",
175
+ ),
176
+ "dep_ref_ruleset": (1, "章节的`depend_on`字段的`ArticleRef`只能引用当前章节之前的元素。\n"),
177
+ "rev_dep_ref_ruleset": (
178
+ 1,
179
+ "章节的`support_to`字段的`ArticleRef`只能引用当前章节之后的元素。\n",
180
+ ),
181
+ "ref_ruleset": (1, "ArticleRef必须指向已定义元素"),
182
+ "outline_ruleset": (1, "标题使用学术术语"),
183
+ }
184
+ ),
185
+ GatherAsList(gather_suffix="ruleset").to_task_output(),
186
+ PersistentAll(persist_dir="persistent_ruleset"),
187
+ ),
188
+ ),
189
+ },
190
+ )
191
+
192
+ if rule:
193
+ draft_rule_task: Task[List[RuleSet]] = Task(name="draft a rule set")
194
+ rule_set = ok(await draft_rule_task.delegate(rule_ns), "Failed to generate ruleset")
195
+ logger.success(f"Ruleset:\n{len(rule_set)}")
196
+ if article:
197
+ proposed_task = Task(name="write an article")
198
+ path = ok(await proposed_task.delegate(ns), "Failed to generate an article ")
199
+ logger.success(f"The outline is saved in:\n{path}")
200
+ if fintune:
201
+ proposed_task = Task(name="finetune an article")
202
+ path = ok(await proposed_task.delegate(finetune), "Failed to generate an article")
203
+ logger.success(f"The outline is saved in:\n{path}")
204
+
205
+
206
+ if __name__ == "__main__":
207
+ asyncio.run(main(True, False, False))