fabricatio 0.3.14.dev7__tar.gz → 0.3.15.dev4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- fabricatio-0.3.15.dev4/.github/workflows/build-package.yaml +130 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/PKG-INFO +2 -1
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/README.md +1 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/examples/write_article/write_article.py +55 -12
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/pyproject.toml +1 -1
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/python/fabricatio/actions/article.py +115 -19
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/python/fabricatio/actions/article_rag.py +52 -52
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/python/fabricatio/decorators.py +2 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/python/fabricatio/models/extra/aricle_rag.py +4 -5
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/python/fabricatio/models/extra/article_base.py +98 -34
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/python/fabricatio/models/extra/article_main.py +11 -6
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/python/fabricatio/models/generic.py +1 -1
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/python/fabricatio/models/role.py +24 -20
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/python/fabricatio/rust.pyi +20 -61
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/src/config.rs +1 -0
- fabricatio-0.3.15.dev4/src/templates.rs +217 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/src/typst_tools.rs +25 -1
- fabricatio-0.3.15.dev4/templates/built-in/research_content_summary.hbs +17 -0
- fabricatio-0.3.15.dev4/uv.lock +1917 -0
- fabricatio-0.3.14.dev7/.github/workflows/build-package.yaml +0 -97
- fabricatio-0.3.14.dev7/src/templates.rs +0 -166
- fabricatio-0.3.14.dev7/templates.tar.gz +0 -0
- fabricatio-0.3.14.dev7/uv.lock +0 -1930
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/.github/workflows/ruff.yaml +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/.github/workflows/tests.yaml +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/.gitignore +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/Cargo.lock +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/Cargo.toml +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/LICENSE +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/Makefile +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/build.rs +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/examples/correct/correct.py +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/examples/correct/correct_loop.py +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/examples/extract_and_inject/.gitignore +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/examples/extract_and_inject/article_rag.py +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/examples/extract_and_inject/ask.py +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/examples/extract_and_inject/chunk_article.py +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/examples/extract_and_inject/extract_and_inject.py +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/examples/extract_article/extract.py +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/examples/llm_usages/llm_usage.py +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/examples/make_a_rating/rating.py +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/examples/make_diary/commits.json +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/examples/make_diary/diary.py +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/examples/minor/hello_fabricatio.py +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/examples/minor/write_a_poem.py +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/examples/propose_task/.gitignore +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/examples/propose_task/propose.py +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/examples/reviewer/censor.py +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/examples/reviewer/review.py +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/examples/rules/.gitignore +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/examples/rules/draft_ruleset.py +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/examples/search_bibtex/.gitignore +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/examples/search_bibtex/search.py +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/examples/simple_chat/chat.py +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/examples/simple_rag/simple_rag.py +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/examples/task_handle/handle_task.py +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/examples/write_article/.gitignore +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/examples/write_article/article_rag.py +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/examples/write_article/post_process.py +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/examples/write_outline/.gitignore +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/examples/write_outline/write_outline.py +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/examples/write_outline/write_outline_corrected.py +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/proto/tei.proto +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/python/fabricatio/__init__.py +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/python/fabricatio/actions/__init__.py +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/python/fabricatio/actions/fs.py +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/python/fabricatio/actions/output.py +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/python/fabricatio/actions/rag.py +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/python/fabricatio/actions/rules.py +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/python/fabricatio/capabilities/__init__.py +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/python/fabricatio/capabilities/advanced_judge.py +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/python/fabricatio/capabilities/advanced_rag.py +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/python/fabricatio/capabilities/censor.py +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/python/fabricatio/capabilities/check.py +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/python/fabricatio/capabilities/correct.py +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/python/fabricatio/capabilities/extract.py +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/python/fabricatio/capabilities/persist.py +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/python/fabricatio/capabilities/propose.py +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/python/fabricatio/capabilities/rag.py +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/python/fabricatio/capabilities/rating.py +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/python/fabricatio/capabilities/review.py +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/python/fabricatio/capabilities/task.py +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/python/fabricatio/emitter.py +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/python/fabricatio/fs/__init__.py +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/python/fabricatio/fs/curd.py +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/python/fabricatio/fs/readers.py +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/python/fabricatio/journal.py +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/python/fabricatio/models/action.py +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/python/fabricatio/models/adv_kwargs_types.py +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/python/fabricatio/models/extra/__init__.py +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/python/fabricatio/models/extra/advanced_judge.py +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/python/fabricatio/models/extra/article_essence.py +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/python/fabricatio/models/extra/article_outline.py +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/python/fabricatio/models/extra/article_proposal.py +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/python/fabricatio/models/extra/patches.py +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/python/fabricatio/models/extra/problem.py +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/python/fabricatio/models/extra/rag.py +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/python/fabricatio/models/extra/rule.py +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/python/fabricatio/models/kwargs_types.py +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/python/fabricatio/models/task.py +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/python/fabricatio/models/tool.py +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/python/fabricatio/models/usages.py +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/python/fabricatio/parser.py +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/python/fabricatio/py.typed +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/python/fabricatio/toolboxes/__init__.py +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/python/fabricatio/toolboxes/arithmetic.py +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/python/fabricatio/toolboxes/fs.py +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/python/fabricatio/utils.py +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/python/fabricatio/workflows/__init__.py +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/python/fabricatio/workflows/articles.py +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/python/fabricatio/workflows/rag.py +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/src/bib_tools.rs +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/src/event.rs +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/src/hash.rs +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/src/hbs_helpers.rs +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/src/language.rs +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/src/lib.rs +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/src/macro_utils/Cargo.toml +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/src/macro_utils/src/lib.rs +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/src/tei_client.rs +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/src/typst_conversion/Cargo.toml +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/src/typst_conversion/src/lib.rs +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/src/word_split.rs +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/templates/built-in/as_prompt.hbs +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/templates/built-in/binary-exploitation-ctf-solver.hbs +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/templates/built-in/chap_summary.hbs +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/templates/built-in/check_string.hbs +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/templates/built-in/claude-xml.hbs +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/templates/built-in/clean-up-code.hbs +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/templates/built-in/co_validation.hbs +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/templates/built-in/create_json_obj.hbs +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/templates/built-in/cryptography-ctf-solver.hbs +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/templates/built-in/dependencies.hbs +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/templates/built-in/document-the-code.hbs +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/templates/built-in/draft_rating_criteria.hbs +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/templates/built-in/draft_rating_manual.hbs +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/templates/built-in/draft_rating_weights_klee.hbs +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/templates/built-in/draft_tool_usage_code.hbs +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/templates/built-in/extract.hbs +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/templates/built-in/extract_criteria_from_reasons.hbs +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/templates/built-in/extract_reasons_from_examples.hbs +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/templates/built-in/find-security-vulnerabilities.hbs +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/templates/built-in/fix-bugs.hbs +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/templates/built-in/fix_troubled_obj.hbs +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/templates/built-in/fix_troubled_string.hbs +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/templates/built-in/generic_string.hbs +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/templates/built-in/improve-performance.hbs +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/templates/built-in/liststr.hbs +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/templates/built-in/make_choice.hbs +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/templates/built-in/make_judgment.hbs +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/templates/built-in/pathstr.hbs +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/templates/built-in/rate_fine_grind.hbs +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/templates/built-in/refactor.hbs +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/templates/built-in/refined_query.hbs +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/templates/built-in/retrieved_display.hbs +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/templates/built-in/reverse-engineering-ctf-solver.hbs +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/templates/built-in/review_string.hbs +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/templates/built-in/rule_requirement.hbs +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/templates/built-in/ruleset_requirement_breakdown.hbs +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/templates/built-in/task_briefing.hbs +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/templates/built-in/web-ctf-solver.hbs +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/templates/built-in/write-git-commit.hbs +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/templates/built-in/write-github-pull-request.hbs +0 -0
- {fabricatio-0.3.14.dev7 → fabricatio-0.3.15.dev4}/templates/built-in/write-github-readme.hbs +0 -0
@@ -0,0 +1,130 @@
|
|
1
|
+
name: Build and Release
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- master
|
7
|
+
pull_request:
|
8
|
+
branches:
|
9
|
+
- master
|
10
|
+
|
11
|
+
jobs:
|
12
|
+
determine_changes:
|
13
|
+
name: Determine Release Necessity & Version Details
|
14
|
+
runs-on: ubuntu-latest
|
15
|
+
outputs:
|
16
|
+
version_changed: ${{ steps.check_version_change.outputs.VERSION_CHANGED }}
|
17
|
+
current_version: ${{ steps.get_version.outputs.CURRENT_VERSION }}
|
18
|
+
is_prerelease: ${{ steps.check_prerelease.outputs.IS_PRERELEASE }}
|
19
|
+
steps:
|
20
|
+
- name: Checkout repository
|
21
|
+
uses: actions/checkout@v4
|
22
|
+
- name: Get current version from pyproject.toml
|
23
|
+
id: get_version
|
24
|
+
run: |
|
25
|
+
CURRENT_VERSION_RAW=$(grep '^version' pyproject.toml | cut -d '"' -f 2)
|
26
|
+
echo "CURRENT_VERSION=v$CURRENT_VERSION_RAW" >> $GITHUB_OUTPUT
|
27
|
+
shell: bash
|
28
|
+
- name: Get latest git tag
|
29
|
+
uses: JinoArch/get-latest-tag@latest
|
30
|
+
id: tag
|
31
|
+
- name: Check if version has changed against latest tag
|
32
|
+
id: check_version_change
|
33
|
+
run: |
|
34
|
+
LATEST_TAG=${{ steps.tag.outputs.latestTag }}
|
35
|
+
VERSION_FROM_PYPROJECT=${{ steps.get_version.outputs.CURRENT_VERSION }}
|
36
|
+
echo "Latest git tag is $LATEST_TAG"
|
37
|
+
echo "Current version (from pyproject.toml, prefixed with 'v') is $VERSION_FROM_PYPROJECT"
|
38
|
+
if [ "$LATEST_TAG" != "$VERSION_FROM_PYPROJECT" ]; then
|
39
|
+
echo "VERSION_CHANGED=true" >> $GITHUB_OUTPUT
|
40
|
+
else
|
41
|
+
echo "VERSION_CHANGED=false" >> $GITHUB_OUTPUT
|
42
|
+
fi
|
43
|
+
shell: bash
|
44
|
+
- name: Check if current version is a prerelease
|
45
|
+
id: check_prerelease
|
46
|
+
run: |
|
47
|
+
VERSION_FROM_PYPROJECT=${{ steps.get_version.outputs.CURRENT_VERSION }}
|
48
|
+
if [[ "$VERSION_FROM_PYPROJECT" == *"-"* ]]; then # e.g., v1.0.0-alpha
|
49
|
+
echo "IS_PRERELEASE=true" >> $GITHUB_OUTPUT
|
50
|
+
else
|
51
|
+
echo "IS_PRERELEASE=false" >> $GITHUB_OUTPUT
|
52
|
+
fi
|
53
|
+
shell: bash
|
54
|
+
|
55
|
+
|
56
|
+
create-release:
|
57
|
+
if: needs.determine_changes.outputs.version_changed == 'true'
|
58
|
+
name: Create Release
|
59
|
+
needs: determine_changes
|
60
|
+
runs-on: ubuntu-latest
|
61
|
+
steps:
|
62
|
+
- name: Checkout repository
|
63
|
+
uses: actions/checkout@v4
|
64
|
+
- name: Packing templates
|
65
|
+
run: |
|
66
|
+
tar -czf templates.tar.gz templates
|
67
|
+
- name: Create Release and upload assets
|
68
|
+
id: create_release
|
69
|
+
uses: softprops/action-gh-release@v2
|
70
|
+
with:
|
71
|
+
tag_name: ${{ needs.determine_changes.outputs.current_version }}
|
72
|
+
name: ${{ needs.determine_changes.outputs.current_version }}
|
73
|
+
files: |
|
74
|
+
templates.tar.gz
|
75
|
+
prerelease: ${{ needs.determine_changes.outputs.is_prerelease }}
|
76
|
+
generate_release_notes: true
|
77
|
+
env:
|
78
|
+
GITHUB_TOKEN: ${{ secrets.PAT }}
|
79
|
+
|
80
|
+
|
81
|
+
|
82
|
+
check-and-release:
|
83
|
+
name: Build, Package, and Release
|
84
|
+
needs:
|
85
|
+
- create-release
|
86
|
+
- determine_changes
|
87
|
+
runs-on: ${{ matrix.os }}
|
88
|
+
strategy:
|
89
|
+
matrix:
|
90
|
+
os: [ windows-latest, ubuntu-latest ]
|
91
|
+
python-version: [ "3.12", "3.13" ]
|
92
|
+
steps:
|
93
|
+
- name: Checkout repository
|
94
|
+
uses: actions/checkout@v4
|
95
|
+
|
96
|
+
- name: Install the latest version of uv
|
97
|
+
uses: astral-sh/setup-uv@v6.0.1
|
98
|
+
with:
|
99
|
+
version: "latest"
|
100
|
+
- name: Install nightly rust
|
101
|
+
run: |
|
102
|
+
rustup default nightly
|
103
|
+
- name: Install Protoc
|
104
|
+
uses: arduino/setup-protoc@v3
|
105
|
+
|
106
|
+
- name: Install deps
|
107
|
+
run: |
|
108
|
+
uv sync --no-install-project --all-extras --index https://pypi.org/simple -p ${{ matrix.python-version }}
|
109
|
+
|
110
|
+
- name: Build
|
111
|
+
run: |
|
112
|
+
make PY=${{ matrix.python-version }}
|
113
|
+
|
114
|
+
- name: Upload assets
|
115
|
+
uses: softprops/action-gh-release@v2
|
116
|
+
with:
|
117
|
+
tag_name: ${{ needs.determine_changes.outputs.current_version }}
|
118
|
+
files: |
|
119
|
+
dist/*.whl
|
120
|
+
env:
|
121
|
+
GITHUB_TOKEN: ${{ secrets.PAT }}
|
122
|
+
|
123
|
+
- name: Upload to PyPI
|
124
|
+
if: needs.determine_changes.outputs.version_changed == 'true'
|
125
|
+
run: |
|
126
|
+
make publish PY=${{ matrix.python-version }}
|
127
|
+
env:
|
128
|
+
MATURIN_USERNAME: __token__
|
129
|
+
MATURIN_PASSWORD: ${{ secrets.PYPI_TOKEN }}
|
130
|
+
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: fabricatio
|
3
|
-
Version: 0.3.
|
3
|
+
Version: 0.3.15.dev4
|
4
4
|
Classifier: License :: OSI Approved :: MIT License
|
5
5
|
Classifier: Programming Language :: Rust
|
6
6
|
Classifier: Programming Language :: Python :: 3.12
|
@@ -185,4 +185,5 @@ Special thanks to the contributors and maintainers of:
|
|
185
185
|
- [PyO3](https://github.com/PyO3/pyo3)
|
186
186
|
- [Maturin](https://github.com/PyO3/maturin)
|
187
187
|
- [Handlebars.rs](https://github.com/sunng87/handlebars-rust)
|
188
|
+
- [LiteLLM](https://github.com/BerriAI/litellm)
|
188
189
|
|
@@ -2,37 +2,43 @@
|
|
2
2
|
|
3
3
|
import asyncio
|
4
4
|
from pathlib import Path
|
5
|
-
from typing import Optional
|
5
|
+
from typing import List, Optional
|
6
6
|
|
7
7
|
import typer
|
8
|
-
from fabricatio import Event,
|
8
|
+
from fabricatio import Event, WorkFlow, logger
|
9
|
+
from fabricatio import Role as RoleBase
|
9
10
|
from fabricatio.actions.article import (
|
10
11
|
ExtractOutlineFromRaw,
|
11
12
|
GenerateArticleProposal,
|
12
13
|
GenerateInitialOutline,
|
13
14
|
WriteChapterSummary,
|
15
|
+
WriteResearchContentSummary,
|
14
16
|
)
|
15
17
|
from fabricatio.actions.article_rag import ArticleConsultRAG, WriteArticleContentRAG
|
16
18
|
from fabricatio.actions.output import DumpFinalizedOutput, PersistentAll, RenderedDump
|
17
|
-
from fabricatio.fs import safe_text_read
|
18
|
-
from fabricatio.models.extra.article_main import Article
|
19
19
|
from fabricatio.models.extra.article_outline import ArticleOutline
|
20
20
|
from fabricatio.models.task import Task
|
21
|
+
from fabricatio.models.usages import LLMUsage
|
21
22
|
from fabricatio.utils import ok
|
22
23
|
from typer import Typer
|
23
24
|
|
24
25
|
# from pydantic import HttpUrl
|
25
26
|
|
27
|
+
|
28
|
+
class Role(RoleBase, LLMUsage):
|
29
|
+
"""Role class for article writing."""
|
30
|
+
|
31
|
+
|
26
32
|
Role(
|
27
33
|
name="Undergraduate Researcher",
|
28
34
|
description="Write an outline for an article in typst format.",
|
29
|
-
llm_model="openai/
|
30
|
-
|
35
|
+
llm_model="openai/qwen-plus",
|
36
|
+
llm_api_endpoint="https://dashscope.aliyuncs.com/compatible-mode/v1",
|
31
37
|
llm_stream=True,
|
32
38
|
llm_max_tokens=8191,
|
33
39
|
llm_rpm=600,
|
34
40
|
llm_tpm=900000,
|
35
|
-
llm_timeout=
|
41
|
+
llm_timeout=10,
|
36
42
|
registry={
|
37
43
|
Event.quick_instantiate(ns := "article"): WorkFlow(
|
38
44
|
name="Generate Article",
|
@@ -88,6 +94,11 @@ Role(
|
|
88
94
|
description="Generate chapter summary based on given article outline. dump the outline to the given path. in typst format.",
|
89
95
|
steps=(WriteChapterSummary().to_task_output(),),
|
90
96
|
),
|
97
|
+
Event.quick_instantiate(ns6 := "resc-suma"): WorkFlow(
|
98
|
+
name="Research Content Summary",
|
99
|
+
description="Generate research content summary based on given article outline. dump the outline to the given path. in typst format.",
|
100
|
+
steps=(WriteResearchContentSummary().to_task_output(),),
|
101
|
+
),
|
91
102
|
},
|
92
103
|
)
|
93
104
|
|
@@ -209,21 +220,53 @@ def suma(
|
|
209
220
|
article_path: Path = typer.Option( # noqa: B008
|
210
221
|
Path("article.typ"), "-a", "--article-path", help="Path to the article file."
|
211
222
|
),
|
212
|
-
|
223
|
+
skip_chapters: List[str] = typer.Option( # noqa: B008
|
224
|
+
[], "-s", "--skip-chapters", help="Chapters to skip."
|
225
|
+
),
|
226
|
+
suma_title: str = typer.Option("Chapter Summary", "-t", "--suma-title", help="Title of the chapter summary."),
|
227
|
+
summary_word_count: int = typer.Option(220, "-w", "--word-count", help="Word count for the summary."),
|
213
228
|
) -> None:
|
214
229
|
"""Write chap summary based on given article."""
|
215
|
-
|
230
|
+
_ = ok(
|
216
231
|
asyncio.run(
|
217
232
|
Task(name="write an article")
|
218
233
|
.update_init_context(
|
219
|
-
|
220
|
-
|
234
|
+
article_path=article_path,
|
235
|
+
summary_title=suma_title,
|
236
|
+
skip_chapters=skip_chapters,
|
237
|
+
summary_word_count=summary_word_count,
|
221
238
|
)
|
222
239
|
.delegate(ns5)
|
223
240
|
),
|
224
241
|
"Failed to generate an article ",
|
225
242
|
)
|
226
|
-
logger.success(f"The outline is saved in:\n{
|
243
|
+
logger.success(f"The outline is saved in:\n{article_path.as_posix()}")
|
244
|
+
|
245
|
+
|
246
|
+
@app.command()
|
247
|
+
def rcsuma(
|
248
|
+
article_path: Path = typer.Option( # noqa: B008
|
249
|
+
Path("article.typ"), "-a", "--article-path", help="Path to the article file."
|
250
|
+
),
|
251
|
+
suma_title: str = typer.Option("Research Content", "-t", "--suma-title", help="Title of the summary."),
|
252
|
+
summary_word_count: int = typer.Option(220, "-w", "--word-count", help="Word count for the summary."),
|
253
|
+
paragraph_count: int = typer.Option(1, "-p", "--paragraph-count", help="Number of paragraphs for the summary."),
|
254
|
+
) -> None:
|
255
|
+
"""Write research summary based on given article."""
|
256
|
+
_ = ok(
|
257
|
+
asyncio.run(
|
258
|
+
Task(name="write an article")
|
259
|
+
.update_init_context(
|
260
|
+
article_path=article_path,
|
261
|
+
summary_title=suma_title,
|
262
|
+
summary_word_count=summary_word_count,
|
263
|
+
paragraph_count=paragraph_count,
|
264
|
+
)
|
265
|
+
.delegate(ns6)
|
266
|
+
),
|
267
|
+
"Failed to generate an article ",
|
268
|
+
)
|
269
|
+
logger.success(f"The outline is saved in:\n{article_path.as_posix()}")
|
227
270
|
|
228
271
|
|
229
272
|
if __name__ == "__main__":
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
from asyncio import gather
|
4
4
|
from pathlib import Path
|
5
|
-
from typing import Callable, List, Optional
|
5
|
+
from typing import Callable, ClassVar, List, Optional
|
6
6
|
|
7
7
|
from more_itertools import filter_map
|
8
8
|
from pydantic import Field
|
@@ -15,14 +15,14 @@ from fabricatio.fs import dump_text, safe_text_read
|
|
15
15
|
from fabricatio.journal import logger
|
16
16
|
from fabricatio.models.action import Action
|
17
17
|
from fabricatio.models.extra.article_essence import ArticleEssence
|
18
|
-
from fabricatio.models.extra.article_main import Article
|
18
|
+
from fabricatio.models.extra.article_main import Article, ArticleChapter, ArticleSubsection
|
19
19
|
from fabricatio.models.extra.article_outline import ArticleOutline
|
20
20
|
from fabricatio.models.extra.article_proposal import ArticleProposal
|
21
21
|
from fabricatio.models.extra.rule import RuleSet
|
22
22
|
from fabricatio.models.kwargs_types import ValidateKwargs
|
23
23
|
from fabricatio.models.task import Task
|
24
24
|
from fabricatio.models.usages import LLMUsage
|
25
|
-
from fabricatio.rust import CONFIG, TEMPLATE_MANAGER, BibManager, detect_language
|
25
|
+
from fabricatio.rust import CONFIG, TEMPLATE_MANAGER, BibManager, detect_language, word_count
|
26
26
|
from fabricatio.utils import ok, wrapp_in_block
|
27
27
|
|
28
28
|
|
@@ -277,43 +277,139 @@ class LoadArticle(Action):
|
|
277
277
|
class WriteChapterSummary(Action, LLMUsage):
|
278
278
|
"""Write the chapter summary."""
|
279
279
|
|
280
|
-
|
280
|
+
ctx_override: ClassVar[bool] = True
|
281
281
|
|
282
282
|
paragraph_count: int = 1
|
283
|
+
"""The number of paragraphs to generate in the chapter summary."""
|
283
284
|
|
284
|
-
summary_word_count: int =
|
285
|
-
|
285
|
+
summary_word_count: int = 120
|
286
|
+
"""The number of words to use in each chapter summary."""
|
287
|
+
output_key: str = "summarized_article"
|
288
|
+
"""The key under which the summarized article will be stored in the output."""
|
286
289
|
summary_title: str = "Chapter Summary"
|
287
|
-
|
290
|
+
"""The title to be used for the generated chapter summary section."""
|
291
|
+
|
292
|
+
skip_chapters: List[str] = Field(default_factory=list)
|
293
|
+
"""A list of chapter titles to skip during summary generation."""
|
294
|
+
|
295
|
+
async def _execute(self, article_path: Path, **cxt) -> Article:
|
296
|
+
article = Article.from_article_file(article_path, article_path.stem)
|
297
|
+
|
298
|
+
chaps = [c for c in article.chapters if c.title not in self.skip_chapters]
|
299
|
+
|
300
|
+
retained_chapters = []
|
301
|
+
# Count chapters before filtering based on section presence,
|
302
|
+
# chaps at this point has already been filtered by self.skip_chapters
|
303
|
+
initial_chaps_for_summary_step_count = len(chaps)
|
304
|
+
|
305
|
+
for chapter_candidate in chaps:
|
306
|
+
if chapter_candidate.sections: # Check if the sections list is non-empty
|
307
|
+
retained_chapters.append(chapter_candidate)
|
308
|
+
else:
|
309
|
+
# Log c warning for each chapter skipped due to lack of sections
|
310
|
+
logger.warning(
|
311
|
+
f"Chapter '{chapter_candidate.title}' has no sections and will be skipped for summary generation."
|
312
|
+
)
|
313
|
+
|
314
|
+
chaps = retained_chapters # Update chaps to only include chapters with sections
|
288
315
|
|
289
|
-
|
290
|
-
|
316
|
+
# If chaps is now empty, but there were chapters to consider at the start of this step,
|
317
|
+
# log c specific warning.
|
318
|
+
if not chaps and initial_chaps_for_summary_step_count > 0:
|
319
|
+
raise ValueError("No chapters with sections were found. Please check your input data.")
|
291
320
|
|
321
|
+
# This line was part of the original selection.
|
322
|
+
# It will now log the titles of the chapters that are actually being processed (those with sections).
|
323
|
+
# If 'chaps' is empty, this will result in logger.info(""), which is acceptable.
|
324
|
+
logger.info(";".join(a.title for a in chaps))
|
292
325
|
ret = [
|
293
|
-
|
326
|
+
ArticleSubsection.from_typst_code(self.summary_title, raw)
|
294
327
|
for raw in (
|
295
328
|
await self.aask(
|
296
329
|
TEMPLATE_MANAGER.render_template(
|
297
330
|
CONFIG.templates.chap_summary_template,
|
298
331
|
[
|
299
332
|
{
|
300
|
-
"chapter":
|
301
|
-
"title":
|
302
|
-
"language":
|
333
|
+
"chapter": c.to_typst_code(),
|
334
|
+
"title": c.title,
|
335
|
+
"language": c.language,
|
303
336
|
"summary_word_count": self.summary_word_count,
|
304
337
|
"paragraph_count": self.paragraph_count,
|
305
338
|
}
|
306
|
-
for
|
339
|
+
for c in chaps
|
307
340
|
],
|
308
341
|
)
|
309
342
|
)
|
310
343
|
)
|
311
344
|
]
|
312
345
|
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
346
|
+
for c, n in zip(chaps, ret, strict=True):
|
347
|
+
c: ArticleChapter
|
348
|
+
n: ArticleSubsection
|
349
|
+
if c.sections[-1].title == self.summary_title:
|
350
|
+
logger.debug(f"Removing old summary `{self.summary_title}` at {c.title}")
|
351
|
+
c.sections.pop()
|
352
|
+
|
353
|
+
c.sections[-1].subsections.append(n)
|
354
|
+
|
355
|
+
article.update_article_file(article_path)
|
356
|
+
|
357
|
+
dump_text(
|
358
|
+
article_path, safe_text_read(article_path).replace(f"=== {self.summary_title}", f"== {self.summary_title}")
|
359
|
+
)
|
360
|
+
return article
|
361
|
+
|
362
|
+
|
363
|
+
class WriteResearchContentSummary(Action, LLMUsage):
|
364
|
+
"""Write the research content summary."""
|
365
|
+
|
366
|
+
ctx_override: ClassVar[bool] = True
|
367
|
+
summary_word_count: int = 160
|
368
|
+
"""The number of words to use in the research content summary."""
|
369
|
+
|
370
|
+
output_key: str = "summarized_article"
|
371
|
+
"""The key under which the summarized article will be stored in the output."""
|
372
|
+
|
373
|
+
summary_title: str = "Research Content"
|
374
|
+
"""The title to be used for the generated research content summary section."""
|
375
|
+
|
376
|
+
paragraph_count: int = 1
|
377
|
+
"""The number of paragraphs to generate in the research content summary."""
|
378
|
+
|
379
|
+
async def _execute(self, article_path: Path, **cxt) -> Article:
|
380
|
+
article = Article.from_article_file(article_path, article_path.stem)
|
381
|
+
if not article.chapters:
|
382
|
+
raise ValueError("No chapters found in the article.")
|
383
|
+
chap_1 = article.chapters[0]
|
384
|
+
if not chap_1.sections:
|
385
|
+
raise ValueError("No sections found in the first chapter of the article.")
|
386
|
+
|
387
|
+
outline = article.extrac_outline()
|
388
|
+
suma: str = await self.aask(
|
389
|
+
TEMPLATE_MANAGER.render_template(
|
390
|
+
CONFIG.templates.research_content_summary_template,
|
391
|
+
{
|
392
|
+
"title": outline.title,
|
393
|
+
"outline": outline.to_typst_code(),
|
394
|
+
"language": detect_language(self.summary_title),
|
395
|
+
"summary_word_count": self.summary_word_count,
|
396
|
+
"paragraph_count": self.paragraph_count,
|
397
|
+
},
|
317
398
|
)
|
399
|
+
)
|
400
|
+
logger.success(
|
401
|
+
f"{self.summary_title}|Wordcount: {word_count(suma)}|Expected: {self.summary_word_count}\n{suma}"
|
402
|
+
)
|
403
|
+
|
404
|
+
if chap_1.sections[-1].title == self.summary_title:
|
405
|
+
# remove old
|
406
|
+
logger.debug(f"Removing old summary `{self.summary_title}`")
|
407
|
+
chap_1.sections.pop()
|
318
408
|
|
319
|
-
|
409
|
+
chap_1.sections[-1].subsections.append(ArticleSubsection.from_typst_code(self.summary_title, suma))
|
410
|
+
|
411
|
+
article.update_article_file(article_path)
|
412
|
+
dump_text(
|
413
|
+
article_path, safe_text_read(article_path).replace(f"=== {self.summary_title}", f"== {self.summary_title}")
|
414
|
+
)
|
415
|
+
return article
|
@@ -1,11 +1,11 @@
|
|
1
1
|
"""A module for writing articles using RAG (Retrieval-Augmented Generation) capabilities."""
|
2
2
|
|
3
3
|
from asyncio import gather
|
4
|
-
|
5
4
|
from pathlib import Path
|
6
|
-
from pydantic import Field, PositiveInt
|
7
5
|
from typing import ClassVar, List, Optional
|
8
6
|
|
7
|
+
from pydantic import Field, PositiveInt
|
8
|
+
|
9
9
|
from fabricatio.capabilities.advanced_rag import AdvancedRAG
|
10
10
|
from fabricatio.capabilities.censor import Censor
|
11
11
|
from fabricatio.capabilities.extract import Extract
|
@@ -75,11 +75,11 @@ class WriteArticleContentRAG(Action, Extract, AdvancedRAG):
|
|
75
75
|
tei_endpoint: Optional[str] = None
|
76
76
|
|
77
77
|
async def _execute(
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
78
|
+
self,
|
79
|
+
article_outline: ArticleOutline,
|
80
|
+
collection_name: Optional[str] = None,
|
81
|
+
supervisor: Optional[bool] = None,
|
82
|
+
**cxt,
|
83
83
|
) -> Article:
|
84
84
|
article = Article.from_outline(article_outline).update_ref(article_outline)
|
85
85
|
self.target_collection = collection_name or self.safe_target_collection
|
@@ -100,12 +100,12 @@ class WriteArticleContentRAG(Action, Extract, AdvancedRAG):
|
|
100
100
|
"questionary", "`questionary` is required for supervisor mode, please install it by `fabricatio[qa]`"
|
101
101
|
)
|
102
102
|
async def _supervisor_inner(
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
103
|
+
self,
|
104
|
+
article: Article,
|
105
|
+
article_outline: ArticleOutline,
|
106
|
+
chap: ArticleChapter,
|
107
|
+
sec: ArticleSection,
|
108
|
+
subsec: ArticleSubsection,
|
109
109
|
) -> ArticleSubsection:
|
110
110
|
from questionary import confirm, text
|
111
111
|
from rich import print as r_print
|
@@ -133,12 +133,12 @@ class WriteArticleContentRAG(Action, Extract, AdvancedRAG):
|
|
133
133
|
return await self.extract_new_subsec(subsec, raw_paras, cm)
|
134
134
|
|
135
135
|
async def _inner(
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
136
|
+
self,
|
137
|
+
article: Article,
|
138
|
+
article_outline: ArticleOutline,
|
139
|
+
chap: ArticleChapter,
|
140
|
+
sec: ArticleSection,
|
141
|
+
subsec: ArticleSubsection,
|
142
142
|
) -> ArticleSubsection:
|
143
143
|
cm = CitationManager()
|
144
144
|
|
@@ -154,7 +154,7 @@ class WriteArticleContentRAG(Action, Extract, AdvancedRAG):
|
|
154
154
|
return await self.extract_new_subsec(subsec, raw_paras, cm)
|
155
155
|
|
156
156
|
async def extract_new_subsec(
|
157
|
-
|
157
|
+
self, subsec: ArticleSubsection, raw_paras: str, cm: CitationManager
|
158
158
|
) -> ArticleSubsection:
|
159
159
|
"""Extract the new subsec."""
|
160
160
|
new_subsec = ok(
|
@@ -177,14 +177,14 @@ class WriteArticleContentRAG(Action, Extract, AdvancedRAG):
|
|
177
177
|
return subsec
|
178
178
|
|
179
179
|
async def write_raw(
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
180
|
+
self,
|
181
|
+
article: Article,
|
182
|
+
article_outline: ArticleOutline,
|
183
|
+
chap: ArticleChapter,
|
184
|
+
sec: ArticleSection,
|
185
|
+
subsec: ArticleSubsection,
|
186
|
+
cm: CitationManager,
|
187
|
+
extra_instruction: str = "",
|
188
188
|
) -> str:
|
189
189
|
"""Write the raw paragraphs of the subsec."""
|
190
190
|
return await self.aask(
|
@@ -200,14 +200,14 @@ class WriteArticleContentRAG(Action, Extract, AdvancedRAG):
|
|
200
200
|
)
|
201
201
|
|
202
202
|
async def search_database(
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
203
|
+
self,
|
204
|
+
article: Article,
|
205
|
+
article_outline: ArticleOutline,
|
206
|
+
chap: ArticleChapter,
|
207
|
+
sec: ArticleSection,
|
208
|
+
subsec: ArticleSubsection,
|
209
|
+
cm: CitationManager,
|
210
|
+
extra_instruction: str = "",
|
211
211
|
) -> None:
|
212
212
|
"""Search database for related references."""
|
213
213
|
search_req = (
|
@@ -312,12 +312,12 @@ class TweakArticleRAG(Action, RAG, Censor):
|
|
312
312
|
"""The limit of references to be retrieved"""
|
313
313
|
|
314
314
|
async def _execute(
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
315
|
+
self,
|
316
|
+
article: Article,
|
317
|
+
collection_name: str = "article_essence",
|
318
|
+
twk_rag_ruleset: Optional[RuleSet] = None,
|
319
|
+
parallel: bool = False,
|
320
|
+
**cxt,
|
321
321
|
) -> Article:
|
322
322
|
"""Write an article based on the provided outline.
|
323
323
|
|
@@ -372,10 +372,10 @@ class TweakArticleRAG(Action, RAG, Censor):
|
|
372
372
|
subsec,
|
373
373
|
ruleset=ruleset,
|
374
374
|
reference=f"{'\n\n'.join(d.display() for d in await self.aretrieve(refind_q, document_model=ArticleEssence, max_accepted=self.ref_limit))}\n\n"
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
375
|
+
f"You can use Reference above to rewrite the `{subsec.__class__.__name__}`.\n"
|
376
|
+
f"You should Always use `{subsec.language}` as written language, "
|
377
|
+
f"which is the original language of the `{subsec.title}`. "
|
378
|
+
f"since rewrite a `{subsec.__class__.__name__}` in a different language is usually a bad choice",
|
379
379
|
)
|
380
380
|
|
381
381
|
|
@@ -390,12 +390,12 @@ class ChunkArticle(Action):
|
|
390
390
|
"""The maximum overlapping rate between chunks."""
|
391
391
|
|
392
392
|
async def _execute(
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
393
|
+
self,
|
394
|
+
article_path: str | Path,
|
395
|
+
bib_manager: BibManager,
|
396
|
+
max_chunk_size: Optional[int] = None,
|
397
|
+
max_overlapping_rate: Optional[float] = None,
|
398
|
+
**_,
|
399
399
|
) -> List[ArticleChunk]:
|
400
400
|
return ArticleChunk.from_file(
|
401
401
|
article_path,
|
@@ -235,6 +235,7 @@ def logging_exec_time[**P, R](
|
|
235
235
|
@wraps(func)
|
236
236
|
async def _async_wrapper(*args: P.args, **kwargs: P.kwargs) -> R:
|
237
237
|
start_time = time()
|
238
|
+
logger.debug(f"Starting execution of {func.__name__}")
|
238
239
|
result = await func(*args, **kwargs)
|
239
240
|
logger.debug(f"Execution time of `{func.__name__}`: {time() - start_time:.2f} s")
|
240
241
|
return result
|
@@ -244,6 +245,7 @@ def logging_exec_time[**P, R](
|
|
244
245
|
@wraps(func)
|
245
246
|
def _wrapper(*args: P.args, **kwargs: P.kwargs) -> R:
|
246
247
|
start_time = time()
|
248
|
+
logger.debug(f"Starting execution of {func.__name__}")
|
247
249
|
result = func(*args, **kwargs)
|
248
250
|
logger.debug(f"Execution time of {func.__name__}: {(time() - start_time) * 1000:.2f} ms")
|
249
251
|
return result
|