fabricatio 0.3.15.dev5__cp313-cp313-win_amd64.whl → 0.4.0__cp313-cp313-win_amd64.whl
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/__init__.py +9 -8
- fabricatio/actions/rules.py +83 -83
- fabricatio/rust.cp313-win_amd64.pyd +0 -0
- fabricatio/workflows/rag.py +2 -1
- fabricatio-0.4.0.data/scripts/tdown.exe +0 -0
- {fabricatio-0.3.15.dev5.dist-info → fabricatio-0.4.0.dist-info}/METADATA +17 -16
- fabricatio-0.4.0.dist-info/RECORD +18 -0
- fabricatio/actions/article.py +0 -415
- fabricatio/actions/article_rag.py +0 -407
- fabricatio/capabilities/__init__.py +0 -1
- fabricatio/capabilities/advanced_judge.py +0 -20
- fabricatio/capabilities/advanced_rag.py +0 -61
- fabricatio/capabilities/censor.py +0 -105
- fabricatio/capabilities/check.py +0 -212
- fabricatio/capabilities/correct.py +0 -228
- fabricatio/capabilities/extract.py +0 -74
- fabricatio/capabilities/propose.py +0 -65
- fabricatio/capabilities/rag.py +0 -264
- fabricatio/capabilities/rating.py +0 -404
- fabricatio/capabilities/review.py +0 -114
- fabricatio/capabilities/task.py +0 -113
- fabricatio/decorators.py +0 -253
- fabricatio/emitter.py +0 -177
- fabricatio/fs/__init__.py +0 -35
- fabricatio/fs/curd.py +0 -153
- fabricatio/fs/readers.py +0 -61
- fabricatio/journal.py +0 -12
- fabricatio/models/action.py +0 -263
- fabricatio/models/adv_kwargs_types.py +0 -63
- fabricatio/models/extra/__init__.py +0 -1
- fabricatio/models/extra/advanced_judge.py +0 -32
- fabricatio/models/extra/aricle_rag.py +0 -286
- fabricatio/models/extra/article_base.py +0 -488
- fabricatio/models/extra/article_essence.py +0 -98
- fabricatio/models/extra/article_main.py +0 -285
- fabricatio/models/extra/article_outline.py +0 -45
- fabricatio/models/extra/article_proposal.py +0 -52
- fabricatio/models/extra/patches.py +0 -20
- fabricatio/models/extra/problem.py +0 -165
- fabricatio/models/extra/rag.py +0 -98
- fabricatio/models/extra/rule.py +0 -51
- fabricatio/models/generic.py +0 -904
- fabricatio/models/kwargs_types.py +0 -121
- fabricatio/models/role.py +0 -156
- fabricatio/models/task.py +0 -310
- fabricatio/models/tool.py +0 -328
- fabricatio/models/usages.py +0 -791
- fabricatio/parser.py +0 -114
- fabricatio/rust.pyi +0 -846
- fabricatio/utils.py +0 -156
- fabricatio/workflows/articles.py +0 -24
- fabricatio-0.3.15.dev5.data/scripts/tdown.exe +0 -0
- fabricatio-0.3.15.dev5.data/scripts/ttm.exe +0 -0
- fabricatio-0.3.15.dev5.dist-info/RECORD +0 -63
- {fabricatio-0.3.15.dev5.dist-info → fabricatio-0.4.0.dist-info}/WHEEL +0 -0
- {fabricatio-0.3.15.dev5.dist-info → fabricatio-0.4.0.dist-info}/licenses/LICENSE +0 -0
fabricatio/__init__.py
CHANGED
@@ -1,12 +1,14 @@
|
|
1
1
|
"""Fabricatio is a Python library for building llm app using event-based agent structure."""
|
2
2
|
|
3
|
-
from
|
4
|
-
from
|
5
|
-
from
|
6
|
-
from
|
7
|
-
from
|
8
|
-
from
|
9
|
-
from
|
3
|
+
from fabricatio_core import fs, models, parser, utils
|
4
|
+
from fabricatio_core.journal import logger
|
5
|
+
from fabricatio_core.models.action import Action, WorkFlow
|
6
|
+
from fabricatio_core.models.role import Role
|
7
|
+
from fabricatio_core.models.task import Task
|
8
|
+
from fabricatio_core.models.tool import ToolBox
|
9
|
+
from fabricatio_core.rust import CONFIG, TEMPLATE_MANAGER, Event
|
10
|
+
|
11
|
+
from fabricatio import actions, toolboxes, workflows
|
10
12
|
|
11
13
|
__all__ = [
|
12
14
|
"CONFIG",
|
@@ -18,7 +20,6 @@ __all__ = [
|
|
18
20
|
"ToolBox",
|
19
21
|
"WorkFlow",
|
20
22
|
"actions",
|
21
|
-
"capabilities",
|
22
23
|
"fs",
|
23
24
|
"logger",
|
24
25
|
"models",
|
fabricatio/actions/rules.py
CHANGED
@@ -1,83 +1,83 @@
|
|
1
|
-
"""A module containing the DraftRuleSet action."""
|
2
|
-
|
3
|
-
from typing import Any, List, Mapping, Optional, Self, Tuple
|
4
|
-
|
5
|
-
from fabricatio.capabilities.check import Check
|
6
|
-
from fabricatio.journal import logger
|
7
|
-
from fabricatio.models.action import Action
|
8
|
-
from fabricatio.models.extra.rule import RuleSet
|
9
|
-
from fabricatio.models.generic import FromMapping
|
10
|
-
from fabricatio.utils import ok
|
11
|
-
|
12
|
-
|
13
|
-
class DraftRuleSet(Action, Check, FromMapping):
|
14
|
-
"""Action to draft a ruleset based on a given requirement description."""
|
15
|
-
|
16
|
-
output_key: str = "drafted_ruleset"
|
17
|
-
"""The key used to store the drafted ruleset in the context dictionary."""
|
18
|
-
|
19
|
-
ruleset_requirement: Optional[str] = None
|
20
|
-
"""The natural language description of the desired ruleset characteristics."""
|
21
|
-
rule_count: int = 0
|
22
|
-
"""The number of rules to generate in the ruleset (0 for no restriction)."""
|
23
|
-
|
24
|
-
async def _execute(
|
25
|
-
self,
|
26
|
-
ruleset_requirement: Optional[str] = None,
|
27
|
-
**_,
|
28
|
-
) -> Optional[RuleSet]:
|
29
|
-
"""Draft a ruleset based on the requirement description.
|
30
|
-
|
31
|
-
Args:
|
32
|
-
ruleset_requirement (str): Natural language description of desired ruleset characteristics
|
33
|
-
rule_count (int): Number of rules to generate (0 for no restriction)
|
34
|
-
**kwargs: Validation parameters for rule generation
|
35
|
-
|
36
|
-
Returns:
|
37
|
-
Optional[RuleSet]: Drafted ruleset object or None if generation fails
|
38
|
-
"""
|
39
|
-
ruleset = await self.draft_ruleset(
|
40
|
-
ruleset_requirement=ok(ruleset_requirement or self.ruleset_requirement, "No ruleset requirement provided"),
|
41
|
-
rule_count=self.rule_count,
|
42
|
-
)
|
43
|
-
if ruleset:
|
44
|
-
logger.info(f"Drafted Ruleset length: {len(ruleset.rules)}\n{ruleset.display()}")
|
45
|
-
else:
|
46
|
-
logger.warning(f"Drafting Rule Failed for:\n{ruleset_requirement}")
|
47
|
-
return ruleset
|
48
|
-
|
49
|
-
@classmethod
|
50
|
-
def from_mapping(cls, mapping: Mapping[str, Tuple[int, str]], **kwargs) -> List[Self]:
|
51
|
-
"""Create a list of DraftRuleSet actions from a mapping of output keys to tuples of rule counts and requirements."""
|
52
|
-
return [cls(ruleset_requirement=r, rule_count=c, output_key=k, **kwargs) for k, (c, r) in mapping.items()]
|
53
|
-
|
54
|
-
|
55
|
-
class GatherRuleset(Action, FromMapping):
|
56
|
-
"""Action to gather a ruleset from a given requirement description."""
|
57
|
-
|
58
|
-
output_key: str = "gathered_ruleset"
|
59
|
-
"""The key used to store the drafted ruleset in the context dictionary."""
|
60
|
-
|
61
|
-
to_gather: List[str]
|
62
|
-
"""the cxt name of RuleSet to gather"""
|
63
|
-
|
64
|
-
@classmethod
|
65
|
-
def from_mapping(cls, mapping: Mapping[str, List[str]], **kwargs: Any) -> List[Self]:
|
66
|
-
"""Create a list of GatherRuleset actions from a mapping of output keys to tuples of rule counts and requirements."""
|
67
|
-
return [cls(to_gather=t, output_key=k, **kwargs) for k, t in mapping.items()]
|
68
|
-
|
69
|
-
async def _execute(self, **cxt) -> RuleSet:
|
70
|
-
logger.info(f"Gathering Ruleset from {self.to_gather}")
|
71
|
-
# Fix for not_found
|
72
|
-
not_found = next((t for t in self.to_gather if t not in cxt), None)
|
73
|
-
if not_found:
|
74
|
-
raise ValueError(
|
75
|
-
f"Not all required keys found in context: {self.to_gather}|`{not_found}` not found in context."
|
76
|
-
)
|
77
|
-
|
78
|
-
# Fix for invalid RuleSet check
|
79
|
-
invalid = next((t for t in self.to_gather if not isinstance(cxt[t], RuleSet)), None)
|
80
|
-
if invalid is not None:
|
81
|
-
raise TypeError(f"Invalid RuleSet instance for key `{invalid}`")
|
82
|
-
|
83
|
-
return RuleSet.gather(*[cxt[t] for t in self.to_gather])
|
1
|
+
"""A module containing the DraftRuleSet action."""
|
2
|
+
|
3
|
+
from typing import Any, List, Mapping, Optional, Self, Tuple
|
4
|
+
|
5
|
+
from fabricatio.capabilities.check import Check
|
6
|
+
from fabricatio.journal import logger
|
7
|
+
from fabricatio.models.action import Action
|
8
|
+
from fabricatio.models.extra.rule import RuleSet
|
9
|
+
from fabricatio.models.generic import FromMapping
|
10
|
+
from fabricatio.utils import ok
|
11
|
+
|
12
|
+
|
13
|
+
class DraftRuleSet(Action, Check, FromMapping):
|
14
|
+
"""Action to draft a ruleset based on a given requirement description."""
|
15
|
+
|
16
|
+
output_key: str = "drafted_ruleset"
|
17
|
+
"""The key used to store the drafted ruleset in the context dictionary."""
|
18
|
+
|
19
|
+
ruleset_requirement: Optional[str] = None
|
20
|
+
"""The natural language description of the desired ruleset characteristics."""
|
21
|
+
rule_count: int = 0
|
22
|
+
"""The number of rules to generate in the ruleset (0 for no restriction)."""
|
23
|
+
|
24
|
+
async def _execute(
|
25
|
+
self,
|
26
|
+
ruleset_requirement: Optional[str] = None,
|
27
|
+
**_,
|
28
|
+
) -> Optional[RuleSet]:
|
29
|
+
"""Draft a ruleset based on the requirement description.
|
30
|
+
|
31
|
+
Args:
|
32
|
+
ruleset_requirement (str): Natural language description of desired ruleset characteristics
|
33
|
+
rule_count (int): Number of rules to generate (0 for no restriction)
|
34
|
+
**kwargs: Validation parameters for rule generation
|
35
|
+
|
36
|
+
Returns:
|
37
|
+
Optional[RuleSet]: Drafted ruleset object or None if generation fails
|
38
|
+
"""
|
39
|
+
ruleset = await self.draft_ruleset(
|
40
|
+
ruleset_requirement=ok(ruleset_requirement or self.ruleset_requirement, "No ruleset requirement provided"),
|
41
|
+
rule_count=self.rule_count,
|
42
|
+
)
|
43
|
+
if ruleset:
|
44
|
+
logger.info(f"Drafted Ruleset length: {len(ruleset.rules)}\n{ruleset.display()}")
|
45
|
+
else:
|
46
|
+
logger.warning(f"Drafting Rule Failed for:\n{ruleset_requirement}")
|
47
|
+
return ruleset
|
48
|
+
|
49
|
+
@classmethod
|
50
|
+
def from_mapping(cls, mapping: Mapping[str, Tuple[int, str]], **kwargs) -> List[Self]:
|
51
|
+
"""Create a list of DraftRuleSet actions from a mapping of output keys to tuples of rule counts and requirements."""
|
52
|
+
return [cls(ruleset_requirement=r, rule_count=c, output_key=k, **kwargs) for k, (c, r) in mapping.items()]
|
53
|
+
|
54
|
+
|
55
|
+
class GatherRuleset(Action, FromMapping):
|
56
|
+
"""Action to gather a ruleset from a given requirement description."""
|
57
|
+
|
58
|
+
output_key: str = "gathered_ruleset"
|
59
|
+
"""The key used to store the drafted ruleset in the context dictionary."""
|
60
|
+
|
61
|
+
to_gather: List[str]
|
62
|
+
"""the cxt name of RuleSet to gather"""
|
63
|
+
|
64
|
+
@classmethod
|
65
|
+
def from_mapping(cls, mapping: Mapping[str, List[str]], **kwargs: Any) -> List[Self]:
|
66
|
+
"""Create a list of GatherRuleset actions from a mapping of output keys to tuples of rule counts and requirements."""
|
67
|
+
return [cls(to_gather=t, output_key=k, **kwargs) for k, t in mapping.items()]
|
68
|
+
|
69
|
+
async def _execute(self, **cxt) -> RuleSet:
|
70
|
+
logger.info(f"Gathering Ruleset from {self.to_gather}")
|
71
|
+
# Fix for not_found
|
72
|
+
not_found = next((t for t in self.to_gather if t not in cxt), None)
|
73
|
+
if not_found:
|
74
|
+
raise ValueError(
|
75
|
+
f"Not all required keys found in context: {self.to_gather}|`{not_found}` not found in context."
|
76
|
+
)
|
77
|
+
|
78
|
+
# Fix for invalid RuleSet check
|
79
|
+
invalid = next((t for t in self.to_gather if not isinstance(cxt[t], RuleSet)), None)
|
80
|
+
if invalid is not None:
|
81
|
+
raise TypeError(f"Invalid RuleSet instance for key `{invalid}`")
|
82
|
+
|
83
|
+
return RuleSet.gather(*[cxt[t] for t in self.to_gather])
|
Binary file
|
fabricatio/workflows/rag.py
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
"""The workflow for extracting the essence of an article and storing it in the database."""
|
2
2
|
|
3
|
+
from fabricatio_core.models.action import WorkFlow
|
4
|
+
|
3
5
|
from fabricatio.actions.article import ExtractArticleEssence
|
4
6
|
from fabricatio.actions.rag import InjectToDB
|
5
|
-
from fabricatio.models.action import WorkFlow
|
6
7
|
|
7
8
|
StoreArticle = WorkFlow(
|
8
9
|
name="Extract Article Essence",
|
Binary file
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: fabricatio
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.4.0
|
4
4
|
Classifier: License :: OSI Approved :: MIT License
|
5
5
|
Classifier: Programming Language :: Rust
|
6
6
|
Classifier: Programming Language :: Python :: 3.12
|
@@ -9,26 +9,24 @@ Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
9
9
|
Classifier: Framework :: AsyncIO
|
10
10
|
Classifier: Framework :: Pydantic :: 2
|
11
11
|
Classifier: Typing :: Typed
|
12
|
-
Requires-Dist:
|
13
|
-
Requires-Dist:
|
14
|
-
Requires-Dist:
|
15
|
-
Requires-Dist:
|
16
|
-
Requires-Dist:
|
17
|
-
Requires-Dist:
|
18
|
-
Requires-Dist: pydantic>=2.10.6
|
19
|
-
Requires-Dist: pymitter>=1.0.0
|
20
|
-
Requires-Dist: rich>=13.9.4
|
21
|
-
Requires-Dist: ujson>=5.10.0
|
22
|
-
Requires-Dist: fabricatio[ftd,qa,rag,cli] ; extra == 'full'
|
23
|
-
Requires-Dist: pymilvus>=2.5.4 ; extra == 'rag'
|
12
|
+
Requires-Dist: fabricatio-core
|
13
|
+
Requires-Dist: fabricatio-capabilities
|
14
|
+
Requires-Dist: fabricatio[ftd,qa,rag,cli,typst,rule,judge] ; extra == 'full'
|
15
|
+
Requires-Dist: fabricatio-rag ; extra == 'rag'
|
16
|
+
Requires-Dist: fabricatio-judge ; extra == 'judge'
|
17
|
+
Requires-Dist: fabricatio-rule ; extra == 'rule'
|
24
18
|
Requires-Dist: questionary>=2.1.0 ; extra == 'qa'
|
25
19
|
Requires-Dist: magika>=0.6.1 ; extra == 'ftd'
|
26
20
|
Requires-Dist: typer-slim[standard]>=0.15.2 ; extra == 'cli'
|
21
|
+
Requires-Dist: fabricatio-typst ; extra == 'typst'
|
27
22
|
Provides-Extra: full
|
28
23
|
Provides-Extra: rag
|
24
|
+
Provides-Extra: judge
|
25
|
+
Provides-Extra: rule
|
29
26
|
Provides-Extra: qa
|
30
27
|
Provides-Extra: ftd
|
31
28
|
Provides-Extra: cli
|
29
|
+
Provides-Extra: typst
|
32
30
|
License-File: LICENSE
|
33
31
|
Summary: A LLM multi-agent framework.
|
34
32
|
Keywords: ai,agents,multi-agent,llm,pyo3
|
@@ -66,8 +64,11 @@ pip install uv
|
|
66
64
|
git clone https://github.com/Whth/fabricatio.git
|
67
65
|
cd fabricatio
|
68
66
|
|
69
|
-
# Install the package in development mode with
|
70
|
-
|
67
|
+
# Install the package in development mode with uvx
|
68
|
+
uvx --with-editable . maturin develop --uv -r
|
69
|
+
|
70
|
+
# Or, with make
|
71
|
+
make dev
|
71
72
|
```
|
72
73
|
|
73
74
|
### Building Distribution
|
@@ -154,7 +155,7 @@ max_tokens = 8192
|
|
154
155
|
```
|
155
156
|
2. **Install Dependencies**:
|
156
157
|
```bash
|
157
|
-
|
158
|
+
make dev
|
158
159
|
```
|
159
160
|
3. **Run Tests**:
|
160
161
|
```bash
|
@@ -0,0 +1,18 @@
|
|
1
|
+
fabricatio-0.4.0.data/scripts/tdown.exe,sha256=wJB4uqkaC7lj5SdJTbsBoa6Cz-Bl_WC-jnZeabGwfic,3378176
|
2
|
+
fabricatio-0.4.0.dist-info/METADATA,sha256=f0SYcL4jgeWa4X3giEG6zJZ6qXActgZQ0ynZuJXO2ds,5189
|
3
|
+
fabricatio-0.4.0.dist-info/WHEEL,sha256=Fk195VgSS-LCRRJAxz6O39eu2NdDhBCq3h9q4zoTguY,96
|
4
|
+
fabricatio-0.4.0.dist-info/licenses/LICENSE,sha256=do7J7EiCGbq0QPbMAL_FqLYufXpHnCnXBOuqVPwSV8Y,1088
|
5
|
+
fabricatio/__init__.py,sha256=9YbjjPgR_-rvuXt86oNLXZodDm3zltnMNmhP-1pESvE,786
|
6
|
+
fabricatio/actions/__init__.py,sha256=wVENCFtpVb1rLFxoOFJt9-8smLWXuJV7IwA8P3EfFz4,48
|
7
|
+
fabricatio/actions/fs.py,sha256=gJR14U4ln35nt8Z7OWLVAZpqGaLnED-r1Yi-lX22tkI,959
|
8
|
+
fabricatio/actions/output.py,sha256=nYKCUkNyAVziJmKS_Hdxnb015CrHRFdLJuQJlkEyB1s,9971
|
9
|
+
fabricatio/actions/rag.py,sha256=vgCzIfbSd3_vL3QxB12PY4h12V9Pe3sZRsWme0KC6X8,3583
|
10
|
+
fabricatio/actions/rules.py,sha256=07ILsiwR250AUcKLPHTUPpWD_mPhPCfWKSkEAKcPv3A,3557
|
11
|
+
fabricatio/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
12
|
+
fabricatio/rust.cp313-win_amd64.pyd,sha256=L-c7Su6i5T4fqbGfJU8pqQW5Vx4kaDM1gvidnlFmp9g,176128
|
13
|
+
fabricatio/toolboxes/__init__.py,sha256=KBJi5OG_pExscdlM7Bnt_UF43j4I3Lv6G71kPVu4KQU,395
|
14
|
+
fabricatio/toolboxes/arithmetic.py,sha256=WLqhY-Pikv11Y_0SGajwZx3WhsLNpHKf9drzAqOf_nY,1369
|
15
|
+
fabricatio/toolboxes/fs.py,sha256=l4L1CVxJmjw9Ld2XUpIlWfV0_Fu_2Og6d3E13I-S4aE,736
|
16
|
+
fabricatio/workflows/__init__.py,sha256=5ScFSTA-bvhCesj3U9Mnmi6Law6N1fmh5UKyh58L3u8,51
|
17
|
+
fabricatio/workflows/rag.py,sha256=O8qCLhZTJTEj72R7W6Nq3WFg2I42arzQJkIGaeDdpss,527
|
18
|
+
fabricatio-0.4.0.dist-info/RECORD,,
|