fabricatio 0.2.11.dev1__tar.gz → 0.2.11.dev2__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.11.dev1 → fabricatio-0.2.11.dev2}/PKG-INFO +1 -1
- fabricatio-0.2.11.dev2/examples/write_article/write_article.py +90 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/pyproject.toml +1 -1
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/python/fabricatio/actions/article_rag.py +126 -40
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/python/fabricatio/decorators.py +27 -10
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/python/fabricatio/models/extra/aricle_rag.py +6 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/python/fabricatio/models/extra/article_base.py +27 -8
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/python/fabricatio/rust.pyi +126 -139
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/python/fabricatio/utils.py +25 -6
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/src/typst_tools.rs +18 -9
- fabricatio-0.2.11.dev2/templates.tar.gz +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/uv.lock +8 -8
- fabricatio-0.2.11.dev1/examples/write_article/write_article.py +0 -207
- fabricatio-0.2.11.dev1/templates.tar.gz +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/.github/workflows/build-package.yaml +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/.github/workflows/ruff.yaml +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/.github/workflows/tests.yaml +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/.gitignore +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/.python-version +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/Cargo.lock +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/Cargo.toml +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/LICENSE +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/Makefile +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/README.md +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/examples/correct/correct.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/examples/correct/correct_loop.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/examples/extract_and_inject/.gitignore +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/examples/extract_and_inject/article_rag.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/examples/extract_and_inject/ask.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/examples/extract_and_inject/chunk_article.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/examples/extract_and_inject/extract_and_inject.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/examples/extract_article/extract.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/examples/llm_usages/llm_usage.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/examples/make_a_rating/rating.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/examples/make_diary/commits.json +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/examples/make_diary/diary.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/examples/minor/hello_fabricatio.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/examples/minor/write_a_poem.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/examples/propose_task/.gitignore +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/examples/propose_task/propose.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/examples/reviewer/censor.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/examples/reviewer/review.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/examples/rules/.gitignore +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/examples/rules/draft_ruleset.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/examples/search_bibtex/.gitignore +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/examples/search_bibtex/search.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/examples/simple_chat/chat.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/examples/simple_rag/simple_rag.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/examples/task_handle/handle_task.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/examples/write_article/.gitignore +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/examples/write_article/article_rag.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/examples/write_article/post_process.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/examples/write_outline/.gitignore +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/examples/write_outline/write_outline.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/examples/write_outline/write_outline_corrected.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/python/fabricatio/__init__.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/python/fabricatio/actions/__init__.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/python/fabricatio/actions/article.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/python/fabricatio/actions/fs.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/python/fabricatio/actions/output.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/python/fabricatio/actions/rag.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/python/fabricatio/actions/rules.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/python/fabricatio/capabilities/__init__.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/python/fabricatio/capabilities/advanced_judge.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/python/fabricatio/capabilities/censor.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/python/fabricatio/capabilities/check.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/python/fabricatio/capabilities/correct.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/python/fabricatio/capabilities/extract.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/python/fabricatio/capabilities/propose.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/python/fabricatio/capabilities/rag.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/python/fabricatio/capabilities/rating.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/python/fabricatio/capabilities/review.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/python/fabricatio/capabilities/task.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/python/fabricatio/config.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/python/fabricatio/constants.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/python/fabricatio/core.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/python/fabricatio/fs/__init__.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/python/fabricatio/fs/curd.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/python/fabricatio/fs/readers.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/python/fabricatio/journal.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/python/fabricatio/models/action.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/python/fabricatio/models/adv_kwargs_types.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/python/fabricatio/models/events.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/python/fabricatio/models/extra/__init__.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/python/fabricatio/models/extra/advanced_judge.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/python/fabricatio/models/extra/article_essence.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/python/fabricatio/models/extra/article_main.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/python/fabricatio/models/extra/article_outline.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/python/fabricatio/models/extra/article_proposal.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/python/fabricatio/models/extra/patches.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/python/fabricatio/models/extra/problem.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/python/fabricatio/models/extra/rag.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/python/fabricatio/models/extra/rule.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/python/fabricatio/models/generic.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/python/fabricatio/models/kwargs_types.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/python/fabricatio/models/role.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/python/fabricatio/models/task.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/python/fabricatio/models/tool.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/python/fabricatio/models/usages.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/python/fabricatio/parser.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/python/fabricatio/py.typed +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/python/fabricatio/rust_instances.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/python/fabricatio/toolboxes/__init__.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/python/fabricatio/toolboxes/arithmetic.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/python/fabricatio/toolboxes/fs.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/python/fabricatio/workflows/__init__.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/python/fabricatio/workflows/articles.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/python/fabricatio/workflows/rag.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/src/bib_tools.rs +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/src/hash.rs +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/src/hbs_helpers.rs +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/src/language.rs +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/src/lib.rs +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/src/templates.rs +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/src/word_split.rs +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/templates/built-in/as_prompt.hbs +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/templates/built-in/binary-exploitation-ctf-solver.hbs +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/templates/built-in/check_string.hbs +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/templates/built-in/claude-xml.hbs +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/templates/built-in/clean-up-code.hbs +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/templates/built-in/co_validation.hbs +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/templates/built-in/create_json_obj.hbs +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/templates/built-in/cryptography-ctf-solver.hbs +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/templates/built-in/dependencies.hbs +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/templates/built-in/document-the-code.hbs +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/templates/built-in/draft_rating_criteria.hbs +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/templates/built-in/draft_rating_manual.hbs +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/templates/built-in/draft_rating_weights_klee.hbs +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/templates/built-in/draft_tool_usage_code.hbs +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/templates/built-in/extract.hbs +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/templates/built-in/extract_criteria_from_reasons.hbs +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/templates/built-in/extract_reasons_from_examples.hbs +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/templates/built-in/find-security-vulnerabilities.hbs +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/templates/built-in/fix-bugs.hbs +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/templates/built-in/fix_troubled_obj.hbs +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/templates/built-in/fix_troubled_string.hbs +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/templates/built-in/generic_string.hbs +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/templates/built-in/improve-performance.hbs +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/templates/built-in/liststr.hbs +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/templates/built-in/make_choice.hbs +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/templates/built-in/make_judgment.hbs +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/templates/built-in/pathstr.hbs +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/templates/built-in/rate_fine_grind.hbs +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/templates/built-in/refactor.hbs +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/templates/built-in/refined_query.hbs +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/templates/built-in/retrieved_display.hbs +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/templates/built-in/reverse-engineering-ctf-solver.hbs +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/templates/built-in/review_string.hbs +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/templates/built-in/rule_requirement.hbs +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/templates/built-in/ruleset_requirement_breakdown.hbs +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/templates/built-in/task_briefing.hbs +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/templates/built-in/web-ctf-solver.hbs +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/templates/built-in/write-git-commit.hbs +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/templates/built-in/write-github-pull-request.hbs +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/templates/built-in/write-github-readme.hbs +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/tests/test_config.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/tests/test_models/test_action.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/tests/test_models/test_advanced.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/tests/test_models/test_generic.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/tests/test_models/test_problem.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/tests/test_models/test_role.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/tests/test_models/test_task.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/tests/test_models/test_tool.py +0 -0
- {fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/tests/test_models/test_usages.py +0 -0
@@ -0,0 +1,90 @@
|
|
1
|
+
"""Example of using the library."""
|
2
|
+
|
3
|
+
import asyncio
|
4
|
+
from pathlib import Path
|
5
|
+
|
6
|
+
from fabricatio import Event, Role, WorkFlow, logger
|
7
|
+
from fabricatio.actions.article import (
|
8
|
+
GenerateArticleProposal,
|
9
|
+
GenerateInitialOutline,
|
10
|
+
)
|
11
|
+
from fabricatio.actions.article_rag import WriteArticleContentRAG
|
12
|
+
from fabricatio.actions.output import (
|
13
|
+
DumpFinalizedOutput,
|
14
|
+
PersistentAll,
|
15
|
+
)
|
16
|
+
from fabricatio.models.action import Action
|
17
|
+
from fabricatio.models.extra.article_main import Article
|
18
|
+
from fabricatio.models.extra.article_outline import ArticleOutline
|
19
|
+
from fabricatio.models.extra.article_proposal import ArticleProposal
|
20
|
+
from fabricatio.models.task import Task
|
21
|
+
from fabricatio.utils import ok
|
22
|
+
|
23
|
+
|
24
|
+
class Connect(Action):
|
25
|
+
"""Connect the article with the article_outline and article_proposal."""
|
26
|
+
|
27
|
+
output_key: str = "article"
|
28
|
+
"""Connect the article with the article_outline and article_proposal."""
|
29
|
+
|
30
|
+
async def _execute(
|
31
|
+
self,
|
32
|
+
article_briefing: str,
|
33
|
+
article_proposal: ArticleProposal,
|
34
|
+
article_outline: ArticleOutline,
|
35
|
+
article: Article,
|
36
|
+
**cxt,
|
37
|
+
) -> Article:
|
38
|
+
"""Connect the article with the article_outline and article_proposal."""
|
39
|
+
return article.update_ref(article_outline.update_ref(article_proposal.update_ref(article_briefing)))
|
40
|
+
|
41
|
+
|
42
|
+
async def main(article: bool) -> None:
|
43
|
+
"""Main function."""
|
44
|
+
Role(
|
45
|
+
name="Undergraduate Researcher",
|
46
|
+
description="Write an outline for an article in typst format.",
|
47
|
+
llm_model="openai/qwen-max",
|
48
|
+
llm_temperature=0.63,
|
49
|
+
llm_stream=True,
|
50
|
+
llm_top_p=0.85,
|
51
|
+
llm_max_tokens=8191,
|
52
|
+
llm_rpm=600,
|
53
|
+
llm_tpm=900000,
|
54
|
+
registry={
|
55
|
+
Event.quick_instantiate(ns := "article"): WorkFlow(
|
56
|
+
name="Generate Article Outline",
|
57
|
+
description="Generate an outline for an article. dump the outline to the given path. in typst format.",
|
58
|
+
steps=(
|
59
|
+
GenerateArticleProposal,
|
60
|
+
GenerateInitialOutline(output_key="article_outline", supervisor=False),
|
61
|
+
PersistentAll,
|
62
|
+
WriteArticleContentRAG(
|
63
|
+
output_key="to_dump",
|
64
|
+
llm_top_p=0.9,
|
65
|
+
ref_limit=60,
|
66
|
+
llm_model="openai/qwq-plus",
|
67
|
+
target_collection="article_chunks",
|
68
|
+
extractor_model="openai/qwen-plus",
|
69
|
+
query_model="openai/qwen-max",
|
70
|
+
),
|
71
|
+
DumpFinalizedOutput(output_key="task_output"),
|
72
|
+
PersistentAll,
|
73
|
+
),
|
74
|
+
).update_init_context(
|
75
|
+
article_briefing=Path("./article_briefing.txt").read_text(),
|
76
|
+
dump_path="out.typ",
|
77
|
+
persist_dir="persistent",
|
78
|
+
collection_name="article_chunks",
|
79
|
+
),
|
80
|
+
},
|
81
|
+
)
|
82
|
+
|
83
|
+
if article:
|
84
|
+
proposed_task = Task(name="write an article")
|
85
|
+
path = ok(await proposed_task.delegate(ns), "Failed to generate an article ")
|
86
|
+
logger.success(f"The outline is saved in:\n{path}")
|
87
|
+
|
88
|
+
|
89
|
+
if __name__ == "__main__":
|
90
|
+
asyncio.run(main(True))
|
@@ -8,6 +8,7 @@ from fabricatio import BibManager
|
|
8
8
|
from fabricatio.capabilities.censor import Censor
|
9
9
|
from fabricatio.capabilities.extract import Extract
|
10
10
|
from fabricatio.capabilities.rag import RAG
|
11
|
+
from fabricatio.decorators import precheck_package
|
11
12
|
from fabricatio.journal import logger
|
12
13
|
from fabricatio.models.action import Action
|
13
14
|
from fabricatio.models.extra.aricle_rag import ArticleChunk, CitationManager
|
@@ -15,7 +16,7 @@ from fabricatio.models.extra.article_essence import ArticleEssence
|
|
15
16
|
from fabricatio.models.extra.article_main import Article, ArticleChapter, ArticleSection, ArticleSubsection
|
16
17
|
from fabricatio.models.extra.article_outline import ArticleOutline
|
17
18
|
from fabricatio.models.extra.rule import RuleSet
|
18
|
-
from fabricatio.utils import ok
|
19
|
+
from fabricatio.utils import ask_retain, ok
|
19
20
|
|
20
21
|
|
21
22
|
class WriteArticleContentRAG(Action, RAG, Extract):
|
@@ -23,11 +24,14 @@ class WriteArticleContentRAG(Action, RAG, Extract):
|
|
23
24
|
|
24
25
|
ref_limit: int = 35
|
25
26
|
"""The limit of references to be retrieved"""
|
27
|
+
threshold: float = 0.55
|
28
|
+
"""The threshold of relevance"""
|
26
29
|
extractor_model: str
|
27
30
|
"""The model to use for extracting the content from the retrieved references."""
|
28
31
|
query_model: str
|
29
32
|
"""The model to use for querying the database"""
|
30
|
-
|
33
|
+
supervisor: bool = False
|
34
|
+
"""Whether to use supervisor mode"""
|
31
35
|
req: str = (
|
32
36
|
"citation number is REQUIRED to cite any reference!\n"
|
33
37
|
"Everything is build upon the typst language, which is similar to latex, \n"
|
@@ -40,12 +44,12 @@ class WriteArticleContentRAG(Action, RAG, Extract):
|
|
40
44
|
"you can refer to that label by using the syntax with prefix of `@eqt:`"
|
41
45
|
"Below is a usage example:\n"
|
42
46
|
"```typst\n"
|
43
|
-
"See @eqt:mass-energy-equation , it's the
|
47
|
+
"See @eqt:mass-energy-equation , it's the foundation of physics.\n"
|
44
48
|
"$$\n"
|
45
49
|
"E = m c^2"
|
46
50
|
"$$\n"
|
47
|
-
"<mass-energy-equation
|
48
|
-
"In @eqt:mass-energy-equation ,
|
51
|
+
"<mass-energy-equation>\n\n"
|
52
|
+
"In @eqt:mass-energy-equation , $m$ stands for mass, $c$ stands for speed of light, and $E$ stands for energy. \n"
|
49
53
|
"```"
|
50
54
|
)
|
51
55
|
|
@@ -57,14 +61,57 @@ class WriteArticleContentRAG(Action, RAG, Extract):
|
|
57
61
|
**cxt,
|
58
62
|
) -> Article:
|
59
63
|
article = Article.from_outline(article_outline).update_ref(article_outline)
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
64
|
+
|
65
|
+
if self.supervisor:
|
66
|
+
await gather(
|
67
|
+
*[
|
68
|
+
self._supervisor_inner(article, article_outline, chap, sec, subsec)
|
69
|
+
for chap, sec, subsec in article.iter_subsections()
|
70
|
+
]
|
71
|
+
)
|
72
|
+
else:
|
73
|
+
await gather(
|
74
|
+
*[
|
75
|
+
self._inner(article, article_outline, chap, sec, subsec)
|
76
|
+
for chap, sec, subsec in article.iter_subsections()
|
77
|
+
]
|
78
|
+
)
|
66
79
|
return article.convert_tex()
|
67
80
|
|
81
|
+
@precheck_package(
|
82
|
+
"questionary", "`questionary` is required for supervisor mode, please install it by `fabricatio[qa]`"
|
83
|
+
)
|
84
|
+
async def _supervisor_inner(
|
85
|
+
self,
|
86
|
+
article: Article,
|
87
|
+
article_outline: ArticleOutline,
|
88
|
+
chap: ArticleChapter,
|
89
|
+
sec: ArticleSection,
|
90
|
+
subsec: ArticleSubsection,
|
91
|
+
) -> ArticleSubsection:
|
92
|
+
from questionary import confirm, text
|
93
|
+
from rich import print as r_print
|
94
|
+
|
95
|
+
ret = await self.search_database(article, article_outline, chap, sec, subsec)
|
96
|
+
|
97
|
+
cm = CitationManager(article_chunks=await ask_retain([r.chunk for r in ret], ret)).set_cite_number_all()
|
98
|
+
|
99
|
+
raw = await self.write_raw(article, article_outline, chap, sec, subsec, cm)
|
100
|
+
r_print(raw)
|
101
|
+
while not await confirm("Accept this version and continue?").ask_async():
|
102
|
+
if await confirm("Search for more refs?").ask_async():
|
103
|
+
new_refs = await self.search_database(article, article_outline, chap, sec, subsec)
|
104
|
+
cm.add_chunks(await ask_retain([r.chunk for r in new_refs], new_refs))
|
105
|
+
|
106
|
+
instruction = await text("Enter the instructions to improve").ask_async()
|
107
|
+
raw = await self.write_raw(article, article_outline, chap, sec, subsec, cm, instruction)
|
108
|
+
if await confirm("Edit it?").ask_async():
|
109
|
+
raw = await text("Edit", default=raw).ask_async() or raw
|
110
|
+
|
111
|
+
r_print(raw)
|
112
|
+
|
113
|
+
return await self.extract_new_subsec(subsec, raw, cm)
|
114
|
+
|
68
115
|
async def _inner(
|
69
116
|
self,
|
70
117
|
article: Article,
|
@@ -73,35 +120,17 @@ class WriteArticleContentRAG(Action, RAG, Extract):
|
|
73
120
|
sec: ArticleSection,
|
74
121
|
subsec: ArticleSubsection,
|
75
122
|
) -> ArticleSubsection:
|
76
|
-
|
77
|
-
|
78
|
-
f"{article_outline.display()}\n\nAbove is my article outline, I m writing graduate thesis titled `{article.title}`. "
|
79
|
-
f"More specifically, i m witting the Chapter `{chap.title}` >> Section `{sec.title}` >> Subsection `{subsec.title}`.\n"
|
80
|
-
f"I need to search related references to build up the content of the subsec mentioned above, which is `{subsec.title}`.\n"
|
81
|
-
f"plus, you can search required formulas by using latex equation code.\n"
|
82
|
-
f"provide 10 queries as possible, to get best result!\n"
|
83
|
-
f"You should provide both English version and chinese version of the refined queries!\n",
|
84
|
-
model=self.query_model,
|
85
|
-
),
|
86
|
-
"Failed to refine query.",
|
87
|
-
)
|
88
|
-
ret = await self.aretrieve(ref_q, ArticleChunk, final_limit=self.ref_limit, result_per_query=6)
|
89
|
-
ret.reverse()
|
90
|
-
cm = CitationManager().update_chunks(ret)
|
91
|
-
|
92
|
-
raw_paras = await self.aask(
|
93
|
-
f"{cm.as_prompt()}\nAbove is some related reference retrieved for you."
|
94
|
-
f"{article.referenced.display()}\n\nAbove is my article outline, I m writing graduate thesis titled `{article.title}`. "
|
95
|
-
f"More specifically, i m witting the Chapter `{chap.title}` >> Section `{sec.title}` >> Subsection `{subsec.title}`.\n"
|
96
|
-
f"Please help me write the paragraphs of the subsec mentioned above, which is `{subsec.title}`.\n"
|
97
|
-
f"{self.req}\n"
|
98
|
-
f"You SHALL use `{article.language}` as writing language."
|
99
|
-
)
|
123
|
+
ret = await self.search_database(article, article_outline, chap, sec, subsec)
|
124
|
+
cm = CitationManager(article_chunks=ret).set_cite_number_all()
|
100
125
|
|
101
|
-
raw_paras = (
|
102
|
-
|
103
|
-
)
|
126
|
+
raw_paras = await self.write_raw(article, article_outline, chap, sec, subsec, cm)
|
127
|
+
|
128
|
+
return await self.extract_new_subsec(subsec, raw_paras, cm)
|
104
129
|
|
130
|
+
async def extract_new_subsec(
|
131
|
+
self, subsec: ArticleSubsection, raw_paras: str, cm: CitationManager
|
132
|
+
) -> ArticleSubsection:
|
133
|
+
"""Extract the new subsec."""
|
105
134
|
new_subsec = ok(
|
106
135
|
await self.extract(
|
107
136
|
ArticleSubsection,
|
@@ -112,14 +141,71 @@ class WriteArticleContentRAG(Action, RAG, Extract):
|
|
112
141
|
),
|
113
142
|
"Failed to propose new subsection.",
|
114
143
|
)
|
115
|
-
|
116
144
|
for p in new_subsec.paragraphs:
|
117
145
|
p.content = cm.apply(p.content).replace("$$", "\n$$\n")
|
118
|
-
|
119
146
|
subsec.update_from(new_subsec)
|
120
147
|
logger.debug(f"{subsec.title}:rpl\n{subsec.display()}")
|
121
148
|
return subsec
|
122
149
|
|
150
|
+
async def write_raw(
|
151
|
+
self,
|
152
|
+
article: Article,
|
153
|
+
article_outline: ArticleOutline,
|
154
|
+
chap: ArticleChapter,
|
155
|
+
sec: ArticleSection,
|
156
|
+
subsec: ArticleSubsection,
|
157
|
+
cm: CitationManager,
|
158
|
+
extra_instruction: str = "",
|
159
|
+
) -> str:
|
160
|
+
"""Write the raw paragraphs of the subsec."""
|
161
|
+
return (
|
162
|
+
(
|
163
|
+
await self.aask(
|
164
|
+
f"{cm.as_prompt()}\nAbove is some related reference retrieved for you."
|
165
|
+
f"{article_outline.finalized_dump()}\n\nAbove is my article outline, I m writing graduate thesis titled `{article.title}`. "
|
166
|
+
f"More specifically, i m witting the Chapter `{chap.title}` >> Section `{sec.title}` >> Subsection `{subsec.title}`.\n"
|
167
|
+
f"Please help me write the paragraphs of the subsec mentioned above, which is `{subsec.title}`.\n"
|
168
|
+
f"{self.req}\n"
|
169
|
+
f"You SHALL use `{article.language}` as writing language.\n{extra_instruction}"
|
170
|
+
)
|
171
|
+
)
|
172
|
+
.replace(r" \( ", "$")
|
173
|
+
.replace(r" \) ", "$")
|
174
|
+
.replace(r"\(", "$")
|
175
|
+
.replace(r"\)", "$")
|
176
|
+
.replace("\\[\n", "$$\n")
|
177
|
+
.replace("\n\\]", "\n$$")
|
178
|
+
)
|
179
|
+
|
180
|
+
async def search_database(
|
181
|
+
self,
|
182
|
+
article: Article,
|
183
|
+
article_outline: ArticleOutline,
|
184
|
+
chap: ArticleChapter,
|
185
|
+
sec: ArticleSection,
|
186
|
+
subsec: ArticleSubsection,
|
187
|
+
extra_instruction: str = "",
|
188
|
+
) -> List[ArticleChunk]:
|
189
|
+
"""Search database for related references."""
|
190
|
+
ref_q = ok(
|
191
|
+
await self.arefined_query(
|
192
|
+
f"{article_outline.finalized_dump()}\n\nAbove is my article outline, I m writing graduate thesis titled `{article.title}`. "
|
193
|
+
f"More specifically, i m witting the Chapter `{chap.title}` >> Section `{sec.title}` >> Subsection `{subsec.title}`.\n"
|
194
|
+
f"I need to search related references to build up the content of the subsec mentioned above, which is `{subsec.title}`.\n"
|
195
|
+
f"provide 10~16 queries as possible, to get best result!\n"
|
196
|
+
f"You should provide both English version and chinese version of the refined queries!\n{extra_instruction}\n",
|
197
|
+
model=self.query_model,
|
198
|
+
),
|
199
|
+
"Failed to refine query.",
|
200
|
+
)
|
201
|
+
|
202
|
+
if self.supervisor:
|
203
|
+
ref_q = await ask_retain(ref_q)
|
204
|
+
|
205
|
+
return await self.aretrieve(
|
206
|
+
ref_q, ArticleChunk, final_limit=self.ref_limit, result_per_query=3, similarity_threshold=self.threshold
|
207
|
+
)
|
208
|
+
|
123
209
|
|
124
210
|
class TweakArticleRAG(Action, RAG, Censor):
|
125
211
|
"""Write an article based on the provided outline.
|
@@ -6,7 +6,7 @@ from importlib.util import find_spec
|
|
6
6
|
from inspect import signature
|
7
7
|
from shutil import which
|
8
8
|
from types import ModuleType
|
9
|
-
from typing import Callable, List, Optional
|
9
|
+
from typing import Callable, Coroutine, List, Optional
|
10
10
|
|
11
11
|
from fabricatio.config import configs
|
12
12
|
from fabricatio.journal import logger
|
@@ -23,7 +23,20 @@ def precheck_package[**P, R](package_name: str, msg: str) -> Callable[[Callable[
|
|
23
23
|
bool: True if the package exists, False otherwise.
|
24
24
|
"""
|
25
25
|
|
26
|
-
def _wrapper(
|
26
|
+
def _wrapper(
|
27
|
+
func: Callable[P, R] | Callable[P, Coroutine[None, None, R]],
|
28
|
+
) -> Callable[P, R] | Callable[P, Coroutine[None, None, R]]:
|
29
|
+
if iscoroutinefunction(func):
|
30
|
+
|
31
|
+
@wraps(func)
|
32
|
+
async def _async_inner(*args: P.args, **kwargs: P.kwargs) -> R:
|
33
|
+
if find_spec(package_name):
|
34
|
+
return await func(*args, **kwargs)
|
35
|
+
raise RuntimeError(msg)
|
36
|
+
|
37
|
+
return _async_inner
|
38
|
+
|
39
|
+
@wraps(func)
|
27
40
|
def _inner(*args: P.args, **kwargs: P.kwargs) -> R:
|
28
41
|
if find_spec(package_name):
|
29
42
|
return func(*args, **kwargs)
|
@@ -35,7 +48,7 @@ def precheck_package[**P, R](package_name: str, msg: str) -> Callable[[Callable[
|
|
35
48
|
|
36
49
|
|
37
50
|
def depend_on_external_cmd[**P, R](
|
38
|
-
|
51
|
+
bin_name: str, install_tip: Optional[str], homepage: Optional[str] = None
|
39
52
|
) -> Callable[[Callable[P, R]], Callable[P, R]]:
|
40
53
|
"""Decorator to check for the presence of an external command.
|
41
54
|
|
@@ -88,8 +101,9 @@ def logging_execution_info[**P, R](func: Callable[P, R]) -> Callable[P, R]:
|
|
88
101
|
return _wrapper
|
89
102
|
|
90
103
|
|
91
|
-
@precheck_package(
|
92
|
-
|
104
|
+
@precheck_package(
|
105
|
+
"questionary", "'questionary' is required to run this function. Have you installed `fabricatio[qa]`?."
|
106
|
+
)
|
93
107
|
def confirm_to_execute[**P, R](func: Callable[P, R]) -> Callable[P, Optional[R]] | Callable[P, R]:
|
94
108
|
"""Decorator to confirm before executing a function.
|
95
109
|
|
@@ -109,8 +123,8 @@ def confirm_to_execute[**P, R](func: Callable[P, R]) -> Callable[P, Optional[R]]
|
|
109
123
|
@wraps(func)
|
110
124
|
async def _wrapper(*args: P.args, **kwargs: P.kwargs) -> Optional[R]:
|
111
125
|
if await confirm(
|
112
|
-
|
113
|
-
|
126
|
+
f"Are you sure to execute function: {func.__name__}{signature(func)} \n📦 Args:{args}\n🔑 Kwargs:{kwargs}\n",
|
127
|
+
instruction="Please input [Yes/No] to proceed (default: Yes):",
|
114
128
|
).ask_async():
|
115
129
|
return await func(*args, **kwargs)
|
116
130
|
logger.warning(f"Function: {func.__name__}{signature(func)} canceled by user.")
|
@@ -121,8 +135,8 @@ def confirm_to_execute[**P, R](func: Callable[P, R]) -> Callable[P, Optional[R]]
|
|
121
135
|
@wraps(func)
|
122
136
|
def _wrapper(*args: P.args, **kwargs: P.kwargs) -> Optional[R]:
|
123
137
|
if confirm(
|
124
|
-
|
125
|
-
|
138
|
+
f"Are you sure to execute function: {func.__name__}{signature(func)} \n📦 Args:{args}\n��� Kwargs:{kwargs}\n",
|
139
|
+
instruction="Please input [Yes/No] to proceed (default: Yes):",
|
126
140
|
).ask():
|
127
141
|
return func(*args, **kwargs)
|
128
142
|
logger.warning(f"Function: {func.__name__}{signature(func)} canceled by user.")
|
@@ -203,7 +217,9 @@ def use_temp_module[**P, R](modules: ModuleType | List[ModuleType]) -> Callable[
|
|
203
217
|
return _decorator
|
204
218
|
|
205
219
|
|
206
|
-
def logging_exec_time[**P, R](
|
220
|
+
def logging_exec_time[**P, R](
|
221
|
+
func: Callable[P, R] | Callable[P, Coroutine[None, None, R]],
|
222
|
+
) -> Callable[P, R] | Callable[P, Coroutine[None, None, R]]:
|
207
223
|
"""Decorator to log the execution time of a function.
|
208
224
|
|
209
225
|
Args:
|
@@ -215,6 +231,7 @@ def logging_exec_time[**P, R](func: Callable[P, R]) -> Callable[P, R]:
|
|
215
231
|
from time import time
|
216
232
|
|
217
233
|
if iscoroutinefunction(func):
|
234
|
+
|
218
235
|
@wraps(func)
|
219
236
|
async def _async_wrapper(*args: P.args, **kwargs: P.kwargs) -> R:
|
220
237
|
start_time = time()
|
{fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/python/fabricatio/models/extra/aricle_rag.py
RENAMED
@@ -190,6 +190,12 @@ class CitationManager(AsPrompt):
|
|
190
190
|
self.set_cite_number_all()
|
191
191
|
return self
|
192
192
|
|
193
|
+
def add_chunks(self, article_chunks: List[ArticleChunk], set_cite_number: bool = True)-> Self:
|
194
|
+
"""Add article chunks."""
|
195
|
+
self.article_chunks.extend(article_chunks)
|
196
|
+
if set_cite_number:
|
197
|
+
self.set_cite_number_all()
|
198
|
+
return self
|
193
199
|
def set_cite_number_all(self) -> Self:
|
194
200
|
"""Set citation numbers for all article chunks."""
|
195
201
|
for i, a in enumerate(self.article_chunks, 1):
|
{fabricatio-0.2.11.dev1 → fabricatio-0.2.11.dev2}/python/fabricatio/models/extra/article_base.py
RENAMED
@@ -18,6 +18,7 @@ from fabricatio.models.generic import (
|
|
18
18
|
Titled,
|
19
19
|
WordCount,
|
20
20
|
)
|
21
|
+
from fabricatio.rust import comment
|
21
22
|
from pydantic import Field
|
22
23
|
|
23
24
|
|
@@ -29,11 +30,9 @@ class ReferringType(StrEnum):
|
|
29
30
|
SUBSECTION = "subsection"
|
30
31
|
|
31
32
|
|
32
|
-
|
33
33
|
type RefKey = Tuple[str, Optional[str], Optional[str]]
|
34
34
|
|
35
35
|
|
36
|
-
|
37
36
|
class ArticleMetaData(SketchedAble, Described, WordCount, Titled, Language):
|
38
37
|
"""Metadata for an article component."""
|
39
38
|
|
@@ -48,8 +47,6 @@ class ArticleMetaData(SketchedAble, Described, WordCount, Titled, Language):
|
|
48
47
|
"""List of writing aims of the research component in academic style."""
|
49
48
|
|
50
49
|
|
51
|
-
|
52
|
-
|
53
50
|
class ArticleOutlineBase(
|
54
51
|
ArticleMetaData,
|
55
52
|
ResolveUpdateConflict,
|
@@ -92,7 +89,13 @@ class SubSectionBase(ArticleOutlineBase):
|
|
92
89
|
|
93
90
|
def to_typst_code(self) -> str:
|
94
91
|
"""Converts the component into a Typst code snippet for rendering."""
|
95
|
-
return
|
92
|
+
return (
|
93
|
+
f"=== {self.title}\n"
|
94
|
+
f"{comment(f'Desc:\n{self.description}\nAims:\n{"\n".join(self.aims)}')}\n"
|
95
|
+
+ f"Expected Word Count:{self.expected_word_count}"
|
96
|
+
if self.expected_word_count
|
97
|
+
else ""
|
98
|
+
)
|
96
99
|
|
97
100
|
def introspect(self) -> str:
|
98
101
|
"""Introspects the article subsection outline."""
|
@@ -117,7 +120,13 @@ class SectionBase[T: SubSectionBase](ArticleOutlineBase):
|
|
117
120
|
Returns:
|
118
121
|
str: The formatted Typst code snippet.
|
119
122
|
"""
|
120
|
-
return
|
123
|
+
return (
|
124
|
+
f"== {self.title}\n"
|
125
|
+
f"{comment(f'Desc:\n{self.description}\nAims:\n{"\n".join(self.aims)}')}\n"
|
126
|
+
+ f"Expected Word Count:{self.expected_word_count}"
|
127
|
+
if self.expected_word_count
|
128
|
+
else ""
|
129
|
+
) + "\n\n".join(subsec.to_typst_code() for subsec in self.subsections)
|
121
130
|
|
122
131
|
def resolve_update_conflict(self, other: Self) -> str:
|
123
132
|
"""Resolve update errors in the article outline."""
|
@@ -160,7 +169,13 @@ class ChapterBase[T: SectionBase](ArticleOutlineBase):
|
|
160
169
|
|
161
170
|
def to_typst_code(self) -> str:
|
162
171
|
"""Converts the chapter into a Typst formatted code snippet for rendering."""
|
163
|
-
return
|
172
|
+
return (
|
173
|
+
f"= {self.title}\n"
|
174
|
+
f"{comment(f'Desc:\n{self.description}\nAims:\n{"\n".join(self.aims)}')}\n"
|
175
|
+
+ f"Expected Word Count:{self.expected_word_count}"
|
176
|
+
if self.expected_word_count
|
177
|
+
else ""
|
178
|
+
) + "\n\n".join(sec.to_typst_code() for sec in self.sections)
|
164
179
|
|
165
180
|
def resolve_update_conflict(self, other: Self) -> str:
|
166
181
|
"""Resolve update errors in the article outline."""
|
@@ -302,4 +317,8 @@ class ArticleBase[T: ChapterBase](FinalizedDumpAble, AsPrompt, WordCount, Descri
|
|
302
317
|
=== Implementation Details
|
303
318
|
== Evaluation Protocol
|
304
319
|
"""
|
305
|
-
return
|
320
|
+
return comment(
|
321
|
+
f"Title:{self.title}\nDesc:\n{self.description}\n" + f"Word Count:{self.expected_word_count}"
|
322
|
+
if self.expected_word_count
|
323
|
+
else ""
|
324
|
+
) + "\n\n".join(a.to_typst_code() for a in self.chapters)
|