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.
Files changed (56) hide show
  1. fabricatio/__init__.py +9 -8
  2. fabricatio/actions/rules.py +83 -83
  3. fabricatio/rust.cp313-win_amd64.pyd +0 -0
  4. fabricatio/workflows/rag.py +2 -1
  5. fabricatio-0.4.0.data/scripts/tdown.exe +0 -0
  6. {fabricatio-0.3.15.dev5.dist-info → fabricatio-0.4.0.dist-info}/METADATA +17 -16
  7. fabricatio-0.4.0.dist-info/RECORD +18 -0
  8. fabricatio/actions/article.py +0 -415
  9. fabricatio/actions/article_rag.py +0 -407
  10. fabricatio/capabilities/__init__.py +0 -1
  11. fabricatio/capabilities/advanced_judge.py +0 -20
  12. fabricatio/capabilities/advanced_rag.py +0 -61
  13. fabricatio/capabilities/censor.py +0 -105
  14. fabricatio/capabilities/check.py +0 -212
  15. fabricatio/capabilities/correct.py +0 -228
  16. fabricatio/capabilities/extract.py +0 -74
  17. fabricatio/capabilities/propose.py +0 -65
  18. fabricatio/capabilities/rag.py +0 -264
  19. fabricatio/capabilities/rating.py +0 -404
  20. fabricatio/capabilities/review.py +0 -114
  21. fabricatio/capabilities/task.py +0 -113
  22. fabricatio/decorators.py +0 -253
  23. fabricatio/emitter.py +0 -177
  24. fabricatio/fs/__init__.py +0 -35
  25. fabricatio/fs/curd.py +0 -153
  26. fabricatio/fs/readers.py +0 -61
  27. fabricatio/journal.py +0 -12
  28. fabricatio/models/action.py +0 -263
  29. fabricatio/models/adv_kwargs_types.py +0 -63
  30. fabricatio/models/extra/__init__.py +0 -1
  31. fabricatio/models/extra/advanced_judge.py +0 -32
  32. fabricatio/models/extra/aricle_rag.py +0 -286
  33. fabricatio/models/extra/article_base.py +0 -488
  34. fabricatio/models/extra/article_essence.py +0 -98
  35. fabricatio/models/extra/article_main.py +0 -285
  36. fabricatio/models/extra/article_outline.py +0 -45
  37. fabricatio/models/extra/article_proposal.py +0 -52
  38. fabricatio/models/extra/patches.py +0 -20
  39. fabricatio/models/extra/problem.py +0 -165
  40. fabricatio/models/extra/rag.py +0 -98
  41. fabricatio/models/extra/rule.py +0 -51
  42. fabricatio/models/generic.py +0 -904
  43. fabricatio/models/kwargs_types.py +0 -121
  44. fabricatio/models/role.py +0 -156
  45. fabricatio/models/task.py +0 -310
  46. fabricatio/models/tool.py +0 -328
  47. fabricatio/models/usages.py +0 -791
  48. fabricatio/parser.py +0 -114
  49. fabricatio/rust.pyi +0 -846
  50. fabricatio/utils.py +0 -156
  51. fabricatio/workflows/articles.py +0 -24
  52. fabricatio-0.3.15.dev5.data/scripts/tdown.exe +0 -0
  53. fabricatio-0.3.15.dev5.data/scripts/ttm.exe +0 -0
  54. fabricatio-0.3.15.dev5.dist-info/RECORD +0 -63
  55. {fabricatio-0.3.15.dev5.dist-info → fabricatio-0.4.0.dist-info}/WHEEL +0 -0
  56. {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 fabricatio import actions, capabilities, fs, models, parser, toolboxes, utils, workflows
4
- from fabricatio.journal import logger
5
- from fabricatio.models.action import Action, WorkFlow
6
- from fabricatio.models.role import Role
7
- from fabricatio.models.task import Task
8
- from fabricatio.models.tool import ToolBox
9
- from fabricatio.rust import CONFIG, TEMPLATE_MANAGER, Event
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",
@@ -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
@@ -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.15.dev5
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: asyncio>=3.4.3
13
- Requires-Dist: asyncstdlib>=3.13.0
14
- Requires-Dist: json-repair>=0.39.1
15
- Requires-Dist: litellm>=1.60.0
16
- Requires-Dist: loguru>=0.7.3
17
- Requires-Dist: more-itertools>=10.6.0
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 uv
70
- uv --with-editable . maturin develop --uv -r
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
- uv --with-editable . maturin develop --uv -r
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,,