fabricatio 0.2.10.dev0__tar.gz → 0.2.11__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (171) hide show
  1. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/.gitignore +1 -0
  2. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/Cargo.lock +113 -0
  3. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/Cargo.toml +2 -0
  4. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/PKG-INFO +19 -11
  5. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/README.md +9 -4
  6. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/examples/extract_and_inject/.gitignore +2 -1
  7. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/examples/extract_and_inject/ask.py +16 -17
  8. fabricatio-0.2.11/examples/extract_and_inject/chunk_article.py +40 -0
  9. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/examples/make_a_rating/rating.py +4 -4
  10. fabricatio-0.2.11/examples/propose_task/.gitignore +2 -0
  11. fabricatio-0.2.11/examples/propose_task/propose.py +49 -0
  12. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/examples/search_bibtex/search.py +1 -1
  13. fabricatio-0.2.11/examples/write_article/.gitignore +4 -0
  14. fabricatio-0.2.11/examples/write_article/post_process.py +12 -0
  15. fabricatio-0.2.11/examples/write_article/write_article.py +189 -0
  16. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/pyproject.toml +17 -10
  17. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/python/fabricatio/actions/article.py +55 -10
  18. fabricatio-0.2.11/python/fabricatio/actions/article_rag.py +390 -0
  19. fabricatio-0.2.11/python/fabricatio/actions/fs.py +25 -0
  20. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/python/fabricatio/actions/output.py +17 -3
  21. fabricatio-0.2.11/python/fabricatio/actions/rag.py +96 -0
  22. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/python/fabricatio/actions/rules.py +14 -3
  23. fabricatio-0.2.11/python/fabricatio/capabilities/extract.py +70 -0
  24. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/python/fabricatio/capabilities/rag.py +5 -2
  25. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/python/fabricatio/capabilities/rating.py +5 -2
  26. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/python/fabricatio/capabilities/task.py +16 -16
  27. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/python/fabricatio/config.py +9 -2
  28. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/python/fabricatio/decorators.py +43 -26
  29. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/python/fabricatio/fs/__init__.py +9 -2
  30. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/python/fabricatio/fs/readers.py +6 -10
  31. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/python/fabricatio/models/action.py +16 -11
  32. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/python/fabricatio/models/adv_kwargs_types.py +5 -12
  33. fabricatio-0.2.11/python/fabricatio/models/extra/aricle_rag.py +254 -0
  34. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/python/fabricatio/models/extra/article_base.py +56 -7
  35. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/python/fabricatio/models/extra/article_essence.py +8 -7
  36. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/python/fabricatio/models/extra/article_main.py +102 -6
  37. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/python/fabricatio/models/extra/problem.py +5 -1
  38. fabricatio-0.2.11/python/fabricatio/models/extra/rag.py +98 -0
  39. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/python/fabricatio/models/generic.py +43 -24
  40. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/python/fabricatio/models/kwargs_types.py +12 -3
  41. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/python/fabricatio/models/task.py +13 -1
  42. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/python/fabricatio/models/usages.py +10 -27
  43. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/python/fabricatio/parser.py +16 -12
  44. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/python/fabricatio/rust.pyi +177 -63
  45. fabricatio-0.2.11/python/fabricatio/utils.py +94 -0
  46. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/src/bib_tools.rs +39 -5
  47. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/src/hbs_helpers.rs +6 -0
  48. fabricatio-0.2.11/src/language.rs +126 -0
  49. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/src/lib.rs +3 -1
  50. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/src/templates.rs +58 -14
  51. fabricatio-0.2.11/src/typst_tools.rs +85 -0
  52. fabricatio-0.2.11/templates/built-in/extract.hbs +6 -0
  53. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/templates/built-in/refined_query.hbs +7 -6
  54. fabricatio-0.2.11/templates.tar.gz +0 -0
  55. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/tests/test_models/test_problem.py +17 -37
  56. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/uv.lock +192 -196
  57. fabricatio-0.2.10.dev0/examples/propose_task/propose.py +0 -32
  58. fabricatio-0.2.10.dev0/examples/write_article/.gitignore +0 -3
  59. fabricatio-0.2.10.dev0/examples/write_article/write_article.py +0 -241
  60. fabricatio-0.2.10.dev0/python/fabricatio/actions/article_rag.py +0 -105
  61. fabricatio-0.2.10.dev0/python/fabricatio/actions/rag.py +0 -74
  62. fabricatio-0.2.10.dev0/python/fabricatio/models/extra/rag.py +0 -72
  63. fabricatio-0.2.10.dev0/python/fabricatio/utils.py +0 -54
  64. fabricatio-0.2.10.dev0/src/language.rs +0 -40
  65. fabricatio-0.2.10.dev0/templates.tar.gz +0 -0
  66. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/.github/workflows/build-package.yaml +0 -0
  67. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/.github/workflows/ruff.yaml +0 -0
  68. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/.github/workflows/tests.yaml +0 -0
  69. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/.python-version +0 -0
  70. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/LICENSE +0 -0
  71. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/Makefile +0 -0
  72. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/examples/correct/correct.py +0 -0
  73. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/examples/correct/correct_loop.py +0 -0
  74. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/examples/extract_and_inject/article_rag.py +0 -0
  75. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/examples/extract_and_inject/extract_and_inject.py +0 -0
  76. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/examples/extract_article/extract.py +0 -0
  77. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/examples/llm_usages/llm_usage.py +0 -0
  78. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/examples/make_diary/commits.json +0 -0
  79. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/examples/make_diary/diary.py +0 -0
  80. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/examples/minor/hello_fabricatio.py +0 -0
  81. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/examples/minor/write_a_poem.py +0 -0
  82. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/examples/reviewer/censor.py +0 -0
  83. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/examples/reviewer/review.py +0 -0
  84. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/examples/rules/.gitignore +0 -0
  85. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/examples/rules/draft_ruleset.py +0 -0
  86. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/examples/search_bibtex/.gitignore +0 -0
  87. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/examples/simple_chat/chat.py +0 -0
  88. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/examples/simple_rag/simple_rag.py +0 -0
  89. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/examples/task_handle/handle_task.py +0 -0
  90. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/examples/write_article/article_rag.py +0 -0
  91. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/examples/write_outline/.gitignore +0 -0
  92. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/examples/write_outline/write_outline.py +0 -0
  93. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/examples/write_outline/write_outline_corrected.py +0 -0
  94. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/python/fabricatio/__init__.py +0 -0
  95. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/python/fabricatio/actions/__init__.py +0 -0
  96. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/python/fabricatio/capabilities/__init__.py +0 -0
  97. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/python/fabricatio/capabilities/advanced_judge.py +0 -0
  98. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/python/fabricatio/capabilities/censor.py +0 -0
  99. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/python/fabricatio/capabilities/check.py +0 -0
  100. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/python/fabricatio/capabilities/correct.py +0 -0
  101. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/python/fabricatio/capabilities/propose.py +0 -0
  102. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/python/fabricatio/capabilities/review.py +0 -0
  103. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/python/fabricatio/constants.py +0 -0
  104. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/python/fabricatio/core.py +0 -0
  105. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/python/fabricatio/fs/curd.py +0 -0
  106. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/python/fabricatio/journal.py +0 -0
  107. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/python/fabricatio/models/events.py +0 -0
  108. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/python/fabricatio/models/extra/__init__.py +0 -0
  109. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/python/fabricatio/models/extra/advanced_judge.py +0 -0
  110. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/python/fabricatio/models/extra/article_outline.py +0 -0
  111. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/python/fabricatio/models/extra/article_proposal.py +0 -0
  112. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/python/fabricatio/models/extra/patches.py +0 -0
  113. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/python/fabricatio/models/extra/rule.py +0 -0
  114. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/python/fabricatio/models/role.py +0 -0
  115. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/python/fabricatio/models/tool.py +0 -0
  116. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/python/fabricatio/py.typed +0 -0
  117. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/python/fabricatio/rust_instances.py +0 -0
  118. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/python/fabricatio/toolboxes/__init__.py +0 -0
  119. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/python/fabricatio/toolboxes/arithmetic.py +0 -0
  120. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/python/fabricatio/toolboxes/fs.py +0 -0
  121. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/python/fabricatio/workflows/__init__.py +0 -0
  122. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/python/fabricatio/workflows/articles.py +0 -0
  123. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/python/fabricatio/workflows/rag.py +0 -0
  124. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/src/hash.rs +0 -0
  125. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/src/word_split.rs +0 -0
  126. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/templates/built-in/as_prompt.hbs +0 -0
  127. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/templates/built-in/binary-exploitation-ctf-solver.hbs +0 -0
  128. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/templates/built-in/check_string.hbs +0 -0
  129. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/templates/built-in/claude-xml.hbs +0 -0
  130. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/templates/built-in/clean-up-code.hbs +0 -0
  131. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/templates/built-in/co_validation.hbs +0 -0
  132. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/templates/built-in/create_json_obj.hbs +0 -0
  133. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/templates/built-in/cryptography-ctf-solver.hbs +0 -0
  134. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/templates/built-in/dependencies.hbs +0 -0
  135. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/templates/built-in/document-the-code.hbs +0 -0
  136. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/templates/built-in/draft_rating_criteria.hbs +0 -0
  137. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/templates/built-in/draft_rating_manual.hbs +0 -0
  138. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/templates/built-in/draft_rating_weights_klee.hbs +0 -0
  139. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/templates/built-in/draft_tool_usage_code.hbs +0 -0
  140. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/templates/built-in/extract_criteria_from_reasons.hbs +0 -0
  141. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/templates/built-in/extract_reasons_from_examples.hbs +0 -0
  142. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/templates/built-in/find-security-vulnerabilities.hbs +0 -0
  143. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/templates/built-in/fix-bugs.hbs +0 -0
  144. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/templates/built-in/fix_troubled_obj.hbs +0 -0
  145. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/templates/built-in/fix_troubled_string.hbs +0 -0
  146. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/templates/built-in/generic_string.hbs +0 -0
  147. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/templates/built-in/improve-performance.hbs +0 -0
  148. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/templates/built-in/liststr.hbs +0 -0
  149. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/templates/built-in/make_choice.hbs +0 -0
  150. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/templates/built-in/make_judgment.hbs +0 -0
  151. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/templates/built-in/pathstr.hbs +0 -0
  152. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/templates/built-in/rate_fine_grind.hbs +0 -0
  153. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/templates/built-in/refactor.hbs +0 -0
  154. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/templates/built-in/retrieved_display.hbs +0 -0
  155. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/templates/built-in/reverse-engineering-ctf-solver.hbs +0 -0
  156. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/templates/built-in/review_string.hbs +0 -0
  157. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/templates/built-in/rule_requirement.hbs +0 -0
  158. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/templates/built-in/ruleset_requirement_breakdown.hbs +0 -0
  159. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/templates/built-in/task_briefing.hbs +0 -0
  160. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/templates/built-in/web-ctf-solver.hbs +0 -0
  161. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/templates/built-in/write-git-commit.hbs +0 -0
  162. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/templates/built-in/write-github-pull-request.hbs +0 -0
  163. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/templates/built-in/write-github-readme.hbs +0 -0
  164. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/tests/test_config.py +0 -0
  165. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/tests/test_models/test_action.py +0 -0
  166. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/tests/test_models/test_advanced.py +0 -0
  167. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/tests/test_models/test_generic.py +0 -0
  168. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/tests/test_models/test_role.py +0 -0
  169. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/tests/test_models/test_task.py +0 -0
  170. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/tests/test_models/test_tool.py +0 -0
  171. {fabricatio-0.2.10.dev0 → fabricatio-0.2.11}/tests/test_models/test_usages.py +0 -0
@@ -166,3 +166,4 @@ cython_debug/
166
166
  extra/scripts/*
167
167
  output/
168
168
  .vscode/
169
+ templates/customed
@@ -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.dev0
3
+ Version: 0.2.11
4
4
  Classifier: License :: OSI Approved :: MIT License
5
5
  Classifier: Programming Language :: Rust
6
6
  Classifier: Programming Language :: Python :: 3.12
@@ -14,24 +14,26 @@ 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
26
- Requires-Dist: rtoml>=0.12.0
22
+ Requires-Dist: ujson>=5.10.0
23
+ Requires-Dist: fabricatio[calc,ftd,plot,qa,rag,cli] ; extra == 'full'
27
24
  Requires-Dist: pymilvus>=2.5.4 ; extra == 'rag'
28
- Requires-Dist: fabricatio[calc,plot,rag] ; extra == 'full'
29
25
  Requires-Dist: sympy>=1.13.3 ; extra == 'calc'
30
26
  Requires-Dist: matplotlib>=3.10.1 ; extra == 'plot'
31
- Provides-Extra: rag
27
+ Requires-Dist: questionary>=2.1.0 ; extra == 'qa'
28
+ Requires-Dist: magika>=0.6.1 ; extra == 'ftd'
29
+ Requires-Dist: typer-slim[standard]>=0.15.2 ; extra == 'cli'
32
30
  Provides-Extra: full
31
+ Provides-Extra: rag
33
32
  Provides-Extra: calc
34
33
  Provides-Extra: plot
34
+ Provides-Extra: qa
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
@@ -45,12 +47,11 @@ Project-URL: Issues, https://github.com/Whth/fabricatio/issues
45
47
  # Fabricatio
46
48
 
47
49
  ![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)
48
- ![Python 3.12+](https://img.shields.io/badge/python-3.12+-blue.svg)
49
- ![Build Status](https://img.shields.io/badge/build-passing-brightgreen)
50
50
 
51
51
  ## Overview
52
52
 
53
- 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.
53
+ Fabricatio is a streamlined Python library for building LLM applications using an event-based agent structure. It
54
+ leverages Rust for performance-critical tasks, Handlebars for templating, and PyO3 for Python bindings.
54
55
 
55
56
  ## Features
56
57
 
@@ -90,6 +91,7 @@ import asyncio
90
91
  from fabricatio import Action, Role, Task, logger, WorkFlow
91
92
  from typing import Any
92
93
 
94
+
93
95
  class Hello(Action):
94
96
  name: str = "hello"
95
97
  output_key: str = "task_output"
@@ -99,6 +101,7 @@ class Hello(Action):
99
101
  logger.info("executing talk action")
100
102
  return ret
101
103
 
104
+
102
105
  async def main() -> None:
103
106
  role = Role(
104
107
  name="talker",
@@ -110,6 +113,7 @@ async def main() -> None:
110
113
  result = await task.delegate()
111
114
  logger.success(f"Result: {result}")
112
115
 
116
+
113
117
  if __name__ == "__main__":
114
118
  asyncio.run(main())
115
119
  ```
@@ -117,6 +121,7 @@ if __name__ == "__main__":
117
121
  ### Examples
118
122
 
119
123
  For various usage scenarios, refer to the following examples:
124
+
120
125
  - Simple Chat
121
126
  - Retrieval-Augmented Generation (RAG)
122
127
  - Article Extraction
@@ -164,6 +169,7 @@ max_tokens = 8192
164
169
  ## Contributing
165
170
 
166
171
  Contributions are welcome! Follow these steps:
172
+
167
173
  1. Fork the repository.
168
174
  2. Create your feature branch (`git checkout -b feature/new-feature`).
169
175
  3. Commit your changes (`git commit -am 'Add new feature'`).
@@ -177,6 +183,8 @@ Fabricatio is licensed under the MIT License. See [LICENSE](LICENSE) for details
177
183
  ## Acknowledgments
178
184
 
179
185
  Special thanks to the contributors and maintainers of:
186
+
180
187
  - [PyO3](https://github.com/PyO3/pyo3)
181
188
  - [Maturin](https://github.com/PyO3/maturin)
182
189
  - [Handlebars.rs](https://github.com/sunng87/handlebars-rust)
190
+
@@ -1,12 +1,11 @@
1
1
  # Fabricatio
2
2
 
3
3
  ![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)
4
- ![Python 3.12+](https://img.shields.io/badge/python-3.12+-blue.svg)
5
- ![Build Status](https://img.shields.io/badge/build-passing-brightgreen)
6
4
 
7
5
  ## Overview
8
6
 
9
- 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.
10
9
 
11
10
  ## Features
12
11
 
@@ -46,6 +45,7 @@ import asyncio
46
45
  from fabricatio import Action, Role, Task, logger, WorkFlow
47
46
  from typing import Any
48
47
 
48
+
49
49
  class Hello(Action):
50
50
  name: str = "hello"
51
51
  output_key: str = "task_output"
@@ -55,6 +55,7 @@ class Hello(Action):
55
55
  logger.info("executing talk action")
56
56
  return ret
57
57
 
58
+
58
59
  async def main() -> None:
59
60
  role = Role(
60
61
  name="talker",
@@ -66,6 +67,7 @@ async def main() -> None:
66
67
  result = await task.delegate()
67
68
  logger.success(f"Result: {result}")
68
69
 
70
+
69
71
  if __name__ == "__main__":
70
72
  asyncio.run(main())
71
73
  ```
@@ -73,6 +75,7 @@ if __name__ == "__main__":
73
75
  ### Examples
74
76
 
75
77
  For various usage scenarios, refer to the following examples:
78
+
76
79
  - Simple Chat
77
80
  - Retrieval-Augmented Generation (RAG)
78
81
  - Article Extraction
@@ -120,6 +123,7 @@ max_tokens = 8192
120
123
  ## Contributing
121
124
 
122
125
  Contributions are welcome! Follow these steps:
126
+
123
127
  1. Fork the repository.
124
128
  2. Create your feature branch (`git checkout -b feature/new-feature`).
125
129
  3. Commit your changes (`git commit -am 'Add new feature'`).
@@ -133,6 +137,7 @@ Fabricatio is licensed under the MIT License. See [LICENSE](LICENSE) for details
133
137
  ## Acknowledgments
134
138
 
135
139
  Special thanks to the contributors and maintainers of:
140
+
136
141
  - [PyO3](https://github.com/PyO3/pyo3)
137
142
  - [Maturin](https://github.com/PyO3/maturin)
138
- - [Handlebars.rs](https://github.com/sunng87/handlebars-rust)
143
+ - [Handlebars.rs](https://github.com/sunng87/handlebars-rust)
@@ -1,3 +1,4 @@
1
1
  bpdf_out
2
2
  output*
3
- ref.bib
3
+ ref.bib
4
+ bare_md
@@ -2,8 +2,10 @@
2
2
 
3
3
  import asyncio
4
4
 
5
- from fabricatio import RAG, Action, Role, Task, WorkFlow, logger
5
+ from fabricatio import Action, Role, Task, WorkFlow, logger
6
+ from fabricatio.capabilities.rag import RAG
6
7
  from fabricatio.models.events import Event
8
+ from fabricatio.models.extra.aricle_rag import ArticleChunk
7
9
  from fabricatio.utils import ok
8
10
  from questionary import text
9
11
 
@@ -23,14 +25,14 @@ class Talk(Action, RAG):
23
25
  user_say = await text("User: ").ask_async()
24
26
  if user_say is None:
25
27
  break
26
- gpt_say = await self.aask_refined(
27
- user_say,
28
- "article_essence_max",
29
- extra_system_message=f"You have to answer to user obeying task assigned to you:\n{task_input.briefing}\nYou should explicitly say write a label if you draw a conclusion from the references, the label shall contain names.",
30
- result_per_query=16,
31
- final_limit=40,
32
- similarity_threshold=0.31,
33
- )
28
+ ref_q = ok(await self.arefined_query(user_say))
29
+ logger.info(f'refined query: \n{ref_q}')
30
+ ret = await self.aretrieve(ref_q, document_model=ArticleChunk)
31
+
32
+ sys_msg = "\n".join(r.as_prompt() for r in ret)
33
+ logger.info(f"System message: \n{sys_msg}")
34
+ gpt_say = await self.aask(user_say, sys_msg)
35
+
34
36
  print(f"GPT: {gpt_say}") # noqa: T201
35
37
  counter += 1
36
38
  except KeyboardInterrupt:
@@ -40,18 +42,15 @@ class Talk(Action, RAG):
40
42
 
41
43
  async def main() -> None:
42
44
  """Main function."""
43
- role = Role(
45
+ Role(
44
46
  name="talker",
45
47
  description="talker role but with rag",
46
- registry={Event.instantiate_from("talk").push_wildcard().push("pending"): WorkFlow(name="talk", steps=(Talk,))},
48
+ registry={
49
+ Event.quick_instantiate("talk"): WorkFlow(name="talk", steps=(Talk(target_collection="article_chunks"),))
50
+ },
47
51
  )
48
52
 
49
- task = ok(
50
- await role.propose_task(
51
- "you have to act as a helpful assistant, answer to all user questions properly and patiently"
52
- ),
53
- "Failed to propose task",
54
- )
53
+ task = Task(name="answer user's questions")
55
54
  _ = await task.delegate("talk")
56
55
 
57
56
 
@@ -0,0 +1,40 @@
1
+ """Example of proposing a task to a role."""
2
+
3
+ import asyncio
4
+
5
+ from fabricatio import BibManager, Event, Role, Task, WorkFlow, logger
6
+ from fabricatio.actions.article_rag import ChunkArticle
7
+ from fabricatio.actions.rag import InjectToDB
8
+ from fabricatio.fs import gather_files
9
+ from fabricatio.utils import ok
10
+
11
+
12
+ async def main() -> None:
13
+ """Main function."""
14
+ Role(
15
+ name="Researcher",
16
+ description="chunk the article",
17
+ registry={
18
+ Event.quick_instantiate(e := "Chunk"): WorkFlow(
19
+ name="Chunk",
20
+ steps=(
21
+ ChunkArticle(output_key="to_inject"),
22
+ InjectToDB(collection_name="article_chunks").to_task_output(),
23
+ ),
24
+ ).update_init_context(
25
+ article_path=gather_files("bare_md", "md"),
26
+ bib_manager=BibManager(path="ref.bib"),
27
+ max_chunk_size=600,
28
+ max_overlapping_rate=0.3,
29
+ override_inject=True,
30
+ ),
31
+ },
32
+ )
33
+
34
+ task: Task[str] = Task(name="Chunk Article")
35
+ res = ok(await task.delegate(e))
36
+ logger.success(f"Injected to {res}")
37
+
38
+
39
+ if __name__ == "__main__":
40
+ asyncio.run(main())
@@ -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())
@@ -3,7 +3,7 @@ from fabricatio import BibManager, logger
3
3
 
4
4
  b = BibManager("Exported Items.bib")
5
5
  logger.success(
6
- b.get_cite_key("A Negative Selection Immune System Inspired Methodology for Fault Diagnosis of Wind Turbines"))
6
+ b.get_cite_key_by_title("A Negative Selection Immune System Inspired Methodology for Fault Diagnosis of Wind Turbines"))
7
7
  logger.success(
8
8
  b.get_cite_key_fuzzy(
9
9
  "System Inspired Methodology for Fault"
@@ -0,0 +1,4 @@
1
+ article_briefing.txt
2
+ article_outline_raw.txt
3
+ out.typ
4
+ persistent*
@@ -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())