fabricatio 0.2.13.dev1__tar.gz → 0.2.13.dev3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/PKG-INFO +1 -1
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/examples/write_article/write_article.py +4 -4
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/pyproject.toml +1 -1
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/python/fabricatio/actions/article_rag.py +52 -71
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/python/fabricatio/capabilities/advanced_rag.py +5 -1
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/python/fabricatio/capabilities/rag.py +7 -1
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/python/fabricatio/models/adv_kwargs_types.py +1 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/python/fabricatio/models/extra/aricle_rag.py +26 -11
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/python/fabricatio/models/extra/article_base.py +27 -2
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/python/fabricatio/models/extra/article_main.py +1 -0
- fabricatio-0.2.13.dev3/python/fabricatio/models/extra/article_outline.py +45 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/python/fabricatio/rust.pyi +65 -1
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/python/fabricatio/utils.py +2 -2
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/src/typst_tools.rs +52 -2
- fabricatio-0.2.13.dev3/templates.tar.gz +0 -0
- fabricatio-0.2.13.dev3/uv.lock +1706 -0
- fabricatio-0.2.13.dev1/python/fabricatio/models/extra/article_outline.py +0 -78
- fabricatio-0.2.13.dev1/templates.tar.gz +0 -0
- fabricatio-0.2.13.dev1/uv.lock +0 -1706
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/.github/workflows/build-package.yaml +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/.github/workflows/ruff.yaml +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/.github/workflows/tests.yaml +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/.gitignore +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/.python-version +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/Cargo.lock +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/Cargo.toml +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/LICENSE +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/Makefile +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/README.md +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/examples/correct/correct.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/examples/correct/correct_loop.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/examples/extract_and_inject/.gitignore +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/examples/extract_and_inject/article_rag.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/examples/extract_and_inject/ask.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/examples/extract_and_inject/chunk_article.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/examples/extract_and_inject/extract_and_inject.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/examples/extract_article/extract.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/examples/llm_usages/llm_usage.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/examples/make_a_rating/rating.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/examples/make_diary/commits.json +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/examples/make_diary/diary.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/examples/minor/hello_fabricatio.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/examples/minor/write_a_poem.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/examples/propose_task/.gitignore +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/examples/propose_task/propose.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/examples/reviewer/censor.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/examples/reviewer/review.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/examples/rules/.gitignore +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/examples/rules/draft_ruleset.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/examples/search_bibtex/.gitignore +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/examples/search_bibtex/search.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/examples/simple_chat/chat.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/examples/simple_rag/simple_rag.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/examples/task_handle/handle_task.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/examples/write_article/.gitignore +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/examples/write_article/article_rag.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/examples/write_article/post_process.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/examples/write_outline/.gitignore +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/examples/write_outline/write_outline.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/examples/write_outline/write_outline_corrected.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/python/fabricatio/__init__.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/python/fabricatio/actions/__init__.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/python/fabricatio/actions/article.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/python/fabricatio/actions/fs.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/python/fabricatio/actions/output.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/python/fabricatio/actions/rag.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/python/fabricatio/actions/rules.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/python/fabricatio/capabilities/__init__.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/python/fabricatio/capabilities/advanced_judge.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/python/fabricatio/capabilities/censor.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/python/fabricatio/capabilities/check.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/python/fabricatio/capabilities/correct.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/python/fabricatio/capabilities/extract.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/python/fabricatio/capabilities/propose.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/python/fabricatio/capabilities/rating.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/python/fabricatio/capabilities/review.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/python/fabricatio/capabilities/task.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/python/fabricatio/config.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/python/fabricatio/constants.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/python/fabricatio/core.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/python/fabricatio/decorators.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/python/fabricatio/fs/__init__.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/python/fabricatio/fs/curd.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/python/fabricatio/fs/readers.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/python/fabricatio/journal.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/python/fabricatio/models/action.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/python/fabricatio/models/events.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/python/fabricatio/models/extra/__init__.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/python/fabricatio/models/extra/advanced_judge.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/python/fabricatio/models/extra/article_essence.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/python/fabricatio/models/extra/article_proposal.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/python/fabricatio/models/extra/patches.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/python/fabricatio/models/extra/problem.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/python/fabricatio/models/extra/rag.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/python/fabricatio/models/extra/rule.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/python/fabricatio/models/generic.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/python/fabricatio/models/kwargs_types.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/python/fabricatio/models/role.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/python/fabricatio/models/task.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/python/fabricatio/models/tool.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/python/fabricatio/models/usages.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/python/fabricatio/parser.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/python/fabricatio/py.typed +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/python/fabricatio/rust_instances.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/python/fabricatio/toolboxes/__init__.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/python/fabricatio/toolboxes/arithmetic.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/python/fabricatio/toolboxes/fs.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/python/fabricatio/workflows/__init__.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/python/fabricatio/workflows/articles.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/python/fabricatio/workflows/rag.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/src/bib_tools.rs +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/src/hash.rs +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/src/hbs_helpers.rs +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/src/language.rs +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/src/lib.rs +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/src/templates.rs +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/src/word_split.rs +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/templates/built-in/as_prompt.hbs +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/templates/built-in/binary-exploitation-ctf-solver.hbs +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/templates/built-in/chap_summary.hbs +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/templates/built-in/check_string.hbs +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/templates/built-in/claude-xml.hbs +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/templates/built-in/clean-up-code.hbs +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/templates/built-in/co_validation.hbs +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/templates/built-in/create_json_obj.hbs +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/templates/built-in/cryptography-ctf-solver.hbs +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/templates/built-in/dependencies.hbs +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/templates/built-in/document-the-code.hbs +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/templates/built-in/draft_rating_criteria.hbs +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/templates/built-in/draft_rating_manual.hbs +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/templates/built-in/draft_rating_weights_klee.hbs +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/templates/built-in/draft_tool_usage_code.hbs +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/templates/built-in/extract.hbs +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/templates/built-in/extract_criteria_from_reasons.hbs +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/templates/built-in/extract_reasons_from_examples.hbs +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/templates/built-in/find-security-vulnerabilities.hbs +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/templates/built-in/fix-bugs.hbs +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/templates/built-in/fix_troubled_obj.hbs +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/templates/built-in/fix_troubled_string.hbs +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/templates/built-in/generic_string.hbs +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/templates/built-in/improve-performance.hbs +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/templates/built-in/liststr.hbs +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/templates/built-in/make_choice.hbs +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/templates/built-in/make_judgment.hbs +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/templates/built-in/pathstr.hbs +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/templates/built-in/rate_fine_grind.hbs +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/templates/built-in/refactor.hbs +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/templates/built-in/refined_query.hbs +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/templates/built-in/retrieved_display.hbs +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/templates/built-in/reverse-engineering-ctf-solver.hbs +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/templates/built-in/review_string.hbs +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/templates/built-in/rule_requirement.hbs +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/templates/built-in/ruleset_requirement_breakdown.hbs +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/templates/built-in/task_briefing.hbs +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/templates/built-in/web-ctf-solver.hbs +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/templates/built-in/write-git-commit.hbs +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/templates/built-in/write-github-pull-request.hbs +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/templates/built-in/write-github-readme.hbs +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/tests/test_config.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/tests/test_models/test_action.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/tests/test_models/test_advanced.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/tests/test_models/test_generic.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/tests/test_models/test_problem.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/tests/test_models/test_role.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/tests/test_models/test_task.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/tests/test_models/test_tool.py +0 -0
- {fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/tests/test_models/test_usages.py +0 -0
@@ -26,10 +26,9 @@ from typer import Typer
|
|
26
26
|
Role(
|
27
27
|
name="Undergraduate Researcher",
|
28
28
|
description="Write an outline for an article in typst format.",
|
29
|
-
llm_model="openai/
|
30
|
-
llm_temperature=0.45,
|
29
|
+
llm_model="openai/qwen3-235b-a22b",
|
31
30
|
# llm_api_endpoint=HttpUrl("https://dashscope.aliyuncs.com/compatible-mode/v1"),
|
32
|
-
|
31
|
+
llm_stream=True,
|
33
32
|
llm_max_tokens=8191,
|
34
33
|
llm_rpm=600,
|
35
34
|
llm_tpm=900000,
|
@@ -49,7 +48,7 @@ Role(
|
|
49
48
|
threshold=0.58,
|
50
49
|
result_per_query=2,
|
51
50
|
extractor_model={"model": "openai/qwen-max"},
|
52
|
-
query_model={"model": "openai/qwen-turbo"
|
51
|
+
query_model={"model": "openai/qwen-turbo"},
|
53
52
|
)
|
54
53
|
),
|
55
54
|
PersistentAll,
|
@@ -212,6 +211,7 @@ def suma(
|
|
212
211
|
),
|
213
212
|
dump_path: Path = typer.Option(Path("out.typ"), "-d", "--dump-path", help="Path to dump the final output."), # noqa: B008
|
214
213
|
) -> None:
|
214
|
+
"""Write chap summary based on given article."""
|
215
215
|
path = ok(
|
216
216
|
asyncio.run(
|
217
217
|
Task(name="write an article")
|
@@ -20,18 +20,26 @@ from fabricatio.models.extra.article_main import Article, ArticleChapter, Articl
|
|
20
20
|
from fabricatio.models.extra.article_outline import ArticleOutline
|
21
21
|
from fabricatio.models.extra.rule import RuleSet
|
22
22
|
from fabricatio.models.kwargs_types import ChooseKwargs, LLMKwargs
|
23
|
-
from fabricatio.rust import
|
24
|
-
|
23
|
+
from fabricatio.rust import (
|
24
|
+
convert_all_block_tex,
|
25
|
+
convert_all_inline_tex,
|
26
|
+
convert_to_block_formula,
|
27
|
+
convert_to_inline_formula,
|
28
|
+
fix_misplaced_labels,
|
29
|
+
)
|
30
|
+
from fabricatio.utils import ok
|
25
31
|
|
26
32
|
TYPST_CITE_USAGE = (
|
27
|
-
"citation number is REQUIRED to cite any reference
|
28
|
-
"Everything is build upon the typst language, which is similar to latex, \n"
|
33
|
+
"citation number is REQUIRED to cite any reference!'\n"
|
29
34
|
"Legal citing syntax examples(seperated by |): [[1]]|[[1,2]]|[[1-3]]|[[12,13-15]]|[[1-3,5-7]]\n"
|
30
35
|
"Illegal citing syntax examples(seperated by |): [[1],[2],[3]]|[[1],[1-2]]\n"
|
31
|
-
"
|
36
|
+
"You SHALL not cite a single reference more than once!"
|
32
37
|
"It's recommended to cite multiple references that supports your conclusion at a time.\n"
|
38
|
+
)
|
39
|
+
|
40
|
+
TYPST_MATH_USAGE = (
|
33
41
|
"Wrap inline expression with '\\(' and '\\)',like '\\(>5m\\)' '\\(89%\\)', and wrap block equation with '\\[' and '\\]'.\n"
|
34
|
-
"In addition to that, you can add a label outside the block equation which can be used as a cross reference identifier, the label is a string wrapped in `<` and `>` like `<energy-release-rate-equation>`.Note that the label string should be a summarizing title for the equation being labeled.\n"
|
42
|
+
"In addition to that, you can add a label outside the block equation which can be used as a cross reference identifier, the label is a string wrapped in `<` and `>` like `<energy-release-rate-equation>`.Note that the label string should be a summarizing title for the equation being labeled and should never be written within the formula block.\n"
|
35
43
|
"you can refer to that label by using the syntax with prefix of `@eqt:`, which indicate that this notation is citing a label from the equations. For example ' @eqt:energy-release-rate-equation ' DO remember that the notation shall have both suffixed and prefixed space char which enable the compiler to distinguish the notation from the plaintext."
|
36
44
|
"Below is two usage example:\n"
|
37
45
|
"```typst\n"
|
@@ -44,9 +52,10 @@ TYPST_CITE_USAGE = (
|
|
44
52
|
)
|
45
53
|
|
46
54
|
|
47
|
-
class WriteArticleContentRAG(Action,
|
55
|
+
class WriteArticleContentRAG(Action, Extract, AdvancedRAG):
|
48
56
|
"""Write an article based on the provided outline."""
|
49
57
|
|
58
|
+
ctx_override: ClassVar[bool] = True
|
50
59
|
search_increment_multiplier: float = 1.6
|
51
60
|
"""The increment multiplier of the search increment."""
|
52
61
|
ref_limit: int = 35
|
@@ -55,15 +64,19 @@ class WriteArticleContentRAG(Action, RAG, Extract):
|
|
55
64
|
"""The threshold of relevance"""
|
56
65
|
extractor_model: LLMKwargs
|
57
66
|
"""The model to use for extracting the content from the retrieved references."""
|
58
|
-
query_model:
|
67
|
+
query_model: ChooseKwargs
|
59
68
|
"""The model to use for querying the database"""
|
60
69
|
supervisor: bool = False
|
61
70
|
"""Whether to use supervisor mode"""
|
62
71
|
result_per_query: PositiveInt = 4
|
63
72
|
"""The number of results to be returned per query."""
|
64
|
-
|
73
|
+
cite_req: str = TYPST_CITE_USAGE
|
65
74
|
"""The req of the write article content."""
|
66
75
|
|
76
|
+
math_req: str = TYPST_MATH_USAGE
|
77
|
+
"""The req of the write article content."""
|
78
|
+
tei_endpoint: Optional[str] = None
|
79
|
+
|
67
80
|
async def _execute(
|
68
81
|
self,
|
69
82
|
article_outline: ArticleOutline,
|
@@ -103,30 +116,25 @@ class WriteArticleContentRAG(Action, RAG, Extract):
|
|
103
116
|
cm = CitationManager()
|
104
117
|
await self.search_database(article, article_outline, chap, sec, subsec, cm)
|
105
118
|
|
106
|
-
|
107
|
-
r_print(
|
119
|
+
raw_paras = await self.write_raw(article, article_outline, chap, sec, subsec, cm)
|
120
|
+
r_print(raw_paras)
|
108
121
|
|
109
122
|
while not await confirm("Accept this version and continue?").ask_async():
|
110
123
|
if inst := await text("Search for more refs for additional spec.").ask_async():
|
111
|
-
await self.search_database(
|
112
|
-
article,
|
113
|
-
article_outline,
|
114
|
-
chap,
|
115
|
-
sec,
|
116
|
-
subsec,
|
117
|
-
cm,
|
118
|
-
supervisor=True,
|
119
|
-
extra_instruction=inst,
|
120
|
-
)
|
124
|
+
await self.search_database(article, article_outline, chap, sec, subsec, cm, extra_instruction=inst)
|
121
125
|
|
122
126
|
if instruction := await text("Enter the instructions to improve").ask_async():
|
123
|
-
|
124
|
-
if edt := await text("Edit", default=
|
125
|
-
|
127
|
+
raw_paras = await self.write_raw(article, article_outline, chap, sec, subsec, cm, instruction)
|
128
|
+
if edt := await text("Edit", default=raw_paras).ask_async():
|
129
|
+
raw_paras = edt
|
126
130
|
|
127
|
-
|
131
|
+
raw_paras = fix_misplaced_labels(raw_paras)
|
132
|
+
raw_paras = convert_all_inline_tex(raw_paras)
|
133
|
+
raw_paras = convert_all_block_tex(raw_paras)
|
128
134
|
|
129
|
-
|
135
|
+
r_print(raw_paras)
|
136
|
+
|
137
|
+
return await self.extract_new_subsec(subsec, raw_paras, cm)
|
130
138
|
|
131
139
|
async def _inner(
|
132
140
|
self,
|
@@ -144,6 +152,10 @@ class WriteArticleContentRAG(Action, RAG, Extract):
|
|
144
152
|
|
145
153
|
raw_paras = "\n".join(p for p in raw_paras.splitlines() if p and not p.endswith("**") and not p.startswith("#"))
|
146
154
|
|
155
|
+
raw_paras = fix_misplaced_labels(raw_paras)
|
156
|
+
raw_paras = convert_all_inline_tex(raw_paras)
|
157
|
+
raw_paras = convert_all_block_tex(raw_paras)
|
158
|
+
|
147
159
|
return await self.extract_new_subsec(subsec, raw_paras, cm)
|
148
160
|
|
149
161
|
async def extract_new_subsec(
|
@@ -155,12 +167,13 @@ class WriteArticleContentRAG(Action, RAG, Extract):
|
|
155
167
|
ArticleSubsection,
|
156
168
|
raw_paras,
|
157
169
|
f"Above is the subsection titled `{subsec.title}`.\n"
|
158
|
-
f"I need you to extract the content to
|
159
|
-
f"
|
170
|
+
f"I need you to extract the content to construct a new `{ArticleSubsection.__class__.__name__}`,"
|
171
|
+
f"Do not attempt to change the original content, your job is ONLY content extraction",
|
160
172
|
**self.extractor_model,
|
161
173
|
),
|
162
174
|
"Failed to propose new subsection.",
|
163
175
|
)
|
176
|
+
|
164
177
|
for p in new_subsec.paragraphs:
|
165
178
|
p.content = cm.apply(p.content)
|
166
179
|
p.description = cm.apply(p.description)
|
@@ -184,7 +197,7 @@ class WriteArticleContentRAG(Action, RAG, Extract):
|
|
184
197
|
f"{article_outline.finalized_dump()}\n\nAbove is my article outline, I m writing graduate thesis titled `{article.title}`. "
|
185
198
|
f"More specifically, i m witting the Chapter `{chap.title}` >> Section `{sec.title}` >> Subsection `{subsec.title}`.\n"
|
186
199
|
f"Please help me write the paragraphs of the subsec mentioned above, which is `{subsec.title}`.\n"
|
187
|
-
f"{self.
|
200
|
+
f"{self.cite_req}\n{self.math_req}\n"
|
188
201
|
f"You SHALL use `{article.language}` as writing language.\n{extra_instruction}\n"
|
189
202
|
f"Do not use numbered list to display the outcome, you should regard you are writing the main text of the thesis.\n"
|
190
203
|
f"You should not copy others' works from the references directly on to my thesis, we can only harness the conclusion they have drawn.\n"
|
@@ -200,7 +213,6 @@ class WriteArticleContentRAG(Action, RAG, Extract):
|
|
200
213
|
subsec: ArticleSubsection,
|
201
214
|
cm: CitationManager,
|
202
215
|
extra_instruction: str = "",
|
203
|
-
supervisor: bool = False,
|
204
216
|
) -> None:
|
205
217
|
"""Search database for related references."""
|
206
218
|
search_req = (
|
@@ -208,51 +220,20 @@ class WriteArticleContentRAG(Action, RAG, Extract):
|
|
208
220
|
f"More specifically, i m witting the Chapter `{chap.title}` >> Section `{sec.title}` >> Subsection `{subsec.title}`.\n"
|
209
221
|
f"I need to search related references to build up the content of the subsec mentioned above, which is `{subsec.title}`.\n"
|
210
222
|
f"provide 10~16 queries as possible, to get best result!\n"
|
211
|
-
f"You should provide both English version and chinese version of the refined queries!\n{extra_instruction}
|
212
|
-
)
|
213
|
-
|
214
|
-
ref_q = ok(
|
215
|
-
await self.arefined_query(
|
216
|
-
search_req,
|
217
|
-
**self.query_model,
|
218
|
-
),
|
219
|
-
"Failed to refine query.",
|
223
|
+
f"You should provide both English version and chinese version of the refined queries!\n{extra_instruction}"
|
220
224
|
)
|
221
225
|
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
226
|
+
await self.clued_search(
|
227
|
+
search_req,
|
228
|
+
cm,
|
229
|
+
refinery_kwargs=self.query_model,
|
230
|
+
expand_multiplier=self.search_increment_multiplier,
|
231
|
+
base_accepted=self.ref_limit,
|
228
232
|
result_per_query=self.result_per_query,
|
229
233
|
similarity_threshold=self.threshold,
|
234
|
+
tei_endpoint=self.tei_endpoint,
|
230
235
|
)
|
231
236
|
|
232
|
-
cm.add_chunks(ok(ret))
|
233
|
-
ref_q = await self.arefined_query(
|
234
|
-
f"{cm.as_prompt()}\n\nAbove is the retrieved references in the first RAG, now we need to perform the second RAG.\n\n{search_req}",
|
235
|
-
**self.query_model,
|
236
|
-
)
|
237
|
-
|
238
|
-
if ref_q is None:
|
239
|
-
logger.warning("Second refine query is None, skipping.")
|
240
|
-
return
|
241
|
-
if supervisor:
|
242
|
-
ref_q = await ask_retain(ref_q)
|
243
|
-
|
244
|
-
ret = await self.aretrieve(
|
245
|
-
ref_q,
|
246
|
-
ArticleChunk,
|
247
|
-
max_accepted=int(self.ref_limit * self.search_increment_multiplier),
|
248
|
-
result_per_query=int(self.result_per_query * self.search_increment_multiplier),
|
249
|
-
similarity_threshold=self.threshold,
|
250
|
-
)
|
251
|
-
if ret is None:
|
252
|
-
logger.warning("Second retrieve is None, skipping.")
|
253
|
-
return
|
254
|
-
cm.add_chunks(ret)
|
255
|
-
|
256
237
|
|
257
238
|
class ArticleConsultRAG(Action, AdvancedRAG):
|
258
239
|
"""Write an article based on the provided outline."""
|
@@ -261,9 +242,9 @@ class ArticleConsultRAG(Action, AdvancedRAG):
|
|
261
242
|
output_key: str = "consult_count"
|
262
243
|
search_increment_multiplier: float = 1.6
|
263
244
|
"""The multiplier to increase the limit of references to retrieve per query."""
|
264
|
-
ref_limit: int =
|
245
|
+
ref_limit: int = 26
|
265
246
|
"""The final limit of references."""
|
266
|
-
ref_per_q: int =
|
247
|
+
ref_per_q: int = 13
|
267
248
|
"""The limit of references to retrieve per query."""
|
268
249
|
similarity_threshold: float = 0.62
|
269
250
|
"""The similarity threshold of references to retrieve."""
|
{fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/python/fabricatio/capabilities/advanced_rag.py
RENAMED
@@ -7,6 +7,7 @@ from fabricatio.journal import logger
|
|
7
7
|
from fabricatio.models.adv_kwargs_types import FetchKwargs
|
8
8
|
from fabricatio.models.extra.aricle_rag import ArticleChunk, CitationManager
|
9
9
|
from fabricatio.models.kwargs_types import ChooseKwargs
|
10
|
+
from fabricatio.utils import fallback_kwargs
|
10
11
|
|
11
12
|
|
12
13
|
class AdvancedRAG(RAG):
|
@@ -40,10 +41,13 @@ class AdvancedRAG(RAG):
|
|
40
41
|
f"\n\n{requirement}",
|
41
42
|
**refinery_kwargs,
|
42
43
|
)
|
44
|
+
|
43
45
|
if ref_q is None:
|
44
46
|
logger.error(f"At round [{i}/{max_round}] search, failed to refine the query, exit.")
|
45
47
|
return cm
|
46
|
-
refs = await self.aretrieve(
|
48
|
+
refs = await self.aretrieve(
|
49
|
+
ref_q, ArticleChunk, base_accepted, **fallback_kwargs(kwargs, filter_expr=cm.as_milvus_filter_expr())
|
50
|
+
)
|
47
51
|
|
48
52
|
if (max_capacity := max_capacity - len(refs)) < 0:
|
49
53
|
cm.add_chunks(refs[0:max_capacity])
|
@@ -150,6 +150,7 @@ class RAG(EmbeddingUsage):
|
|
150
150
|
result_per_query: int = 10,
|
151
151
|
tei_endpoint: Optional[str] = None,
|
152
152
|
reranker_threshold: float = 0.7,
|
153
|
+
filter_expr: str = "",
|
153
154
|
) -> List[D]:
|
154
155
|
"""Asynchronously fetches documents from a Milvus database based on input vectors.
|
155
156
|
|
@@ -162,6 +163,7 @@ class RAG(EmbeddingUsage):
|
|
162
163
|
result_per_query (int): The maximum number of results to return per query. Defaults to 10.
|
163
164
|
tei_endpoint (str): the endpoint of the TEI api.
|
164
165
|
reranker_threshold (float): The threshold used to filtered low relativity document.
|
166
|
+
filter_expr (str): filter_expression parsed into pymilvus search.
|
165
167
|
|
166
168
|
Returns:
|
167
169
|
List[D]: A list of document objects created from the fetched data.
|
@@ -172,6 +174,7 @@ class RAG(EmbeddingUsage):
|
|
172
174
|
await self.vectorize(query),
|
173
175
|
search_params={"radius": similarity_threshold},
|
174
176
|
output_fields=list(document_model.model_fields),
|
177
|
+
filter=filter_expr,
|
175
178
|
limit=result_per_query,
|
176
179
|
)
|
177
180
|
if tei_endpoint is not None:
|
@@ -184,8 +187,11 @@ class RAG(EmbeddingUsage):
|
|
184
187
|
|
185
188
|
for q, g in zip(query, search_results, strict=True):
|
186
189
|
models = document_model.from_sequence([res["entity"] for res in g if res["id"] not in retrieved_id])
|
190
|
+
logger.debug(f"Retrived {len(g)} raw document, filtered out {len(models)}.")
|
187
191
|
retrieved_id.update(res["id"] for res in g)
|
188
|
-
|
192
|
+
if not models:
|
193
|
+
continue
|
194
|
+
rank_scores = await reranker.arerank(q, [m.prepare_vectorization() for m in models], truncate=True)
|
189
195
|
raw_result.extend(
|
190
196
|
(models[s["index"]], s["score"]) for s in rank_scores if s["score"] > reranker_threshold
|
191
197
|
)
|
{fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/python/fabricatio/models/extra/aricle_rag.py
RENAMED
@@ -1,6 +1,7 @@
|
|
1
1
|
"""A Module containing the article rag models."""
|
2
2
|
|
3
3
|
import re
|
4
|
+
from itertools import groupby
|
4
5
|
from pathlib import Path
|
5
6
|
from typing import ClassVar, Dict, List, Optional, Self, Unpack
|
6
7
|
|
@@ -10,12 +11,13 @@ from fabricatio.models.extra.rag import MilvusDataBase
|
|
10
11
|
from fabricatio.models.generic import AsPrompt
|
11
12
|
from fabricatio.models.kwargs_types import ChunkKwargs
|
12
13
|
from fabricatio.rust import BibManager, blake3_hash, split_into_chunks
|
13
|
-
from fabricatio.utils import ok
|
14
|
+
from fabricatio.utils import ok, wrapp_in_block
|
15
|
+
from more_itertools.more import first
|
14
16
|
from more_itertools.recipes import flatten, unique
|
15
17
|
from pydantic import Field
|
16
18
|
|
17
19
|
|
18
|
-
class ArticleChunk(MilvusDataBase
|
20
|
+
class ArticleChunk(MilvusDataBase):
|
19
21
|
"""The chunk of an article."""
|
20
22
|
|
21
23
|
etc_word: ClassVar[str] = "等"
|
@@ -51,10 +53,9 @@ class ArticleChunk(MilvusDataBase, AsPrompt):
|
|
51
53
|
bibtex_cite_key: str
|
52
54
|
"""The bibtex cite key of the article"""
|
53
55
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
}
|
56
|
+
@property
|
57
|
+
def reference_header(self) -> str:
|
58
|
+
return f"[[{ok(self._cite_number, 'You need to update cite number first.')}]] reference `{self.article_title}` from {self.as_auther_seq()}"
|
58
59
|
|
59
60
|
@property
|
60
61
|
def cite_number(self) -> int:
|
@@ -204,13 +205,23 @@ class CitationManager(AsPrompt):
|
|
204
205
|
|
205
206
|
def set_cite_number_all(self) -> Self:
|
206
207
|
"""Set citation numbers for all article chunks."""
|
207
|
-
|
208
|
-
|
208
|
+
number_mapping = {a.bibtex_cite_key: 0 for a in self.article_chunks}
|
209
|
+
|
210
|
+
for i, k in enumerate(number_mapping.keys()):
|
211
|
+
number_mapping[k] = i
|
212
|
+
|
213
|
+
for a in self.article_chunks:
|
214
|
+
a.update_cite_number(number_mapping[a.bibtex_cite_key])
|
209
215
|
return self
|
210
216
|
|
211
217
|
def _as_prompt_inner(self) -> Dict[str, str]:
|
212
218
|
"""Generate prompt inner representation."""
|
213
|
-
|
219
|
+
seg = []
|
220
|
+
for k, g in groupby(self.article_chunks, key=lambda a: a.bibtex_cite_key):
|
221
|
+
g = list(g)
|
222
|
+
logger.debug(f"Group [{k}]: {len(g)}")
|
223
|
+
seg.append(wrapp_in_block("\n\n".join(a.chunk for a in g), first(g).reference_header))
|
224
|
+
return {"References": "\n".join(seg)}
|
214
225
|
|
215
226
|
def apply(self, string: str) -> str:
|
216
227
|
"""Apply citation replacements to the input string."""
|
@@ -261,5 +272,9 @@ class CitationManager(AsPrompt):
|
|
261
272
|
|
262
273
|
def unpack_cite_seq(self, citation_seq: List[int]) -> str:
|
263
274
|
"""Unpack citation sequence into a string."""
|
264
|
-
chunk_seq =
|
265
|
-
return "".join(a.as_typst_cite() for a in chunk_seq)
|
275
|
+
chunk_seq = {a.bibtex_cite_key: a for a in self.article_chunks if a.cite_number in citation_seq}
|
276
|
+
return "".join(a.as_typst_cite() for a in chunk_seq.values())
|
277
|
+
|
278
|
+
def as_milvus_filter_expr(self, blacklist: bool = True) -> str:
|
279
|
+
if blacklist:
|
280
|
+
return " and ".join(f'bibtex_cite_key != "{a.bibtex_cite_key}"' for a in self.article_chunks)
|
{fabricatio-0.2.13.dev1 → fabricatio-0.2.13.dev3}/python/fabricatio/models/extra/article_base.py
RENAMED
@@ -2,9 +2,12 @@
|
|
2
2
|
|
3
3
|
from abc import ABC
|
4
4
|
from enum import StrEnum
|
5
|
+
from pathlib import Path
|
5
6
|
from typing import ClassVar, Generator, List, Optional, Self, Tuple, Type
|
6
7
|
|
8
|
+
from fabricatio.fs import dump_text, safe_text_read
|
7
9
|
from fabricatio.fs.readers import extract_sections
|
10
|
+
from fabricatio.journal import logger
|
8
11
|
from fabricatio.models.generic import (
|
9
12
|
AsPrompt,
|
10
13
|
Described,
|
@@ -19,10 +22,12 @@ from fabricatio.models.generic import (
|
|
19
22
|
Titled,
|
20
23
|
WordCount,
|
21
24
|
)
|
22
|
-
from fabricatio.rust import split_out_metadata, to_metadata, word_count
|
23
|
-
from fabricatio.utils import fallback_kwargs
|
25
|
+
from fabricatio.rust import extract_body, inplace_update, split_out_metadata, to_metadata, word_count
|
26
|
+
from fabricatio.utils import fallback_kwargs, ok
|
24
27
|
from pydantic import Field
|
25
28
|
|
29
|
+
ARTICLE_WRAPPER = "// =-=-=-=-=-=-=-=-=-="
|
30
|
+
|
26
31
|
|
27
32
|
class ReferringType(StrEnum):
|
28
33
|
"""Enumeration of different types of references that can be made in an article."""
|
@@ -397,3 +402,23 @@ class ArticleBase[T: ChapterBase](FinalizedDumpAble, AsPrompt, FromTypstCode, To
|
|
397
402
|
def avg_wordcount_recursive[S: "ArticleBase"](self: S) -> S:
|
398
403
|
"""Set all chap, sec, subsec have same word count sum up to be `self.expected_word_count`."""
|
399
404
|
return self.avg_chap_wordcount().avg_sec_wordcount().avg_subsec_wordcount()
|
405
|
+
|
406
|
+
def update_article_file(self, file: str | Path) -> Self:
|
407
|
+
"""Update the article file."""
|
408
|
+
file = Path(file)
|
409
|
+
string = safe_text_read(file)
|
410
|
+
if updated := inplace_update(string, ARTICLE_WRAPPER, self.to_typst_code()):
|
411
|
+
dump_text(file, updated)
|
412
|
+
logger.success(f"Successfully updated {file.as_posix()}.")
|
413
|
+
else:
|
414
|
+
logger.warning(f"Failed to update {file.as_posix()}. Please make sure there are paired `{ARTICLE_WRAPPER}`")
|
415
|
+
return self
|
416
|
+
|
417
|
+
@classmethod
|
418
|
+
def from_article_file(cls, file: str | Path, title: str) -> Self:
|
419
|
+
"""Load article from file."""
|
420
|
+
file = Path(file)
|
421
|
+
string = safe_text_read(file)
|
422
|
+
return cls.from_typst_code(
|
423
|
+
title, ok(extract_body(string, ARTICLE_WRAPPER), "Failed to extract body from file.")
|
424
|
+
)
|
@@ -0,0 +1,45 @@
|
|
1
|
+
"""A module containing the ArticleOutline class, which represents the outline of an academic paper."""
|
2
|
+
|
3
|
+
from typing import ClassVar, Dict, Type
|
4
|
+
|
5
|
+
from fabricatio.models.extra.article_base import (
|
6
|
+
ArticleBase,
|
7
|
+
ChapterBase,
|
8
|
+
SectionBase,
|
9
|
+
SubSectionBase,
|
10
|
+
)
|
11
|
+
from fabricatio.models.extra.article_proposal import ArticleProposal
|
12
|
+
from fabricatio.models.generic import PersistentAble, WithRef
|
13
|
+
|
14
|
+
|
15
|
+
class ArticleSubsectionOutline(SubSectionBase):
|
16
|
+
"""Atomic research component specification for academic paper generation."""
|
17
|
+
|
18
|
+
|
19
|
+
class ArticleSectionOutline(SectionBase[ArticleSubsectionOutline]):
|
20
|
+
"""A slightly more detailed research component specification for academic paper generation, Must contain subsections."""
|
21
|
+
|
22
|
+
child_type: ClassVar[Type[SubSectionBase]] = ArticleSubsectionOutline
|
23
|
+
|
24
|
+
|
25
|
+
class ArticleChapterOutline(ChapterBase[ArticleSectionOutline]):
|
26
|
+
"""Macro-structural unit implementing standard academic paper organization. Must contain sections."""
|
27
|
+
|
28
|
+
child_type: ClassVar[Type[SectionBase]] = ArticleSectionOutline
|
29
|
+
|
30
|
+
|
31
|
+
class ArticleOutline(
|
32
|
+
WithRef[ArticleProposal],
|
33
|
+
PersistentAble,
|
34
|
+
ArticleBase[ArticleChapterOutline],
|
35
|
+
):
|
36
|
+
"""Outline of an academic paper, containing chapters, sections, subsections."""
|
37
|
+
|
38
|
+
child_type: ClassVar[Type[ChapterBase]] = ArticleChapterOutline
|
39
|
+
|
40
|
+
def _as_prompt_inner(self) -> Dict[str, str]:
|
41
|
+
return {
|
42
|
+
"Original Article Briefing": self.referenced.referenced,
|
43
|
+
"Original Article Proposal": self.referenced.display(),
|
44
|
+
"Original Article Outline": self.display(),
|
45
|
+
}
|