fabricatio 0.2.1.dev0__cp313-cp313-win_amd64.whl → 0.3.14.dev5__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 (75) hide show
  1. fabricatio/__init__.py +12 -20
  2. fabricatio/actions/__init__.py +1 -5
  3. fabricatio/actions/article.py +319 -0
  4. fabricatio/actions/article_rag.py +416 -0
  5. fabricatio/actions/fs.py +25 -0
  6. fabricatio/actions/output.py +248 -0
  7. fabricatio/actions/rag.py +96 -0
  8. fabricatio/actions/rules.py +83 -0
  9. fabricatio/capabilities/__init__.py +1 -0
  10. fabricatio/capabilities/advanced_judge.py +20 -0
  11. fabricatio/capabilities/advanced_rag.py +61 -0
  12. fabricatio/capabilities/censor.py +105 -0
  13. fabricatio/capabilities/check.py +212 -0
  14. fabricatio/capabilities/correct.py +228 -0
  15. fabricatio/capabilities/extract.py +74 -0
  16. fabricatio/capabilities/persist.py +103 -0
  17. fabricatio/capabilities/propose.py +65 -0
  18. fabricatio/capabilities/rag.py +263 -0
  19. fabricatio/capabilities/rating.py +404 -0
  20. fabricatio/capabilities/review.py +114 -0
  21. fabricatio/capabilities/task.py +113 -0
  22. fabricatio/decorators.py +251 -179
  23. fabricatio/{core.py → emitter.py} +31 -21
  24. fabricatio/fs/__init__.py +32 -2
  25. fabricatio/fs/curd.py +32 -9
  26. fabricatio/fs/readers.py +44 -7
  27. fabricatio/journal.py +3 -19
  28. fabricatio/models/action.py +185 -61
  29. fabricatio/models/adv_kwargs_types.py +63 -0
  30. fabricatio/models/extra/__init__.py +1 -0
  31. fabricatio/models/extra/advanced_judge.py +32 -0
  32. fabricatio/models/extra/aricle_rag.py +284 -0
  33. fabricatio/models/extra/article_base.py +422 -0
  34. fabricatio/models/extra/article_essence.py +101 -0
  35. fabricatio/models/extra/article_main.py +284 -0
  36. fabricatio/models/extra/article_outline.py +46 -0
  37. fabricatio/models/extra/article_proposal.py +52 -0
  38. fabricatio/models/extra/patches.py +20 -0
  39. fabricatio/models/extra/problem.py +165 -0
  40. fabricatio/models/extra/rag.py +98 -0
  41. fabricatio/models/extra/rule.py +52 -0
  42. fabricatio/models/generic.py +704 -36
  43. fabricatio/models/kwargs_types.py +112 -17
  44. fabricatio/models/role.py +74 -27
  45. fabricatio/models/task.py +94 -60
  46. fabricatio/models/tool.py +328 -188
  47. fabricatio/models/usages.py +791 -515
  48. fabricatio/parser.py +81 -60
  49. fabricatio/rust.cp313-win_amd64.pyd +0 -0
  50. fabricatio/rust.pyi +886 -0
  51. fabricatio/toolboxes/__init__.py +1 -3
  52. fabricatio/toolboxes/fs.py +17 -1
  53. fabricatio/utils.py +156 -0
  54. fabricatio/workflows/__init__.py +1 -0
  55. fabricatio/workflows/articles.py +24 -0
  56. fabricatio/workflows/rag.py +11 -0
  57. fabricatio-0.3.14.dev5.data/scripts/tdown.exe +0 -0
  58. fabricatio-0.3.14.dev5.data/scripts/ttm.exe +0 -0
  59. fabricatio-0.3.14.dev5.dist-info/METADATA +188 -0
  60. fabricatio-0.3.14.dev5.dist-info/RECORD +64 -0
  61. {fabricatio-0.2.1.dev0.dist-info → fabricatio-0.3.14.dev5.dist-info}/WHEEL +1 -1
  62. fabricatio/_rust.cp313-win_amd64.pyd +0 -0
  63. fabricatio/_rust.pyi +0 -53
  64. fabricatio/_rust_instances.py +0 -8
  65. fabricatio/actions/communication.py +0 -15
  66. fabricatio/actions/transmission.py +0 -23
  67. fabricatio/config.py +0 -263
  68. fabricatio/models/advanced.py +0 -128
  69. fabricatio/models/events.py +0 -82
  70. fabricatio/models/utils.py +0 -78
  71. fabricatio/toolboxes/task.py +0 -6
  72. fabricatio-0.2.1.dev0.data/scripts/tdown.exe +0 -0
  73. fabricatio-0.2.1.dev0.dist-info/METADATA +0 -420
  74. fabricatio-0.2.1.dev0.dist-info/RECORD +0 -35
  75. {fabricatio-0.2.1.dev0.dist-info → fabricatio-0.3.14.dev5.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,52 @@
1
+ """A module containing classes related to rule sets and rules.
2
+
3
+ This module provides the `Rule` and `RuleSet` classes, which are used to define and manage
4
+ individual rules and collections of rules, respectively. These classes are designed to
5
+ facilitate the creation, organization, and application of rules in various contexts,
6
+ ensuring clarity, consistency, and enforceability. The module supports detailed
7
+ descriptions, examples, and metadata for each rule and rule set, making it suitable for
8
+ complex rule management systems.
9
+ """
10
+
11
+ from typing import List, Self, Tuple, Unpack
12
+
13
+ from fabricatio.capabilities.persist import PersistentAble
14
+ from fabricatio.models.generic import Language, SketchedAble, WithBriefing
15
+ from more_itertools import flatten
16
+
17
+
18
+ class Rule(WithBriefing, Language, SketchedAble, PersistentAble):
19
+ """Represents a rule or guideline for a specific topic."""
20
+
21
+ violation_examples: List[str]
22
+ """A list of concrete examples demonstrating violations of this rule. Each example should
23
+ be a clear scenario or case that illustrates how the rule can be broken, including the
24
+ context, actions, and consequences of the violation. These examples should help in
25
+ understanding the boundaries of the rule."""
26
+
27
+ compliance_examples: List[str]
28
+ """A list of concrete examples demonstrating proper compliance with this rule. Each example
29
+ should be a clear scenario or case that illustrates how to correctly follow the rule,
30
+ including the context, actions, and positive outcomes of compliance. These examples should
31
+ serve as practical guidance for implementing the rule correctly."""
32
+
33
+
34
+ class RuleSet(SketchedAble, PersistentAble, WithBriefing, Language):
35
+ """Represents a collection of rules and guidelines for a particular topic."""
36
+
37
+ rules: List[Rule]
38
+ """The collection of rules and guidelines contained in this rule set. Each rule should be
39
+ a well-defined, specific guideline that contributes to the overall purpose of the rule set.
40
+ The rules should be logically organized and consistent with each other, forming a coherent
41
+ framework for the topic or domain covered by the rule set."""
42
+
43
+ @classmethod
44
+ def gather(cls, *rulesets: Unpack[Tuple["RuleSet", ...]]) -> Self:
45
+ """Gathers multiple rule sets into a single rule set."""
46
+ if not rulesets:
47
+ raise ValueError("No rulesets provided")
48
+ return cls(
49
+ name=";".join(ruleset.name for ruleset in rulesets),
50
+ description=";".join(ruleset.description for ruleset in rulesets),
51
+ rules=list(flatten(r.rules for r in rulesets)),
52
+ )