fabricatio 0.2.6.dev3__tar.gz → 0.2.6.dev4__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 (122) hide show
  1. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/PKG-INFO +1 -1
  2. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/examples/extract_and_review/extract_and_review.py +2 -1
  3. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/examples/extract_article/extract.py +2 -1
  4. fabricatio-0.2.6.dev4/examples/search_bibtex/search.py +11 -0
  5. fabricatio-0.2.6.dev4/examples/write_outline/write_outline_corrected.py +44 -0
  6. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/pyproject.toml +1 -1
  7. fabricatio-0.2.6.dev4/python/fabricatio/__init__.py +43 -0
  8. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/python/fabricatio/_rust.pyi +0 -1
  9. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/python/fabricatio/actions/article.py +46 -2
  10. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/python/fabricatio/models/extra.py +3 -3
  11. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/python/fabricatio/models/kwargs_types.py +2 -2
  12. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/python/fabricatio/parser.py +1 -0
  13. fabricatio-0.2.6.dev4/python/fabricatio/workflows/articles.py +26 -0
  14. fabricatio-0.2.6.dev4/templates.tar.gz +0 -0
  15. fabricatio-0.2.6.dev4/uv.lock +1549 -0
  16. fabricatio-0.2.6.dev3/examples/search_bibtex/search.py +0 -12
  17. fabricatio-0.2.6.dev3/python/fabricatio/__init__.py +0 -60
  18. fabricatio-0.2.6.dev3/python/fabricatio/workflows/articles.py +0 -15
  19. fabricatio-0.2.6.dev3/templates.tar.gz +0 -0
  20. fabricatio-0.2.6.dev3/uv.lock +0 -1547
  21. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/.github/workflows/build-package.yaml +0 -0
  22. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/.github/workflows/ruff.yaml +0 -0
  23. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/.github/workflows/tests.yaml +0 -0
  24. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/.gitignore +0 -0
  25. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/.python-version +0 -0
  26. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/Cargo.lock +0 -0
  27. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/Cargo.toml +0 -0
  28. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/LICENSE +0 -0
  29. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/Makefile +0 -0
  30. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/README.md +0 -0
  31. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/examples/correct/correct.py +0 -0
  32. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/examples/correct/correct_loop.py +0 -0
  33. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/examples/extract_and_review/.gitignore +0 -0
  34. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/examples/llm_usages/llm_usage.py +0 -0
  35. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/examples/make_a_rating/rating.py +0 -0
  36. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/examples/make_diary/commits.json +0 -0
  37. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/examples/make_diary/diary.py +0 -0
  38. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/examples/minor/hello_fabricatio.py +0 -0
  39. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/examples/minor/write_a_poem.py +0 -0
  40. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/examples/propose_task/propose.py +0 -0
  41. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/examples/reviewer/review.py +0 -0
  42. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/examples/search_bibtex/.gitignore +0 -0
  43. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/examples/simple_chat/chat.py +0 -0
  44. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/examples/simple_rag/simple_rag.py +0 -0
  45. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/examples/task_handle/handle_task.py +0 -0
  46. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/examples/write_outline/.gitignore +0 -0
  47. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/examples/write_outline/write_outline.py +0 -0
  48. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/python/fabricatio/_rust_instances.py +0 -0
  49. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/python/fabricatio/actions/output.py +0 -0
  50. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/python/fabricatio/actions/rag.py +0 -0
  51. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/python/fabricatio/capabilities/correct.py +0 -0
  52. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/python/fabricatio/capabilities/propose.py +0 -0
  53. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/python/fabricatio/capabilities/rag.py +0 -0
  54. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/python/fabricatio/capabilities/rating.py +0 -0
  55. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/python/fabricatio/capabilities/review.py +0 -0
  56. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/python/fabricatio/capabilities/task.py +0 -0
  57. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/python/fabricatio/config.py +0 -0
  58. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/python/fabricatio/core.py +0 -0
  59. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/python/fabricatio/decorators.py +0 -0
  60. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/python/fabricatio/fs/__init__.py +0 -0
  61. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/python/fabricatio/fs/curd.py +0 -0
  62. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/python/fabricatio/fs/readers.py +0 -0
  63. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/python/fabricatio/journal.py +0 -0
  64. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/python/fabricatio/models/action.py +0 -0
  65. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/python/fabricatio/models/events.py +0 -0
  66. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/python/fabricatio/models/generic.py +0 -0
  67. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/python/fabricatio/models/role.py +0 -0
  68. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/python/fabricatio/models/task.py +0 -0
  69. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/python/fabricatio/models/tool.py +0 -0
  70. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/python/fabricatio/models/usages.py +0 -0
  71. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/python/fabricatio/models/utils.py +0 -0
  72. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/python/fabricatio/py.typed +0 -0
  73. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/python/fabricatio/toolboxes/__init__.py +0 -0
  74. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/python/fabricatio/toolboxes/arithmetic.py +0 -0
  75. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/python/fabricatio/toolboxes/fs.py +0 -0
  76. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/python/fabricatio/workflows/rag.py +0 -0
  77. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/src/bib_tools.rs +0 -0
  78. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/src/hash.rs +0 -0
  79. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/src/hbs_helpers.rs +0 -0
  80. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/src/lib.rs +0 -0
  81. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/src/templates.rs +0 -0
  82. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/templates/built-in/binary-exploitation-ctf-solver.hbs +0 -0
  83. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/templates/built-in/claude-xml.hbs +0 -0
  84. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/templates/built-in/clean-up-code.hbs +0 -0
  85. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/templates/built-in/correct.hbs +0 -0
  86. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/templates/built-in/create_json_obj.hbs +0 -0
  87. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/templates/built-in/cryptography-ctf-solver.hbs +0 -0
  88. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/templates/built-in/dependencies.hbs +0 -0
  89. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/templates/built-in/document-the-code.hbs +0 -0
  90. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/templates/built-in/draft_rating_criteria.hbs +0 -0
  91. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/templates/built-in/draft_rating_manual.hbs +0 -0
  92. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/templates/built-in/draft_rating_weights_klee.hbs +0 -0
  93. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/templates/built-in/draft_tool_usage_code.hbs +0 -0
  94. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/templates/built-in/extract_criteria_from_reasons.hbs +0 -0
  95. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/templates/built-in/extract_reasons_from_examples.hbs +0 -0
  96. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/templates/built-in/find-security-vulnerabilities.hbs +0 -0
  97. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/templates/built-in/fix-bugs.hbs +0 -0
  98. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/templates/built-in/generic_string.hbs +0 -0
  99. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/templates/built-in/improve-performance.hbs +0 -0
  100. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/templates/built-in/liststr.hbs +0 -0
  101. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/templates/built-in/make_choice.hbs +0 -0
  102. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/templates/built-in/make_judgment.hbs +0 -0
  103. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/templates/built-in/pathstr.hbs +0 -0
  104. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/templates/built-in/rate_fine_grind.hbs +0 -0
  105. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/templates/built-in/refactor.hbs +0 -0
  106. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/templates/built-in/refined_query.hbs +0 -0
  107. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/templates/built-in/retrieved_display.hbs +0 -0
  108. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/templates/built-in/reverse-engineering-ctf-solver.hbs +0 -0
  109. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/templates/built-in/review_string.hbs +0 -0
  110. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/templates/built-in/task_briefing.hbs +0 -0
  111. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/templates/built-in/web-ctf-solver.hbs +0 -0
  112. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/templates/built-in/write-git-commit.hbs +0 -0
  113. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/templates/built-in/write-github-pull-request.hbs +0 -0
  114. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/templates/built-in/write-github-readme.hbs +0 -0
  115. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/tests/test_config.py +0 -0
  116. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/tests/test_models/test_action.py +0 -0
  117. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/tests/test_models/test_advanced.py +0 -0
  118. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/tests/test_models/test_generic.py +0 -0
  119. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/tests/test_models/test_role.py +0 -0
  120. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/tests/test_models/test_task.py +0 -0
  121. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/tests/test_models/test_tool.py +0 -0
  122. {fabricatio-0.2.6.dev3 → fabricatio-0.2.6.dev4}/tests/test_models/test_usages.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fabricatio
3
- Version: 0.2.6.dev3
3
+ Version: 0.2.6.dev4
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,8 @@ import asyncio
4
4
  from pathlib import Path
5
5
  from typing import List
6
6
 
7
- from fabricatio import ArticleEssence, Event, ExtractArticleEssence, Role, Task, WorkFlow, logger
7
+ from fabricatio import ArticleEssence, Event, Role, Task, WorkFlow, logger
8
+ from fabricatio.actions.article import ExtractArticleEssence
8
9
  from fabricatio.fs.curd import dump_text, gather_files
9
10
 
10
11
 
@@ -3,7 +3,8 @@
3
3
  import asyncio
4
4
  from typing import List
5
5
 
6
- from fabricatio import ArticleEssence, Event, ExtractArticleEssence, Role, Task, WorkFlow, logger
6
+ from fabricatio import ArticleEssence, Event, Role, Task, WorkFlow, logger
7
+ from fabricatio.actions.article import ExtractArticleEssence
7
8
 
8
9
 
9
10
  async def main() -> None:
@@ -0,0 +1,11 @@
1
+ """Example of using BibManager."""
2
+ from fabricatio import BibManager, logger
3
+
4
+ b = BibManager("Exported Items.bib")
5
+ logger.success(
6
+ b.get_cite_key("A Negative Selection Immune System Inspired Methodology for Fault Diagnosis of Wind Turbines"))
7
+ logger.success(
8
+ b.get_cite_key_fuzzy(
9
+ "System Inspired Methodology for Fault"
10
+ )
11
+ )
@@ -0,0 +1,44 @@
1
+ """Example of using the library."""
2
+
3
+ import asyncio
4
+
5
+ from fabricatio import Event, Role, WorkFlow, logger
6
+ from fabricatio.actions.article import CorrectOutline, CorrectProposal, GenerateArticleProposal, GenerateOutline
7
+ from fabricatio.actions.output import DumpFinalizedOutput
8
+
9
+
10
+ async def main() -> None:
11
+ """Main function."""
12
+ role = Role(
13
+ name="Undergraduate Researcher",
14
+ description="Write an outline for an article in typst format.",
15
+ llm_top_p=0.8,
16
+ llm_temperature=1.15,
17
+ registry={
18
+ Event.quick_instantiate(ns := "article"): WorkFlow(
19
+ name="Generate Article Outline",
20
+ description="Generate an outline for an article. dump the outline to the given path. in typst format.",
21
+ steps=(
22
+ GenerateArticleProposal(llm_model="deepseek/deepseek-reasoner", llm_temperature=1.3),
23
+ CorrectProposal(
24
+ output_key="article_proposal",
25
+ llm_model="deepseek/deepseek-reasoner",
26
+ llm_temperature=1.3,
27
+ ),
28
+ GenerateOutline(llm_model="deepseek/deepseek-chat", llm_temperature=1.4, llm_top_p=0.5),
29
+ CorrectOutline(output_key="to_dump", llm_temperature=1.4, llm_top_p=0.45),
30
+ DumpFinalizedOutput(output_key="task_output"),
31
+ ),
32
+ )
33
+ },
34
+ )
35
+
36
+ proposed_task = await role.propose_task(
37
+ "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.",
38
+ )
39
+ path = await proposed_task.delegate(ns)
40
+ logger.success(f"The outline is saved in:\n{path}")
41
+
42
+
43
+ if __name__ == "__main__":
44
+ asyncio.run(main())
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "fabricatio"
3
- version = "0.2.6-dev3"
3
+ version = "0.2.6-dev4"
4
4
  description = "A LLM multi-agent framework."
5
5
  readme = "README.md"
6
6
  license = { file = "LICENSE" }
@@ -0,0 +1,43 @@
1
+ """Fabricatio is a Python library for building llm app using event-based agent structure."""
2
+
3
+ from importlib.util import find_spec
4
+
5
+ from fabricatio import actions, toolboxes, workflows
6
+ from fabricatio._rust import BibManager
7
+ from fabricatio._rust_instances import TEMPLATE_MANAGER
8
+ from fabricatio.core import env
9
+ from fabricatio.journal import logger
10
+ from fabricatio.models import extra
11
+ from fabricatio.models.action import Action, WorkFlow
12
+ from fabricatio.models.events import Event
13
+ from fabricatio.models.role import Role
14
+ from fabricatio.models.task import Task
15
+ from fabricatio.models.tool import ToolBox
16
+ from fabricatio.parser import Capture, GenericCapture, JsonCapture, PythonCapture
17
+
18
+ __all__ = [
19
+ "TEMPLATE_MANAGER",
20
+ "Action",
21
+ "BibManager",
22
+ "Capture",
23
+ "Event",
24
+ "GenericCapture",
25
+ "JsonCapture",
26
+ "PythonCapture",
27
+ "Role",
28
+ "Task",
29
+ "ToolBox",
30
+ "WorkFlow",
31
+ "actions",
32
+ "env",
33
+ "extra",
34
+ "logger",
35
+ "toolboxes",
36
+ "workflows",
37
+ ]
38
+
39
+
40
+ if find_spec("pymilvus"):
41
+ from fabricatio.capabilities.rag import RAG
42
+
43
+ __all__ += ["RAG"]
@@ -1,7 +1,6 @@
1
1
  from pathlib import Path
2
2
  from typing import Any, Dict, List, Optional
3
3
 
4
-
5
4
  class TemplateManager:
6
5
  """Template rendering engine using Handlebars templates.
7
6
 
@@ -2,13 +2,15 @@
2
2
 
3
3
  from os import PathLike
4
4
  from pathlib import Path
5
- from typing import Callable, List, Optional
5
+ from typing import Any, Callable, List, Optional
6
6
 
7
7
  from fabricatio.fs import safe_text_read
8
8
  from fabricatio.journal import logger
9
9
  from fabricatio.models.action import Action
10
10
  from fabricatio.models.extra import ArticleEssence, ArticleOutline, ArticleProposal
11
11
  from fabricatio.models.task import Task
12
+ from questionary import confirm, text
13
+ from rich import print as rprint
12
14
 
13
15
 
14
16
  class ExtractArticleEssence(Action):
@@ -66,7 +68,7 @@ class GenerateArticleProposal(Action):
66
68
  class GenerateOutline(Action):
67
69
  """Generate the article based on the outline."""
68
70
 
69
- output_key: str = "article"
71
+ output_key: str = "article_outline"
70
72
  """The key of the output data."""
71
73
 
72
74
  async def _execute(
@@ -79,3 +81,45 @@ class GenerateOutline(Action):
79
81
  article_proposal.display(),
80
82
  system_message=f"# your personal briefing: \n{self.briefing}",
81
83
  )
84
+
85
+
86
+ class CorrectProposal(Action):
87
+ """Correct the proposal of the article."""
88
+
89
+ output_key: str = "corrected_proposal"
90
+
91
+ async def _execute(self, task_input: Task, article_proposal: ArticleProposal, **_) -> Any:
92
+ input_path = await self.awhich_pathstr(
93
+ f"{task_input.briefing}\nExtract the path of file, which contains the article briefing that I need to read."
94
+ )
95
+
96
+ rprint(article_proposal.display())
97
+ ret = None
98
+ while await confirm("Do you want to correct the Proposal?").ask_async():
99
+ topic = await text("What is the topic of the proposal?").ask_async()
100
+ ret = await self.correct_obj(
101
+ article_proposal,
102
+ safe_text_read(input_path),
103
+ topic=topic,
104
+ )
105
+ return ret or article_proposal
106
+
107
+
108
+ class CorrectOutline(Action):
109
+ """Correct the outline of the article."""
110
+
111
+ output_key: str = "corrected_outline"
112
+ """The key of the output data."""
113
+
114
+ async def _execute(
115
+ self,
116
+ article_outline: ArticleOutline,
117
+ article_proposal: ArticleProposal,
118
+ **_,
119
+ ) -> Optional[str]:
120
+ rprint(article_outline.finalized_dump())
121
+ ret = None
122
+ while await confirm("Do you want to correct the outline?").ask_async():
123
+ topic = await text("What is the topic of the outline?").ask_async()
124
+ ret = await self.correct_obj(article_outline, article_proposal.display(), topic=topic)
125
+ return ret or article_outline
@@ -126,7 +126,7 @@ class ArticleSectionOutline(Base):
126
126
  """The title of the section."""
127
127
  description: str = Field(...)
128
128
  """A brief description of the section's content should be, how it fits into the overall structure of the paper, and its significance in the context of the research."""
129
- subsections: List[ArticleSubsectionOutline] = Field(default_factory=list)
129
+ subsections: List[ArticleSubsectionOutline]
130
130
  """The subsections of the section, outlining their content and significance."""
131
131
 
132
132
 
@@ -137,7 +137,7 @@ class ArticleChapterOutline(Base):
137
137
  """The title of the chapter."""
138
138
  description: str = Field(...)
139
139
  """A brief description of the chapter's content should be, how it fits into the overall structure of the paper, and its significance in the context of the research."""
140
- sections: List[ArticleSectionOutline] = Field(default_factory=list)
140
+ sections: List[ArticleSectionOutline]
141
141
  """The sections of the chapter, outlining their content and significance."""
142
142
 
143
143
 
@@ -150,7 +150,7 @@ class ArticleOutline(ProposedAble, Display, FinalizedDumpAble):
150
150
  prospect: str = Field(...)
151
151
  """A brief description of the research problem or question that the paper aims to address manipulating methods or techniques"""
152
152
 
153
- chapters: List[ArticleChapterOutline] = Field(default_factory=list)
153
+ chapters: List[ArticleChapterOutline]
154
154
  """The chapters of the paper, outlining their content and significance."""
155
155
 
156
156
  def finalized_dump(self) -> str:
@@ -1,6 +1,6 @@
1
1
  """This module contains the types for the keyword arguments of the methods in the models module."""
2
2
 
3
- from typing import Any, TypedDict
3
+ from typing import Any, Required, TypedDict
4
4
 
5
5
  from litellm.caching.caching import CacheMode
6
6
  from litellm.types.caching import CachingSupportedCallTypes
@@ -91,7 +91,7 @@ class ReviewKwargs[T](ValidateKwargs[T], total=False):
91
91
  specific topics and review criteria.
92
92
  """
93
93
 
94
- topic: str
94
+ topic: Required[str]
95
95
  criteria: set[str]
96
96
 
97
97
 
@@ -64,6 +64,7 @@ class Capture(BaseModel):
64
64
  """
65
65
  match = self._compiled.search(text)
66
66
  if match is None:
67
+ logger.debug(f"Capture Failed: \n{text}")
67
68
  return None
68
69
  groups = self.fix(match.groups()) if configs.general.use_json_repair else match.groups()
69
70
  if self.target_groups:
@@ -0,0 +1,26 @@
1
+ """Store article essence in the database."""
2
+
3
+ from fabricatio.actions.article import CorrectOutline, CorrectProposal, GenerateArticleProposal, GenerateOutline
4
+ from fabricatio.actions.output import DumpFinalizedOutput
5
+ from fabricatio.models.action import WorkFlow
6
+
7
+ WriteOutlineWorkFlow = WorkFlow(
8
+ name="Generate Article Outline",
9
+ description="Generate an outline for an article. dump the outline to the given path. in typst format.",
10
+ steps=(
11
+ GenerateArticleProposal,
12
+ GenerateOutline(output_key="to_dump"),
13
+ DumpFinalizedOutput(output_key="task_output"),
14
+ ),
15
+ )
16
+ WriteOutlineCorrectedWorkFlow = WorkFlow(
17
+ name="Generate Article Outline",
18
+ description="Generate an outline for an article. dump the outline to the given path. in typst format.",
19
+ steps=(
20
+ GenerateArticleProposal,
21
+ CorrectProposal(output_key="article_proposal"),
22
+ GenerateOutline,
23
+ CorrectOutline(output_key="to_dump"),
24
+ DumpFinalizedOutput(output_key="task_output"),
25
+ ),
26
+ )
Binary file