fabricatio 0.2.4.dev3__tar.gz → 0.2.5.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.
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/Cargo.lock +130 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/Cargo.toml +2 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/PKG-INFO +2 -1
- fabricatio-0.2.5.dev1/examples/write_outline/.gitignore +2 -0
- fabricatio-0.2.5.dev1/examples/write_outline/write_outline.py +24 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/pyproject.toml +6 -5
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/python/fabricatio/__init__.py +14 -5
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/python/fabricatio/_rust.pyi +8 -0
- fabricatio-0.2.5.dev1/python/fabricatio/actions/article.py +81 -0
- fabricatio-0.2.5.dev1/python/fabricatio/actions/output.py +21 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/python/fabricatio/capabilities/rag.py +40 -8
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/python/fabricatio/capabilities/rating.py +6 -15
- fabricatio-0.2.5.dev1/python/fabricatio/capabilities/review.py +141 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/python/fabricatio/config.py +6 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/python/fabricatio/fs/__init__.py +11 -1
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/python/fabricatio/fs/curd.py +14 -8
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/python/fabricatio/fs/readers.py +5 -2
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/python/fabricatio/models/action.py +2 -3
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/python/fabricatio/models/extra.py +81 -9
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/python/fabricatio/models/generic.py +25 -1
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/python/fabricatio/models/kwargs_types.py +9 -1
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/python/fabricatio/models/role.py +2 -2
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/python/fabricatio/models/task.py +0 -14
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/python/fabricatio/models/tool.py +3 -2
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/python/fabricatio/models/usages.py +36 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/python/fabricatio/toolboxes/__init__.py +1 -3
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/python/fabricatio/toolboxes/fs.py +15 -1
- fabricatio-0.2.5.dev1/python/fabricatio/workflows/articles.py +15 -0
- fabricatio-0.2.4.dev3/python/fabricatio/workflows/articles.py → fabricatio-0.2.5.dev1/python/fabricatio/workflows/rag.py +1 -1
- fabricatio-0.2.5.dev1/src/bib_tools.rs +45 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/src/lib.rs +2 -1
- fabricatio-0.2.5.dev1/templates/built-in/pathstr.hbs +3 -0
- fabricatio-0.2.5.dev1/templates/built-in/review_string.hbs +14 -0
- fabricatio-0.2.5.dev1/templates.tar.gz +0 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/uv.lock +9 -1
- fabricatio-0.2.4.dev3/python/fabricatio/actions/article.py +0 -49
- fabricatio-0.2.4.dev3/python/fabricatio/toolboxes/task.py +0 -6
- fabricatio-0.2.4.dev3/templates.tar.gz +0 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/.github/workflows/build-package.yaml +0 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/.github/workflows/ruff.yaml +0 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/.github/workflows/tests.yaml +0 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/.gitignore +0 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/.python-version +0 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/LICENSE +0 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/Makefile +0 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/README.md +0 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/examples/extract_article/extract.py +0 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/examples/llm_usages/llm_usage.py +0 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/examples/make_a_rating/rating.py +0 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/examples/make_diary/commits.json +0 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/examples/make_diary/diary.py +0 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/examples/minor/hello_fabricatio.py +0 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/examples/propose_task/propose.py +0 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/examples/simple_chat/chat.py +0 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/examples/simple_rag/simple_rag.py +0 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/examples/task_handle/handle_task.py +0 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/python/fabricatio/_rust_instances.py +0 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/python/fabricatio/actions/rag.py +0 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/python/fabricatio/capabilities/propose.py +0 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/python/fabricatio/capabilities/task.py +0 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/python/fabricatio/core.py +0 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/python/fabricatio/decorators.py +0 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/python/fabricatio/journal.py +0 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/python/fabricatio/models/events.py +0 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/python/fabricatio/models/utils.py +0 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/python/fabricatio/parser.py +0 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/python/fabricatio/py.typed +0 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/python/fabricatio/toolboxes/arithmetic.py +0 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/src/hash.rs +0 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/src/hbs_helpers.rs +0 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/src/templates.rs +0 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/templates/built-in/binary-exploitation-ctf-solver.hbs +0 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/templates/built-in/claude-xml.hbs +0 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/templates/built-in/clean-up-code.hbs +0 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/templates/built-in/create_json_obj.hbs +0 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/templates/built-in/cryptography-ctf-solver.hbs +0 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/templates/built-in/dependencies.hbs +0 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/templates/built-in/document-the-code.hbs +0 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/templates/built-in/draft_rating_criteria.hbs +0 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/templates/built-in/draft_rating_manual.hbs +0 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/templates/built-in/draft_rating_weights_klee.hbs +0 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/templates/built-in/draft_tool_usage_code.hbs +0 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/templates/built-in/extract_criteria_from_reasons.hbs +0 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/templates/built-in/extract_reasons_from_examples.hbs +0 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/templates/built-in/find-security-vulnerabilities.hbs +0 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/templates/built-in/fix-bugs.hbs +0 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/templates/built-in/improve-performance.hbs +0 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/templates/built-in/liststr.hbs +0 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/templates/built-in/make_choice.hbs +0 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/templates/built-in/make_judgment.hbs +0 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/templates/built-in/rate_fine_grind.hbs +0 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/templates/built-in/refactor.hbs +0 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/templates/built-in/refined_query.hbs +0 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/templates/built-in/retrieved_display.hbs +0 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/templates/built-in/reverse-engineering-ctf-solver.hbs +0 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/templates/built-in/task_briefing.hbs +0 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/templates/built-in/web-ctf-solver.hbs +0 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/templates/built-in/write-git-commit.hbs +0 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/templates/built-in/write-github-pull-request.hbs +0 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/templates/built-in/write-github-readme.hbs +0 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/tests/test_config.py +0 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/tests/test_models/test_action.py +0 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/tests/test_models/test_advanced.py +0 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/tests/test_models/test_generic.py +0 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/tests/test_models/test_role.py +0 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/tests/test_models/test_task.py +0 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/tests/test_models/test_tool.py +0 -0
- {fabricatio-0.2.4.dev3 → fabricatio-0.2.5.dev1}/tests/test_models/test_usages.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,12 @@ dependencies = [
|
|
401
445
|
name = "fabricatio"
|
402
446
|
version = "0.0.0"
|
403
447
|
dependencies = [
|
448
|
+
"biblatex",
|
404
449
|
"blake3",
|
405
450
|
"handlebars",
|
406
451
|
"pyo3",
|
407
452
|
"pythonize",
|
453
|
+
"rayon",
|
408
454
|
"serde_json",
|
409
455
|
"walkdir",
|
410
456
|
]
|
@@ -1021,6 +1067,12 @@ dependencies = [
|
|
1021
1067
|
"num-modular",
|
1022
1068
|
]
|
1023
1069
|
|
1070
|
+
[[package]]
|
1071
|
+
name = "numerals"
|
1072
|
+
version = "0.1.4"
|
1073
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1074
|
+
checksum = "e25be21376a772d15f97ae789845340a9651d3c4246ff5ebb6a2b35f9c37bd31"
|
1075
|
+
|
1024
1076
|
[[package]]
|
1025
1077
|
name = "object"
|
1026
1078
|
version = "0.36.7"
|
@@ -1086,6 +1138,12 @@ version = "0.2.0"
|
|
1086
1138
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1087
1139
|
checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d"
|
1088
1140
|
|
1141
|
+
[[package]]
|
1142
|
+
name = "paste"
|
1143
|
+
version = "1.0.15"
|
1144
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1145
|
+
checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a"
|
1146
|
+
|
1089
1147
|
[[package]]
|
1090
1148
|
name = "percent-encoding"
|
1091
1149
|
version = "2.3.1"
|
@@ -1252,6 +1310,26 @@ dependencies = [
|
|
1252
1310
|
"proc-macro2",
|
1253
1311
|
]
|
1254
1312
|
|
1313
|
+
[[package]]
|
1314
|
+
name = "rayon"
|
1315
|
+
version = "1.10.0"
|
1316
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1317
|
+
checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa"
|
1318
|
+
dependencies = [
|
1319
|
+
"either",
|
1320
|
+
"rayon-core",
|
1321
|
+
]
|
1322
|
+
|
1323
|
+
[[package]]
|
1324
|
+
name = "rayon-core"
|
1325
|
+
version = "1.12.1"
|
1326
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1327
|
+
checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2"
|
1328
|
+
dependencies = [
|
1329
|
+
"crossbeam-deque",
|
1330
|
+
"crossbeam-utils",
|
1331
|
+
]
|
1332
|
+
|
1255
1333
|
[[package]]
|
1256
1334
|
name = "redox_syscall"
|
1257
1335
|
version = "0.5.8"
|
@@ -1540,6 +1618,28 @@ version = "0.11.1"
|
|
1540
1618
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1541
1619
|
checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
|
1542
1620
|
|
1621
|
+
[[package]]
|
1622
|
+
name = "strum"
|
1623
|
+
version = "0.26.3"
|
1624
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1625
|
+
checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06"
|
1626
|
+
dependencies = [
|
1627
|
+
"strum_macros",
|
1628
|
+
]
|
1629
|
+
|
1630
|
+
[[package]]
|
1631
|
+
name = "strum_macros"
|
1632
|
+
version = "0.26.4"
|
1633
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1634
|
+
checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be"
|
1635
|
+
dependencies = [
|
1636
|
+
"heck",
|
1637
|
+
"proc-macro2",
|
1638
|
+
"quote",
|
1639
|
+
"rustversion",
|
1640
|
+
"syn",
|
1641
|
+
]
|
1642
|
+
|
1543
1643
|
[[package]]
|
1544
1644
|
name = "subtle"
|
1545
1645
|
version = "2.6.1"
|
@@ -1659,6 +1759,21 @@ dependencies = [
|
|
1659
1759
|
"zerovec",
|
1660
1760
|
]
|
1661
1761
|
|
1762
|
+
[[package]]
|
1763
|
+
name = "tinyvec"
|
1764
|
+
version = "1.9.0"
|
1765
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1766
|
+
checksum = "09b3661f17e86524eccd4371ab0429194e0d7c008abb45f7a7495b1719463c71"
|
1767
|
+
dependencies = [
|
1768
|
+
"tinyvec_macros",
|
1769
|
+
]
|
1770
|
+
|
1771
|
+
[[package]]
|
1772
|
+
name = "tinyvec_macros"
|
1773
|
+
version = "0.1.1"
|
1774
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1775
|
+
checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
|
1776
|
+
|
1662
1777
|
[[package]]
|
1663
1778
|
name = "tokio"
|
1664
1779
|
version = "1.43.0"
|
@@ -1789,12 +1904,27 @@ version = "1.0.16"
|
|
1789
1904
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1790
1905
|
checksum = "a210d160f08b701c8721ba1c726c11662f877ea6b7094007e1ca9a1041945034"
|
1791
1906
|
|
1907
|
+
[[package]]
|
1908
|
+
name = "unicode-normalization"
|
1909
|
+
version = "0.1.24"
|
1910
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1911
|
+
checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956"
|
1912
|
+
dependencies = [
|
1913
|
+
"tinyvec",
|
1914
|
+
]
|
1915
|
+
|
1792
1916
|
[[package]]
|
1793
1917
|
name = "unindent"
|
1794
1918
|
version = "0.2.3"
|
1795
1919
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1796
1920
|
checksum = "c7de7d73e1754487cb58364ee906a499937a0dfabd86bcb980fa99ec8c8fa2ce"
|
1797
1921
|
|
1922
|
+
[[package]]
|
1923
|
+
name = "unscanny"
|
1924
|
+
version = "0.1.0"
|
1925
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1926
|
+
checksum = "e9df2af067a7953e9c3831320f35c1cc0600c30d44d9f7a12b01db1cd88d6b47"
|
1927
|
+
|
1798
1928
|
[[package]]
|
1799
1929
|
name = "untrusted"
|
1800
1930
|
version = "0.9.0"
|
@@ -6,10 +6,12 @@ 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"
|
11
12
|
pyo3 = { version = "0.23.4", features = ["extension-module"] }
|
12
13
|
pythonize = "0.23.0"
|
14
|
+
rayon = "1.10.0"
|
13
15
|
serde_json = "1.0.138"
|
14
16
|
walkdir = "2.5.0"
|
15
17
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: fabricatio
|
3
|
-
Version: 0.2.
|
3
|
+
Version: 0.2.5.dev1
|
4
4
|
Classifier: License :: OSI Approved :: MIT License
|
5
5
|
Classifier: Programming Language :: Rust
|
6
6
|
Classifier: Programming Language :: Python :: 3.12
|
@@ -9,6 +9,7 @@ Classifier: Framework :: AsyncIO
|
|
9
9
|
Classifier: Framework :: Pydantic :: 2
|
10
10
|
Classifier: Typing :: Typed
|
11
11
|
Requires-Dist: appdirs>=1.4.4
|
12
|
+
Requires-Dist: async-cache>=1.1.1
|
12
13
|
Requires-Dist: asyncio>=3.4.3
|
13
14
|
Requires-Dist: asyncstdlib>=3.13.0
|
14
15
|
Requires-Dist: litellm>=1.60.0
|
@@ -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.
|
3
|
+
version = "0.2.5-dev1"
|
4
4
|
description = "A LLM multi-agent framework."
|
5
5
|
readme = "README.md"
|
6
6
|
license = { file = "LICENSE" }
|
@@ -28,6 +28,7 @@ keywords = [
|
|
28
28
|
requires-python = ">=3.12,<3.13"
|
29
29
|
dependencies = [
|
30
30
|
"appdirs>=1.4.4",
|
31
|
+
"async-cache>=1.1.1",
|
31
32
|
"asyncio>=3.4.3",
|
32
33
|
"asyncstdlib>=3.13.0",
|
33
34
|
"litellm>=1.60.0",
|
@@ -138,6 +139,10 @@ testpaths = [
|
|
138
139
|
asyncio_mode = "auto"
|
139
140
|
asyncio_default_fixture_loop_scope = "function"
|
140
141
|
|
142
|
+
[[tool.uv.index]]
|
143
|
+
url = "https://mirrors.bfsu.edu.cn/pypi/web/simple"
|
144
|
+
default = true
|
145
|
+
|
141
146
|
[[tool.uv.index]]
|
142
147
|
url = "https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple"
|
143
148
|
|
@@ -147,7 +152,3 @@ url = "https://mirrors.huaweicloud.com/repository/pypi/simple"
|
|
147
152
|
[[tool.uv.index]]
|
148
153
|
url = "https://mirrors.aliyun.com/pypi/simple/"
|
149
154
|
|
150
|
-
[[tool.uv.index]]
|
151
|
-
url = "https://mirrors.bfsu.edu.cn/pypi/web/simple"
|
152
|
-
default = true
|
153
|
-
|
@@ -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
|
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
|
-
"
|
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.
|
58
|
+
from fabricatio.workflows.rag import StoreArticle
|
50
59
|
|
51
60
|
__all__ += ["RAG", "InjectToDB", "StoreArticle"]
|
@@ -51,3 +51,11 @@ def blake3_hash(content: bytes) -> str:
|
|
51
51
|
Returns:
|
52
52
|
str: The BLAKE3 hash of the data.
|
53
53
|
"""
|
54
|
+
|
55
|
+
class BibManager:
|
56
|
+
"""BibManager class for managing BibTeX files."""
|
57
|
+
def __init__(self, path: str) -> None:
|
58
|
+
"""Initialize the BibManager with the given path."""
|
59
|
+
|
60
|
+
def get_cite_key(self, title: str) -> str:
|
61
|
+
"""Get the cite key for the given title."""
|
@@ -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
|
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
|
+
) -> 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
|
+
) -> 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
|
+
) -> 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
|
@@ -242,7 +242,6 @@ class RAG(EmbeddingUsage):
|
|
242
242
|
async def aretrieve(
|
243
243
|
self,
|
244
244
|
query: List[str] | str,
|
245
|
-
collection_name: Optional[str] = None,
|
246
245
|
final_limit: int = 20,
|
247
246
|
**kwargs: Unpack[FetchKwargs],
|
248
247
|
) -> List[str]:
|
@@ -250,7 +249,6 @@ class RAG(EmbeddingUsage):
|
|
250
249
|
|
251
250
|
Args:
|
252
251
|
query (List[str] | str): The query to be used for retrieval.
|
253
|
-
collection_name (Optional[str]): The name of the collection. If not provided, the currently viewed collection is used.
|
254
252
|
final_limit (int): The final limit on the number of results to return.
|
255
253
|
**kwargs (Unpack[FetchKwargs]): Additional keyword arguments for retrieval.
|
256
254
|
|
@@ -263,15 +261,14 @@ class RAG(EmbeddingUsage):
|
|
263
261
|
await self.afetch_document(
|
264
262
|
vecs=(await self.vectorize(query)),
|
265
263
|
desired_fields="text",
|
266
|
-
collection_name=collection_name,
|
267
264
|
**kwargs,
|
268
265
|
)
|
269
266
|
)[:final_limit]
|
270
267
|
|
271
268
|
async def aask_retrieved(
|
272
269
|
self,
|
273
|
-
question: str
|
274
|
-
query: List[str] | str,
|
270
|
+
question: str,
|
271
|
+
query: Optional[List[str] | str] = None,
|
275
272
|
collection_name: Optional[str] = None,
|
276
273
|
extra_system_message: str = "",
|
277
274
|
result_per_query: int = 10,
|
@@ -285,7 +282,7 @@ class RAG(EmbeddingUsage):
|
|
285
282
|
specified question using the retrieved documents as context.
|
286
283
|
|
287
284
|
Args:
|
288
|
-
question (str
|
285
|
+
question (str): The question to be asked.
|
289
286
|
query (List[str] | str): The query or list of queries used for document retrieval.
|
290
287
|
collection_name (Optional[str]): The name of the collection to retrieve documents from.
|
291
288
|
If not provided, the currently viewed collection is used.
|
@@ -299,9 +296,9 @@ class RAG(EmbeddingUsage):
|
|
299
296
|
str: A string response generated after asking with the context of retrieved documents.
|
300
297
|
"""
|
301
298
|
docs = await self.aretrieve(
|
302
|
-
query,
|
303
|
-
collection_name,
|
299
|
+
query or question,
|
304
300
|
final_limit,
|
301
|
+
collection_name=collection_name,
|
305
302
|
result_per_query=result_per_query,
|
306
303
|
similarity_threshold=similarity_threshold,
|
307
304
|
)
|
@@ -332,3 +329,38 @@ class RAG(EmbeddingUsage):
|
|
332
329
|
),
|
333
330
|
**kwargs,
|
334
331
|
)
|
332
|
+
|
333
|
+
async def aask_refined(
|
334
|
+
self,
|
335
|
+
question: str,
|
336
|
+
collection_name: Optional[str] = None,
|
337
|
+
extra_system_message: str = "",
|
338
|
+
result_per_query: int = 10,
|
339
|
+
final_limit: int = 20,
|
340
|
+
similarity_threshold: float = 0.37,
|
341
|
+
**kwargs: Unpack[LLMKwargs],
|
342
|
+
) -> str:
|
343
|
+
"""Asks a question using a refined query based on the provided question.
|
344
|
+
|
345
|
+
Args:
|
346
|
+
question (str): The question to be asked.
|
347
|
+
collection_name (Optional[str]): The name of the collection to retrieve documents from.
|
348
|
+
extra_system_message (str): An additional system message to be included in the prompt.
|
349
|
+
result_per_query (int): The number of results to return per query. Default is 10.
|
350
|
+
final_limit (int): The maximum number of retrieved documents to consider. Default is 20.
|
351
|
+
similarity_threshold (float): The threshold for similarity, only results above this threshold will be returned.
|
352
|
+
**kwargs (Unpack[LLMKwargs]): Additional keyword arguments passed to the underlying `aask` method.
|
353
|
+
|
354
|
+
Returns:
|
355
|
+
str: A string response generated after asking with the refined question.
|
356
|
+
"""
|
357
|
+
return await self.aask_retrieved(
|
358
|
+
question,
|
359
|
+
await self.arefined_query(question, **kwargs),
|
360
|
+
collection_name=collection_name,
|
361
|
+
extra_system_message=extra_system_message,
|
362
|
+
result_per_query=result_per_query,
|
363
|
+
final_limit=final_limit,
|
364
|
+
similarity_threshold=similarity_threshold,
|
365
|
+
**kwargs,
|
366
|
+
)
|
@@ -4,7 +4,7 @@ from asyncio import gather
|
|
4
4
|
from itertools import permutations
|
5
5
|
from typing import Dict, List, Set, Tuple, Union, Unpack, overload
|
6
6
|
|
7
|
-
import
|
7
|
+
from cache import AsyncLRU
|
8
8
|
from fabricatio._rust_instances import template_manager
|
9
9
|
from fabricatio.config import configs
|
10
10
|
from fabricatio.journal import logger
|
@@ -40,10 +40,8 @@ class GiveRating(WithBriefing, LLMUsage):
|
|
40
40
|
|
41
41
|
def _validator(response: str) -> Dict[str, float] | None:
|
42
42
|
if (
|
43
|
-
(json_data := JsonCapture.
|
44
|
-
and isinstance(json_data, dict)
|
43
|
+
(json_data := JsonCapture.validate_with(response, dict, str))
|
45
44
|
and json_data.keys() == rating_manual.keys()
|
46
|
-
and all(isinstance(v, float) for v in json_data.values())
|
47
45
|
and all(score_range[0] <= v <= score_range[1] for v in json_data.values())
|
48
46
|
):
|
49
47
|
return json_data
|
@@ -115,6 +113,7 @@ class GiveRating(WithBriefing, LLMUsage):
|
|
115
113
|
return await gather(*[self.rate_fine_grind(item, manual, score_range, **kwargs) for item in to_rate])
|
116
114
|
raise ValueError("to_rate must be a string or a list of strings")
|
117
115
|
|
116
|
+
@AsyncLRU(maxsize=32)
|
118
117
|
async def draft_rating_manual(
|
119
118
|
self, topic: str, criteria: Set[str], **kwargs: Unpack[ValidateKwargs]
|
120
119
|
) -> Dict[str, str]:
|
@@ -169,16 +168,6 @@ class GiveRating(WithBriefing, LLMUsage):
|
|
169
168
|
Returns:
|
170
169
|
Set[str]: A set of rating dimensions.
|
171
170
|
"""
|
172
|
-
|
173
|
-
def _validator(response: str) -> Set[str] | None:
|
174
|
-
if (
|
175
|
-
json_data := JsonCapture.validate_with(
|
176
|
-
response, target_type=list, elements_type=str, length=criteria_count
|
177
|
-
)
|
178
|
-
) is not None:
|
179
|
-
return set(json_data)
|
180
|
-
return None
|
181
|
-
|
182
171
|
return await self.aask_validate(
|
183
172
|
question=(
|
184
173
|
template_manager.render_template(
|
@@ -189,7 +178,9 @@ class GiveRating(WithBriefing, LLMUsage):
|
|
189
178
|
},
|
190
179
|
)
|
191
180
|
),
|
192
|
-
validator=
|
181
|
+
validator=lambda resp: set(out)
|
182
|
+
if (out := JsonCapture.validate_with(resp, list, str, criteria_count))
|
183
|
+
else out,
|
193
184
|
system_message=f"# your personal briefing: \n{self.briefing}",
|
194
185
|
**kwargs,
|
195
186
|
)
|