fabricatio 0.2.6.dev5__tar.gz → 0.2.6.dev6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/PKG-INFO +1 -1
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/examples/extract_and_review/extract_and_review.py +5 -2
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/examples/extract_article/extract.py +5 -2
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/pyproject.toml +1 -1
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/python/fabricatio/actions/article.py +7 -4
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/python/fabricatio/capabilities/rag.py +3 -3
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/python/fabricatio/config.py +5 -5
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/python/fabricatio/models/action.py +1 -2
- fabricatio-0.2.6.dev6/python/fabricatio/models/extra.py +339 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/python/fabricatio/models/kwargs_types.py +1 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/python/fabricatio/models/role.py +1 -2
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/python/fabricatio/models/usages.py +58 -27
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/python/fabricatio/models/utils.py +21 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/python/fabricatio/parser.py +1 -0
- fabricatio-0.2.6.dev6/templates.tar.gz +0 -0
- fabricatio-0.2.6.dev6/uv.lock +1547 -0
- fabricatio-0.2.6.dev5/python/fabricatio/capabilities/covalidate.py +0 -160
- fabricatio-0.2.6.dev5/python/fabricatio/models/extra.py +0 -171
- fabricatio-0.2.6.dev5/templates.tar.gz +0 -0
- fabricatio-0.2.6.dev5/uv.lock +0 -1549
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/.github/workflows/build-package.yaml +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/.github/workflows/ruff.yaml +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/.github/workflows/tests.yaml +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/.gitignore +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/.python-version +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/Cargo.lock +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/Cargo.toml +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/LICENSE +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/Makefile +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/README.md +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/examples/correct/correct.py +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/examples/correct/correct_loop.py +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/examples/extract_and_review/.gitignore +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/examples/llm_usages/llm_usage.py +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/examples/make_a_rating/rating.py +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/examples/make_diary/commits.json +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/examples/make_diary/diary.py +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/examples/minor/hello_fabricatio.py +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/examples/minor/write_a_poem.py +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/examples/propose_task/propose.py +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/examples/reviewer/review.py +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/examples/search_bibtex/.gitignore +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/examples/search_bibtex/search.py +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/examples/simple_chat/chat.py +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/examples/simple_rag/simple_rag.py +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/examples/task_handle/handle_task.py +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/examples/write_outline/.gitignore +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/examples/write_outline/write_outline.py +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/examples/write_outline/write_outline_corrected.py +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/python/fabricatio/__init__.py +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/python/fabricatio/_rust.pyi +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/python/fabricatio/_rust_instances.py +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/python/fabricatio/actions/output.py +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/python/fabricatio/actions/rag.py +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/python/fabricatio/capabilities/correct.py +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/python/fabricatio/capabilities/propose.py +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/python/fabricatio/capabilities/rating.py +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/python/fabricatio/capabilities/review.py +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/python/fabricatio/capabilities/task.py +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/python/fabricatio/core.py +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/python/fabricatio/decorators.py +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/python/fabricatio/fs/__init__.py +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/python/fabricatio/fs/curd.py +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/python/fabricatio/fs/readers.py +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/python/fabricatio/journal.py +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/python/fabricatio/models/events.py +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/python/fabricatio/models/generic.py +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/python/fabricatio/models/task.py +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/python/fabricatio/models/tool.py +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/python/fabricatio/py.typed +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/python/fabricatio/toolboxes/__init__.py +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/python/fabricatio/toolboxes/arithmetic.py +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/python/fabricatio/toolboxes/fs.py +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/python/fabricatio/workflows/articles.py +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/python/fabricatio/workflows/rag.py +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/src/bib_tools.rs +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/src/hash.rs +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/src/hbs_helpers.rs +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/src/lib.rs +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/src/templates.rs +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/templates/built-in/binary-exploitation-ctf-solver.hbs +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/templates/built-in/claude-xml.hbs +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/templates/built-in/clean-up-code.hbs +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/templates/built-in/co_validation.hbs +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/templates/built-in/correct.hbs +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/templates/built-in/create_json_obj.hbs +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/templates/built-in/cryptography-ctf-solver.hbs +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/templates/built-in/dependencies.hbs +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/templates/built-in/document-the-code.hbs +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/templates/built-in/draft_rating_criteria.hbs +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/templates/built-in/draft_rating_manual.hbs +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/templates/built-in/draft_rating_weights_klee.hbs +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/templates/built-in/draft_tool_usage_code.hbs +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/templates/built-in/extract_criteria_from_reasons.hbs +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/templates/built-in/extract_reasons_from_examples.hbs +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/templates/built-in/find-security-vulnerabilities.hbs +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/templates/built-in/fix-bugs.hbs +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/templates/built-in/generic_string.hbs +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/templates/built-in/improve-performance.hbs +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/templates/built-in/liststr.hbs +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/templates/built-in/make_choice.hbs +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/templates/built-in/make_judgment.hbs +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/templates/built-in/pathstr.hbs +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/templates/built-in/rate_fine_grind.hbs +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/templates/built-in/refactor.hbs +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/templates/built-in/refined_query.hbs +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/templates/built-in/retrieved_display.hbs +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/templates/built-in/reverse-engineering-ctf-solver.hbs +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/templates/built-in/review_string.hbs +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/templates/built-in/task_briefing.hbs +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/templates/built-in/web-ctf-solver.hbs +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/templates/built-in/write-git-commit.hbs +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/templates/built-in/write-github-pull-request.hbs +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/templates/built-in/write-github-readme.hbs +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/tests/test_config.py +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/tests/test_models/test_action.py +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/tests/test_models/test_advanced.py +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/tests/test_models/test_generic.py +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/tests/test_models/test_role.py +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/tests/test_models/test_task.py +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/tests/test_models/test_tool.py +0 -0
- {fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/tests/test_models/test_usages.py +0 -0
{fabricatio-0.2.6.dev5 → fabricatio-0.2.6.dev6}/examples/extract_and_review/extract_and_review.py
RENAMED
@@ -2,12 +2,15 @@
|
|
2
2
|
|
3
3
|
import asyncio
|
4
4
|
from pathlib import Path
|
5
|
-
from typing import List
|
5
|
+
from typing import TYPE_CHECKING, List
|
6
6
|
|
7
|
-
from fabricatio import
|
7
|
+
from fabricatio import Event, Role, Task, WorkFlow, logger
|
8
8
|
from fabricatio.actions.article import ExtractArticleEssence
|
9
9
|
from fabricatio.fs.curd import dump_text, gather_files
|
10
10
|
|
11
|
+
if TYPE_CHECKING:
|
12
|
+
from fabricatio.models.extra import ArticleEssence
|
13
|
+
|
11
14
|
|
12
15
|
async def main() -> None:
|
13
16
|
"""Main function."""
|
@@ -1,11 +1,14 @@
|
|
1
1
|
"""Example of proposing a task to a role."""
|
2
2
|
|
3
3
|
import asyncio
|
4
|
-
from typing import List
|
4
|
+
from typing import TYPE_CHECKING, List
|
5
5
|
|
6
|
-
from fabricatio import
|
6
|
+
from fabricatio import Event, Role, Task, WorkFlow, logger
|
7
7
|
from fabricatio.actions.article import ExtractArticleEssence
|
8
8
|
|
9
|
+
if TYPE_CHECKING:
|
10
|
+
from fabricatio.models.extra import ArticleEssence
|
11
|
+
|
9
12
|
|
10
13
|
async def main() -> None:
|
11
14
|
"""Main function."""
|
@@ -93,10 +93,11 @@ class CorrectProposal(Action):
|
|
93
93
|
f"{task_input.briefing}\nExtract the path of file, which contains the article briefing that I need to read."
|
94
94
|
)
|
95
95
|
|
96
|
-
rprint(article_proposal.display())
|
97
96
|
ret = None
|
98
97
|
while await confirm("Do you want to correct the Proposal?").ask_async():
|
99
|
-
|
98
|
+
rprint(article_proposal.display())
|
99
|
+
while not (topic := await text("What is the topic of the proposal reviewing?").ask_async()):
|
100
|
+
...
|
100
101
|
ret = await self.correct_obj(
|
101
102
|
article_proposal,
|
102
103
|
safe_text_read(input_path),
|
@@ -115,11 +116,13 @@ class CorrectOutline(Action):
|
|
115
116
|
self,
|
116
117
|
article_outline: ArticleOutline,
|
117
118
|
article_proposal: ArticleProposal,
|
119
|
+
|
118
120
|
**_,
|
119
121
|
) -> Optional[str]:
|
120
|
-
rprint(article_outline.finalized_dump())
|
121
122
|
ret = None
|
122
123
|
while await confirm("Do you want to correct the outline?").ask_async():
|
123
|
-
|
124
|
+
rprint(article_outline.finalized_dump())
|
125
|
+
while not (topic := await text("What is the topic of the outline reviewing?").ask_async()):
|
126
|
+
...
|
124
127
|
ret = await self.correct_obj(article_outline, article_proposal.display(), topic=topic)
|
125
128
|
return ret or article_outline
|
@@ -21,7 +21,7 @@ from fabricatio.models.kwargs_types import (
|
|
21
21
|
LLMKwargs,
|
22
22
|
)
|
23
23
|
from fabricatio.models.usages import EmbeddingUsage
|
24
|
-
from fabricatio.models.utils import MilvusData
|
24
|
+
from fabricatio.models.utils import MilvusData, ok
|
25
25
|
from more_itertools.recipes import flatten, unique
|
26
26
|
from pydantic import Field, PrivateAttr
|
27
27
|
|
@@ -60,7 +60,7 @@ class RAG(EmbeddingUsage):
|
|
60
60
|
) -> Self:
|
61
61
|
"""Initialize the Milvus client."""
|
62
62
|
self._client = create_client(
|
63
|
-
uri=milvus_uri or (self.milvus_uri or configs.rag.milvus_uri).unicode_string(),
|
63
|
+
uri=milvus_uri or ok(self.milvus_uri or configs.rag.milvus_uri).unicode_string(),
|
64
64
|
token=milvus_token
|
65
65
|
or (token.get_secret_value() if (token := (self.milvus_token or configs.rag.milvus_token)) else ""),
|
66
66
|
timeout=milvus_timeout or self.milvus_timeout,
|
@@ -315,7 +315,7 @@ class RAG(EmbeddingUsage):
|
|
315
315
|
**kwargs,
|
316
316
|
)
|
317
317
|
|
318
|
-
async def arefined_query(self, question: List[str] | str, **kwargs: Unpack[ChooseKwargs]) -> List[str]:
|
318
|
+
async def arefined_query(self, question: List[str] | str, **kwargs: Unpack[ChooseKwargs]) -> Optional[List[str]]:
|
319
319
|
"""Refines the given question using a template.
|
320
320
|
|
321
321
|
Args:
|
@@ -66,7 +66,7 @@ class LLMConfig(BaseModel):
|
|
66
66
|
temperature: Optional[NonNegativeFloat] = Field(default=1.0)
|
67
67
|
"""The temperature of the LLM model. Controls randomness in generation. Set to 1.0 as per request."""
|
68
68
|
|
69
|
-
stop_sign: Optional[str | List[str]] = Field(default=
|
69
|
+
stop_sign: Optional[str | List[str]] = Field(default=None)
|
70
70
|
"""The stop sign of the LLM model. No default stop sign specified."""
|
71
71
|
|
72
72
|
top_p: Optional[NonNegativeFloat] = Field(default=0.35)
|
@@ -78,7 +78,7 @@ class LLMConfig(BaseModel):
|
|
78
78
|
stream: Optional[bool] = Field(default=False)
|
79
79
|
"""Whether to stream the LLM model's response. Default is False."""
|
80
80
|
|
81
|
-
max_tokens: Optional[PositiveInt] = Field(default=
|
81
|
+
max_tokens: Optional[PositiveInt] = Field(default=None)
|
82
82
|
"""The maximum number of tokens to generate. Set to 8192 as per request."""
|
83
83
|
|
84
84
|
rpm: Optional[PositiveInt] = Field(default=100)
|
@@ -148,13 +148,13 @@ class DebugConfig(BaseModel):
|
|
148
148
|
log_level: Literal["DEBUG", "INFO", "SUCCESS", "WARNING", "ERROR", "CRITICAL"] = Field(default="INFO")
|
149
149
|
"""The log level of the application."""
|
150
150
|
|
151
|
-
log_file: FilePath = Field(default=Path(rf"{ROAMING_DIR}\fabricatio.log"))
|
151
|
+
log_file: FilePath = Field(default=Path(rf"{ROAMING_DIR}\fabricatio.log"), frozen=True)
|
152
152
|
"""The log file of the application."""
|
153
153
|
|
154
|
-
rotation: int = Field(default=1)
|
154
|
+
rotation: int = Field(default=1, frozen=True)
|
155
155
|
"""The rotation of the log file. in weeks."""
|
156
156
|
|
157
|
-
retention: int = Field(default=2)
|
157
|
+
retention: int = Field(default=2, frozen=True)
|
158
158
|
"""The retention of the log file. in weeks."""
|
159
159
|
|
160
160
|
streaming_visible: bool = Field(default=False)
|
@@ -10,7 +10,6 @@ from asyncio import Queue, create_task
|
|
10
10
|
from typing import Any, Dict, Self, Tuple, Type, Union, final
|
11
11
|
|
12
12
|
from fabricatio.capabilities.correct import Correct
|
13
|
-
from fabricatio.capabilities.covalidate import CoValidate
|
14
13
|
from fabricatio.capabilities.task import HandleTask, ProposeTask
|
15
14
|
from fabricatio.journal import logger
|
16
15
|
from fabricatio.models.generic import WithBriefing
|
@@ -19,7 +18,7 @@ from fabricatio.models.usages import ToolBoxUsage
|
|
19
18
|
from pydantic import Field, PrivateAttr
|
20
19
|
|
21
20
|
|
22
|
-
class Action(HandleTask, ProposeTask, Correct
|
21
|
+
class Action(HandleTask, ProposeTask, Correct):
|
23
22
|
"""Class that represents an action to be executed in a workflow.
|
24
23
|
|
25
24
|
Actions are the atomic units of work in a workflow. Each action performs
|
@@ -0,0 +1,339 @@
|
|
1
|
+
"""Extra models for built-in actions."""
|
2
|
+
|
3
|
+
from typing import List
|
4
|
+
|
5
|
+
from fabricatio.models.generic import Base, Display, FinalizedDumpAble, PrepareVectorization, ProposedAble
|
6
|
+
from pydantic import Field
|
7
|
+
|
8
|
+
|
9
|
+
class Equation(Base):
|
10
|
+
"""Mathematical formalism specification for research contributions.
|
11
|
+
|
12
|
+
Encodes equations with dual representation: semantic meaning and typeset-ready notation.
|
13
|
+
"""
|
14
|
+
|
15
|
+
description: str
|
16
|
+
"""Equation significance structured in three elements:
|
17
|
+
1. Physical/conceptual meaning
|
18
|
+
2. Role in technical workflow
|
19
|
+
3. Relationship to paper's core contribution
|
20
|
+
Example: 'Defines constrained search space dimensionality reduction. Used in architecture optimization phase (Section 3.2). Enables 40% parameter reduction.'"""
|
21
|
+
|
22
|
+
latex_code: str
|
23
|
+
"""LaTeX representation following academic typesetting standards:
|
24
|
+
- Must use equation environment
|
25
|
+
- Multiline equations aligned at '='
|
26
|
+
- Unit annotations where applicable
|
27
|
+
Example: r'\begin{equation} \\mathcal{L}_{NAS} = \alpha \\|\theta\\|_2 + \beta H(p) \\end{equation}'"""
|
28
|
+
|
29
|
+
|
30
|
+
class Figure(Base):
|
31
|
+
"""Visual component specification for technical communication.
|
32
|
+
|
33
|
+
Combines graphical assets with structured academic captioning.
|
34
|
+
"""
|
35
|
+
|
36
|
+
description: str
|
37
|
+
"""Figure interpretation guide containing:
|
38
|
+
1. Key visual elements mapping
|
39
|
+
2. Data representation methodology
|
40
|
+
3. Connection to research findings
|
41
|
+
Example: 'Architecture search space topology (left) vs. convergence curves (right). Demonstrates NAS efficiency gains through constrained search.'"""
|
42
|
+
|
43
|
+
figure_caption: str
|
44
|
+
"""Complete caption following Nature-style guidelines:
|
45
|
+
1. Brief overview statement (首句总结)
|
46
|
+
2. Technical detail layer
|
47
|
+
3. Result implication
|
48
|
+
Example: 'Figure 3: Differentiable NAS framework. (a) Search space topology with constrained dimensions. (b) Training convergence across language pairs. Dashed lines indicate baseline methods.'"""
|
49
|
+
|
50
|
+
figure_path: str
|
51
|
+
"""Filesystem path to high-resolution vector graphic (PDF/EPS/SVG).
|
52
|
+
Strict validation requirements:
|
53
|
+
- Absolute path under /assets/figures/
|
54
|
+
- Naming convention: fig[chapter]-[section]_[description].pdf
|
55
|
+
Example: '/assets/figures/fig3-2_nas_convergence.pdf'"""
|
56
|
+
|
57
|
+
|
58
|
+
class Highlightings(Base):
|
59
|
+
"""Technical showcase aggregator for research artifacts.
|
60
|
+
|
61
|
+
Curates core scientific components with machine-parseable annotations.
|
62
|
+
"""
|
63
|
+
|
64
|
+
highlighted_equations: List[Equation] = Field(default_factory=list)
|
65
|
+
"""3-5 pivotal equations representing theoretical contributions.
|
66
|
+
Each must:
|
67
|
+
- Use $$ wrapping for display math
|
68
|
+
- Contain at least one novel operator/symbol
|
69
|
+
- Reference in Methods/Results sections
|
70
|
+
Example: Equation describing proposed loss function"""
|
71
|
+
|
72
|
+
highlighted_algorithms: List[str] = Field(default_factory=list)
|
73
|
+
"""Algorithm pseudocode following ACM style:
|
74
|
+
1. Numbered steps with bold keywords
|
75
|
+
2. Complexity analysis subsection
|
76
|
+
3. Novel components marked with ※
|
77
|
+
Example:
|
78
|
+
'Algorithm 1: Constrained NAS
|
79
|
+
1. Initialize search space with §3.1 constraints ※
|
80
|
+
2. While not converged:
|
81
|
+
a. Compute gradient ▽θ
|
82
|
+
b. Update architecture parameters...'"""
|
83
|
+
|
84
|
+
highlighted_figures: List[Figure] = Field(default_factory=list)
|
85
|
+
"""4-6 key figures demonstrating:
|
86
|
+
1. Framework overview (1 required)
|
87
|
+
2. Quantitative results (2-3 required)
|
88
|
+
3. Ablation studies (1 optional)
|
89
|
+
Each must appear in Results/Discussion chapters."""
|
90
|
+
|
91
|
+
highlighted_tables: List[str] = Field(default_factory=list)
|
92
|
+
"""Critical data presentations using booktabs format:
|
93
|
+
- Minimum 3 comparison baselines
|
94
|
+
- Statistical significance markers (*/†/‡)
|
95
|
+
- Standard deviation in parentheses
|
96
|
+
Example:
|
97
|
+
\begin{tabular}{lcc}
|
98
|
+
\toprule
|
99
|
+
Method & BLEU & Δ Params \\
|
100
|
+
\\midrule
|
101
|
+
Ours & 32.4 & -41\\%† \\
|
102
|
+
\bottomrule
|
103
|
+
\\end{tabular}"""
|
104
|
+
|
105
|
+
|
106
|
+
class ArticleEssence(ProposedAble, Display, PrepareVectorization):
|
107
|
+
"""Semantic fingerprint of academic paper for structured analysis.
|
108
|
+
|
109
|
+
Encodes research artifacts with dual human-machine interpretability.
|
110
|
+
"""
|
111
|
+
|
112
|
+
title: str = Field(...)
|
113
|
+
"""Complete title with technical specificity (12-18 words).
|
114
|
+
Must contain:
|
115
|
+
1. Methodology focus
|
116
|
+
2. Application domain
|
117
|
+
3. Performance metric
|
118
|
+
Example: 'EfficientViT: Multi-Scale Linear Attention for High-Resolution Dense Prediction'"""
|
119
|
+
|
120
|
+
authors: List[str]
|
121
|
+
"""Author list with institutional annotations.
|
122
|
+
Format: [First Last¹, First Last²]
|
123
|
+
Superscripts mapping to affiliations.
|
124
|
+
Example: ['Yuanhao Zhou¹', 'Lei Chen²']"""
|
125
|
+
|
126
|
+
keywords: List[str]
|
127
|
+
"""5-8 ACM CCS concepts in camel case.
|
128
|
+
Example: ['Computing methodologies~Neural networks', 'Hardware~Emerging technologies']"""
|
129
|
+
|
130
|
+
publication_year: int
|
131
|
+
"""Publication timestamp in ISO 8601 (YYYY format).
|
132
|
+
Constraint: 2017 ≤ year ≤ current_year"""
|
133
|
+
|
134
|
+
highlightings: Highlightings = Field(default_factory=Highlightings)
|
135
|
+
"""Technical highlight reel containing:
|
136
|
+
- Core equations (Theory)
|
137
|
+
- Key algorithms (Implementation)
|
138
|
+
- Critical figures (Results)
|
139
|
+
- Benchmark tables (Evaluation)"""
|
140
|
+
|
141
|
+
domain: List[str]
|
142
|
+
"""Primary research domains from ACM CCS 2023 taxonomy.
|
143
|
+
Exactly 2-3 categories required.
|
144
|
+
Example: ['Computing methodologies → Machine learning']"""
|
145
|
+
|
146
|
+
abstract: str = Field(...)
|
147
|
+
"""Three-paragraph structured abstract:
|
148
|
+
Paragraph 1: Problem & Motivation (2-3 sentences)
|
149
|
+
Paragraph 2: Methodology & Innovations (3-4 sentences)
|
150
|
+
Paragraph 3: Results & Impact (2-3 sentences)
|
151
|
+
Total length: 150-250 words"""
|
152
|
+
|
153
|
+
core_contributions: List[str]
|
154
|
+
"""3-5 technical contributions using CRediT taxonomy verbs.
|
155
|
+
Each item starts with action verb.
|
156
|
+
Example:
|
157
|
+
- 'Developed constrained NAS framework'
|
158
|
+
- 'Established cross-lingual transfer metrics'"""
|
159
|
+
|
160
|
+
technical_novelty: List[str]
|
161
|
+
"""Patent-style claims with technical specificity.
|
162
|
+
Format: 'A [system/method] comprising [novel components]...'
|
163
|
+
Example:
|
164
|
+
'A neural architecture search system comprising:
|
165
|
+
a differentiable constrained search space;
|
166
|
+
multi-lingual transferability predictors...'"""
|
167
|
+
|
168
|
+
research_problems: List[str]
|
169
|
+
"""Problem statements as how/why questions.
|
170
|
+
Example:
|
171
|
+
- 'How to reduce NAS computational overhead while maintaining search diversity?'
|
172
|
+
- 'Why do existing architectures fail in low-resource cross-lingual transfer?'"""
|
173
|
+
|
174
|
+
limitations: List[str]
|
175
|
+
"""Technical limitations analysis containing:
|
176
|
+
1. Constraint source (data/method/theory)
|
177
|
+
2. Impact quantification
|
178
|
+
3. Mitigation pathway
|
179
|
+
Example:
|
180
|
+
'Methodology constraint: Single-objective optimization (affects 5% edge cases),
|
181
|
+
mitigated through future multi-task extension'"""
|
182
|
+
|
183
|
+
future_work: List[str]
|
184
|
+
"""Research roadmap items with 3 horizons:
|
185
|
+
1. Immediate extensions (1 year)
|
186
|
+
2. Mid-term directions (2-3 years)
|
187
|
+
3. Long-term vision (5+ years)
|
188
|
+
Example:
|
189
|
+
'Short-term: Adapt framework for vision transformers (ongoing with CVPR submission)'"""
|
190
|
+
|
191
|
+
impact_analysis: List[str]
|
192
|
+
"""Bibliometric impact projections:
|
193
|
+
- Expected citation counts (next 3 years)
|
194
|
+
- Target application domains
|
195
|
+
- Standard adoption potential
|
196
|
+
Example:
|
197
|
+
'Predicted 150+ citations via integration into MMEngine (Alibaba OpenMMLab)'"""
|
198
|
+
|
199
|
+
def _prepare_vectorization_inner(self) -> str:
|
200
|
+
return self.model_dump_json()
|
201
|
+
|
202
|
+
|
203
|
+
class ArticleProposal(ProposedAble, Display):
|
204
|
+
"""Structured proposal for academic paper development with core research elements.
|
205
|
+
|
206
|
+
Guides LLM in generating comprehensive research proposals with clearly defined components.
|
207
|
+
"""
|
208
|
+
|
209
|
+
title: str = Field(...)
|
210
|
+
"""Paper title in academic style (Title Case, 8-15 words). Example: 'Exploring Neural Architecture Search for Low-Resource Machine Translation'"""
|
211
|
+
|
212
|
+
focused_problem: List[str] = Field(default_factory=list)
|
213
|
+
"""Specific research problem(s) or question(s) addressed (list of 1-3 concise statements).
|
214
|
+
Example: ['NAS computational overhead in low-resource settings', 'Architecture transferability across language pairs']"""
|
215
|
+
|
216
|
+
research_aim: List[str] = Field(default_factory=list)
|
217
|
+
"""Primary research objectives (list of 2-4 measurable goals).
|
218
|
+
Example: ['Develop parameter-efficient NAS framework', 'Establish cross-lingual architecture transfer metrics']"""
|
219
|
+
|
220
|
+
research_methods: List[str] = Field(default_factory=list)
|
221
|
+
"""Methodological components (list of techniques/tools).
|
222
|
+
Example: ['Differentiable architecture search', 'Transformer-based search space', 'Multi-lingual perplexity evaluation']"""
|
223
|
+
|
224
|
+
|
225
|
+
class ArticleSubsectionOutline(Base):
|
226
|
+
"""Atomic content unit within academic paper sections.
|
227
|
+
|
228
|
+
Provides structured content specification for LLM-generated subsections.
|
229
|
+
"""
|
230
|
+
|
231
|
+
title: str = Field(...)
|
232
|
+
"""Subsection title reflecting specific content focus (Title Case, 3-8 words).
|
233
|
+
Example: 'Differentiable Search Space Design'"""
|
234
|
+
|
235
|
+
description: str = Field(...)
|
236
|
+
"""Content specification with three required elements:
|
237
|
+
1. Core technical content
|
238
|
+
2. Structural purpose in section
|
239
|
+
3. Research significance
|
240
|
+
Example: 'Introduces continuous relaxation method for search space, enabling gradient-based optimization. Forms technical foundation for Section 3. Critical for reducing search complexity.'"""
|
241
|
+
|
242
|
+
|
243
|
+
class ArticleSectionOutline(Base):
|
244
|
+
"""Primary organizational unit within paper chapters.
|
245
|
+
|
246
|
+
Defines section-level structure with nested subsections for hierarchical content organization.
|
247
|
+
"""
|
248
|
+
|
249
|
+
title: str = Field(...)
|
250
|
+
"""Section title indicating methodological phase or conceptual component (Title Case).
|
251
|
+
Example: 'Architecture Search Methodology'"""
|
252
|
+
|
253
|
+
description: str = Field(...)
|
254
|
+
"""Functional description covering:
|
255
|
+
1. Section's research stage
|
256
|
+
2. Key contributions
|
257
|
+
3. Flow relationship with adjacent sections
|
258
|
+
Example: 'Presents core NAS framework building on literature from Section 2. Introduces novel constrained search space. Leads to implementation details in Section 4.'"""
|
259
|
+
|
260
|
+
subsections: List[ArticleSubsectionOutline]
|
261
|
+
"""Ordered sequence of 3-5 subsections implementing IMRaD structure within section. Maintains logical flow from problem statement to technical solution."""
|
262
|
+
|
263
|
+
|
264
|
+
class ArticleChapterOutline(Base):
|
265
|
+
"""Macro-level paper organization unit.
|
266
|
+
|
267
|
+
Represents major paper divisions (Introduction, Methodology, etc.) with hierarchical section structure.
|
268
|
+
"""
|
269
|
+
|
270
|
+
title: str = Field(...)
|
271
|
+
"""Chapter title reflecting standard academic sections (Title Case).
|
272
|
+
Example: 'Experimental Evaluation', 'Theoretical Framework'"""
|
273
|
+
|
274
|
+
description: str = Field(...)
|
275
|
+
"""Chapter role specification containing:
|
276
|
+
1. Research phase covered
|
277
|
+
2. Chapter-specific objectives
|
278
|
+
3. Relationship to overall paper thesis
|
279
|
+
Example: 'Validates NAS framework through multilingual experiments. Demonstrates method effectiveness across 10 language pairs. Supports core thesis of parameter-efficient architecture search.'"""
|
280
|
+
|
281
|
+
sections: List[ArticleSectionOutline]
|
282
|
+
"""3-5 sections implementing chapter's main function. Ordered to maintain academic paper logic:
|
283
|
+
Introduction → Related Work → Methods → Experiments → Analysis"""
|
284
|
+
|
285
|
+
|
286
|
+
class ArticleOutline(ProposedAble, Display, FinalizedDumpAble):
|
287
|
+
"""Complete hierarchical structure for academic paper generation.
|
288
|
+
|
289
|
+
Provides multi-level outline specification for LLM-based paper drafting with strict academic conventions.
|
290
|
+
"""
|
291
|
+
|
292
|
+
title: str = Field(...)
|
293
|
+
"""Full paper title with technical specificity (Title Case, 12-18 words).
|
294
|
+
Example: 'Parameter-Efficient Neural Architecture Search for Low-Resource Machine Translation: A Cross-Lingual Transfer Approach'"""
|
295
|
+
|
296
|
+
prospect: str = Field(...)
|
297
|
+
"""Unified problem-solution statement combining:
|
298
|
+
1. Core research gap
|
299
|
+
2. Proposed methodology
|
300
|
+
3. Expected contribution
|
301
|
+
Example: 'Addressing NAS computational barriers in low-resource NLP through differentiable constrained search spaces and cross-lingual transfer metrics, enabling efficient architecture discovery for 50+ languages.'"""
|
302
|
+
|
303
|
+
chapters: List[ArticleChapterOutline]
|
304
|
+
"""Standard academic structure (5-8 chapters):
|
305
|
+
1. Introduction
|
306
|
+
2. Related Work
|
307
|
+
3. Methodology
|
308
|
+
4. Experiments
|
309
|
+
5. Results
|
310
|
+
6. Discussion
|
311
|
+
7. Conclusion
|
312
|
+
Maintains IMRaD logical flow with clear inter-chapter transitions."""
|
313
|
+
|
314
|
+
def finalized_dump(self) -> str:
|
315
|
+
"""Generates standardized hierarchical markup for paper drafting systems.
|
316
|
+
|
317
|
+
Returns:
|
318
|
+
str: Multi-level outline using academic markup conventions:
|
319
|
+
= Chapter Title
|
320
|
+
== Section Title
|
321
|
+
=== Subsection Title
|
322
|
+
==== Subsubsection Title (if needed)
|
323
|
+
|
324
|
+
Example:
|
325
|
+
= Methodology
|
326
|
+
== Neural Architecture Search Framework
|
327
|
+
=== Differentiable Search Space
|
328
|
+
=== Constrained Optimization Approach
|
329
|
+
"""
|
330
|
+
lines: List[str] = []
|
331
|
+
|
332
|
+
for chapter in self.chapters:
|
333
|
+
lines.append(f"= {chapter.title}")
|
334
|
+
for section in chapter.sections:
|
335
|
+
lines.append(f"== {section.title}")
|
336
|
+
for subsection in section.subsections:
|
337
|
+
lines.append(f"=== {subsection.title}")
|
338
|
+
|
339
|
+
return "\n\n".join(lines)
|
@@ -3,7 +3,6 @@
|
|
3
3
|
from typing import Any, Self, Set
|
4
4
|
|
5
5
|
from fabricatio.capabilities.correct import Correct
|
6
|
-
from fabricatio.capabilities.covalidate import CoValidate
|
7
6
|
from fabricatio.capabilities.task import HandleTask, ProposeTask
|
8
7
|
from fabricatio.core import env
|
9
8
|
from fabricatio.journal import logger
|
@@ -13,7 +12,7 @@ from fabricatio.models.tool import ToolBox
|
|
13
12
|
from pydantic import Field
|
14
13
|
|
15
14
|
|
16
|
-
class Role(ProposeTask, HandleTask, Correct
|
15
|
+
class Role(ProposeTask, HandleTask, Correct):
|
17
16
|
"""Class that represents a role with a registry of events and workflows.
|
18
17
|
|
19
18
|
A Role serves as a container for workflows, managing their registration to events
|