fabricatio 0.3.15.dev5__cp313-cp313-win_amd64.whl → 0.4.0.dev0__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 (62) hide show
  1. fabricatio/__init__.py +8 -9
  2. fabricatio/rust.cp313-win_amd64.pyd +0 -0
  3. fabricatio/toolboxes/arithmetic.py +1 -1
  4. fabricatio/toolboxes/fs.py +2 -2
  5. fabricatio/workflows/rag.py +2 -1
  6. fabricatio-0.4.0.dev0.data/scripts/tdown.exe +0 -0
  7. {fabricatio-0.3.15.dev5.dist-info → fabricatio-0.4.0.dev0.dist-info}/METADATA +22 -16
  8. fabricatio-0.4.0.dev0.dist-info/RECORD +13 -0
  9. fabricatio/actions/__init__.py +0 -1
  10. fabricatio/actions/article.py +0 -415
  11. fabricatio/actions/article_rag.py +0 -407
  12. fabricatio/actions/fs.py +0 -25
  13. fabricatio/actions/output.py +0 -247
  14. fabricatio/actions/rag.py +0 -96
  15. fabricatio/actions/rules.py +0 -83
  16. fabricatio/capabilities/__init__.py +0 -1
  17. fabricatio/capabilities/advanced_judge.py +0 -20
  18. fabricatio/capabilities/advanced_rag.py +0 -61
  19. fabricatio/capabilities/censor.py +0 -105
  20. fabricatio/capabilities/check.py +0 -212
  21. fabricatio/capabilities/correct.py +0 -228
  22. fabricatio/capabilities/extract.py +0 -74
  23. fabricatio/capabilities/propose.py +0 -65
  24. fabricatio/capabilities/rag.py +0 -264
  25. fabricatio/capabilities/rating.py +0 -404
  26. fabricatio/capabilities/review.py +0 -114
  27. fabricatio/capabilities/task.py +0 -113
  28. fabricatio/decorators.py +0 -253
  29. fabricatio/emitter.py +0 -177
  30. fabricatio/fs/__init__.py +0 -35
  31. fabricatio/fs/curd.py +0 -153
  32. fabricatio/fs/readers.py +0 -61
  33. fabricatio/journal.py +0 -12
  34. fabricatio/models/action.py +0 -263
  35. fabricatio/models/adv_kwargs_types.py +0 -63
  36. fabricatio/models/extra/__init__.py +0 -1
  37. fabricatio/models/extra/advanced_judge.py +0 -32
  38. fabricatio/models/extra/aricle_rag.py +0 -286
  39. fabricatio/models/extra/article_base.py +0 -488
  40. fabricatio/models/extra/article_essence.py +0 -98
  41. fabricatio/models/extra/article_main.py +0 -285
  42. fabricatio/models/extra/article_outline.py +0 -45
  43. fabricatio/models/extra/article_proposal.py +0 -52
  44. fabricatio/models/extra/patches.py +0 -20
  45. fabricatio/models/extra/problem.py +0 -165
  46. fabricatio/models/extra/rag.py +0 -98
  47. fabricatio/models/extra/rule.py +0 -51
  48. fabricatio/models/generic.py +0 -904
  49. fabricatio/models/kwargs_types.py +0 -121
  50. fabricatio/models/role.py +0 -156
  51. fabricatio/models/task.py +0 -310
  52. fabricatio/models/tool.py +0 -328
  53. fabricatio/models/usages.py +0 -791
  54. fabricatio/parser.py +0 -114
  55. fabricatio/rust.pyi +0 -846
  56. fabricatio/utils.py +0 -156
  57. fabricatio/workflows/articles.py +0 -24
  58. fabricatio-0.3.15.dev5.data/scripts/tdown.exe +0 -0
  59. fabricatio-0.3.15.dev5.data/scripts/ttm.exe +0 -0
  60. fabricatio-0.3.15.dev5.dist-info/RECORD +0 -63
  61. {fabricatio-0.3.15.dev5.dist-info → fabricatio-0.4.0.dev0.dist-info}/WHEEL +0 -0
  62. {fabricatio-0.3.15.dev5.dist-info → fabricatio-0.4.0.dev0.dist-info}/licenses/LICENSE +0 -0
fabricatio/utils.py DELETED
@@ -1,156 +0,0 @@
1
- """A collection of utility functions for the fabricatio package."""
2
-
3
- from typing import Any, Dict, Iterable, List, Mapping, Optional, Tuple, Type, overload
4
-
5
- from fabricatio.decorators import precheck_package
6
-
7
-
8
- def is_subclass_of_base(cls: Type, base_module: str, base_name: str) -> bool:
9
- """Determines if the given class is a subclass of an unimported base class.
10
-
11
- Args:
12
- cls: The class to check
13
- base_module: The module name of the base class
14
- base_name: The class name of the base class
15
-
16
- Returns:
17
- bool: True if cls is a subclass of the specified base class, False otherwise
18
- """
19
- return any(ancestor.__module__ == base_module and ancestor.__name__ == base_name for ancestor in cls.__mro__)
20
-
21
-
22
- def is_subclass_of_any_base(cls: Type, bases: List[Tuple[str, str]]) -> bool:
23
- """Determines if the given class is a subclass of the candidate base classes.
24
-
25
- Args:
26
- cls: The class to check
27
- bases: A list of tuples where each tuple contains (module_name, class_name)
28
-
29
- Returns:
30
- bool: True if cls is a subclass of the specified base classes, False otherwise
31
- """
32
- for ancestor in cls.__mro__:
33
- for base_module, base_name in bases:
34
- if ancestor.__module__ == base_module and ancestor.__name__ == base_name:
35
- return True
36
- return False
37
-
38
-
39
- @precheck_package(
40
- "questionary", "'questionary' is required to run this function. Have you installed `fabricatio[qa]`?."
41
- )
42
- async def ask_edit(text_seq: List[str]) -> List[str]:
43
- """Asks the user to edit a list of texts.
44
-
45
- Args:
46
- text_seq (List[str]): A list of texts to be edited.
47
-
48
- Returns:
49
- List[str]: A list of edited texts.
50
- If the user does not edit a text, it will not be included in the returned list.
51
- """
52
- from questionary import text
53
-
54
- res = []
55
- for i, t in enumerate(text_seq):
56
- edited = await text(f"[{i}] ", default=t).ask_async()
57
- if edited:
58
- res.append(edited)
59
- return res
60
-
61
-
62
- @overload
63
- async def ask_retain[V](candidates: List[str]) -> List[str]: ...
64
-
65
-
66
- @overload
67
- async def ask_retain[V](candidates: List[str], value_mapping: List[V]) -> List[V]: ...
68
-
69
-
70
- @precheck_package(
71
- "questionary", "'questionary' is required to run this function. Have you installed `fabricatio[qa]`?."
72
- )
73
- async def ask_retain[V](candidates: List[str], value_mapping: Optional[List[V]] = None) -> List[str] | List[V]:
74
- """Asks the user to retain a list of candidates."""
75
- from questionary import Choice, checkbox
76
-
77
- return await checkbox(
78
- "Please choose those that should be retained.",
79
- choices=[Choice(p, value=p, checked=True) for p in candidates]
80
- if value_mapping is None
81
- else [Choice(p, value=v, checked=True) for p, v in zip(candidates, value_mapping, strict=True)],
82
- ).ask_async()
83
-
84
-
85
- def override_kwargs(kwargs: Mapping[str, Any], **overrides) -> Dict[str, Any]:
86
- """Override the values in kwargs with the provided overrides."""
87
- new_kwargs = dict(kwargs.items())
88
- new_kwargs.update(overrides)
89
- return new_kwargs
90
-
91
-
92
- def fallback_kwargs(kwargs: Mapping[str, Any], **fallbacks) -> Dict[str, Any]:
93
- """Fallback the values in kwargs with the provided fallbacks."""
94
- new_kwargs = dict(kwargs.items())
95
- new_kwargs.update({k: v for k, v in fallbacks.items() if k not in new_kwargs})
96
- return new_kwargs
97
-
98
-
99
- def ok[T](val: Optional[T], msg: str = "Value is None") -> T:
100
- """Check if a value is None and raise a ValueError with the provided message if it is.
101
-
102
- Args:
103
- val: The value to check.
104
- msg: The message to include in the ValueError if val is None.
105
-
106
- Returns:
107
- T: The value if it is not None.
108
- """
109
- if val is None:
110
- raise ValueError(msg)
111
- return val
112
-
113
-
114
- def first_available[T](iterable: Iterable[T], msg: str = "No available item found in the iterable.") -> T:
115
- """Return the first available item in the iterable that's not None.
116
-
117
- This function searches through the provided iterable and returns the first
118
- item that is not None. If all items are None or the iterable is empty,
119
- it raises a ValueError.
120
-
121
- Args:
122
- iterable: The iterable collection to search through.
123
- msg: The message to include in the ValueError if no non-None item is found.
124
-
125
- Returns:
126
- T: The first non-None item found in the iterable.
127
- If no non-None item is found, it raises a ValueError.
128
-
129
- Raises:
130
- ValueError: If no non-None item is found in the iterable.
131
-
132
- Examples:
133
- >>> first_available([None, None, "value", "another"])
134
- 'value'
135
- >>> first_available([1, 2, 3])
136
- 1
137
- >>> assert (first_available([None, None]))
138
- ValueError: No available item found in the iterable.
139
- """
140
- if (first := next((item for item in iterable if item is not None), None)) is not None:
141
- return first
142
- raise ValueError(msg)
143
-
144
-
145
- def wrapp_in_block(string: str, title: str, style: str = "-") -> str:
146
- """Wraps a string in a block with a title.
147
-
148
- Args:
149
- string: The string to wrap.
150
- title: The title of the block.
151
- style: The style of the block.
152
-
153
- Returns:
154
- str: The wrapped string.
155
- """
156
- return f"--- Start of {title} ---\n{string}\n--- End of {title} ---".replace("-", style)
@@ -1,24 +0,0 @@
1
- """Store article essence in the database."""
2
-
3
- from fabricatio.actions.article import GenerateArticleProposal, GenerateInitialOutline
4
- from fabricatio.actions.output import DumpFinalizedOutput
5
- from fabricatio.models.action import WorkFlow
6
-
7
- WriteOutlineWorkFlow = WorkFlow(
8
- name="Generate Article Outline",
9
- description="Generate an outline for an article. dump the outline to the given path. in typst format.",
10
- steps=(
11
- GenerateArticleProposal,
12
- GenerateInitialOutline(output_key="article_outline"),
13
- DumpFinalizedOutput(output_key="task_output"),
14
- ),
15
- )
16
- WriteOutlineCorrectedWorkFlow = WorkFlow(
17
- name="Generate Article Outline",
18
- description="Generate an outline for an article. dump the outline to the given path. in typst format.",
19
- steps=(
20
- GenerateArticleProposal,
21
- GenerateInitialOutline(output_key="article_outline"),
22
- DumpFinalizedOutput(output_key="task_output"),
23
- ),
24
- )
Binary file
@@ -1,63 +0,0 @@
1
- fabricatio-0.3.15.dev5.data/scripts/tdown.exe,sha256=b9847TDX6VyRzfZOITsYgOcrpWw8vi_2vjIRqlp8f2k,3452416
2
- fabricatio-0.3.15.dev5.data/scripts/ttm.exe,sha256=XjZq6x3Qi_g1aqeC-CcFXRkIjF8gR82ctcFKlv-HfO8,2556416
3
- fabricatio-0.3.15.dev5.dist-info/METADATA,sha256=TBhqN2F5lbHd6fEgM-IwJecibnD_J2veBU6DmwM-Qa8,5216
4
- fabricatio-0.3.15.dev5.dist-info/WHEEL,sha256=Fk195VgSS-LCRRJAxz6O39eu2NdDhBCq3h9q4zoTguY,96
5
- fabricatio-0.3.15.dev5.dist-info/licenses/LICENSE,sha256=do7J7EiCGbq0QPbMAL_FqLYufXpHnCnXBOuqVPwSV8Y,1088
6
- fabricatio/__init__.py,sha256=w7ObFg6ud4pQuC1DhVyQI9x9dtp05QrcJAEk643iJmc,761
7
- fabricatio/actions/__init__.py,sha256=wVENCFtpVb1rLFxoOFJt9-8smLWXuJV7IwA8P3EfFz4,48
8
- fabricatio/actions/article.py,sha256=pKJ8DBHeb3MIUdz-y-Xtk-7XAIyDAGQf3b135w1Moxo,17110
9
- fabricatio/actions/article_rag.py,sha256=ohS1CRtYuv2rJNgoIsBl2yv-PuuoypA3y223rUUyDBg,17989
10
- fabricatio/actions/fs.py,sha256=gJR14U4ln35nt8Z7OWLVAZpqGaLnED-r1Yi-lX22tkI,959
11
- fabricatio/actions/output.py,sha256=nYKCUkNyAVziJmKS_Hdxnb015CrHRFdLJuQJlkEyB1s,9971
12
- fabricatio/actions/rag.py,sha256=vgCzIfbSd3_vL3QxB12PY4h12V9Pe3sZRsWme0KC6X8,3583
13
- fabricatio/actions/rules.py,sha256=dkvCgNDjt2KSO1VgPRsxT4YBmIIMeetZb5tiz-slYkU,3640
14
- fabricatio/capabilities/__init__.py,sha256=v1cHRHIJ2gxyqMLNCs6ERVcCakSasZNYzmMI4lqAcls,57
15
- fabricatio/capabilities/advanced_judge.py,sha256=jQ_Gsn6L8EKb6KQi3j0G0GSUz2j8D2220C1hIhrAeU8,682
16
- fabricatio/capabilities/advanced_rag.py,sha256=DYh-imLQkjVOgKd__OEbwGzqwNeTtX_6NBGx_bCiFs8,2539
17
- fabricatio/capabilities/censor.py,sha256=e0tHll4J_-TT8-Vn1OZ1innVZbJfx55oyGtDoEI99r8,4745
18
- fabricatio/capabilities/check.py,sha256=6IC6F0IhYVpSf9pJ8r9lq40l_FF3qf-iJcTRWwpnkdg,8591
19
- fabricatio/capabilities/correct.py,sha256=-JR8ZUAtagmNXepVyY679MBUyFCZwtKPjv8dANJMZiE,10403
20
- fabricatio/capabilities/extract.py,sha256=E7CLZflWzJ6C6DVLEWysYZ_48g_-F93gZJVU56k2-XA,2523
21
- fabricatio/capabilities/propose.py,sha256=v8OiUHc8GU7Jg1zAUghYhrI-AKgmBeUvQMo22ZAOddw,2030
22
- fabricatio/capabilities/rag.py,sha256=lwFrC96tL3uJ4keJ6n46vrvrdF6bARg1Yn6y6pQn7VQ,11194
23
- fabricatio/capabilities/rating.py,sha256=cm-s2YJMYcS36mR9b7XNwRQ1x0h0uWxLHCapoAORv8I,17815
24
- fabricatio/capabilities/review.py,sha256=l06BYcQzPi7VKmWdplj9L6WvZEscZqW1Wx9OhR-UnNw,5061
25
- fabricatio/capabilities/task.py,sha256=-b92cGi7b3B30kOSS-90_H6BjA0VF_cjc1BzPbO5MkI,4401
26
- fabricatio/decorators.py,sha256=FmUDSr6RFtRnIXZ2OWYmbxCgTM1lsHKuyw4jTFgJbDo,9094
27
- fabricatio/emitter.py,sha256=n4vH6E7lcT57qVve_3hUAdfvj0mQUDkWu6iU5aNztB8,6341
28
- fabricatio/fs/__init__.py,sha256=USoMI_HcIr3Yc77_JQYYsXrsplYPXtFTaNB9YgFfC4s,713
29
- fabricatio/fs/curd.py,sha256=652nHulbJ3gwt0Z3nywtPMmjhEyglDvEfc3p7ieJNNA,4777
30
- fabricatio/fs/readers.py,sha256=UXvcJO3UCsxHu9PPkg34Yh55Zi-miv61jD_wZQJgKRs,1751
31
- fabricatio/journal.py,sha256=mnbdB1Dw-mhEKIgWlPKn7W07ssg-6dmxMXilIGQMFV8,216
32
- fabricatio/models/action.py,sha256=RhjHaEJILiCZux5hzxSZVt_7Evcu3TnFHNuJN8rzgq8,10052
33
- fabricatio/models/adv_kwargs_types.py,sha256=IBV3ZcsNLvvEjO_2hBpYg_wLSpNKaMx6Ndam3qXJCw8,2097
34
- fabricatio/models/extra/__init__.py,sha256=XlYnS_2B9nhLhtQkjE7rvvfPmAAtXVdNi9bSDAR-Ge8,54
35
- fabricatio/models/extra/advanced_judge.py,sha256=INUl_41C8jkausDekkjnEmTwNfLCJ23TwFjq2cM23Cw,1092
36
- fabricatio/models/extra/aricle_rag.py,sha256=wg7EaxDW3ScOoYHPc-e9HXzllNgaJemNFmrAuF_mgzI,12009
37
- fabricatio/models/extra/article_base.py,sha256=OI55jmjKDscJNlzSBZRxx0xBj3Z1FHxDg-nb4tKSxMs,18882
38
- fabricatio/models/extra/article_essence.py,sha256=CFmoP5emEL9TptIFP1gKO9Ec8AA_6uxkeI__8XokdPU,2745
39
- fabricatio/models/extra/article_main.py,sha256=s_jnwZzliwTz_LvvI7mGhW_nOu7pn2pOf8UOi45o5OM,11263
40
- fabricatio/models/extra/article_outline.py,sha256=mw7eOuKMJgns4bihjcjOEIpAy38i0g-x6T6Vx3J0T5A,1629
41
- fabricatio/models/extra/article_proposal.py,sha256=NbyjW-7UiFPtnVD9nte75re4xL2pD4qL29PpNV4Cg_M,1870
42
- fabricatio/models/extra/patches.py,sha256=_WNCxtYzzsVfUxI16vu4IqsLahLYRHdbQN9er9tqhC0,997
43
- fabricatio/models/extra/problem.py,sha256=8tTU-3giFHOi5j7NJsvH__JJyYcaGrcfsRnkzQNm0Ew,7216
44
- fabricatio/models/extra/rag.py,sha256=C7ptZCuGJmT8WikjpF9KhZ0Bw-VicdB-s8EqEAgMLKE,3967
45
- fabricatio/models/extra/rule.py,sha256=KQQELVhCLUXhEZ35jU3WGYqKHuCYEAkn0p6pxAE-hOU,2625
46
- fabricatio/models/generic.py,sha256=ERUrwjOnLjR3zm1uXHPi-YrRQGSHqsgjtr5PHNcqEHU,30996
47
- fabricatio/models/kwargs_types.py,sha256=Ik8-Oi_NmwfkvC9B8K4NsoZc_vSWV85xKCSthA1Xv_k,3403
48
- fabricatio/models/role.py,sha256=p8yE9dc8xW6zxd-_tk3sjU_e1oabX6rNYsiGAMmZS44,7493
49
- fabricatio/models/task.py,sha256=XZ1l1P-iS02ZF9P8cXv8gEfJKBa17PFPNJ1SbhyhT4Q,11033
50
- fabricatio/models/tool.py,sha256=q2wDtZAebWMZlsFifgmJq8N3XvAhVNMb0aUIKkdruGc,12419
51
- fabricatio/models/usages.py,sha256=q2jLqa0vJ7ho9ZUkC-2uPuFpK8uClBLIS6TEEYHUotY,33041
52
- fabricatio/parser.py,sha256=dYFri9pDlsiwVpEJ-a5jmVU2nFuKN3uBHC8VsVpdEm8,4642
53
- fabricatio/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
54
- fabricatio/rust.cp313-win_amd64.pyd,sha256=J3SXmYBCP-UcfXxSdxMFWNwg7FkboBiEruVxYP6Gal4,7813632
55
- fabricatio/rust.pyi,sha256=gACnTKrPEU15AC3c_HfcNNzLcMa6VTdC8SoGRgm0Qdw,26337
56
- fabricatio/toolboxes/__init__.py,sha256=KBJi5OG_pExscdlM7Bnt_UF43j4I3Lv6G71kPVu4KQU,395
57
- fabricatio/toolboxes/arithmetic.py,sha256=WLqhY-Pikv11Y_0SGajwZx3WhsLNpHKf9drzAqOf_nY,1369
58
- fabricatio/toolboxes/fs.py,sha256=l4L1CVxJmjw9Ld2XUpIlWfV0_Fu_2Og6d3E13I-S4aE,736
59
- fabricatio/utils.py,sha256=WYhFB4tHk6jKmjZgAsYhRmg1ZvBjn4X2y4n7yz25HjE,5454
60
- fabricatio/workflows/__init__.py,sha256=5ScFSTA-bvhCesj3U9Mnmi6Law6N1fmh5UKyh58L3u8,51
61
- fabricatio/workflows/articles.py,sha256=ObYTFUqLUk_CzdmmnX6S7APfxcGmPFqnFr9pdjU7Z4Y,969
62
- fabricatio/workflows/rag.py,sha256=-YYp2tlE9Vtfgpg6ROpu6QVO8j8yVSPa6yDzlN3qVxs,520
63
- fabricatio-0.3.15.dev5.dist-info/RECORD,,