fabricatio 0.2.4.dev3__tar.gz → 0.2.5__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 (116) hide show
  1. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/Cargo.lock +147 -0
  2. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/Cargo.toml +3 -0
  3. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/PKG-INFO +2 -1
  4. fabricatio-0.2.5/examples/extract_and_review/.gitignore +1 -0
  5. fabricatio-0.2.5/examples/extract_and_review/extract_and_review.py +40 -0
  6. fabricatio-0.2.5/examples/reviewer/review.py +27 -0
  7. fabricatio-0.2.5/examples/write_outline/.gitignore +2 -0
  8. fabricatio-0.2.5/examples/write_outline/write_outline.py +24 -0
  9. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/pyproject.toml +2 -1
  10. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/python/fabricatio/__init__.py +14 -5
  11. fabricatio-0.2.5/python/fabricatio/_rust.pyi +102 -0
  12. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/python/fabricatio/_rust_instances.py +2 -0
  13. fabricatio-0.2.5/python/fabricatio/actions/article.py +81 -0
  14. fabricatio-0.2.5/python/fabricatio/actions/output.py +21 -0
  15. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/python/fabricatio/actions/rag.py +1 -1
  16. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/python/fabricatio/capabilities/propose.py +14 -20
  17. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/python/fabricatio/capabilities/rag.py +57 -22
  18. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/python/fabricatio/capabilities/rating.py +59 -51
  19. fabricatio-0.2.5/python/fabricatio/capabilities/review.py +241 -0
  20. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/python/fabricatio/capabilities/task.py +7 -8
  21. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/python/fabricatio/config.py +33 -4
  22. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/python/fabricatio/fs/__init__.py +13 -1
  23. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/python/fabricatio/fs/curd.py +27 -8
  24. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/python/fabricatio/fs/readers.py +6 -3
  25. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/python/fabricatio/journal.py +1 -1
  26. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/python/fabricatio/models/action.py +6 -8
  27. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/python/fabricatio/models/events.py +6 -4
  28. fabricatio-0.2.5/python/fabricatio/models/extra.py +171 -0
  29. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/python/fabricatio/models/generic.py +56 -4
  30. fabricatio-0.2.5/python/fabricatio/models/kwargs_types.py +147 -0
  31. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/python/fabricatio/models/role.py +3 -3
  32. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/python/fabricatio/models/task.py +0 -14
  33. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/python/fabricatio/models/tool.py +7 -6
  34. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/python/fabricatio/models/usages.py +144 -101
  35. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/python/fabricatio/parser.py +26 -5
  36. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/python/fabricatio/toolboxes/__init__.py +1 -3
  37. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/python/fabricatio/toolboxes/fs.py +17 -1
  38. fabricatio-0.2.5/python/fabricatio/workflows/articles.py +15 -0
  39. fabricatio-0.2.4.dev3/python/fabricatio/workflows/articles.py → fabricatio-0.2.5/python/fabricatio/workflows/rag.py +1 -1
  40. fabricatio-0.2.5/src/bib_tools.rs +73 -0
  41. fabricatio-0.2.5/src/hbs_helpers.rs +9 -0
  42. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/src/lib.rs +2 -1
  43. fabricatio-0.2.5/src/templates.rs +104 -0
  44. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/templates/built-in/create_json_obj.hbs +8 -2
  45. fabricatio-0.2.5/templates/built-in/pathstr.hbs +3 -0
  46. fabricatio-0.2.5/templates/built-in/review_string.hbs +22 -0
  47. fabricatio-0.2.5/templates.tar.gz +0 -0
  48. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/tests/test_models/test_usages.py +2 -2
  49. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/uv.lock +12 -1
  50. fabricatio-0.2.4.dev3/python/fabricatio/_rust.pyi +0 -53
  51. fabricatio-0.2.4.dev3/python/fabricatio/actions/article.py +0 -49
  52. fabricatio-0.2.4.dev3/python/fabricatio/models/extra.py +0 -96
  53. fabricatio-0.2.4.dev3/python/fabricatio/models/kwargs_types.py +0 -59
  54. fabricatio-0.2.4.dev3/python/fabricatio/toolboxes/task.py +0 -6
  55. fabricatio-0.2.4.dev3/src/hbs_helpers.rs +0 -15
  56. fabricatio-0.2.4.dev3/src/templates.rs +0 -105
  57. fabricatio-0.2.4.dev3/templates.tar.gz +0 -0
  58. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/.github/workflows/build-package.yaml +0 -0
  59. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/.github/workflows/ruff.yaml +0 -0
  60. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/.github/workflows/tests.yaml +0 -0
  61. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/.gitignore +0 -0
  62. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/.python-version +0 -0
  63. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/LICENSE +0 -0
  64. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/Makefile +0 -0
  65. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/README.md +0 -0
  66. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/examples/extract_article/extract.py +0 -0
  67. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/examples/llm_usages/llm_usage.py +0 -0
  68. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/examples/make_a_rating/rating.py +0 -0
  69. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/examples/make_diary/commits.json +0 -0
  70. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/examples/make_diary/diary.py +0 -0
  71. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/examples/minor/hello_fabricatio.py +0 -0
  72. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/examples/propose_task/propose.py +0 -0
  73. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/examples/simple_chat/chat.py +0 -0
  74. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/examples/simple_rag/simple_rag.py +0 -0
  75. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/examples/task_handle/handle_task.py +0 -0
  76. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/python/fabricatio/core.py +0 -0
  77. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/python/fabricatio/decorators.py +0 -0
  78. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/python/fabricatio/models/utils.py +0 -0
  79. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/python/fabricatio/py.typed +0 -0
  80. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/python/fabricatio/toolboxes/arithmetic.py +0 -0
  81. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/src/hash.rs +0 -0
  82. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/templates/built-in/binary-exploitation-ctf-solver.hbs +0 -0
  83. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/templates/built-in/claude-xml.hbs +0 -0
  84. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/templates/built-in/clean-up-code.hbs +0 -0
  85. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/templates/built-in/cryptography-ctf-solver.hbs +0 -0
  86. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/templates/built-in/dependencies.hbs +0 -0
  87. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/templates/built-in/document-the-code.hbs +0 -0
  88. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/templates/built-in/draft_rating_criteria.hbs +0 -0
  89. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/templates/built-in/draft_rating_manual.hbs +0 -0
  90. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/templates/built-in/draft_rating_weights_klee.hbs +0 -0
  91. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/templates/built-in/draft_tool_usage_code.hbs +0 -0
  92. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/templates/built-in/extract_criteria_from_reasons.hbs +0 -0
  93. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/templates/built-in/extract_reasons_from_examples.hbs +0 -0
  94. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/templates/built-in/find-security-vulnerabilities.hbs +0 -0
  95. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/templates/built-in/fix-bugs.hbs +0 -0
  96. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/templates/built-in/improve-performance.hbs +0 -0
  97. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/templates/built-in/liststr.hbs +0 -0
  98. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/templates/built-in/make_choice.hbs +0 -0
  99. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/templates/built-in/make_judgment.hbs +0 -0
  100. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/templates/built-in/rate_fine_grind.hbs +0 -0
  101. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/templates/built-in/refactor.hbs +0 -0
  102. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/templates/built-in/refined_query.hbs +0 -0
  103. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/templates/built-in/retrieved_display.hbs +0 -0
  104. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/templates/built-in/reverse-engineering-ctf-solver.hbs +0 -0
  105. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/templates/built-in/task_briefing.hbs +0 -0
  106. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/templates/built-in/web-ctf-solver.hbs +0 -0
  107. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/templates/built-in/write-git-commit.hbs +0 -0
  108. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/templates/built-in/write-github-pull-request.hbs +0 -0
  109. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/templates/built-in/write-github-readme.hbs +0 -0
  110. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/tests/test_config.py +0 -0
  111. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/tests/test_models/test_action.py +0 -0
  112. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/tests/test_models/test_advanced.py +0 -0
  113. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/tests/test_models/test_generic.py +0 -0
  114. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/tests/test_models/test_role.py +0 -0
  115. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/tests/test_models/test_task.py +0 -0
  116. {fabricatio-0.2.4.dev3 → fabricatio-0.2.5}/tests/test_models/test_tool.py +0 -0
@@ -112,6 +112,19 @@ version = "0.22.1"
112
112
  source = "registry+https://github.com/rust-lang/crates.io-index"
113
113
  checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
114
114
 
115
+ [[package]]
116
+ name = "biblatex"
117
+ version = "0.10.0"
118
+ source = "registry+https://github.com/rust-lang/crates.io-index"
119
+ checksum = "a35a7317fcbdbef94b60d0dd0a658711a936accfce4a631fea4bf8e527eff3c2"
120
+ dependencies = [
121
+ "numerals",
122
+ "paste",
123
+ "strum",
124
+ "unicode-normalization",
125
+ "unscanny",
126
+ ]
127
+
115
128
  [[package]]
116
129
  name = "bitflags"
117
130
  version = "2.8.0"
@@ -254,6 +267,31 @@ dependencies = [
254
267
  "cfg-if",
255
268
  ]
256
269
 
270
+ [[package]]
271
+ name = "crossbeam-deque"
272
+ version = "0.8.6"
273
+ source = "registry+https://github.com/rust-lang/crates.io-index"
274
+ checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51"
275
+ dependencies = [
276
+ "crossbeam-epoch",
277
+ "crossbeam-utils",
278
+ ]
279
+
280
+ [[package]]
281
+ name = "crossbeam-epoch"
282
+ version = "0.9.18"
283
+ source = "registry+https://github.com/rust-lang/crates.io-index"
284
+ checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e"
285
+ dependencies = [
286
+ "crossbeam-utils",
287
+ ]
288
+
289
+ [[package]]
290
+ name = "crossbeam-utils"
291
+ version = "0.8.21"
292
+ source = "registry+https://github.com/rust-lang/crates.io-index"
293
+ checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28"
294
+
257
295
  [[package]]
258
296
  name = "crypto-common"
259
297
  version = "0.1.6"
@@ -372,6 +410,12 @@ dependencies = [
372
410
  "syn",
373
411
  ]
374
412
 
413
+ [[package]]
414
+ name = "either"
415
+ version = "1.15.0"
416
+ source = "registry+https://github.com/rust-lang/crates.io-index"
417
+ checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719"
418
+
375
419
  [[package]]
376
420
  name = "encoding_rs"
377
421
  version = "0.8.35"
@@ -401,10 +445,13 @@ dependencies = [
401
445
  name = "fabricatio"
402
446
  version = "0.0.0"
403
447
  dependencies = [
448
+ "biblatex",
404
449
  "blake3",
405
450
  "handlebars",
451
+ "nucleo-matcher",
406
452
  "pyo3",
407
453
  "pythonize",
454
+ "rayon",
408
455
  "serde_json",
409
456
  "walkdir",
410
457
  ]
@@ -1006,6 +1053,16 @@ dependencies = [
1006
1053
  "tempfile",
1007
1054
  ]
1008
1055
 
1056
+ [[package]]
1057
+ name = "nucleo-matcher"
1058
+ version = "0.3.1"
1059
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1060
+ checksum = "bf33f538733d1a5a3494b836ba913207f14d9d4a1d3cd67030c5061bdd2cac85"
1061
+ dependencies = [
1062
+ "memchr",
1063
+ "unicode-segmentation",
1064
+ ]
1065
+
1009
1066
  [[package]]
1010
1067
  name = "num-modular"
1011
1068
  version = "0.6.1"
@@ -1021,6 +1078,12 @@ dependencies = [
1021
1078
  "num-modular",
1022
1079
  ]
1023
1080
 
1081
+ [[package]]
1082
+ name = "numerals"
1083
+ version = "0.1.4"
1084
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1085
+ checksum = "e25be21376a772d15f97ae789845340a9651d3c4246ff5ebb6a2b35f9c37bd31"
1086
+
1024
1087
  [[package]]
1025
1088
  name = "object"
1026
1089
  version = "0.36.7"
@@ -1086,6 +1149,12 @@ version = "0.2.0"
1086
1149
  source = "registry+https://github.com/rust-lang/crates.io-index"
1087
1150
  checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d"
1088
1151
 
1152
+ [[package]]
1153
+ name = "paste"
1154
+ version = "1.0.15"
1155
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1156
+ checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a"
1157
+
1089
1158
  [[package]]
1090
1159
  name = "percent-encoding"
1091
1160
  version = "2.3.1"
@@ -1252,6 +1321,26 @@ dependencies = [
1252
1321
  "proc-macro2",
1253
1322
  ]
1254
1323
 
1324
+ [[package]]
1325
+ name = "rayon"
1326
+ version = "1.10.0"
1327
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1328
+ checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa"
1329
+ dependencies = [
1330
+ "either",
1331
+ "rayon-core",
1332
+ ]
1333
+
1334
+ [[package]]
1335
+ name = "rayon-core"
1336
+ version = "1.12.1"
1337
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1338
+ checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2"
1339
+ dependencies = [
1340
+ "crossbeam-deque",
1341
+ "crossbeam-utils",
1342
+ ]
1343
+
1255
1344
  [[package]]
1256
1345
  name = "redox_syscall"
1257
1346
  version = "0.5.8"
@@ -1540,6 +1629,28 @@ version = "0.11.1"
1540
1629
  source = "registry+https://github.com/rust-lang/crates.io-index"
1541
1630
  checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
1542
1631
 
1632
+ [[package]]
1633
+ name = "strum"
1634
+ version = "0.26.3"
1635
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1636
+ checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06"
1637
+ dependencies = [
1638
+ "strum_macros",
1639
+ ]
1640
+
1641
+ [[package]]
1642
+ name = "strum_macros"
1643
+ version = "0.26.4"
1644
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1645
+ checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be"
1646
+ dependencies = [
1647
+ "heck",
1648
+ "proc-macro2",
1649
+ "quote",
1650
+ "rustversion",
1651
+ "syn",
1652
+ ]
1653
+
1543
1654
  [[package]]
1544
1655
  name = "subtle"
1545
1656
  version = "2.6.1"
@@ -1659,6 +1770,21 @@ dependencies = [
1659
1770
  "zerovec",
1660
1771
  ]
1661
1772
 
1773
+ [[package]]
1774
+ name = "tinyvec"
1775
+ version = "1.9.0"
1776
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1777
+ checksum = "09b3661f17e86524eccd4371ab0429194e0d7c008abb45f7a7495b1719463c71"
1778
+ dependencies = [
1779
+ "tinyvec_macros",
1780
+ ]
1781
+
1782
+ [[package]]
1783
+ name = "tinyvec_macros"
1784
+ version = "0.1.1"
1785
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1786
+ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
1787
+
1662
1788
  [[package]]
1663
1789
  name = "tokio"
1664
1790
  version = "1.43.0"
@@ -1789,12 +1915,33 @@ version = "1.0.16"
1789
1915
  source = "registry+https://github.com/rust-lang/crates.io-index"
1790
1916
  checksum = "a210d160f08b701c8721ba1c726c11662f877ea6b7094007e1ca9a1041945034"
1791
1917
 
1918
+ [[package]]
1919
+ name = "unicode-normalization"
1920
+ version = "0.1.24"
1921
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1922
+ checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956"
1923
+ dependencies = [
1924
+ "tinyvec",
1925
+ ]
1926
+
1927
+ [[package]]
1928
+ name = "unicode-segmentation"
1929
+ version = "1.12.0"
1930
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1931
+ checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493"
1932
+
1792
1933
  [[package]]
1793
1934
  name = "unindent"
1794
1935
  version = "0.2.3"
1795
1936
  source = "registry+https://github.com/rust-lang/crates.io-index"
1796
1937
  checksum = "c7de7d73e1754487cb58364ee906a499937a0dfabd86bcb980fa99ec8c8fa2ce"
1797
1938
 
1939
+ [[package]]
1940
+ name = "unscanny"
1941
+ version = "0.1.0"
1942
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1943
+ checksum = "e9df2af067a7953e9c3831320f35c1cc0600c30d44d9f7a12b01db1cd88d6b47"
1944
+
1798
1945
  [[package]]
1799
1946
  name = "untrusted"
1800
1947
  version = "0.9.0"
@@ -6,10 +6,13 @@ edition = "2024"
6
6
  crate-type = ["cdylib"]
7
7
 
8
8
  [dependencies]
9
+ biblatex = "0.10.0"
9
10
  blake3 = "1.6.0"
10
11
  handlebars = "6.3.1"
12
+ nucleo-matcher = "0.3.1"
11
13
  pyo3 = { version = "0.23.4", features = ["extension-module"] }
12
14
  pythonize = "0.23.0"
15
+ rayon = "1.10.0"
13
16
  serde_json = "1.0.138"
14
17
  walkdir = "2.5.0"
15
18
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fabricatio
3
- Version: 0.2.4.dev3
3
+ Version: 0.2.5
4
4
  Classifier: License :: OSI Approved :: MIT License
5
5
  Classifier: Programming Language :: Rust
6
6
  Classifier: Programming Language :: Python :: 3.12
@@ -11,6 +11,7 @@ Classifier: Typing :: Typed
11
11
  Requires-Dist: appdirs>=1.4.4
12
12
  Requires-Dist: asyncio>=3.4.3
13
13
  Requires-Dist: asyncstdlib>=3.13.0
14
+ Requires-Dist: json-repair>=0.39.1
14
15
  Requires-Dist: litellm>=1.60.0
15
16
  Requires-Dist: loguru>=0.7.3
16
17
  Requires-Dist: magika>=0.5.1
@@ -0,0 +1 @@
1
+ bpdf_out
@@ -0,0 +1,40 @@
1
+ """Example of proposing a task to a role."""
2
+
3
+ import asyncio
4
+ from pathlib import Path
5
+ from typing import List
6
+
7
+ from fabricatio import ArticleEssence, Event, ExtractArticleEssence, Role, Task, WorkFlow, logger
8
+ from fabricatio.fs.curd import dump_text, gather_files
9
+
10
+
11
+ async def main() -> None:
12
+ """Main function."""
13
+ role = Role(
14
+ name="Researcher",
15
+ description="Extract article essence",
16
+ registry={
17
+ Event.quick_instantiate("article"): WorkFlow(
18
+ name="extract",
19
+ steps=(ExtractArticleEssence(output_key="task_output"),),
20
+ )
21
+ },
22
+ )
23
+
24
+ task: Task[List[ArticleEssence]] = await role.propose_task(
25
+ "Extract the essence of the article from the files in './bpdf_out'",
26
+ )
27
+
28
+ unchecked_ess = await task.override_dependencies(gather_files("bpdf_out", "md")).delegate("article")
29
+
30
+ ess = list(filter(lambda x: x is not None, unchecked_ess))
31
+
32
+ logger.success(f"Essence Count:{len(ess)}, invalid count: {len(unchecked_ess) - len(ess)}")
33
+
34
+ Path("output").mkdir(exist_ok=True)
35
+ for i, e in enumerate(ess):
36
+ dump_text(f"output/{i}.json", e.display())
37
+
38
+
39
+ if __name__ == "__main__":
40
+ asyncio.run(main())
@@ -0,0 +1,27 @@
1
+ """Example of review usage."""
2
+
3
+ import asyncio
4
+
5
+ from fabricatio import Role, logger
6
+
7
+
8
+ async def main() -> None:
9
+ """Main function."""
10
+ role = Role(
11
+ name="Reviewer",
12
+ description="A role that reviews the code.",
13
+ )
14
+
15
+ code = await role.aask(
16
+ "write a cli app using rust with clap which can generate a basic manifest of a standard rust project, output code only,no extra explanation"
17
+ )
18
+
19
+ logger.success(f"Code: \n{code}")
20
+ res = await role.review_string(code, "If the cli app is of good design")
21
+ logger.success(f"Review: \n{res.display()}")
22
+ await res.supervisor_check(True)
23
+ logger.success(f"Review: \n{res.display()}")
24
+
25
+
26
+ if __name__ == "__main__":
27
+ asyncio.run(main())
@@ -0,0 +1,2 @@
1
+ article_briefing.txt
2
+ out.typ
@@ -0,0 +1,24 @@
1
+ """Example of using the library."""
2
+
3
+ import asyncio
4
+
5
+ from fabricatio import Event, Role, WriteOutlineWorkFlow, logger
6
+
7
+
8
+ async def main() -> None:
9
+ """Main function."""
10
+ role = Role(
11
+ name="Undergraduate Researcher",
12
+ description="Write an outline for an article in typst format.",
13
+ registry={Event.quick_instantiate(ns := "article"): WriteOutlineWorkFlow},
14
+ )
15
+
16
+ proposed_task = await role.propose_task(
17
+ "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.",
18
+ )
19
+ path = await proposed_task.delegate(ns)
20
+ logger.success(f"The outline is saved in:\n{path}")
21
+
22
+
23
+ if __name__ == "__main__":
24
+ asyncio.run(main())
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "fabricatio"
3
- version = "0.2.4-dev3"
3
+ version = "0.2.5"
4
4
  description = "A LLM multi-agent framework."
5
5
  readme = "README.md"
6
6
  license = { file = "LICENSE" }
@@ -30,6 +30,7 @@ dependencies = [
30
30
  "appdirs>=1.4.4",
31
31
  "asyncio>=3.4.3",
32
32
  "asyncstdlib>=3.13.0",
33
+ "json-repair>=0.39.1",
33
34
  "litellm>=1.60.0",
34
35
  "loguru>=0.7.3",
35
36
  "magika>=0.5.1",
@@ -2,10 +2,12 @@
2
2
 
3
3
  from importlib.util import find_spec
4
4
 
5
+ from fabricatio._rust import BibManager
5
6
  from fabricatio._rust_instances import template_manager
6
- from fabricatio.actions.article import ExtractArticleEssence
7
+ from fabricatio.actions.article import ExtractArticleEssence, GenerateArticleProposal, GenerateOutline
8
+ from fabricatio.actions.output import DumpFinalizedOutput
7
9
  from fabricatio.core import env
8
- from fabricatio.fs import magika
10
+ from fabricatio.fs import magika, safe_json_read, safe_text_read
9
11
  from fabricatio.journal import logger
10
12
  from fabricatio.models.action import Action, WorkFlow
11
13
  from fabricatio.models.events import Event
@@ -15,15 +17,20 @@ from fabricatio.models.task import Task
15
17
  from fabricatio.models.tool import ToolBox
16
18
  from fabricatio.models.utils import Message, Messages
17
19
  from fabricatio.parser import Capture, CodeBlockCapture, JsonCapture, PythonCapture
18
- from fabricatio.toolboxes import arithmetic_toolbox, basic_toolboxes, fs_toolbox, task_toolbox
20
+ from fabricatio.toolboxes import arithmetic_toolbox, basic_toolboxes, fs_toolbox
21
+ from fabricatio.workflows.articles import WriteOutlineWorkFlow
19
22
 
20
23
  __all__ = [
21
24
  "Action",
22
25
  "ArticleEssence",
26
+ "BibManager",
23
27
  "Capture",
24
28
  "CodeBlockCapture",
29
+ "DumpFinalizedOutput",
25
30
  "Event",
26
31
  "ExtractArticleEssence",
32
+ "GenerateArticleProposal",
33
+ "GenerateOutline",
27
34
  "JsonCapture",
28
35
  "Message",
29
36
  "Messages",
@@ -32,13 +39,15 @@ __all__ = [
32
39
  "Task",
33
40
  "ToolBox",
34
41
  "WorkFlow",
42
+ "WriteOutlineWorkFlow",
35
43
  "arithmetic_toolbox",
36
44
  "basic_toolboxes",
37
45
  "env",
38
46
  "fs_toolbox",
39
47
  "logger",
40
48
  "magika",
41
- "task_toolbox",
49
+ "safe_json_read",
50
+ "safe_text_read",
42
51
  "template_manager",
43
52
  ]
44
53
 
@@ -46,6 +55,6 @@ __all__ = [
46
55
  if find_spec("pymilvus"):
47
56
  from fabricatio.actions.rag import InjectToDB
48
57
  from fabricatio.capabilities.rag import RAG
49
- from fabricatio.workflows.articles import StoreArticle
58
+ from fabricatio.workflows.rag import StoreArticle
50
59
 
51
60
  __all__ += ["RAG", "InjectToDB", "StoreArticle"]
@@ -0,0 +1,102 @@
1
+ from pathlib import Path
2
+ from typing import Any, Dict, List, Optional
3
+
4
+ class TemplateManager:
5
+ """Template rendering engine using Handlebars templates.
6
+
7
+ This manager handles template discovery, loading, and rendering
8
+ through a wrapper around the handlebars-rust engine.
9
+
10
+ See: https://crates.io/crates/handlebars
11
+ """
12
+ def __init__(
13
+ self, template_dirs: List[Path], suffix: Optional[str] = None, active_loading: Optional[bool] = None
14
+ ) -> None:
15
+ """Initialize the template manager.
16
+
17
+ Args:
18
+ template_dirs: List of directories containing template files
19
+ suffix: File extension for templates (defaults to 'hbs')
20
+ active_loading: Whether to enable dev mode for reloading templates on change
21
+ """
22
+
23
+ @property
24
+ def template_count(self) -> int:
25
+ """Returns the number of currently loaded templates."""
26
+
27
+ def get_template_source(self, name: str) -> Optional[str]:
28
+ """Get the filesystem path for a template.
29
+
30
+ Args:
31
+ name: Template name (without extension)
32
+
33
+ Returns:
34
+ Path to the template file if found, None otherwise
35
+ """
36
+
37
+ def discover_templates(self) -> None:
38
+ """Scan template directories and load available templates.
39
+
40
+ This refreshes the template cache, finding any new or modified templates.
41
+ """
42
+
43
+ def render_template(self, name: str, data: Dict[str, Any]) -> str:
44
+ """Render a template with context data.
45
+
46
+ Args:
47
+ name: Template name (without extension)
48
+ data: Context dictionary to provide variables to the template
49
+
50
+ Returns:
51
+ Rendered template content as string
52
+
53
+ Raises:
54
+ RuntimeError: If template rendering fails
55
+ """
56
+
57
+ def blake3_hash(content: bytes) -> str:
58
+ """Calculate the BLAKE3 cryptographic hash of data.
59
+
60
+ Args:
61
+ content: Bytes to be hashed
62
+
63
+ Returns:
64
+ Hex-encoded BLAKE3 hash string
65
+ """
66
+
67
+ class BibManager:
68
+ """BibTeX bibliography manager for parsing and querying citation data."""
69
+
70
+ def __init__(self, path: str) -> None:
71
+ """Initialize the bibliography manager.
72
+
73
+ Args:
74
+ path: Path to BibTeX (.bib) file to load
75
+
76
+ Raises:
77
+ RuntimeError: If file cannot be read or parsed
78
+ """
79
+
80
+ def get_cite_key(self, title: str) -> Optional[str]:
81
+ """Find citation key by exact title match.
82
+
83
+ Args:
84
+ title: Full title to search for (case-insensitive)
85
+
86
+ Returns:
87
+ Citation key if exact match found, None otherwise
88
+ """
89
+
90
+ def get_cite_key_fuzzy(self, query: str) -> Optional[str]:
91
+ """Find best matching citation using fuzzy text search.
92
+
93
+ Args:
94
+ query: Search term to find in bibliography entries
95
+
96
+ Returns:
97
+ Citation key of best matching entry, or None if no good match
98
+
99
+ Notes:
100
+ Uses nucleo_matcher for high-quality fuzzy text searching
101
+ See: https://crates.io/crates/nucleo-matcher
102
+ """
@@ -1,3 +1,5 @@
1
+ """Some necessary instances."""
2
+
1
3
  from fabricatio._rust import TemplateManager
2
4
  from fabricatio.config import configs
3
5
 
@@ -0,0 +1,81 @@
1
+ """Actions for transmitting tasks to targets."""
2
+
3
+ from os import PathLike
4
+ from pathlib import Path
5
+ from typing import Callable, List, Optional
6
+
7
+ from fabricatio.fs import safe_text_read
8
+ from fabricatio.journal import logger
9
+ from fabricatio.models.action import Action
10
+ from fabricatio.models.extra import ArticleEssence, ArticleOutline, ArticleProposal
11
+ from fabricatio.models.task import Task
12
+
13
+
14
+ class ExtractArticleEssence(Action):
15
+ """Extract the essence of article(s) in text format from the paths specified in the task dependencies.
16
+
17
+ Notes:
18
+ This action is designed to extract vital information from articles with Markdown format, which is pure text, and
19
+ which is converted from pdf files using `magic-pdf` from the `MinerU` project, see https://github.com/opendatalab/MinerU
20
+ """
21
+
22
+ output_key: str = "article_essence"
23
+ """The key of the output data."""
24
+
25
+ async def _execute[P: PathLike | str](
26
+ self,
27
+ task_input: Task,
28
+ reader: Callable[[P], str] = lambda p: Path(p).read_text(encoding="utf-8"),
29
+ **_,
30
+ ) -> Optional[List[ArticleEssence]]:
31
+ if not task_input.dependencies:
32
+ logger.info(err := "Task not approved, since no dependencies are provided.")
33
+ raise RuntimeError(err)
34
+
35
+ # trim the references
36
+ contents = ["References".join(c.split("References")[:-1]) for c in map(reader, task_input.dependencies)]
37
+ return await self.propose(
38
+ ArticleEssence,
39
+ contents,
40
+ system_message=f"# your personal briefing: \n{self.briefing}",
41
+ )
42
+
43
+
44
+ class GenerateArticleProposal(Action):
45
+ """Generate an outline for the article based on the extracted essence."""
46
+
47
+ output_key: str = "article_proposal"
48
+ """The key of the output data."""
49
+
50
+ async def _execute(
51
+ self,
52
+ task_input: Task,
53
+ **_,
54
+ ) -> Optional[ArticleProposal]:
55
+ input_path = await self.awhich_pathstr(
56
+ f"{task_input.briefing}\nExtract the path of file, which contains the article briefing that I need to read."
57
+ )
58
+
59
+ return await self.propose(
60
+ ArticleProposal,
61
+ safe_text_read(input_path),
62
+ system_message=f"# your personal briefing: \n{self.briefing}",
63
+ )
64
+
65
+
66
+ class GenerateOutline(Action):
67
+ """Generate the article based on the outline."""
68
+
69
+ output_key: str = "article"
70
+ """The key of the output data."""
71
+
72
+ async def _execute(
73
+ self,
74
+ article_proposal: ArticleProposal,
75
+ **_,
76
+ ) -> Optional[ArticleOutline]:
77
+ return await self.propose(
78
+ ArticleOutline,
79
+ article_proposal.display(),
80
+ system_message=f"# your personal briefing: \n{self.briefing}",
81
+ )
@@ -0,0 +1,21 @@
1
+ """Dump the finalized output to a file."""
2
+
3
+ from typing import Unpack
4
+
5
+ from fabricatio.models.action import Action
6
+ from fabricatio.models.generic import FinalizedDumpAble
7
+ from fabricatio.models.task import Task
8
+
9
+
10
+ class DumpFinalizedOutput(Action):
11
+ """Dump the finalized output to a file."""
12
+
13
+ output_key: str = "dump_path"
14
+
15
+ async def _execute(self, task_input: Task, to_dump: FinalizedDumpAble, **cxt: Unpack) -> str:
16
+ dump_path = await self.awhich_pathstr(
17
+ f"{task_input.briefing}\n\nExtract a single path of the file, to which I will dump the data."
18
+ )
19
+
20
+ to_dump.finalized_dump_to(dump_path)
21
+ return dump_path
@@ -14,7 +14,7 @@ class InjectToDB(Action, RAG):
14
14
 
15
15
  async def _execute[T: PrepareVectorization](
16
16
  self, to_inject: T | List[T], collection_name: Optional[str] = "my_collection", **cxt: Unpack
17
- ) -> str:
17
+ ) -> Optional[str]:
18
18
  if not isinstance(to_inject, list):
19
19
  to_inject = [to_inject]
20
20