fabricatio 0.2.12.dev1__tar.gz → 0.2.12.dev3__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 (167) hide show
  1. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/Cargo.lock +32 -0
  2. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/Cargo.toml +1 -0
  3. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/PKG-INFO +1 -1
  4. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/examples/write_article/write_article.py +13 -12
  5. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/examples/write_outline/write_outline.py +5 -2
  6. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/pyproject.toml +1 -1
  7. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/python/fabricatio/actions/article_rag.py +42 -48
  8. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/python/fabricatio/actions/output.py +12 -3
  9. fabricatio-0.2.12.dev3/python/fabricatio/capabilities/advanced_rag.py +56 -0
  10. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/python/fabricatio/capabilities/rag.py +4 -4
  11. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/python/fabricatio/models/extra/article_base.py +52 -39
  12. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/python/fabricatio/models/extra/article_main.py +28 -43
  13. fabricatio-0.2.12.dev3/python/fabricatio/models/extra/article_outline.py +78 -0
  14. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/python/fabricatio/rust.pyi +34 -1
  15. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/src/templates.rs +1 -1
  16. fabricatio-0.2.12.dev3/src/typst_tools.rs +159 -0
  17. fabricatio-0.2.12.dev3/templates.tar.gz +0 -0
  18. fabricatio-0.2.12.dev3/uv.lock +1709 -0
  19. fabricatio-0.2.12.dev1/python/fabricatio/models/extra/article_outline.py +0 -40
  20. fabricatio-0.2.12.dev1/src/typst_tools.rs +0 -85
  21. fabricatio-0.2.12.dev1/templates.tar.gz +0 -0
  22. fabricatio-0.2.12.dev1/uv.lock +0 -1706
  23. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/.github/workflows/build-package.yaml +0 -0
  24. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/.github/workflows/ruff.yaml +0 -0
  25. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/.github/workflows/tests.yaml +0 -0
  26. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/.gitignore +0 -0
  27. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/.python-version +0 -0
  28. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/LICENSE +0 -0
  29. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/Makefile +0 -0
  30. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/README.md +0 -0
  31. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/examples/correct/correct.py +0 -0
  32. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/examples/correct/correct_loop.py +0 -0
  33. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/examples/extract_and_inject/.gitignore +0 -0
  34. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/examples/extract_and_inject/article_rag.py +0 -0
  35. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/examples/extract_and_inject/ask.py +0 -0
  36. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/examples/extract_and_inject/chunk_article.py +0 -0
  37. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/examples/extract_and_inject/extract_and_inject.py +0 -0
  38. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/examples/extract_article/extract.py +0 -0
  39. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/examples/llm_usages/llm_usage.py +0 -0
  40. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/examples/make_a_rating/rating.py +0 -0
  41. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/examples/make_diary/commits.json +0 -0
  42. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/examples/make_diary/diary.py +0 -0
  43. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/examples/minor/hello_fabricatio.py +0 -0
  44. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/examples/minor/write_a_poem.py +0 -0
  45. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/examples/propose_task/.gitignore +0 -0
  46. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/examples/propose_task/propose.py +0 -0
  47. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/examples/reviewer/censor.py +0 -0
  48. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/examples/reviewer/review.py +0 -0
  49. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/examples/rules/.gitignore +0 -0
  50. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/examples/rules/draft_ruleset.py +0 -0
  51. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/examples/search_bibtex/.gitignore +0 -0
  52. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/examples/search_bibtex/search.py +0 -0
  53. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/examples/simple_chat/chat.py +0 -0
  54. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/examples/simple_rag/simple_rag.py +0 -0
  55. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/examples/task_handle/handle_task.py +0 -0
  56. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/examples/write_article/.gitignore +0 -0
  57. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/examples/write_article/article_rag.py +0 -0
  58. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/examples/write_article/post_process.py +0 -0
  59. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/examples/write_outline/.gitignore +0 -0
  60. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/examples/write_outline/write_outline_corrected.py +0 -0
  61. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/python/fabricatio/__init__.py +0 -0
  62. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/python/fabricatio/actions/__init__.py +0 -0
  63. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/python/fabricatio/actions/article.py +0 -0
  64. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/python/fabricatio/actions/fs.py +0 -0
  65. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/python/fabricatio/actions/rag.py +0 -0
  66. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/python/fabricatio/actions/rules.py +0 -0
  67. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/python/fabricatio/capabilities/__init__.py +0 -0
  68. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/python/fabricatio/capabilities/advanced_judge.py +0 -0
  69. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/python/fabricatio/capabilities/censor.py +0 -0
  70. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/python/fabricatio/capabilities/check.py +0 -0
  71. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/python/fabricatio/capabilities/correct.py +0 -0
  72. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/python/fabricatio/capabilities/extract.py +0 -0
  73. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/python/fabricatio/capabilities/propose.py +0 -0
  74. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/python/fabricatio/capabilities/rating.py +0 -0
  75. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/python/fabricatio/capabilities/review.py +0 -0
  76. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/python/fabricatio/capabilities/task.py +0 -0
  77. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/python/fabricatio/config.py +0 -0
  78. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/python/fabricatio/constants.py +0 -0
  79. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/python/fabricatio/core.py +0 -0
  80. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/python/fabricatio/decorators.py +0 -0
  81. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/python/fabricatio/fs/__init__.py +0 -0
  82. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/python/fabricatio/fs/curd.py +0 -0
  83. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/python/fabricatio/fs/readers.py +0 -0
  84. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/python/fabricatio/journal.py +0 -0
  85. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/python/fabricatio/models/action.py +0 -0
  86. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/python/fabricatio/models/adv_kwargs_types.py +0 -0
  87. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/python/fabricatio/models/events.py +0 -0
  88. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/python/fabricatio/models/extra/__init__.py +0 -0
  89. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/python/fabricatio/models/extra/advanced_judge.py +0 -0
  90. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/python/fabricatio/models/extra/aricle_rag.py +0 -0
  91. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/python/fabricatio/models/extra/article_essence.py +0 -0
  92. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/python/fabricatio/models/extra/article_proposal.py +0 -0
  93. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/python/fabricatio/models/extra/patches.py +0 -0
  94. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/python/fabricatio/models/extra/problem.py +0 -0
  95. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/python/fabricatio/models/extra/rag.py +0 -0
  96. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/python/fabricatio/models/extra/rule.py +0 -0
  97. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/python/fabricatio/models/generic.py +0 -0
  98. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/python/fabricatio/models/kwargs_types.py +0 -0
  99. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/python/fabricatio/models/role.py +0 -0
  100. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/python/fabricatio/models/task.py +0 -0
  101. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/python/fabricatio/models/tool.py +0 -0
  102. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/python/fabricatio/models/usages.py +0 -0
  103. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/python/fabricatio/parser.py +0 -0
  104. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/python/fabricatio/py.typed +0 -0
  105. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/python/fabricatio/rust_instances.py +0 -0
  106. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/python/fabricatio/toolboxes/__init__.py +0 -0
  107. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/python/fabricatio/toolboxes/arithmetic.py +0 -0
  108. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/python/fabricatio/toolboxes/fs.py +0 -0
  109. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/python/fabricatio/utils.py +0 -0
  110. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/python/fabricatio/workflows/__init__.py +0 -0
  111. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/python/fabricatio/workflows/articles.py +0 -0
  112. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/python/fabricatio/workflows/rag.py +0 -0
  113. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/src/bib_tools.rs +0 -0
  114. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/src/hash.rs +0 -0
  115. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/src/hbs_helpers.rs +0 -0
  116. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/src/language.rs +0 -0
  117. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/src/lib.rs +0 -0
  118. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/src/word_split.rs +0 -0
  119. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/templates/built-in/as_prompt.hbs +0 -0
  120. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/templates/built-in/binary-exploitation-ctf-solver.hbs +0 -0
  121. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/templates/built-in/check_string.hbs +0 -0
  122. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/templates/built-in/claude-xml.hbs +0 -0
  123. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/templates/built-in/clean-up-code.hbs +0 -0
  124. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/templates/built-in/co_validation.hbs +0 -0
  125. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/templates/built-in/create_json_obj.hbs +0 -0
  126. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/templates/built-in/cryptography-ctf-solver.hbs +0 -0
  127. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/templates/built-in/dependencies.hbs +0 -0
  128. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/templates/built-in/document-the-code.hbs +0 -0
  129. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/templates/built-in/draft_rating_criteria.hbs +0 -0
  130. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/templates/built-in/draft_rating_manual.hbs +0 -0
  131. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/templates/built-in/draft_rating_weights_klee.hbs +0 -0
  132. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/templates/built-in/draft_tool_usage_code.hbs +0 -0
  133. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/templates/built-in/extract.hbs +0 -0
  134. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/templates/built-in/extract_criteria_from_reasons.hbs +0 -0
  135. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/templates/built-in/extract_reasons_from_examples.hbs +0 -0
  136. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/templates/built-in/find-security-vulnerabilities.hbs +0 -0
  137. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/templates/built-in/fix-bugs.hbs +0 -0
  138. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/templates/built-in/fix_troubled_obj.hbs +0 -0
  139. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/templates/built-in/fix_troubled_string.hbs +0 -0
  140. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/templates/built-in/generic_string.hbs +0 -0
  141. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/templates/built-in/improve-performance.hbs +0 -0
  142. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/templates/built-in/liststr.hbs +0 -0
  143. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/templates/built-in/make_choice.hbs +0 -0
  144. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/templates/built-in/make_judgment.hbs +0 -0
  145. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/templates/built-in/pathstr.hbs +0 -0
  146. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/templates/built-in/rate_fine_grind.hbs +0 -0
  147. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/templates/built-in/refactor.hbs +0 -0
  148. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/templates/built-in/refined_query.hbs +0 -0
  149. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/templates/built-in/retrieved_display.hbs +0 -0
  150. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/templates/built-in/reverse-engineering-ctf-solver.hbs +0 -0
  151. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/templates/built-in/review_string.hbs +0 -0
  152. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/templates/built-in/rule_requirement.hbs +0 -0
  153. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/templates/built-in/ruleset_requirement_breakdown.hbs +0 -0
  154. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/templates/built-in/task_briefing.hbs +0 -0
  155. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/templates/built-in/web-ctf-solver.hbs +0 -0
  156. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/templates/built-in/write-git-commit.hbs +0 -0
  157. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/templates/built-in/write-github-pull-request.hbs +0 -0
  158. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/templates/built-in/write-github-readme.hbs +0 -0
  159. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/tests/test_config.py +0 -0
  160. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/tests/test_models/test_action.py +0 -0
  161. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/tests/test_models/test_advanced.py +0 -0
  162. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/tests/test_models/test_generic.py +0 -0
  163. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/tests/test_models/test_problem.py +0 -0
  164. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/tests/test_models/test_role.py +0 -0
  165. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/tests/test_models/test_task.py +0 -0
  166. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/tests/test_models/test_tool.py +0 -0
  167. {fabricatio-0.2.12.dev1 → fabricatio-0.2.12.dev3}/tests/test_models/test_usages.py +0 -0
@@ -76,6 +76,12 @@ dependencies = [
76
76
  "windows-sys 0.59.0",
77
77
  ]
78
78
 
79
+ [[package]]
80
+ name = "anyhow"
81
+ version = "1.0.98"
82
+ source = "registry+https://github.com/rust-lang/crates.io-index"
83
+ checksum = "e16d2d3311acee920a9eb8d33b8cbc1787ce4a264e85f964c2404b969bdcd487"
84
+
79
85
  [[package]]
80
86
  name = "arrayref"
81
87
  version = "0.3.9"
@@ -462,6 +468,7 @@ dependencies = [
462
468
  "rayon",
463
469
  "regex",
464
470
  "serde_json",
471
+ "serde_yml",
465
472
  "tex2typst-rs",
466
473
  "unicode-segmentation",
467
474
  "walkdir",
@@ -980,6 +987,16 @@ dependencies = [
980
987
  "redox_syscall",
981
988
  ]
982
989
 
990
+ [[package]]
991
+ name = "libyml"
992
+ version = "0.0.5"
993
+ source = "registry+https://github.com/rust-lang/crates.io-index"
994
+ checksum = "3302702afa434ffa30847a83305f0a69d6abd74293b6554c18ec85c7ef30c980"
995
+ dependencies = [
996
+ "anyhow",
997
+ "version_check",
998
+ ]
999
+
983
1000
  [[package]]
984
1001
  name = "linux-raw-sys"
985
1002
  version = "0.9.3"
@@ -1670,6 +1687,21 @@ dependencies = [
1670
1687
  "serde",
1671
1688
  ]
1672
1689
 
1690
+ [[package]]
1691
+ name = "serde_yml"
1692
+ version = "0.0.12"
1693
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1694
+ checksum = "59e2dd588bf1597a252c3b920e0143eb99b0f76e4e082f4c92ce34fbc9e71ddd"
1695
+ dependencies = [
1696
+ "indexmap",
1697
+ "itoa",
1698
+ "libyml",
1699
+ "memchr",
1700
+ "ryu",
1701
+ "serde",
1702
+ "version_check",
1703
+ ]
1704
+
1673
1705
  [[package]]
1674
1706
  name = "sha2"
1675
1707
  version = "0.10.8"
@@ -15,6 +15,7 @@ pythonize = "0.23.0"
15
15
  rayon = "1.10.0"
16
16
  regex = "1.11.1"
17
17
  serde_json = "1.0.138"
18
+ serde_yml = "0.0.12"
18
19
  tex2typst-rs = "0.4.1"
19
20
  unicode-segmentation = "1.12.0"
20
21
  walkdir = "2.5.0"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fabricatio
3
- Version: 0.2.12.dev1
3
+ Version: 0.2.12.dev3
4
4
  Classifier: License :: OSI Approved :: MIT License
5
5
  Classifier: Programming Language :: Rust
6
6
  Classifier: Programming Language :: Python :: 3.12
@@ -7,7 +7,7 @@ import typer
7
7
  from fabricatio import Event, Role, WorkFlow, logger
8
8
  from fabricatio.actions.article import ExtractOutlineFromRaw, GenerateArticleProposal, GenerateInitialOutline
9
9
  from fabricatio.actions.article_rag import ArticleConsultRAG, WriteArticleContentRAG
10
- from fabricatio.actions.output import DumpFinalizedOutput, PersistentAll
10
+ from fabricatio.actions.output import DumpFinalizedOutput, PersistentAll, RenderedDump
11
11
  from fabricatio.models.extra.article_outline import ArticleOutline
12
12
  from fabricatio.models.task import Task
13
13
  from fabricatio.utils import ok
@@ -18,14 +18,13 @@ from typer import Typer
18
18
  Role(
19
19
  name="Undergraduate Researcher",
20
20
  description="Write an outline for an article in typst format.",
21
- llm_model="openai/qwen-plus",
22
- llm_temperature=0.35,
21
+ llm_model="openai/deepseek-v3-250324",
22
+ llm_temperature=0.45,
23
23
  # llm_api_endpoint=HttpUrl("https://dashscope.aliyuncs.com/compatible-mode/v1"),
24
24
  llm_top_p=0.95,
25
25
  llm_max_tokens=8191,
26
- llm_stream=True,
27
26
  llm_rpm=600,
28
- llm_tpm=1000000,
27
+ llm_tpm=900000,
29
28
  llm_timeout=600,
30
29
  registry={
31
30
  Event.quick_instantiate(ns := "article"): WorkFlow(
@@ -41,13 +40,13 @@ Role(
41
40
  ref_limit=18,
42
41
  threshold=0.58,
43
42
  result_per_query=2,
44
- llm_model="openai/qwq-plus",
45
- extractor_model="openai/qwen-max",
46
- query_model="openai/qwen-turbo",
43
+ extractor_model={"model": "openai/qwen-max"},
44
+ query_model={"model": "openai/qwen-turbo", "temperature": 0.3, "top_p": 0.85},
47
45
  )
48
46
  ),
49
- DumpFinalizedOutput(output_key="task_output"),
50
47
  PersistentAll,
48
+ DumpFinalizedOutput(dump_path="median.typ"),
49
+ RenderedDump(template_name="article").to_task_output(),
51
50
  ),
52
51
  ),
53
52
  Event.quick_instantiate(ns2 := "complete"): WorkFlow(
@@ -57,8 +56,9 @@ Role(
57
56
  ExtractOutlineFromRaw(output_key="article_outline"),
58
57
  PersistentAll,
59
58
  a,
60
- DumpFinalizedOutput(output_key="task_output"),
61
59
  PersistentAll,
60
+ DumpFinalizedOutput(dump_path="median.typ"),
61
+ RenderedDump(template_name="article").to_task_output(),
62
62
  ),
63
63
  ),
64
64
  Event.quick_instantiate(ns3 := "finish"): WorkFlow(
@@ -66,14 +66,15 @@ Role(
66
66
  description="Finish an article with given article outline. dump the outline to the given path. in typst format.",
67
67
  steps=(
68
68
  a,
69
- DumpFinalizedOutput(output_key="task_output"),
70
69
  PersistentAll,
70
+ DumpFinalizedOutput(dump_path="median.typ"),
71
+ RenderedDump(template_name="article").to_task_output(),
71
72
  ),
72
73
  ),
73
74
  Event.quick_instantiate(ns4 := "consult"): WorkFlow(
74
75
  name="Consult Article",
75
76
  description="Consult an article with given article outline. dump the outline to the given path. in typst format.",
76
- steps=(ArticleConsultRAG().to_task_output(),),
77
+ steps=(ArticleConsultRAG(ref_q_model={"model":"openai/qwen-turbo"}).to_task_output(),),
77
78
  ),
78
79
  },
79
80
  )
@@ -3,6 +3,8 @@
3
3
  import asyncio
4
4
 
5
5
  from fabricatio import Event, Role, logger
6
+ from fabricatio.models.task import Task
7
+ from fabricatio.utils import ok
6
8
  from fabricatio.workflows.articles import WriteOutlineCorrectedWorkFlow
7
9
 
8
10
 
@@ -14,10 +16,11 @@ async def main() -> None:
14
16
  registry={Event.quick_instantiate(ns := "article"): WriteOutlineCorrectedWorkFlow},
15
17
  )
16
18
 
17
- proposed_task = await role.propose_task(
19
+ proposed_task = await role.propose(
20
+ Task,
18
21
  "You need to read the `./article_briefing.txt` file and write an outline for the article in typst format. The outline should be saved in the `./out.typ` file.",
19
22
  )
20
- path = await proposed_task.delegate(ns)
23
+ path = await ok(proposed_task).delegate(ns)
21
24
  logger.success(f"The outline is saved in:\n{path}")
22
25
 
23
26
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "fabricatio"
3
- version = "0.2.12-dev1"
3
+ version = "0.2.12-dev3"
4
4
  description = "A LLM multi-agent framework."
5
5
  readme = "README.md"
6
6
  license = { file = "LICENSE" }
@@ -4,9 +4,10 @@ from asyncio import gather
4
4
  from pathlib import Path
5
5
  from typing import List, Optional
6
6
 
7
- from pydantic import PositiveInt
7
+ from pydantic import Field, PositiveInt
8
8
 
9
9
  from fabricatio import BibManager
10
+ from fabricatio.capabilities.advanced_rag import AdvancedRAG
10
11
  from fabricatio.capabilities.censor import Censor
11
12
  from fabricatio.capabilities.extract import Extract
12
13
  from fabricatio.capabilities.rag import RAG
@@ -18,6 +19,7 @@ from fabricatio.models.extra.article_essence import ArticleEssence
18
19
  from fabricatio.models.extra.article_main import Article, ArticleChapter, ArticleSection, ArticleSubsection
19
20
  from fabricatio.models.extra.article_outline import ArticleOutline
20
21
  from fabricatio.models.extra.rule import RuleSet
22
+ from fabricatio.models.kwargs_types import ChooseKwargs, LLMKwargs
21
23
  from fabricatio.utils import ask_retain, ok
22
24
 
23
25
  TYPST_CITE_USAGE = (
@@ -27,17 +29,17 @@ TYPST_CITE_USAGE = (
27
29
  "Illegal citing syntax examples(seperated by |): [[1],[2],[3]]|[[1],[1-2]]\n"
28
30
  "Those reference mark shall not be omitted during the extraction\n"
29
31
  "It's recommended to cite multiple references that supports your conclusion at a time.\n"
30
- "Wrapp inline expression using $ $,like '$>5m$' '$89%$' , and wrapp block equation using $$ $$. if you are using '$' as the money unit, you should add a '\\' before it to avoid being interpreted as a inline equation. For example 'The pants worths 5\\$.'\n"
32
+ "Wrap inline expression with '\\(' and '\\)',like '\\(>5m\\)' '\\(89%\\)', and wrap block equation with '\\[' and '\\]'.\n"
31
33
  "In addition to that, you can add a label outside the block equation which can be used as a cross reference identifier, the label is a string wrapped in `<` and `>` like `<energy-release-rate-equation>`.Note that the label string should be a summarizing title for the equation being labeled.\n"
32
34
  "you can refer to that label by using the syntax with prefix of `@eqt:`, which indicate that this notation is citing a label from the equations. For example ' @eqt:energy-release-rate-equation ' DO remember that the notation shall have both suffixed and prefixed space char which enable the compiler to distinguish the notation from the plaintext."
33
- "Below is a usage example:\n"
35
+ "Below is two usage example:\n"
34
36
  "```typst\n"
35
37
  "See @eqt:mass-energy-equation , it's the foundation of physics.\n"
36
- "$$\n"
38
+ "\\[\n"
37
39
  "E = m c^2\n"
38
- "$$ <mass-energy-equation>\n\n\n"
39
- "In @eqt:mass-energy-equation , $m$ stands for mass, $c$ stands for speed of light, and $E$ stands for energy. \n"
40
- "```"
40
+ "\\] <mass-energy-equation>\n\n\n"
41
+ "In @eqt:mass-energy-equation , \\(m\\) stands for mass, \\(c\\) stands for speed of light, and \\(E\\) stands for energy. \n"
42
+ "```\n"
41
43
  )
42
44
 
43
45
 
@@ -50,9 +52,9 @@ class WriteArticleContentRAG(Action, RAG, Extract):
50
52
  """The limit of references to be retrieved"""
51
53
  threshold: float = 0.62
52
54
  """The threshold of relevance"""
53
- extractor_model: str
55
+ extractor_model: LLMKwargs
54
56
  """The model to use for extracting the content from the retrieved references."""
55
- query_model: str
57
+ query_model: LLMKwargs
56
58
  """The model to use for querying the database"""
57
59
  supervisor: bool = False
58
60
  """Whether to use supervisor mode"""
@@ -154,12 +156,12 @@ class WriteArticleContentRAG(Action, RAG, Extract):
154
156
  f"Above is the subsection titled `{subsec.title}`.\n"
155
157
  f"I need you to extract the content to update my subsection obj provided below.\n{self.req}"
156
158
  f"{subsec.display()}\n",
157
- model=self.extractor_model,
159
+ **self.extractor_model,
158
160
  ),
159
161
  "Failed to propose new subsection.",
160
162
  )
161
163
  for p in new_subsec.paragraphs:
162
- p.content = cm.apply(p.content).replace("$$", "\n$$\n")
164
+ p.content = cm.apply(p.content)
163
165
  subsec.update_from(new_subsec)
164
166
  logger.debug(f"{subsec.title}:rpl\n{subsec.display()}")
165
167
  return subsec
@@ -175,28 +177,16 @@ class WriteArticleContentRAG(Action, RAG, Extract):
175
177
  extra_instruction: str = "",
176
178
  ) -> str:
177
179
  """Write the raw paragraphs of the subsec."""
178
- return (
179
- (
180
- await self.aask(
181
- f"{cm.as_prompt()}\nAbove is some related reference from other auther retrieved for you."
182
- f"{article_outline.finalized_dump()}\n\nAbove is my article outline, I m writing graduate thesis titled `{article.title}`. "
183
- f"More specifically, i m witting the Chapter `{chap.title}` >> Section `{sec.title}` >> Subsection `{subsec.title}`.\n"
184
- f"Please help me write the paragraphs of the subsec mentioned above, which is `{subsec.title}`.\n"
185
- f"{self.req}\n"
186
- f"You SHALL use `{article.language}` as writing language.\n{extra_instruction}\n"
187
- f"Do not use numbered list to display the outcome, you should regard you are writing the main text of the thesis.\n"
188
- f"You should not copy others' works from the references directly on to my thesis, we can only harness the conclusion they have drawn.\n"
189
- f"No extra explanation is allowed."
190
- )
191
- )
192
- .replace(r" \( ", "$")
193
- .replace(r" \) ", "$")
194
- .replace(r"\(", "$")
195
- .replace(r"\)", "$")
196
- .replace("\\[\n", "$$\n")
197
- .replace("\\[ ", "$$\n")
198
- .replace("\n\\]", "\n$$")
199
- .replace(" \\]", "\n$$")
180
+ return await self.aask(
181
+ f"{cm.as_prompt()}\nAbove is some related reference from other auther retrieved for you."
182
+ f"{article_outline.finalized_dump()}\n\nAbove is my article outline, I m writing graduate thesis titled `{article.title}`. "
183
+ f"More specifically, i m witting the Chapter `{chap.title}` >> Section `{sec.title}` >> Subsection `{subsec.title}`.\n"
184
+ f"Please help me write the paragraphs of the subsec mentioned above, which is `{subsec.title}`.\n"
185
+ f"{self.req}\n"
186
+ f"You SHALL use `{article.language}` as writing language.\n{extra_instruction}\n"
187
+ f"Do not use numbered list to display the outcome, you should regard you are writing the main text of the thesis.\n"
188
+ f"You should not copy others' works from the references directly on to my thesis, we can only harness the conclusion they have drawn.\n"
189
+ f"No extra explanation is allowed."
200
190
  )
201
191
 
202
192
  async def search_database(
@@ -222,7 +212,7 @@ class WriteArticleContentRAG(Action, RAG, Extract):
222
212
  ref_q = ok(
223
213
  await self.arefined_query(
224
214
  search_req,
225
- model=self.query_model,
215
+ **self.query_model,
226
216
  ),
227
217
  "Failed to refine query.",
228
218
  )
@@ -232,7 +222,7 @@ class WriteArticleContentRAG(Action, RAG, Extract):
232
222
  ret = await self.aretrieve(
233
223
  ref_q,
234
224
  ArticleChunk,
235
- final_limit=self.ref_limit,
225
+ max_accepted=self.ref_limit,
236
226
  result_per_query=self.result_per_query,
237
227
  similarity_threshold=self.threshold,
238
228
  )
@@ -240,7 +230,7 @@ class WriteArticleContentRAG(Action, RAG, Extract):
240
230
  cm.add_chunks(ok(ret))
241
231
  ref_q = await self.arefined_query(
242
232
  f"{cm.as_prompt()}\n\nAbove is the retrieved references in the first RAG, now we need to perform the second RAG.\n\n{search_req}",
243
- model=self.query_model,
233
+ **self.query_model,
244
234
  )
245
235
 
246
236
  if ref_q is None:
@@ -252,7 +242,7 @@ class WriteArticleContentRAG(Action, RAG, Extract):
252
242
  ret = await self.aretrieve(
253
243
  ref_q,
254
244
  ArticleChunk,
255
- final_limit=int(self.ref_limit * self.search_increment_multiplier),
245
+ max_accepted=int(self.ref_limit * self.search_increment_multiplier),
256
246
  result_per_query=int(self.result_per_query * self.search_increment_multiplier),
257
247
  similarity_threshold=self.threshold,
258
248
  )
@@ -262,18 +252,19 @@ class WriteArticleContentRAG(Action, RAG, Extract):
262
252
  cm.add_chunks(ret)
263
253
 
264
254
 
265
- class ArticleConsultRAG(Action, RAG):
255
+ class ArticleConsultRAG(Action, AdvancedRAG):
266
256
  """Write an article based on the provided outline."""
267
257
 
268
258
  output_key: str = "consult_count"
269
-
259
+ search_increment_multiplier: float = 1.6
260
+ """The multiplier to increase the limit of references to retrieve per query."""
270
261
  ref_limit: int = 20
271
262
  """The final limit of references."""
272
263
  ref_per_q: int = 3
273
264
  """The limit of references to retrieve per query."""
274
265
  similarity_threshold: float = 0.62
275
266
  """The similarity threshold of references to retrieve."""
276
- ref_q_model: Optional[str] = None
267
+ ref_q_model: ChooseKwargs = Field(default_factory=ChooseKwargs)
277
268
  """The model to use for refining query."""
278
269
  req: str = TYPST_CITE_USAGE
279
270
  """The request for the rag model."""
@@ -285,7 +276,7 @@ class ArticleConsultRAG(Action, RAG):
285
276
  from questionary import confirm, text
286
277
  from rich import print as r_print
287
278
 
288
- from fabricatio.rust import convert_all_block_tex, convert_all_inline_tex
279
+ from fabricatio.rust import convert_all_block_tex, convert_all_inline_tex, fix_misplaced_labels
289
280
 
290
281
  self.target_collection = collection_name or self.safe_target_collection
291
282
 
@@ -295,16 +286,19 @@ class ArticleConsultRAG(Action, RAG):
295
286
  while (req := await text("User: ").ask_async()) is not None:
296
287
  if await confirm("Empty the cm?").ask_async():
297
288
  cm.empty()
298
- ref_q = await self.arefined_query(req, model=self.ref_q_model)
299
- refs = await self.aretrieve(
300
- ok(ref_q, "Failed to refine query."),
301
- ArticleChunk,
302
- final_limit=self.ref_limit,
289
+ await self.clued_search(
290
+ req,
291
+ cm,
292
+ refinery_kwargs=self.ref_q_model,
293
+ expand_multiplier=self.search_increment_multiplier,
294
+ base_accepted=self.ref_limit,
303
295
  result_per_query=self.ref_per_q,
304
296
  similarity_threshold=self.similarity_threshold,
305
297
  )
306
298
 
307
- ret = await self.aask(f"{cm.add_chunks(refs).as_prompt()}\n{self.req}\n{req}")
299
+ ret = await self.aask(f"{cm.as_prompt()}\n{self.req}\n{req}")
300
+
301
+ ret = fix_misplaced_labels(ret)
308
302
  ret = convert_all_inline_tex(ret)
309
303
  ret = convert_all_block_tex(ret)
310
304
  ret = cm.apply(ret)
@@ -396,7 +390,7 @@ class TweakArticleRAG(Action, RAG, Censor):
396
390
  await self.censor_obj_inplace(
397
391
  subsec,
398
392
  ruleset=ruleset,
399
- reference=f"{'\n\n'.join(d.display() for d in await self.aretrieve(refind_q, document_model=ArticleEssence, final_limit=self.ref_limit))}\n\n"
393
+ reference=f"{'\n\n'.join(d.display() for d in await self.aretrieve(refind_q, document_model=ArticleEssence, max_accepted=self.ref_limit))}\n\n"
400
394
  f"You can use Reference above to rewrite the `{subsec.__class__.__name__}`.\n"
401
395
  f"You should Always use `{subsec.language}` as written language, "
402
396
  f"which is the original language of the `{subsec.title}`. "
@@ -1,9 +1,10 @@
1
1
  """Dump the finalized output to a file."""
2
2
 
3
3
  from pathlib import Path
4
- from typing import Any, Dict, Iterable, List, Mapping, Optional, Type
4
+ from typing import Any, Iterable, List, Mapping, Optional, Type
5
5
 
6
6
  from fabricatio import TEMPLATE_MANAGER
7
+ from fabricatio.fs import dump_text
7
8
  from fabricatio.journal import logger
8
9
  from fabricatio.models.action import Action
9
10
  from fabricatio.models.generic import FinalizedDumpAble, FromMapping, PersistentAble
@@ -51,7 +52,7 @@ class RenderedDump(Action, LLMUsage):
51
52
 
52
53
  async def _execute(
53
54
  self,
54
- to_dump: Dict[str, Any],
55
+ to_dump: FinalizedDumpAble,
55
56
  task_input: Optional[Task] = None,
56
57
  dump_path: Optional[str | Path] = None,
57
58
  **_,
@@ -66,8 +67,16 @@ class RenderedDump(Action, LLMUsage):
66
67
  "Could not find the path of file to dump the data.",
67
68
  )
68
69
  )
70
+
69
71
  logger.info(f"Saving output to {dump_path.as_posix()}")
70
- return TEMPLATE_MANAGER.render_template(self.template_name, to_dump)
72
+ dump_text(
73
+ dump_path,
74
+ TEMPLATE_MANAGER.render_template(
75
+ self.template_name, {to_dump.__class__.__name__: to_dump.finalized_dump()}
76
+ ),
77
+ )
78
+
79
+ return dump_path.as_posix()
71
80
 
72
81
 
73
82
  class PersistentAll(Action, LLMUsage):
@@ -0,0 +1,56 @@
1
+ """Advanced RAG (Retrieval Augmented Generation) model."""
2
+
3
+ from typing import Optional, Unpack
4
+
5
+ from fabricatio.capabilities.rag import RAG
6
+ from fabricatio.journal import logger
7
+ from fabricatio.models.adv_kwargs_types import FetchKwargs
8
+ from fabricatio.models.extra.aricle_rag import ArticleChunk, CitationManager
9
+ from fabricatio.models.kwargs_types import ChooseKwargs
10
+
11
+
12
+ class AdvancedRAG(RAG):
13
+ """A class representing the Advanced RAG (Retrieval Augmented Generation) model."""
14
+
15
+ async def clued_search(
16
+ self,
17
+ requirement: str,
18
+ cm: CitationManager,
19
+ max_capacity: int = 40,
20
+ max_round: int = 3,
21
+ expand_multiplier: float = 1.4,
22
+ base_accepted: int = 12,
23
+ refinery_kwargs: Optional[ChooseKwargs] = None,
24
+ **kwargs: Unpack[FetchKwargs],
25
+ ) -> CitationManager:
26
+ """Asynchronously performs a clued search based on a given requirement and citation manager."""
27
+ if max_round<=0:
28
+ raise ValueError("max_round should be greater than 0")
29
+ if max_round == 1:
30
+ logger.warning(
31
+ "max_round should be greater than 1, otherwise it behaves nothing different from the `self.aretrieve`"
32
+ )
33
+
34
+ refinery_kwargs = refinery_kwargs or {}
35
+
36
+ for i in range(max_round + 1, 1):
37
+ logger.info(f"Round [{i + 1}/{max_round}] search started.")
38
+ ref_q = await self.arefined_query(
39
+ f"{cm.as_prompt()}\n\nAbove is the retrieved references in the {i - 1}th RAG, now we need to perform the {i}th RAG."
40
+ f"\n\n{requirement}",
41
+ **refinery_kwargs,
42
+ )
43
+ if ref_q is None:
44
+ logger.error(f"At round [{i + 1}/{max_round}] search, failed to refine the query, exit.")
45
+ return cm
46
+ refs = await self.aretrieve(ref_q, ArticleChunk, base_accepted, **kwargs)
47
+
48
+ if (max_capacity := max_capacity - len(refs)) < 0:
49
+ cm.add_chunks(refs[0:max_capacity])
50
+ logger.debug(f"At round [{i + 1}/{max_round}] search, the capacity is not enough, exit.")
51
+ return cm
52
+
53
+ cm.add_chunks(refs)
54
+ base_accepted = int(base_accepted * expand_multiplier)
55
+ logger.debug(f"Exceeded max_round: {max_round}, exit.")
56
+ return cm
@@ -189,7 +189,7 @@ class RAG(EmbeddingUsage):
189
189
  self,
190
190
  query: List[str] | str,
191
191
  document_model: Type[D],
192
- final_limit: int = 20,
192
+ max_accepted: int = 20,
193
193
  **kwargs: Unpack[FetchKwargs],
194
194
  ) -> List[D]:
195
195
  """Retrieve data from the collection.
@@ -197,7 +197,7 @@ class RAG(EmbeddingUsage):
197
197
  Args:
198
198
  query (List[str] | str): The query to be used for retrieval.
199
199
  document_model (Type[D]): The model class used to convert retrieved data into document objects.
200
- final_limit (int): The final limit on the number of results to return.
200
+ max_accepted (int): The final limit on the number of results to return.
201
201
  **kwargs (Unpack[FetchKwargs]): Additional keyword arguments for retrieval.
202
202
 
203
203
  Returns:
@@ -211,9 +211,9 @@ class RAG(EmbeddingUsage):
211
211
  document_model=document_model,
212
212
  **kwargs,
213
213
  )
214
- )[:final_limit]
214
+ )[:max_accepted]
215
215
 
216
- async def arefined_query(self, question: List[str] | str, **kwargs: Unpack[ChooseKwargs]) -> Optional[List[str]]:
216
+ async def arefined_query(self, question: List[str] | str, **kwargs: Unpack[ChooseKwargs[Optional[List[str]]]]) -> Optional[List[str]]:
217
217
  """Refines the given question using a template.
218
218
 
219
219
  Args: