fabricatio 0.4.0.dev2__tar.gz → 0.4.0.dev5__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 (140) hide show
  1. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/.github/workflows/build-package.yaml +8 -11
  2. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/Makefile +7 -5
  3. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/PKG-INFO +1 -1
  4. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/examples/correct/correct.py +1 -1
  5. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/examples/write_article/article_rag.py +9 -14
  6. fabricatio-0.4.0.dev5/examples/write_article/post_process.py +11 -0
  7. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/examples/write_article/write_article.py +12 -12
  8. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/packages/fabricatio-actions/python/fabricatio_actions/actions/fs.py +3 -1
  9. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/packages/fabricatio-actions/python/fabricatio_actions/actions/output.py +22 -21
  10. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/packages/fabricatio-actions/python/fabricatio_actions/models/generic.py +1 -1
  11. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/packages/fabricatio-improve/python/fabricatio_improve/models/problem.py +2 -3
  12. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/packages/fabricatio-judge/python/fabricatio_judge/__init__.py +1 -1
  13. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/packages/fabricatio-rule/pyproject.toml +1 -1
  14. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/packages/fabricatio-rule/python/fabricatio_rule/actions/rules.py +4 -3
  15. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/packages/fabricatio-rule/python/fabricatio_rule/capabilities/censor.py +4 -3
  16. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/packages/fabricatio-rule/python/fabricatio_rule/capabilities/check.py +27 -25
  17. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/packages/fabricatio-rule/python/fabricatio_rule/models/kwargs_types.py +2 -2
  18. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/packages/fabricatio-rule/python/fabricatio_rule/models/patch.py +2 -1
  19. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/packages/fabricatio-rule/python/fabricatio_rule/models/rule.py +2 -3
  20. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/pyproject.toml +1 -1
  21. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/python/fabricatio/__init__.py +2 -1
  22. fabricatio-0.4.0.dev5/python/fabricatio/actions/__init__.py +57 -0
  23. fabricatio-0.4.0.dev5/python/fabricatio/capabilities/__init__.py +40 -0
  24. fabricatio-0.4.0.dev5/python/fabricatio/models/__init__.py +23 -0
  25. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/python/fabricatio/toolboxes/__init__.py +2 -1
  26. fabricatio-0.4.0.dev5/subpackages.py +493 -0
  27. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/uv.lock +85 -83
  28. fabricatio-0.4.0.dev2/examples/write_article/post_process.py +0 -12
  29. fabricatio-0.4.0.dev2/publish_subpackages.py +0 -146
  30. fabricatio-0.4.0.dev2/python/fabricatio/workflows/rag.py +0 -12
  31. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/.github/workflows/ruff.yaml +0 -0
  32. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/.github/workflows/tests.yaml +0 -0
  33. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/.gitignore +0 -0
  34. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/Cargo.lock +0 -0
  35. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/Cargo.toml +0 -0
  36. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/LICENSE +0 -0
  37. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/README.md +0 -0
  38. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/examples/correct/correct_loop.py +0 -0
  39. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/examples/extract_and_inject/.gitignore +0 -0
  40. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/examples/extract_and_inject/article_rag.py +0 -0
  41. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/examples/extract_and_inject/ask.py +0 -0
  42. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/examples/extract_and_inject/chunk_article.py +0 -0
  43. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/examples/extract_and_inject/extract_and_inject.py +0 -0
  44. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/examples/extract_article/extract.py +0 -0
  45. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/examples/llm_usages/llm_usage.py +0 -0
  46. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/examples/make_a_rating/rating.py +0 -0
  47. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/examples/make_diary/commits.json +0 -0
  48. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/examples/make_diary/diary.py +0 -0
  49. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/examples/minor/hello_fabricatio.py +0 -0
  50. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/examples/minor/write_a_poem.py +0 -0
  51. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/examples/propose_task/.gitignore +0 -0
  52. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/examples/propose_task/propose.py +0 -0
  53. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/examples/reviewer/censor.py +0 -0
  54. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/examples/reviewer/review.py +0 -0
  55. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/examples/rules/.gitignore +0 -0
  56. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/examples/rules/draft_ruleset.py +0 -0
  57. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/examples/search_bibtex/.gitignore +0 -0
  58. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/examples/search_bibtex/search.py +0 -0
  59. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/examples/simple_chat/chat.py +0 -0
  60. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/examples/simple_rag/simple_rag.py +0 -0
  61. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/examples/task_handle/handle_task.py +0 -0
  62. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/examples/write_article/.gitignore +0 -0
  63. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/examples/write_outline/.gitignore +0 -0
  64. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/examples/write_outline/write_outline.py +0 -0
  65. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/examples/write_outline/write_outline_corrected.py +0 -0
  66. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/packages/fabricatio-actions/LICENSE +0 -0
  67. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/packages/fabricatio-actions/README.md +0 -0
  68. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/packages/fabricatio-actions/pyproject.toml +0 -0
  69. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/packages/fabricatio-actions/python/fabricatio_actions/__init__.py +0 -0
  70. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/packages/fabricatio-actions/python/fabricatio_actions/actions/__init__.py +0 -0
  71. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/packages/fabricatio-actions/python/fabricatio_actions/py.typed +0 -0
  72. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/packages/fabricatio-improve/LICENSE +0 -0
  73. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/packages/fabricatio-improve/README.md +0 -0
  74. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/packages/fabricatio-improve/pyproject.toml +0 -0
  75. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/packages/fabricatio-improve/python/fabricatio_improve/__init__.py +0 -0
  76. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/packages/fabricatio-improve/python/fabricatio_improve/capabilities/correct.py +0 -0
  77. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/packages/fabricatio-improve/python/fabricatio_improve/capabilities/review.py +0 -0
  78. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/packages/fabricatio-improve/python/fabricatio_improve/models/improve.py +0 -0
  79. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/packages/fabricatio-improve/python/fabricatio_improve/models/kwargs_types.py +0 -0
  80. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/packages/fabricatio-improve/python/fabricatio_improve/py.typed +0 -0
  81. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/packages/fabricatio-judge/LICENSE +0 -0
  82. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/packages/fabricatio-judge/README.md +0 -0
  83. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/packages/fabricatio-judge/pyproject.toml +0 -0
  84. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/packages/fabricatio-judge/python/fabricatio_judge/capabilities/advanced_judge.py +0 -0
  85. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/packages/fabricatio-judge/python/fabricatio_judge/models/advanced_judge.py +0 -0
  86. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/packages/fabricatio-judge/python/fabricatio_judge/py.typed +0 -0
  87. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/packages/fabricatio-rule/LICENSE +0 -0
  88. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/packages/fabricatio-rule/README.md +0 -0
  89. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/packages/fabricatio-rule/python/fabricatio_rule/__init__.py +0 -0
  90. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/packages/fabricatio-rule/python/fabricatio_rule/actions/__init__.py +0 -0
  91. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/packages/fabricatio-rule/python/fabricatio_rule/capabilities/__init__.py +0 -0
  92. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/packages/fabricatio-rule/python/fabricatio_rule/models/__init__.py +0 -0
  93. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/packages/fabricatio-rule/python/fabricatio_rule/py.typed +0 -0
  94. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/python/fabricatio/py.typed +0 -0
  95. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/python/fabricatio/toolboxes/arithmetic.py +0 -0
  96. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/python/fabricatio/toolboxes/fs.py +0 -0
  97. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/python/fabricatio/workflows/__init__.py +0 -0
  98. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/src/lib.rs +0 -0
  99. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/templates/built-in/as_prompt.hbs +0 -0
  100. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/templates/built-in/binary-exploitation-ctf-solver.hbs +0 -0
  101. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/templates/built-in/chap_summary.hbs +0 -0
  102. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/templates/built-in/check_string.hbs +0 -0
  103. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/templates/built-in/claude-xml.hbs +0 -0
  104. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/templates/built-in/clean-up-code.hbs +0 -0
  105. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/templates/built-in/co_validation.hbs +0 -0
  106. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/templates/built-in/create_json_obj.hbs +0 -0
  107. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/templates/built-in/cryptography-ctf-solver.hbs +0 -0
  108. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/templates/built-in/dependencies.hbs +0 -0
  109. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/templates/built-in/document-the-code.hbs +0 -0
  110. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/templates/built-in/draft_rating_criteria.hbs +0 -0
  111. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/templates/built-in/draft_rating_manual.hbs +0 -0
  112. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/templates/built-in/draft_rating_weights_klee.hbs +0 -0
  113. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/templates/built-in/draft_tool_usage_code.hbs +0 -0
  114. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/templates/built-in/extract.hbs +0 -0
  115. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/templates/built-in/extract_criteria_from_reasons.hbs +0 -0
  116. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/templates/built-in/extract_reasons_from_examples.hbs +0 -0
  117. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/templates/built-in/find-security-vulnerabilities.hbs +0 -0
  118. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/templates/built-in/fix-bugs.hbs +0 -0
  119. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/templates/built-in/fix_troubled_obj.hbs +0 -0
  120. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/templates/built-in/fix_troubled_string.hbs +0 -0
  121. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/templates/built-in/generic_string.hbs +0 -0
  122. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/templates/built-in/improve-performance.hbs +0 -0
  123. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/templates/built-in/liststr.hbs +0 -0
  124. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/templates/built-in/make_choice.hbs +0 -0
  125. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/templates/built-in/make_judgment.hbs +0 -0
  126. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/templates/built-in/pathstr.hbs +0 -0
  127. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/templates/built-in/rate_fine_grind.hbs +0 -0
  128. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/templates/built-in/refactor.hbs +0 -0
  129. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/templates/built-in/refined_query.hbs +0 -0
  130. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/templates/built-in/research_content_summary.hbs +0 -0
  131. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/templates/built-in/retrieved_display.hbs +0 -0
  132. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/templates/built-in/reverse-engineering-ctf-solver.hbs +0 -0
  133. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/templates/built-in/review_string.hbs +0 -0
  134. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/templates/built-in/rule_requirement.hbs +0 -0
  135. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/templates/built-in/ruleset_requirement_breakdown.hbs +0 -0
  136. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/templates/built-in/task_briefing.hbs +0 -0
  137. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/templates/built-in/web-ctf-solver.hbs +0 -0
  138. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/templates/built-in/write-git-commit.hbs +0 -0
  139. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/templates/built-in/write-github-pull-request.hbs +0 -0
  140. {fabricatio-0.4.0.dev2 → fabricatio-0.4.0.dev5}/templates/built-in/write-github-readme.hbs +0 -0
@@ -107,9 +107,15 @@ jobs:
107
107
  run: |
108
108
  uv sync --no-install-project --only-dev --index https://pypi.org/simple -p ${{ matrix.python-version }}
109
109
 
110
- - name: Build
110
+ - name: Upload to PyPI
111
+ if: needs.determine_changes.outputs.version_changed == 'true'
111
112
  run: |
112
- make PY=${{ matrix.python-version }}
113
+ make publish PY=${{ matrix.python-version }}
114
+ env:
115
+ MATURIN_USERNAME: __token__
116
+ MATURIN_PASSWORD: ${{ secrets.PYPI_TOKEN }}
117
+ UV_INDEX: https://pypi.org/simple
118
+
113
119
 
114
120
  - name: Upload assets
115
121
  uses: softprops/action-gh-release@v2
@@ -119,12 +125,3 @@ jobs:
119
125
  dist/*.whl
120
126
  env:
121
127
  GITHUB_TOKEN: ${{ secrets.PAT }}
122
-
123
- - name: Upload to PyPI
124
- if: needs.determine_changes.outputs.version_changed == 'true'
125
- run: |
126
- make publish PY=${{ matrix.python-version }}
127
- env:
128
- MATURIN_USERNAME: __token__
129
- MATURIN_PASSWORD: ${{ secrets.PYPI_TOKEN }}
130
-
@@ -14,10 +14,12 @@ dev:
14
14
  rm $(DATA)/scripts/*.pdb |true
15
15
  rm $(DATA)/scripts/*.dwarf |true
16
16
  uvx -p $(PY) --project . maturin develop --uv -r
17
+ uv run subpackages.py --no-publish --pyversion $(PY) --dev
17
18
 
18
- bdist: dirs clean dev
19
+
20
+ bdist: dirs dev
19
21
  uvx -p $(PY) --project . maturin build --sdist -r -o $(DIST)
20
- uv run publish_subpackages.py --no-publish
22
+ uv run subpackages.py --no-publish --pyversion $(PY)
21
23
 
22
24
  clean:
23
25
  rm -rf $(DIST)/* $(DATA)/*
@@ -26,8 +28,8 @@ clean:
26
28
  test:dev
27
29
  uvx -p $(PY) --project . pytest tests
28
30
 
29
- publish:
30
- uv run publish_subpackages.py
31
+ publish: bdist
32
+ uv run subpackages.py --pyversion $(PY)
31
33
 
32
34
 
33
- .PHONY: dev bdist clean publish test
35
+ .PHONY: dev bdist clean publish tests
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fabricatio
3
- Version: 0.4.0.dev2
3
+ Version: 0.4.0.dev5
4
4
  Classifier: License :: OSI Approved :: MIT License
5
5
  Classifier: Programming Language :: Rust
6
6
  Classifier: Programming Language :: Python :: 3.12
@@ -4,7 +4,7 @@ import asyncio
4
4
 
5
5
  from fabricatio import Role as BaseRole
6
6
  from fabricatio import logger
7
- from fabricatio.capabilities.correct import Correct
7
+ from fabricatio.capabilities import Correct
8
8
 
9
9
 
10
10
  class Role(BaseRole, Correct):
@@ -3,26 +3,21 @@
3
3
  import asyncio
4
4
  from pathlib import Path
5
5
 
6
- from fabricatio import Event, Role, WorkFlow, logger
7
- from fabricatio.actions.article_rag import TweakArticleRAG
8
- from fabricatio.actions.output import DumpFinalizedOutput, PersistentAll, RetrieveFromPersistent
9
- from fabricatio.models.action import Action
10
- from fabricatio.models.extra.article_main import Article
11
- from fabricatio.models.extra.article_outline import ArticleOutline
12
- from fabricatio.models.extra.article_proposal import ArticleProposal
13
- from fabricatio.models.task import Task
6
+ from fabricatio import Action, Event, Role, Task, WorkFlow, logger
7
+ from fabricatio.actions import DumpFinalizedOutput, PersistentAll, RetrieveFromPersistent, TweakArticleRAG
8
+ from fabricatio.models import Article, ArticleOutline, ArticleProposal
14
9
 
15
10
 
16
11
  class Connect(Action):
17
12
  """Connect the article to the outline."""
18
13
 
19
14
  async def _execute(
20
- self,
21
- article_briefing: str,
22
- article_proposal: ArticleProposal,
23
- article_outline: ArticleOutline,
24
- article: Article,
25
- **cxt,
15
+ self,
16
+ article_briefing: str,
17
+ article_proposal: ArticleProposal,
18
+ article_outline: ArticleOutline,
19
+ article: Article,
20
+ **cxt,
26
21
  ) -> None:
27
22
  article.update_ref(article_outline.update_ref(article_proposal.update_ref(article_briefing)))
28
23
 
@@ -0,0 +1,11 @@
1
+ """Fix the article."""
2
+
3
+ from fabricatio.models import Article
4
+
5
+ a = Article.from_persistent(
6
+ r"persistent\to_dump\Article_20250408_103051_51d822.json")
7
+ a.convert_tex()
8
+
9
+ from fabricatio_core.fs.curd import dump_text
10
+
11
+ dump_text("corrected.typ", a.finalized_dump())
@@ -5,21 +5,22 @@ from pathlib import Path
5
5
  from typing import List, Optional
6
6
 
7
7
  import typer
8
- from fabricatio import Event, WorkFlow, logger
8
+ from fabricatio import Event, Task, WorkFlow, logger
9
9
  from fabricatio import Role as RoleBase
10
- from fabricatio.actions.article import (
10
+ from fabricatio.actions import (
11
+ ArticleConsultRAG,
12
+ DumpFinalizedOutput,
11
13
  ExtractOutlineFromRaw,
12
14
  GenerateArticleProposal,
13
15
  GenerateInitialOutline,
16
+ PersistentAll,
17
+ RenderedDump,
18
+ WriteArticleContentRAG,
14
19
  WriteChapterSummary,
15
20
  WriteResearchContentSummary,
16
21
  )
17
- from fabricatio.actions.article_rag import ArticleConsultRAG, WriteArticleContentRAG
18
- from fabricatio.actions.output import DumpFinalizedOutput, PersistentAll, RenderedDump
19
- from fabricatio.models.extra.article_outline import ArticleOutline
20
- from fabricatio.models.task import Task
21
- from fabricatio.models.usages import LLMUsage
22
- from fabricatio.utils import ok
22
+ from fabricatio.models import ArticleOutline, LLMUsage
23
+ from fabricatio_core.utils import ok
23
24
  from typer import Typer
24
25
 
25
26
  # from pydantic import HttpUrl
@@ -102,7 +103,6 @@ Role(
102
103
  },
103
104
  )
104
105
 
105
-
106
106
  app = Typer()
107
107
 
108
108
 
@@ -126,7 +126,7 @@ def finish(
126
126
  article_outline_path: Path = typer.Argument( # noqa: B008
127
127
  help="Path to the article outline raw file."
128
128
  ),
129
- dump_path: Path = typer.Option(Path("out.typ"), "-d", "--dump-path", help="Path to dump the final output."), # noqa: B008
129
+ dump_path: Path = typer.Option(Path("out.typ"), "-d", "--dump-path", help="Path to dump the final output."),
130
130
  persist_dir: Path = typer.Option( # noqa: B008
131
131
  Path("persistent"), "-p", "--persist-dir", help="Directory to persist the output."
132
132
  ),
@@ -156,7 +156,7 @@ def completion(
156
156
  article_outline_raw_path: Path = typer.Option( # noqa: B008
157
157
  Path("article_outline_raw.txt"), "-a", "--article-outline-raw", help="Path to the article outline raw file."
158
158
  ),
159
- dump_path: Path = typer.Option(Path("out.typ"), "-d", "--dump-path", help="Path to dump the final output."), # noqa: B008
159
+ dump_path: Path = typer.Option(Path("out.typ"), "-d", "--dump-path", help="Path to dump the final output."),
160
160
  persist_dir: Path = typer.Option( # noqa: B008
161
161
  Path("persistent"), "-p", "--persist-dir", help="Directory to persist the output."
162
162
  ),
@@ -186,7 +186,7 @@ def write(
186
186
  article_briefing: Path = typer.Option( # noqa: B008
187
187
  Path("article_briefing.txt"), "-a", "--article-briefing", help="Path to the article briefing file."
188
188
  ),
189
- dump_path: Path = typer.Option(Path("out.typ"), "-d", "--dump-path", help="Path to dump the final output."), # noqa: B008
189
+ dump_path: Path = typer.Option(Path("out.typ"), "-d", "--dump-path", help="Path to dump the final output."),
190
190
  persist_dir: Path = typer.Option( # noqa: B008
191
191
  Path("persistent"), "-p", "--persist-dir", help="Directory to persist the output."
192
192
  ),
@@ -3,14 +3,16 @@
3
3
  from pathlib import Path
4
4
  from typing import Any, List, Mapping, Self
5
5
 
6
- from fabricatio_actions.models.generic import FromMapping
7
6
  from fabricatio_core.fs import safe_text_read
8
7
  from fabricatio_core.journal import logger
9
8
  from fabricatio_core.models.action import Action
10
9
 
10
+ from fabricatio_actions.models.generic import FromMapping
11
+
11
12
 
12
13
  class ReadText(Action, FromMapping):
13
14
  """Read text from a file."""
15
+
14
16
  output_key: str = "read_text"
15
17
  read_path: str | Path
16
18
  """Path to the file to read."""
@@ -3,7 +3,6 @@
3
3
  from pathlib import Path
4
4
  from typing import Any, Iterable, List, Mapping, Optional, Self, Sequence, Type
5
5
 
6
- from fabricatio_actions.models.generic import FromMapping, FromSequence
7
6
  from fabricatio_capabilities.models.generic import FinalizedDumpAble, PersistentAble
8
7
  from fabricatio_core.fs import dump_text
9
8
  from fabricatio_core.journal import logger
@@ -13,6 +12,8 @@ from fabricatio_core.models.usages import LLMUsage
13
12
  from fabricatio_core.rust import TEMPLATE_MANAGER
14
13
  from fabricatio_core.utils import ok
15
14
 
15
+ from fabricatio_actions.models.generic import FromMapping, FromSequence
16
+
16
17
 
17
18
  class DumpFinalizedOutput(Action, LLMUsage):
18
19
  """Dump the finalized output to a file."""
@@ -21,11 +22,11 @@ class DumpFinalizedOutput(Action, LLMUsage):
21
22
  dump_path: Optional[str] = None
22
23
 
23
24
  async def _execute(
24
- self,
25
- to_dump: FinalizedDumpAble,
26
- task_input: Optional[Task] = None,
27
- dump_path: Optional[str | Path] = None,
28
- **_,
25
+ self,
26
+ to_dump: FinalizedDumpAble,
27
+ task_input: Optional[Task] = None,
28
+ dump_path: Optional[str | Path] = None,
29
+ **_,
29
30
  ) -> str:
30
31
  dump_path = Path(
31
32
  dump_path
@@ -52,11 +53,11 @@ class RenderedDump(Action, LLMUsage):
52
53
  """The template name to render the data."""
53
54
 
54
55
  async def _execute(
55
- self,
56
- to_dump: FinalizedDumpAble,
57
- task_input: Optional[Task] = None,
58
- dump_path: Optional[str | Path] = None,
59
- **_,
56
+ self,
57
+ to_dump: FinalizedDumpAble,
58
+ task_input: Optional[Task] = None,
59
+ dump_path: Optional[str | Path] = None,
60
+ **_,
60
61
  ) -> str:
61
62
  dump_path = Path(
62
63
  dump_path
@@ -91,10 +92,10 @@ class PersistentAll(Action, LLMUsage):
91
92
  """Whether to remove the existing dir before dumping."""
92
93
 
93
94
  async def _execute(
94
- self,
95
- task_input: Optional[Task] = None,
96
- persist_dir: Optional[str | Path] = None,
97
- **cxt,
95
+ self,
96
+ task_input: Optional[Task] = None,
97
+ persist_dir: Optional[str | Path] = None,
98
+ **cxt,
98
99
  ) -> int:
99
100
  persist_dir = Path(
100
101
  persist_dir
@@ -124,7 +125,7 @@ class PersistentAll(Action, LLMUsage):
124
125
  v.persist(final_dir)
125
126
  count += 1
126
127
  if isinstance(v, Iterable) and any(
127
- persistent_ables := (pers for pers in v if isinstance(pers, PersistentAble))
128
+ persistent_ables := (pers for pers in v if isinstance(pers, PersistentAble))
128
129
  ):
129
130
  logger.info(f"Persisting collection {k} to {final_dir}")
130
131
  final_dir.mkdir(parents=True, exist_ok=True)
@@ -174,11 +175,11 @@ class RetrieveFromLatest[T: PersistentAble](RetrieveFromPersistent[T], FromMappi
174
175
 
175
176
  @classmethod
176
177
  def from_mapping(
177
- cls,
178
- mapping: Mapping[str, str | Path],
179
- *,
180
- retrieve_cls: Type[T],
181
- **kwargs,
178
+ cls,
179
+ mapping: Mapping[str, str | Path],
180
+ *,
181
+ retrieve_cls: Type[T],
182
+ **kwargs,
182
183
  ) -> List["RetrieveFromLatest[T]"]:
183
184
  """Create a list of `RetrieveFromLatest` from the mapping."""
184
185
  return [
@@ -1,5 +1,5 @@
1
1
  from abc import abstractmethod
2
- from typing import Mapping, Any, List, Sequence
2
+ from typing import Any, List, Mapping, Sequence
3
3
 
4
4
 
5
5
  class FromMapping:
@@ -2,13 +2,12 @@
2
2
 
3
3
  from typing import Any, List, Optional, Self
4
4
 
5
- from pydantic import Field
6
- from rich import print as r_print
7
-
8
5
  from fabricatio_capabilities.models.generic import SketchedAble
9
6
  from fabricatio_core.journal import logger
10
7
  from fabricatio_core.models.generic import WithBriefing
11
8
  from fabricatio_core.utils import ask_edit
9
+ from pydantic import Field
10
+ from rich import print as r_print
12
11
 
13
12
 
14
13
  class Problem(SketchedAble, WithBriefing):
@@ -1,6 +1,6 @@
1
1
  """Fabricatio is a Python library for building llm app using event-based agent structure."""
2
2
 
3
- from fabricatio_judge import models, capabilities
3
+ from fabricatio_judge import capabilities, models
4
4
 
5
5
  __all__ = [
6
6
  "capabilities",
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "fabricatio-rule"
3
- version = "0.1.0"
3
+ version = "0.1.1"
4
4
  description = "Add your description here"
5
5
  license = { file = "LICENSE" }
6
6
  authors = [
@@ -6,6 +6,7 @@ from fabricatio_actions.models.generic import FromMapping
6
6
  from fabricatio_core.journal import logger
7
7
  from fabricatio_core.models.action import Action
8
8
  from fabricatio_core.utils import ok
9
+
9
10
  from fabricatio_rule.capabilities.check import Check
10
11
  from fabricatio_rule.models.rule import RuleSet
11
12
 
@@ -22,9 +23,9 @@ class DraftRuleSet(Action, Check, FromMapping):
22
23
  """The number of rules to generate in the ruleset (0 for no restriction)."""
23
24
 
24
25
  async def _execute(
25
- self,
26
- ruleset_requirement: Optional[str] = None,
27
- **_,
26
+ self,
27
+ ruleset_requirement: Optional[str] = None,
28
+ **_,
28
29
  ) -> Optional[RuleSet]:
29
30
  """Draft a ruleset based on the requirement description.
30
31
 
@@ -13,6 +13,7 @@ from fabricatio_core.models.kwargs_types import ReferencedKwargs
13
13
  from fabricatio_core.utils import override_kwargs
14
14
  from fabricatio_improve.capabilities.correct import Correct
15
15
  from fabricatio_improve.models.improve import Improvement
16
+
16
17
  from fabricatio_rule.capabilities.check import Check
17
18
  from fabricatio_rule.models.rule import RuleSet
18
19
 
@@ -26,7 +27,7 @@ class Censor(Correct, Check, ABC):
26
27
  """
27
28
 
28
29
  async def censor_obj[M: SketchedAble](
29
- self, obj: M, ruleset: RuleSet, **kwargs: Unpack[ReferencedKwargs[M]]
30
+ self, obj: M, ruleset: RuleSet, **kwargs: Unpack[ReferencedKwargs[M]]
30
31
  ) -> Optional[M]:
31
32
  """Censors an object based on the provided ruleset.
32
33
 
@@ -51,7 +52,7 @@ class Censor(Correct, Check, ABC):
51
52
  return await self.correct_obj(obj, Improvement.gather(*imp), **kwargs)
52
53
 
53
54
  async def censor_string(
54
- self, input_text: str, ruleset: RuleSet, **kwargs: Unpack[ReferencedKwargs[str]]
55
+ self, input_text: str, ruleset: RuleSet, **kwargs: Unpack[ReferencedKwargs[str]]
55
56
  ) -> Optional[str]:
56
57
  """Censors a string based on the provided ruleset.
57
58
 
@@ -77,7 +78,7 @@ class Censor(Correct, Check, ABC):
77
78
  return await self.correct_string(input_text, Improvement.gather(*imp), **kwargs)
78
79
 
79
80
  async def censor_obj_inplace[M: ProposedUpdateAble](
80
- self, obj: M, ruleset: RuleSet, **kwargs: Unpack[ReferencedKwargs[M]]
81
+ self, obj: M, ruleset: RuleSet, **kwargs: Unpack[ReferencedKwargs[M]]
81
82
  ) -> Optional[M]:
82
83
  """Censors an object in-place based on the provided ruleset.
83
84
 
@@ -6,12 +6,14 @@ from typing import List, Optional, Unpack
6
6
 
7
7
  from fabricatio_capabilities.capabilities.propose import Propose
8
8
  from fabricatio_capabilities.models.kwargs_types import ValidateKwargs
9
+ from fabricatio_capabilities.rust import detect_language
9
10
  from fabricatio_core.journal import logger
10
11
  from fabricatio_core.models.generic import Display, WithBriefing
11
- from fabricatio_core.rust import CONFIG, TEMPLATE_MANAGER, detect_language
12
+ from fabricatio_core.rust import CONFIG, TEMPLATE_MANAGER
12
13
  from fabricatio_core.utils import override_kwargs
13
14
  from fabricatio_improve.models.improve import Improvement
14
15
  from fabricatio_judge.capabilities.advanced_judge import AdvancedJudge
16
+
15
17
  from fabricatio_rule.models.patch import RuleSetMetadata
16
18
  from fabricatio_rule.models.rule import Rule, RuleSet
17
19
 
@@ -24,7 +26,7 @@ class Check(AdvancedJudge, Propose, ABC):
24
26
  """
25
27
 
26
28
  async def draft_ruleset(
27
- self, ruleset_requirement: str, rule_count: int = 0, **kwargs: Unpack[ValidateKwargs[Rule]]
29
+ self, ruleset_requirement: str, rule_count: int = 0, **kwargs: Unpack[ValidateKwargs[Rule]]
28
30
  ) -> Optional[RuleSet]:
29
31
  """Generate rule set based on requirement description.
30
32
 
@@ -80,11 +82,11 @@ class Check(AdvancedJudge, Propose, ABC):
80
82
  return RuleSet(rules=rules, **ruleset_patch.as_kwargs())
81
83
 
82
84
  async def check_string_against_rule(
83
- self,
84
- input_text: str,
85
- rule: Rule,
86
- reference: str = "",
87
- **kwargs: Unpack[ValidateKwargs[Improvement]],
85
+ self,
86
+ input_text: str,
87
+ rule: Rule,
88
+ reference: str = "",
89
+ **kwargs: Unpack[ValidateKwargs[Improvement]],
88
90
  ) -> Optional[Improvement]:
89
91
  """Validate text against specific rule.
90
92
 
@@ -103,9 +105,9 @@ class Check(AdvancedJudge, Propose, ABC):
103
105
  - Proposes Improvement only when violation is confirmed
104
106
  """
105
107
  if judge := await self.evidently_judge(
106
- f"# Content to exam\n{input_text}\n\n# Rule Must to follow\n{rule.display()}\nDoes `Content to exam` provided above violate the `{rule.name}` provided above?"
107
- f"should I take some measure to fix that violation? true for I do need, false for I don't need.",
108
- **override_kwargs(kwargs, default=None),
108
+ f"# Content to exam\n{input_text}\n\n# Rule Must to follow\n{rule.display()}\nDoes `Content to exam` provided above violate the `{rule.name}` provided above?"
109
+ f"should I take some measure to fix that violation? true for I do need, false for I don't need.",
110
+ **override_kwargs(kwargs, default=None),
109
111
  ):
110
112
  logger.info(f"Rule `{rule.name}` violated: \n{judge.display()}")
111
113
  return await self.propose(
@@ -119,11 +121,11 @@ class Check(AdvancedJudge, Propose, ABC):
119
121
  return None
120
122
 
121
123
  async def check_obj_against_rule[M: (Display, WithBriefing)](
122
- self,
123
- obj: M,
124
- rule: Rule,
125
- reference: str = "",
126
- **kwargs: Unpack[ValidateKwargs[Improvement]],
124
+ self,
125
+ obj: M,
126
+ rule: Rule,
127
+ reference: str = "",
128
+ **kwargs: Unpack[ValidateKwargs[Improvement]],
127
129
  ) -> Optional[Improvement]:
128
130
  """Validate object against rule using text representation.
129
131
 
@@ -151,11 +153,11 @@ class Check(AdvancedJudge, Propose, ABC):
151
153
  return await self.check_string_against_rule(input_text, rule, reference, **kwargs)
152
154
 
153
155
  async def check_string(
154
- self,
155
- input_text: str,
156
- ruleset: RuleSet,
157
- reference: str = "",
158
- **kwargs: Unpack[ValidateKwargs[Improvement]],
156
+ self,
157
+ input_text: str,
158
+ ruleset: RuleSet,
159
+ reference: str = "",
160
+ **kwargs: Unpack[ValidateKwargs[Improvement]],
159
161
  ) -> Optional[List[Improvement]]:
160
162
  """Validate text against full ruleset.
161
163
 
@@ -182,11 +184,11 @@ class Check(AdvancedJudge, Propose, ABC):
182
184
  return [imp for imp in imp_seq if imp]
183
185
 
184
186
  async def check_obj[M: (Display, WithBriefing)](
185
- self,
186
- obj: M,
187
- ruleset: RuleSet,
188
- reference: str = "",
189
- **kwargs: Unpack[ValidateKwargs[Improvement]],
187
+ self,
188
+ obj: M,
189
+ ruleset: RuleSet,
190
+ reference: str = "",
191
+ **kwargs: Unpack[ValidateKwargs[Improvement]],
190
192
  ) -> Optional[List[Improvement]]:
191
193
  """Validate object against full ruleset.
192
194
 
@@ -1,9 +1,9 @@
1
1
  """This module contains the types for the keyword arguments of the methods in the models module."""
2
2
 
3
- from fabricatio_rule.models.problem import Improvement
4
-
5
3
  from fabricatio_core.models.generic import SketchedAble
6
4
  from fabricatio_core.models.kwargs_types import ReferencedKwargs
5
+
6
+ from fabricatio_rule.models.problem import Improvement
7
7
  from fabricatio_rule.models.rule import RuleSet
8
8
 
9
9
 
@@ -2,9 +2,10 @@
2
2
 
3
3
  from typing import Optional, Type
4
4
 
5
+ from fabricatio_capabilities.models.generic import Patch
6
+ from fabricatio_core.models.generic import WithBriefing
5
7
  from pydantic import BaseModel
6
8
 
7
- from fabricatio_core.models.generic import Patch, WithBriefing
8
9
  from fabricatio_rule.models.rule import RuleSet
9
10
 
10
11
 
@@ -10,11 +10,10 @@ complex rule management systems.
10
10
 
11
11
  from typing import List, Self, Tuple, Unpack
12
12
 
13
+ from fabricatio_capabilities.models.generic import Language, PersistentAble, SketchedAble
14
+ from fabricatio_core.models.generic import WithBriefing
13
15
  from more_itertools import flatten
14
16
 
15
- from fabricatio_capabilities.models.generic import SketchedAble
16
- from fabricatio_core.models.generic import Language, PersistentAble, WithBriefing
17
-
18
17
 
19
18
  class Rule(WithBriefing, Language, SketchedAble, PersistentAble):
20
19
  """Represents a rule or guideline for a specific topic."""
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "fabricatio"
3
- version = "0.4.0-dev2"
3
+ version = "0.4.0-dev5"
4
4
  description = "A LLM multi-agent framework."
5
5
  readme = "README.md"
6
6
  license = { file = "LICENSE" }
@@ -1,6 +1,5 @@
1
1
  """Fabricatio is a Python library for building llm app using event-based agent structure."""
2
2
 
3
- from fabricatio import toolboxes, workflows
4
3
  from fabricatio_core import fs, models, parser, utils
5
4
  from fabricatio_core.journal import logger
6
5
  from fabricatio_core.models.action import Action, WorkFlow
@@ -9,6 +8,8 @@ from fabricatio_core.models.task import Task
9
8
  from fabricatio_core.models.tool import ToolBox
10
9
  from fabricatio_core.rust import CONFIG, TEMPLATE_MANAGER, Event
11
10
 
11
+ from fabricatio import toolboxes, workflows
12
+
12
13
  __all__ = [
13
14
  "CONFIG",
14
15
  "TEMPLATE_MANAGER",
@@ -0,0 +1,57 @@
1
+ from importlib.util import find_spec
2
+
3
+ __all__ = []
4
+
5
+ if find_spec("fabricatio_typst"):
6
+ from fabricatio_typst.actions.article import (
7
+ ExtractArticleEssence,
8
+ ExtractOutlineFromRaw,
9
+ GenerateArticle,
10
+ GenerateArticleProposal,
11
+ GenerateInitialOutline,
12
+ WriteChapterSummary,
13
+ WriteResearchContentSummary,
14
+ )
15
+
16
+ __all__ += [
17
+ "ExtractArticleEssence",
18
+ "ExtractOutlineFromRaw",
19
+ "GenerateArticle",
20
+ "GenerateArticleProposal",
21
+ "GenerateInitialOutline",
22
+ "WriteChapterSummary",
23
+ "WriteResearchContentSummary"
24
+
25
+ ]
26
+
27
+ if find_spec("fabricatio_rag"):
28
+ from fabricatio_typst.actions.article_rag import ArticleConsultRAG, TweakArticleRAG, WriteArticleContentRAG
29
+
30
+ __all__ += [
31
+
32
+ "ArticleConsultRAG",
33
+ "TweakArticleRAG",
34
+ "WriteArticleContentRAG"
35
+ ]
36
+
37
+ if find_spec("fabricatio_actions"):
38
+ from fabricatio_actions.actions.output import (
39
+ DumpFinalizedOutput,
40
+ Forward,
41
+ GatherAsList,
42
+ PersistentAll,
43
+ RenderedDump,
44
+ RetrieveFromLatest,
45
+ RetrieveFromPersistent,
46
+ )
47
+
48
+ __all__ += [
49
+
50
+ "DumpFinalizedOutput",
51
+ "Forward",
52
+ "GatherAsList",
53
+ "PersistentAll",
54
+ "RenderedDump",
55
+ "RetrieveFromLatest",
56
+ "RetrieveFromPersistent"
57
+ ]