fabricatio 0.2.11.dev2__tar.gz → 0.2.11.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.11.dev2 → fabricatio-0.2.11.dev3}/PKG-INFO +4 -2
- fabricatio-0.2.11.dev3/examples/write_article/write_article.py +140 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/pyproject.toml +5 -2
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/python/fabricatio/actions/article.py +20 -4
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/python/fabricatio/actions/article_rag.py +6 -4
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/python/fabricatio/models/action.py +14 -7
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/python/fabricatio/models/task.py +13 -1
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/python/fabricatio/models/usages.py +1 -1
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/python/fabricatio/utils.py +4 -4
- fabricatio-0.2.11.dev3/templates.tar.gz +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/uv.lock +36 -3
- fabricatio-0.2.11.dev2/examples/write_article/write_article.py +0 -90
- fabricatio-0.2.11.dev2/templates.tar.gz +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/.github/workflows/build-package.yaml +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/.github/workflows/ruff.yaml +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/.github/workflows/tests.yaml +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/.gitignore +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/.python-version +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/Cargo.lock +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/Cargo.toml +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/LICENSE +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/Makefile +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/README.md +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/examples/correct/correct.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/examples/correct/correct_loop.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/examples/extract_and_inject/.gitignore +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/examples/extract_and_inject/article_rag.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/examples/extract_and_inject/ask.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/examples/extract_and_inject/chunk_article.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/examples/extract_and_inject/extract_and_inject.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/examples/extract_article/extract.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/examples/llm_usages/llm_usage.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/examples/make_a_rating/rating.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/examples/make_diary/commits.json +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/examples/make_diary/diary.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/examples/minor/hello_fabricatio.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/examples/minor/write_a_poem.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/examples/propose_task/.gitignore +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/examples/propose_task/propose.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/examples/reviewer/censor.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/examples/reviewer/review.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/examples/rules/.gitignore +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/examples/rules/draft_ruleset.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/examples/search_bibtex/.gitignore +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/examples/search_bibtex/search.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/examples/simple_chat/chat.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/examples/simple_rag/simple_rag.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/examples/task_handle/handle_task.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/examples/write_article/.gitignore +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/examples/write_article/article_rag.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/examples/write_article/post_process.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/examples/write_outline/.gitignore +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/examples/write_outline/write_outline.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/examples/write_outline/write_outline_corrected.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/python/fabricatio/__init__.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/python/fabricatio/actions/__init__.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/python/fabricatio/actions/fs.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/python/fabricatio/actions/output.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/python/fabricatio/actions/rag.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/python/fabricatio/actions/rules.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/python/fabricatio/capabilities/__init__.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/python/fabricatio/capabilities/advanced_judge.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/python/fabricatio/capabilities/censor.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/python/fabricatio/capabilities/check.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/python/fabricatio/capabilities/correct.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/python/fabricatio/capabilities/extract.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/python/fabricatio/capabilities/propose.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/python/fabricatio/capabilities/rag.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/python/fabricatio/capabilities/rating.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/python/fabricatio/capabilities/review.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/python/fabricatio/capabilities/task.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/python/fabricatio/config.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/python/fabricatio/constants.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/python/fabricatio/core.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/python/fabricatio/decorators.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/python/fabricatio/fs/__init__.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/python/fabricatio/fs/curd.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/python/fabricatio/fs/readers.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/python/fabricatio/journal.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/python/fabricatio/models/adv_kwargs_types.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/python/fabricatio/models/events.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/python/fabricatio/models/extra/__init__.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/python/fabricatio/models/extra/advanced_judge.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/python/fabricatio/models/extra/aricle_rag.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/python/fabricatio/models/extra/article_base.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/python/fabricatio/models/extra/article_essence.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/python/fabricatio/models/extra/article_main.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/python/fabricatio/models/extra/article_outline.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/python/fabricatio/models/extra/article_proposal.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/python/fabricatio/models/extra/patches.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/python/fabricatio/models/extra/problem.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/python/fabricatio/models/extra/rag.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/python/fabricatio/models/extra/rule.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/python/fabricatio/models/generic.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/python/fabricatio/models/kwargs_types.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/python/fabricatio/models/role.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/python/fabricatio/models/tool.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/python/fabricatio/parser.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/python/fabricatio/py.typed +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/python/fabricatio/rust.pyi +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/python/fabricatio/rust_instances.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/python/fabricatio/toolboxes/__init__.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/python/fabricatio/toolboxes/arithmetic.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/python/fabricatio/toolboxes/fs.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/python/fabricatio/workflows/__init__.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/python/fabricatio/workflows/articles.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/python/fabricatio/workflows/rag.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/src/bib_tools.rs +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/src/hash.rs +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/src/hbs_helpers.rs +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/src/language.rs +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/src/lib.rs +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/src/templates.rs +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/src/typst_tools.rs +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/src/word_split.rs +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/templates/built-in/as_prompt.hbs +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/templates/built-in/binary-exploitation-ctf-solver.hbs +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/templates/built-in/check_string.hbs +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/templates/built-in/claude-xml.hbs +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/templates/built-in/clean-up-code.hbs +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/templates/built-in/co_validation.hbs +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/templates/built-in/create_json_obj.hbs +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/templates/built-in/cryptography-ctf-solver.hbs +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/templates/built-in/dependencies.hbs +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/templates/built-in/document-the-code.hbs +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/templates/built-in/draft_rating_criteria.hbs +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/templates/built-in/draft_rating_manual.hbs +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/templates/built-in/draft_rating_weights_klee.hbs +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/templates/built-in/draft_tool_usage_code.hbs +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/templates/built-in/extract.hbs +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/templates/built-in/extract_criteria_from_reasons.hbs +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/templates/built-in/extract_reasons_from_examples.hbs +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/templates/built-in/find-security-vulnerabilities.hbs +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/templates/built-in/fix-bugs.hbs +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/templates/built-in/fix_troubled_obj.hbs +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/templates/built-in/fix_troubled_string.hbs +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/templates/built-in/generic_string.hbs +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/templates/built-in/improve-performance.hbs +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/templates/built-in/liststr.hbs +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/templates/built-in/make_choice.hbs +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/templates/built-in/make_judgment.hbs +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/templates/built-in/pathstr.hbs +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/templates/built-in/rate_fine_grind.hbs +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/templates/built-in/refactor.hbs +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/templates/built-in/refined_query.hbs +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/templates/built-in/retrieved_display.hbs +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/templates/built-in/reverse-engineering-ctf-solver.hbs +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/templates/built-in/review_string.hbs +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/templates/built-in/rule_requirement.hbs +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/templates/built-in/ruleset_requirement_breakdown.hbs +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/templates/built-in/task_briefing.hbs +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/templates/built-in/web-ctf-solver.hbs +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/templates/built-in/write-git-commit.hbs +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/templates/built-in/write-github-pull-request.hbs +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/templates/built-in/write-github-readme.hbs +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/tests/test_config.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/tests/test_models/test_action.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/tests/test_models/test_advanced.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/tests/test_models/test_generic.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/tests/test_models/test_problem.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/tests/test_models/test_role.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/tests/test_models/test_task.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/tests/test_models/test_tool.py +0 -0
- {fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/tests/test_models/test_usages.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: fabricatio
|
3
|
-
Version: 0.2.11.
|
3
|
+
Version: 0.2.11.dev3
|
4
4
|
Classifier: License :: OSI Approved :: MIT License
|
5
5
|
Classifier: Programming Language :: Rust
|
6
6
|
Classifier: Programming Language :: Python :: 3.12
|
@@ -20,18 +20,20 @@ Requires-Dist: pydantic-settings>=2.7.1
|
|
20
20
|
Requires-Dist: pymitter>=1.0.0
|
21
21
|
Requires-Dist: rich>=13.9.4
|
22
22
|
Requires-Dist: ujson>=5.10.0
|
23
|
-
Requires-Dist: fabricatio[calc,ftd,plot,qa,rag] ; extra == 'full'
|
23
|
+
Requires-Dist: fabricatio[calc,ftd,plot,qa,rag,cli] ; extra == 'full'
|
24
24
|
Requires-Dist: pymilvus>=2.5.4 ; extra == 'rag'
|
25
25
|
Requires-Dist: sympy>=1.13.3 ; extra == 'calc'
|
26
26
|
Requires-Dist: matplotlib>=3.10.1 ; extra == 'plot'
|
27
27
|
Requires-Dist: questionary>=2.1.0 ; extra == 'qa'
|
28
28
|
Requires-Dist: magika>=0.6.1 ; extra == 'ftd'
|
29
|
+
Requires-Dist: typer-slim[standard]>=0.15.2 ; extra == 'cli'
|
29
30
|
Provides-Extra: full
|
30
31
|
Provides-Extra: rag
|
31
32
|
Provides-Extra: calc
|
32
33
|
Provides-Extra: plot
|
33
34
|
Provides-Extra: qa
|
34
35
|
Provides-Extra: ftd
|
36
|
+
Provides-Extra: cli
|
35
37
|
License-File: LICENSE
|
36
38
|
Summary: A LLM multi-agent framework.
|
37
39
|
Keywords: ai,agents,multi-agent,llm,pyo3
|
@@ -0,0 +1,140 @@
|
|
1
|
+
"""Example of using the library."""
|
2
|
+
|
3
|
+
import asyncio
|
4
|
+
from pathlib import Path
|
5
|
+
|
6
|
+
import typer
|
7
|
+
from fabricatio import Event, Role, WorkFlow, logger
|
8
|
+
from fabricatio.actions.article import ExtractOutlineFromRaw, GenerateArticleProposal, GenerateInitialOutline
|
9
|
+
from fabricatio.actions.article_rag import WriteArticleContentRAG
|
10
|
+
from fabricatio.actions.output import (
|
11
|
+
DumpFinalizedOutput,
|
12
|
+
PersistentAll,
|
13
|
+
)
|
14
|
+
from fabricatio.models.task import Task
|
15
|
+
from fabricatio.utils import ok
|
16
|
+
from typer import Typer
|
17
|
+
|
18
|
+
Role(
|
19
|
+
name="Undergraduate Researcher",
|
20
|
+
description="Write an outline for an article in typst format.",
|
21
|
+
llm_model="openai/qwen-max",
|
22
|
+
llm_temperature=0.63,
|
23
|
+
llm_stream=True,
|
24
|
+
llm_top_p=0.85,
|
25
|
+
llm_max_tokens=8191,
|
26
|
+
llm_rpm=600,
|
27
|
+
llm_tpm=900000,
|
28
|
+
registry={
|
29
|
+
Event.quick_instantiate(ns := "article"): WorkFlow(
|
30
|
+
name="Generate Article",
|
31
|
+
description="Generate an article. dump the outline to the given path. in typst format.",
|
32
|
+
steps=(
|
33
|
+
GenerateArticleProposal,
|
34
|
+
GenerateInitialOutline(output_key="article_outline"),
|
35
|
+
PersistentAll,
|
36
|
+
WriteArticleContentRAG(
|
37
|
+
output_key="to_dump",
|
38
|
+
llm_top_p=0.9,
|
39
|
+
ref_limit=35,
|
40
|
+
llm_model="openai/qwq-plus",
|
41
|
+
target_collection="article_chunks",
|
42
|
+
extractor_model="openai/qwen-plus",
|
43
|
+
query_model="openai/qwen-max",
|
44
|
+
),
|
45
|
+
DumpFinalizedOutput(output_key="task_output"),
|
46
|
+
PersistentAll,
|
47
|
+
),
|
48
|
+
),
|
49
|
+
Event.quick_instantiate(ns2 := ""): WorkFlow(
|
50
|
+
name="Generate Article",
|
51
|
+
description="Generate an article with given raw article outline. dump the outline to the given path. in typst format.",
|
52
|
+
steps=(
|
53
|
+
ExtractOutlineFromRaw,
|
54
|
+
PersistentAll,
|
55
|
+
WriteArticleContentRAG(
|
56
|
+
output_key="to_dump",
|
57
|
+
llm_top_p=0.9,
|
58
|
+
ref_limit=35,
|
59
|
+
llm_model="openai/qwq-plus",
|
60
|
+
target_collection="article_chunks",
|
61
|
+
extractor_model="openai/qwen-plus",
|
62
|
+
query_model="openai/qwen-max",
|
63
|
+
),
|
64
|
+
DumpFinalizedOutput(output_key="task_output"),
|
65
|
+
PersistentAll,
|
66
|
+
),
|
67
|
+
),
|
68
|
+
},
|
69
|
+
)
|
70
|
+
|
71
|
+
|
72
|
+
app = Typer()
|
73
|
+
|
74
|
+
|
75
|
+
@app.command()
|
76
|
+
def completion(
|
77
|
+
article_outline_raw_path: Path = typer.Option( # noqa: B008
|
78
|
+
Path("article_outline_raw.txt"), "-a", "--article-outline-raw", help="Path to the article outline raw file."
|
79
|
+
),
|
80
|
+
dump_path: Path = typer.Option(Path("out.typ"), "-d", "--dump-path", help="Path to dump the final output."), # noqa: B008
|
81
|
+
persist_dir: Path = typer.Option( # noqa: B008
|
82
|
+
Path("persistent"), "-p", "--persist-dir", help="Directory to persist the output."
|
83
|
+
),
|
84
|
+
collection_name: str = typer.Option("article_chunks", "-c", "--collection-name", help="Name of the collection."),
|
85
|
+
supervisor: bool = typer.Option(False, "-s", "--supervisor", help="Whether to use the supervisor mode."),
|
86
|
+
) -> None:
|
87
|
+
"""Write an article based on a raw article outline."""
|
88
|
+
path = ok(
|
89
|
+
asyncio.run(
|
90
|
+
Task(name="write an article")
|
91
|
+
.update_init_context(
|
92
|
+
article_outline_raw_path=article_outline_raw_path,
|
93
|
+
dump_path=dump_path,
|
94
|
+
persist_dir=persist_dir,
|
95
|
+
collection_name=collection_name,
|
96
|
+
supervisor=supervisor,
|
97
|
+
)
|
98
|
+
.delegate(ns)
|
99
|
+
),
|
100
|
+
"Failed to generate an article ",
|
101
|
+
)
|
102
|
+
logger.success(f"The outline is saved in:\n{path}")
|
103
|
+
|
104
|
+
|
105
|
+
@app.command()
|
106
|
+
def write(
|
107
|
+
article_briefing: Path = typer.Option( # noqa: B008
|
108
|
+
Path("article_briefing.txt"), "-a", "--article-briefing", help="Path to the article briefing file."
|
109
|
+
),
|
110
|
+
dump_path: Path = typer.Option(Path("out.typ"), "-d", "--dump-path", help="Path to dump the final output."), # noqa: B008
|
111
|
+
persist_dir: Path = typer.Option( # noqa: B008
|
112
|
+
Path("persistent"), "-p", "--persist-dir", help="Directory to persist the output."
|
113
|
+
),
|
114
|
+
collection_name: str = typer.Option("article_chunks", "-c", "--collection-name", help="Name of the collection."),
|
115
|
+
supervisor: bool = typer.Option(False, "-s", "--supervisor", help="Whether to use the supervisor mode."),
|
116
|
+
) -> None:
|
117
|
+
"""Write an article based on a briefing.
|
118
|
+
|
119
|
+
This function generates an article outline and content based on the provided briefing.
|
120
|
+
The outline and content are then dumped to the specified path and persisted in the given directory.
|
121
|
+
"""
|
122
|
+
path = ok(
|
123
|
+
asyncio.run(
|
124
|
+
Task(name="write an article")
|
125
|
+
.update_init_context(
|
126
|
+
article_briefing=article_briefing.read_text(),
|
127
|
+
dump_path=dump_path,
|
128
|
+
persist_dir=persist_dir,
|
129
|
+
collection_name=collection_name,
|
130
|
+
supervisor=supervisor,
|
131
|
+
)
|
132
|
+
.delegate(ns)
|
133
|
+
),
|
134
|
+
"Failed to generate an article ",
|
135
|
+
)
|
136
|
+
logger.success(f"The outline is saved in:\n{path}")
|
137
|
+
|
138
|
+
|
139
|
+
if __name__ == "__main__":
|
140
|
+
app()
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[project]
|
2
2
|
name = "fabricatio"
|
3
|
-
version = "0.2.11-
|
3
|
+
version = "0.2.11-dev3"
|
4
4
|
description = "A LLM multi-agent framework."
|
5
5
|
readme = "README.md"
|
6
6
|
license = { file = "LICENSE" }
|
@@ -74,7 +74,7 @@ dev = [
|
|
74
74
|
|
75
75
|
[project.optional-dependencies]
|
76
76
|
full = [
|
77
|
-
"fabricatio[calc,ftd,plot,qa,rag]",
|
77
|
+
"fabricatio[calc,ftd,plot,qa,rag,cli]",
|
78
78
|
]
|
79
79
|
rag = [
|
80
80
|
"pymilvus>=2.5.4",
|
@@ -92,6 +92,9 @@ qa = [
|
|
92
92
|
ftd = [
|
93
93
|
"magika>=0.6.1",
|
94
94
|
]
|
95
|
+
cli = [
|
96
|
+
"typer-slim[standard]>=0.15.2",
|
97
|
+
]
|
95
98
|
|
96
99
|
[tool.ruff]
|
97
100
|
include = ["pyproject.toml", "python/fabricatio/*.py", "python/fabricatio/*.pyi", "examples/*.py"]
|
@@ -149,10 +149,10 @@ class GenerateInitialOutline(Action, Extract):
|
|
149
149
|
async def _execute(
|
150
150
|
self,
|
151
151
|
article_proposal: ArticleProposal,
|
152
|
+
supervisor: Optional[bool] = None,
|
152
153
|
**_,
|
153
154
|
) -> Optional[ArticleOutline]:
|
154
|
-
|
155
|
-
f"{(article_proposal.as_prompt())}\n"
|
155
|
+
req = (
|
156
156
|
f"Design each chapter of a proper and academic and ready for release manner.\n"
|
157
157
|
f"You Must make sure every chapter have sections, and every section have subsections.\n"
|
158
158
|
f"Make the chapter and sections and subsections bing divided into a specific enough article component.\n"
|
@@ -160,14 +160,16 @@ class GenerateInitialOutline(Action, Extract):
|
|
160
160
|
f"Note that you SHALL use `{article_proposal.language}` as written language",
|
161
161
|
)
|
162
162
|
|
163
|
-
|
163
|
+
raw_outline = await self.aask(f"{(article_proposal.as_prompt())}\n{req}")
|
164
|
+
|
165
|
+
if supervisor or (supervisor is None and self.supervisor):
|
164
166
|
from questionary import confirm, text
|
165
167
|
|
166
168
|
r_print(raw_outline)
|
167
169
|
while not await confirm("Accept this version and continue?", default=True).ask_async():
|
168
170
|
imp = await text("Enter the improvement:").ask_async()
|
169
171
|
raw_outline = await self.aask(
|
170
|
-
f"{article_proposal.as_prompt()}\n{wrapp_in_block(raw_outline, 'Previous ArticleOutline')}\n{imp}"
|
172
|
+
f"{article_proposal.as_prompt()}\n{wrapp_in_block(raw_outline, 'Previous ArticleOutline')}\n{req}\n{wrapp_in_block(imp, title='Improvement')}"
|
171
173
|
)
|
172
174
|
r_print(raw_outline)
|
173
175
|
|
@@ -177,6 +179,20 @@ class GenerateInitialOutline(Action, Extract):
|
|
177
179
|
).update_ref(article_proposal)
|
178
180
|
|
179
181
|
|
182
|
+
class ExtractOutlineFromRaw(Action, Extract):
|
183
|
+
"""Extract the outline from the raw outline."""
|
184
|
+
|
185
|
+
output_key: str = "article_outline_from_raw"
|
186
|
+
|
187
|
+
async def _execute(self, article_outline_raw_path: str | Path, **cxt) -> ArticleOutline:
|
188
|
+
logger.info(f"Extracting outline from raw: {Path(article_outline_raw_path).as_posix()}")
|
189
|
+
|
190
|
+
return ok(
|
191
|
+
await self.extract(ArticleOutline, safe_text_read(article_outline_raw_path)),
|
192
|
+
"Could not extract the outline from raw.",
|
193
|
+
)
|
194
|
+
|
195
|
+
|
180
196
|
class FixIntrospectedErrors(Action, Censor):
|
181
197
|
"""Fix introspected errors in the article outline."""
|
182
198
|
|
@@ -56,13 +56,13 @@ class WriteArticleContentRAG(Action, RAG, Extract):
|
|
56
56
|
async def _execute(
|
57
57
|
self,
|
58
58
|
article_outline: ArticleOutline,
|
59
|
-
writing_ruleset: RuleSet,
|
60
59
|
collection_name: str = "article_chunks",
|
60
|
+
supervisor: Optional[bool] = None,
|
61
61
|
**cxt,
|
62
62
|
) -> Article:
|
63
63
|
article = Article.from_outline(article_outline).update_ref(article_outline)
|
64
64
|
|
65
|
-
if self.supervisor:
|
65
|
+
if supervisor or (supervisor is None and self.supervisor):
|
66
66
|
await gather(
|
67
67
|
*[
|
68
68
|
self._supervisor_inner(article, article_outline, chap, sec, subsec)
|
@@ -98,9 +98,10 @@ class WriteArticleContentRAG(Action, RAG, Extract):
|
|
98
98
|
|
99
99
|
raw = await self.write_raw(article, article_outline, chap, sec, subsec, cm)
|
100
100
|
r_print(raw)
|
101
|
+
|
101
102
|
while not await confirm("Accept this version and continue?").ask_async():
|
102
103
|
if await confirm("Search for more refs?").ask_async():
|
103
|
-
new_refs = await self.search_database(article, article_outline, chap, sec, subsec)
|
104
|
+
new_refs = await self.search_database(article, article_outline, chap, sec, subsec, supervisor=True)
|
104
105
|
cm.add_chunks(await ask_retain([r.chunk for r in new_refs], new_refs))
|
105
106
|
|
106
107
|
instruction = await text("Enter the instructions to improve").ask_async()
|
@@ -185,6 +186,7 @@ class WriteArticleContentRAG(Action, RAG, Extract):
|
|
185
186
|
sec: ArticleSection,
|
186
187
|
subsec: ArticleSubsection,
|
187
188
|
extra_instruction: str = "",
|
189
|
+
supervisor: bool = False,
|
188
190
|
) -> List[ArticleChunk]:
|
189
191
|
"""Search database for related references."""
|
190
192
|
ref_q = ok(
|
@@ -199,7 +201,7 @@ class WriteArticleContentRAG(Action, RAG, Extract):
|
|
199
201
|
"Failed to refine query.",
|
200
202
|
)
|
201
203
|
|
202
|
-
if
|
204
|
+
if supervisor:
|
203
205
|
ref_q = await ask_retain(ref_q)
|
204
206
|
|
205
207
|
return await self.aretrieve(
|
@@ -18,6 +18,7 @@ from fabricatio.journal import logger
|
|
18
18
|
from fabricatio.models.generic import WithBriefing
|
19
19
|
from fabricatio.models.task import Task
|
20
20
|
from fabricatio.models.usages import LLMUsage, ToolBoxUsage
|
21
|
+
from fabricatio.utils import override_kwargs
|
21
22
|
from pydantic import Field, PrivateAttr
|
22
23
|
|
23
24
|
OUTPUT_KEY = "task_output"
|
@@ -55,7 +56,7 @@ class Action(WithBriefing, LLMUsage):
|
|
55
56
|
self.description = self.description or self.__class__.__doc__ or ""
|
56
57
|
|
57
58
|
@abstractmethod
|
58
|
-
async def _execute(self, *_:Any, **cxt) -> Any:
|
59
|
+
async def _execute(self, *_: Any, **cxt) -> Any:
|
59
60
|
"""Implement the core logic of the action.
|
60
61
|
|
61
62
|
Args:
|
@@ -95,11 +96,12 @@ class Action(WithBriefing, LLMUsage):
|
|
95
96
|
return f"## Your personality: \n{self.personality}\n# The action you are going to perform: \n{super().briefing}"
|
96
97
|
return f"# The action you are going to perform: \n{super().briefing}"
|
97
98
|
|
98
|
-
def to_task_output(self)->Self:
|
99
|
+
def to_task_output(self) -> Self:
|
99
100
|
"""Set the output key to OUTPUT_KEY and return the action instance."""
|
100
|
-
self.output_key=OUTPUT_KEY
|
101
|
+
self.output_key = OUTPUT_KEY
|
101
102
|
return self
|
102
103
|
|
104
|
+
|
103
105
|
class WorkFlow(WithBriefing, ToolBoxUsage):
|
104
106
|
"""Manages sequences of actions to fulfill tasks.
|
105
107
|
|
@@ -177,7 +179,7 @@ class WorkFlow(WithBriefing, ToolBoxUsage):
|
|
177
179
|
current_action = None
|
178
180
|
try:
|
179
181
|
# Process each action in sequence
|
180
|
-
for i,step in enumerate(self._instances):
|
182
|
+
for i, step in enumerate(self._instances):
|
181
183
|
current_action = step.name
|
182
184
|
logger.info(f"Executing step [{i}] >> {current_action}")
|
183
185
|
|
@@ -227,8 +229,13 @@ class WorkFlow(WithBriefing, ToolBoxUsage):
|
|
227
229
|
- Any extra_init_context values
|
228
230
|
"""
|
229
231
|
logger.debug(f"Initializing context for workflow: {self.name}")
|
230
|
-
|
231
|
-
|
232
|
+
ctx = override_kwargs(self.extra_init_context, **task.extra_init_context)
|
233
|
+
if self.task_input_key in ctx:
|
234
|
+
raise ValueError(
|
235
|
+
f"Task input key: `{self.task_input_key}`, which is reserved, is already set in the init context"
|
236
|
+
)
|
237
|
+
|
238
|
+
await self._context.put({self.task_input_key: task, **ctx})
|
232
239
|
|
233
240
|
def steps_fallback_to_self(self) -> Self:
|
234
241
|
"""Configure all steps to use this workflow's configuration as fallback.
|
@@ -245,7 +252,7 @@ class WorkFlow(WithBriefing, ToolBoxUsage):
|
|
245
252
|
Returns:
|
246
253
|
Self: The workflow instance for method chaining.
|
247
254
|
"""
|
248
|
-
self.provide_tools_to(i for i in self._instances if isinstance(i,ToolBoxUsage))
|
255
|
+
self.provide_tools_to(i for i in self._instances if isinstance(i, ToolBoxUsage))
|
249
256
|
return self
|
250
257
|
|
251
258
|
def update_init_context(self, /, **kwargs) -> Self:
|
@@ -4,7 +4,7 @@ It includes methods to manage the task's lifecycle, such as starting, finishing,
|
|
4
4
|
"""
|
5
5
|
|
6
6
|
from asyncio import Queue
|
7
|
-
from typing import Any, List, Optional, Self
|
7
|
+
from typing import Any, Dict, List, Optional, Self
|
8
8
|
|
9
9
|
from fabricatio.config import configs
|
10
10
|
from fabricatio.constants import TaskStatus
|
@@ -50,6 +50,18 @@ class Task[T](WithBriefing, ProposedAble, WithDependency):
|
|
50
50
|
|
51
51
|
_namespace: Event = PrivateAttr(default_factory=Event)
|
52
52
|
"""The namespace of the task as an event, which is generated from the namespace list."""
|
53
|
+
_extra_init_context: Dict = PrivateAttr(default_factory=dict)
|
54
|
+
"""Extra initialization context for the task, which is designed to override the one of the Workflow."""
|
55
|
+
|
56
|
+
@property
|
57
|
+
def extra_init_context(self) -> Dict:
|
58
|
+
"""Extra initialization context for the task, which is designed to override the one of the Workflow."""
|
59
|
+
return self._extra_init_context
|
60
|
+
|
61
|
+
def update_init_context(self, /, **kwargs) -> Self:
|
62
|
+
"""Update the extra initialization context for the task."""
|
63
|
+
self.extra_init_context.update(kwargs)
|
64
|
+
return self
|
53
65
|
|
54
66
|
def model_post_init(self, __context: Any) -> None:
|
55
67
|
"""Initialize the task with a namespace event."""
|
@@ -31,7 +31,7 @@ from pydantic import BaseModel, ConfigDict, Field, NonNegativeInt, PositiveInt
|
|
31
31
|
|
32
32
|
if configs.cache.enabled and configs.cache.type:
|
33
33
|
litellm.enable_cache(type=configs.cache.type, **configs.cache.params)
|
34
|
-
logger.
|
34
|
+
logger.debug(f"{configs.cache.type.name} Cache enabled")
|
35
35
|
|
36
36
|
ROUTER = Router(
|
37
37
|
routing_strategy="usage-based-routing-v2",
|
@@ -54,14 +54,14 @@ async def ask_retain[V](candidates: List[str], value_mapping: Optional[List[V]]
|
|
54
54
|
def override_kwargs(kwargs: Mapping[str, Any], **overrides) -> Dict[str, Any]:
|
55
55
|
"""Override the values in kwargs with the provided overrides."""
|
56
56
|
new_kwargs = dict(kwargs.items())
|
57
|
-
new_kwargs.update(
|
57
|
+
new_kwargs.update(overrides)
|
58
58
|
return new_kwargs
|
59
59
|
|
60
60
|
|
61
|
-
def fallback_kwargs(kwargs: Mapping[str, Any], **
|
62
|
-
"""Fallback the values in kwargs with the provided
|
61
|
+
def fallback_kwargs(kwargs: Mapping[str, Any], **fallbacks) -> Dict[str, Any]:
|
62
|
+
"""Fallback the values in kwargs with the provided fallbacks."""
|
63
63
|
new_kwargs = dict(kwargs.items())
|
64
|
-
new_kwargs.update({k: v for k, v in
|
64
|
+
new_kwargs.update({k: v for k, v in fallbacks.items() if k not in new_kwargs})
|
65
65
|
return new_kwargs
|
66
66
|
|
67
67
|
|
Binary file
|
@@ -248,7 +248,7 @@ wheels = [
|
|
248
248
|
|
249
249
|
[[package]]
|
250
250
|
name = "fabricatio"
|
251
|
-
version = "0.2.11.
|
251
|
+
version = "0.2.11.dev3"
|
252
252
|
source = { editable = "." }
|
253
253
|
dependencies = [
|
254
254
|
{ name = "appdirs" },
|
@@ -269,6 +269,9 @@ dependencies = [
|
|
269
269
|
calc = [
|
270
270
|
{ name = "sympy" },
|
271
271
|
]
|
272
|
+
cli = [
|
273
|
+
{ name = "typer-slim", extra = ["standard"] },
|
274
|
+
]
|
272
275
|
ftd = [
|
273
276
|
{ name = "magika" },
|
274
277
|
]
|
@@ -278,6 +281,7 @@ full = [
|
|
278
281
|
{ name = "pymilvus" },
|
279
282
|
{ name = "questionary" },
|
280
283
|
{ name = "sympy" },
|
284
|
+
{ name = "typer-slim", extra = ["standard"] },
|
281
285
|
]
|
282
286
|
plot = [
|
283
287
|
{ name = "matplotlib" },
|
@@ -311,7 +315,7 @@ requires-dist = [
|
|
311
315
|
{ name = "appdirs", specifier = ">=1.4.4" },
|
312
316
|
{ name = "asyncio", specifier = ">=3.4.3" },
|
313
317
|
{ name = "asyncstdlib", specifier = ">=3.13.0" },
|
314
|
-
{ name = "fabricatio", extras = ["calc", "ftd", "plot", "qa", "rag"], marker = "extra == 'full'", editable = "." },
|
318
|
+
{ name = "fabricatio", extras = ["calc", "ftd", "plot", "qa", "rag", "cli"], marker = "extra == 'full'", editable = "." },
|
315
319
|
{ name = "json-repair", specifier = ">=0.39.1" },
|
316
320
|
{ name = "litellm", specifier = ">=1.60.0" },
|
317
321
|
{ name = "loguru", specifier = ">=0.7.3" },
|
@@ -325,9 +329,10 @@ requires-dist = [
|
|
325
329
|
{ name = "questionary", marker = "extra == 'qa'", specifier = ">=2.1.0" },
|
326
330
|
{ name = "rich", specifier = ">=13.9.4" },
|
327
331
|
{ name = "sympy", marker = "extra == 'calc'", specifier = ">=1.13.3" },
|
332
|
+
{ name = "typer-slim", extras = ["standard"], marker = "extra == 'cli'", specifier = ">=0.15.2" },
|
328
333
|
{ name = "ujson", specifier = ">=5.10.0" },
|
329
334
|
]
|
330
|
-
provides-extras = ["full", "rag", "calc", "plot", "qa", "ftd"]
|
335
|
+
provides-extras = ["full", "rag", "calc", "plot", "qa", "ftd", "cli"]
|
331
336
|
|
332
337
|
[package.metadata.requires-dev]
|
333
338
|
dev = [
|
@@ -1430,6 +1435,15 @@ wheels = [
|
|
1430
1435
|
{ url = "https://mirrors.bfsu.edu.cn/pypi/web/packages/54/21/f43f0a1fa8b06b32812e0975981f4677d28e0f3271601dc88ac5a5b83220/setuptools-78.1.0-py3-none-any.whl", hash = "sha256:3e386e96793c8702ae83d17b853fb93d3e09ef82ec62722e61da5cd22376dcd8", size = 1256108 },
|
1431
1436
|
]
|
1432
1437
|
|
1438
|
+
[[package]]
|
1439
|
+
name = "shellingham"
|
1440
|
+
version = "1.5.4"
|
1441
|
+
source = { registry = "https://mirrors.bfsu.edu.cn/pypi/web/simple" }
|
1442
|
+
sdist = { url = "https://mirrors.bfsu.edu.cn/pypi/web/packages/58/15/8b3609fd3830ef7b27b655beb4b4e9c62313a4e8da8c676e142cc210d58e/shellingham-1.5.4.tar.gz", hash = "sha256:8dbca0739d487e5bd35ab3ca4b36e11c4078f3a234bfce294b0a0291363404de" }
|
1443
|
+
wheels = [
|
1444
|
+
{ url = "https://mirrors.bfsu.edu.cn/pypi/web/packages/e0/f9/0595336914c5619e5f28a1fb793285925a8cd4b432c9da0a987836c7f822/shellingham-1.5.4-py2.py3-none-any.whl", hash = "sha256:7ecfff8f2fd72616f7481040475a65b2bf8af90a56c89140852d1120324e8686" },
|
1445
|
+
]
|
1446
|
+
|
1433
1447
|
[[package]]
|
1434
1448
|
name = "six"
|
1435
1449
|
version = "1.17.0"
|
@@ -1515,6 +1529,25 @@ wheels = [
|
|
1515
1529
|
{ url = "https://mirrors.bfsu.edu.cn/pypi/web/packages/d0/30/dc54f88dd4a2b5dc8a0279bdd7270e735851848b762aeb1c1184ed1f6b14/tqdm-4.67.1-py3-none-any.whl", hash = "sha256:26445eca388f82e72884e0d580d5464cd801a3ea01e63e5601bdff9ba6a48de2", size = 78540 },
|
1516
1530
|
]
|
1517
1531
|
|
1532
|
+
[[package]]
|
1533
|
+
name = "typer-slim"
|
1534
|
+
version = "0.15.2"
|
1535
|
+
source = { registry = "https://mirrors.bfsu.edu.cn/pypi/web/simple" }
|
1536
|
+
dependencies = [
|
1537
|
+
{ name = "click" },
|
1538
|
+
{ name = "typing-extensions" },
|
1539
|
+
]
|
1540
|
+
sdist = { url = "https://mirrors.bfsu.edu.cn/pypi/web/packages/29/67/88189eb827c491646511dc6c806e2e6e543241cae5438383aa042b1dfa40/typer_slim-0.15.2.tar.gz", hash = "sha256:4a666bb7839a88f51dd25d078d36dbc1d0f37c8c2696e184fbc1f3eaa314a91b", size = 100755 }
|
1541
|
+
wheels = [
|
1542
|
+
{ url = "https://mirrors.bfsu.edu.cn/pypi/web/packages/9e/84/9b68e98bf7417d25e38b27a0296bfcbc6719b15d7000f4c09d9716fa9d11/typer_slim-0.15.2-py3-none-any.whl", hash = "sha256:4273014a3378b24367bffed45c2ce8dd3d85bd201a6f02e51ba6b19f336009be", size = 45117 },
|
1543
|
+
]
|
1544
|
+
|
1545
|
+
[package.optional-dependencies]
|
1546
|
+
standard = [
|
1547
|
+
{ name = "rich" },
|
1548
|
+
{ name = "shellingham" },
|
1549
|
+
]
|
1550
|
+
|
1518
1551
|
[[package]]
|
1519
1552
|
name = "typing-extensions"
|
1520
1553
|
version = "4.13.2"
|
@@ -1,90 +0,0 @@
|
|
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))
|
Binary file
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/examples/extract_and_inject/article_rag.py
RENAMED
File without changes
|
File without changes
|
{fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/examples/extract_and_inject/chunk_article.py
RENAMED
File without changes
|
{fabricatio-0.2.11.dev2 → fabricatio-0.2.11.dev3}/examples/extract_and_inject/extract_and_inject.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|