fabricatio 0.3.15.dev4__cp312-cp312-win_amd64.whl → 0.4.4__cp312-cp312-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 (66) hide show
  1. fabricatio/__init__.py +7 -8
  2. fabricatio/actions/__init__.py +69 -1
  3. fabricatio/capabilities/__init__.py +59 -1
  4. fabricatio/models/__init__.py +47 -0
  5. fabricatio/rust.cp312-win_amd64.pyd +0 -0
  6. fabricatio/toolboxes/__init__.py +2 -1
  7. fabricatio/toolboxes/arithmetic.py +1 -1
  8. fabricatio/toolboxes/fs.py +2 -2
  9. fabricatio/workflows/__init__.py +9 -0
  10. fabricatio-0.4.4.data/scripts/tdown.exe +0 -0
  11. {fabricatio-0.3.15.dev4.dist-info → fabricatio-0.4.4.dist-info}/METADATA +49 -25
  12. fabricatio-0.4.4.dist-info/RECORD +15 -0
  13. fabricatio/actions/article.py +0 -415
  14. fabricatio/actions/article_rag.py +0 -407
  15. fabricatio/actions/fs.py +0 -25
  16. fabricatio/actions/output.py +0 -248
  17. fabricatio/actions/rag.py +0 -96
  18. fabricatio/actions/rules.py +0 -83
  19. fabricatio/capabilities/advanced_judge.py +0 -20
  20. fabricatio/capabilities/advanced_rag.py +0 -61
  21. fabricatio/capabilities/censor.py +0 -105
  22. fabricatio/capabilities/check.py +0 -212
  23. fabricatio/capabilities/correct.py +0 -228
  24. fabricatio/capabilities/extract.py +0 -74
  25. fabricatio/capabilities/persist.py +0 -103
  26. fabricatio/capabilities/propose.py +0 -65
  27. fabricatio/capabilities/rag.py +0 -264
  28. fabricatio/capabilities/rating.py +0 -404
  29. fabricatio/capabilities/review.py +0 -114
  30. fabricatio/capabilities/task.py +0 -113
  31. fabricatio/decorators.py +0 -253
  32. fabricatio/emitter.py +0 -177
  33. fabricatio/fs/__init__.py +0 -35
  34. fabricatio/fs/curd.py +0 -153
  35. fabricatio/fs/readers.py +0 -61
  36. fabricatio/journal.py +0 -12
  37. fabricatio/models/action.py +0 -263
  38. fabricatio/models/adv_kwargs_types.py +0 -63
  39. fabricatio/models/extra/__init__.py +0 -1
  40. fabricatio/models/extra/advanced_judge.py +0 -32
  41. fabricatio/models/extra/aricle_rag.py +0 -286
  42. fabricatio/models/extra/article_base.py +0 -486
  43. fabricatio/models/extra/article_essence.py +0 -101
  44. fabricatio/models/extra/article_main.py +0 -286
  45. fabricatio/models/extra/article_outline.py +0 -46
  46. fabricatio/models/extra/article_proposal.py +0 -52
  47. fabricatio/models/extra/patches.py +0 -20
  48. fabricatio/models/extra/problem.py +0 -165
  49. fabricatio/models/extra/rag.py +0 -98
  50. fabricatio/models/extra/rule.py +0 -52
  51. fabricatio/models/generic.py +0 -812
  52. fabricatio/models/kwargs_types.py +0 -121
  53. fabricatio/models/role.py +0 -99
  54. fabricatio/models/task.py +0 -310
  55. fabricatio/models/tool.py +0 -328
  56. fabricatio/models/usages.py +0 -791
  57. fabricatio/parser.py +0 -114
  58. fabricatio/rust.pyi +0 -846
  59. fabricatio/utils.py +0 -156
  60. fabricatio/workflows/articles.py +0 -24
  61. fabricatio/workflows/rag.py +0 -11
  62. fabricatio-0.3.15.dev4.data/scripts/tdown.exe +0 -0
  63. fabricatio-0.3.15.dev4.data/scripts/ttm.exe +0 -0
  64. fabricatio-0.3.15.dev4.dist-info/RECORD +0 -64
  65. {fabricatio-0.3.15.dev4.dist-info → fabricatio-0.4.4.dist-info}/WHEEL +0 -0
  66. {fabricatio-0.3.15.dev4.dist-info → fabricatio-0.4.4.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
- )
@@ -1,11 +0,0 @@
1
- """The workflow for extracting the essence of an article and storing it in the database."""
2
-
3
- from fabricatio.actions.article import ExtractArticleEssence
4
- from fabricatio.actions.rag import InjectToDB
5
- from fabricatio.models.action import WorkFlow
6
-
7
- StoreArticle = WorkFlow(
8
- name="Extract Article Essence",
9
- description="Extract the essence of an article in the given path, and store it in the database.",
10
- steps=(ExtractArticleEssence(output_key="to_inject"), InjectToDB(output_key="task_output")),
11
- )
Binary file
@@ -1,64 +0,0 @@
1
- fabricatio-0.3.15.dev4.data/scripts/tdown.exe,sha256=xo5gt8ZZhdo04pXNXNcSr8eW__L-GrUYRu09mADIOVI,3448320
2
- fabricatio-0.3.15.dev4.data/scripts/ttm.exe,sha256=fvovyVc2sYfjO9ovvyVyOrg_15xXUyKxTRQEM2w1PCY,2560512
3
- fabricatio-0.3.15.dev4.dist-info/METADATA,sha256=WtY8oxwIpleThYREaAQDeDvcscg8NWOjnAk3-iz-ZH8,5165
4
- fabricatio-0.3.15.dev4.dist-info/WHEEL,sha256=YpU2aDuTyBIvwRZn8idqScP-vkQ8DUGkCILtYmMfnFY,96
5
- fabricatio-0.3.15.dev4.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=jZL72D5uFobKNiVFapnVxBcjSNqGEThYNlCUKQvZwz8,9935
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/persist.py,sha256=9XnKoeZ62YjXVDpYnkbDFf62B_Mz46WVsq1dTr2Wvvc,3421
22
- fabricatio/capabilities/propose.py,sha256=v8OiUHc8GU7Jg1zAUghYhrI-AKgmBeUvQMo22ZAOddw,2030
23
- fabricatio/capabilities/rag.py,sha256=lwFrC96tL3uJ4keJ6n46vrvrdF6bARg1Yn6y6pQn7VQ,11194
24
- fabricatio/capabilities/rating.py,sha256=cm-s2YJMYcS36mR9b7XNwRQ1x0h0uWxLHCapoAORv8I,17815
25
- fabricatio/capabilities/review.py,sha256=l06BYcQzPi7VKmWdplj9L6WvZEscZqW1Wx9OhR-UnNw,5061
26
- fabricatio/capabilities/task.py,sha256=-b92cGi7b3B30kOSS-90_H6BjA0VF_cjc1BzPbO5MkI,4401
27
- fabricatio/decorators.py,sha256=FmUDSr6RFtRnIXZ2OWYmbxCgTM1lsHKuyw4jTFgJbDo,9094
28
- fabricatio/emitter.py,sha256=n4vH6E7lcT57qVve_3hUAdfvj0mQUDkWu6iU5aNztB8,6341
29
- fabricatio/fs/__init__.py,sha256=USoMI_HcIr3Yc77_JQYYsXrsplYPXtFTaNB9YgFfC4s,713
30
- fabricatio/fs/curd.py,sha256=652nHulbJ3gwt0Z3nywtPMmjhEyglDvEfc3p7ieJNNA,4777
31
- fabricatio/fs/readers.py,sha256=UXvcJO3UCsxHu9PPkg34Yh55Zi-miv61jD_wZQJgKRs,1751
32
- fabricatio/journal.py,sha256=mnbdB1Dw-mhEKIgWlPKn7W07ssg-6dmxMXilIGQMFV8,216
33
- fabricatio/models/action.py,sha256=RhjHaEJILiCZux5hzxSZVt_7Evcu3TnFHNuJN8rzgq8,10052
34
- fabricatio/models/adv_kwargs_types.py,sha256=IBV3ZcsNLvvEjO_2hBpYg_wLSpNKaMx6Ndam3qXJCw8,2097
35
- fabricatio/models/extra/__init__.py,sha256=XlYnS_2B9nhLhtQkjE7rvvfPmAAtXVdNi9bSDAR-Ge8,54
36
- fabricatio/models/extra/advanced_judge.py,sha256=INUl_41C8jkausDekkjnEmTwNfLCJ23TwFjq2cM23Cw,1092
37
- fabricatio/models/extra/aricle_rag.py,sha256=wg7EaxDW3ScOoYHPc-e9HXzllNgaJemNFmrAuF_mgzI,12009
38
- fabricatio/models/extra/article_base.py,sha256=HkRsQ1WwwfSLvDbOUQqduEITcXr4alA58hMbzmlSuDo,18815
39
- fabricatio/models/extra/article_essence.py,sha256=z3Qz6xVsB9k-K-c4Y2CoKzxZrXaUd4oyt2Mb6hGDYdg,2793
40
- fabricatio/models/extra/article_main.py,sha256=kBLqKMeBPy2fxioOZa9oqFjGPPjHvXHWDF_Fpx16aLU,11307
41
- fabricatio/models/extra/article_outline.py,sha256=P0T-1DGCzoNmQ3iQVwSmOul0nwS6qLgr0FF8jDdD7F0,1673
42
- fabricatio/models/extra/article_proposal.py,sha256=OQIKoJkmJv0ogYVk7eGK_TOtANVYcBPA_HeV1nuG0Vo,1909
43
- fabricatio/models/extra/patches.py,sha256=_WNCxtYzzsVfUxI16vu4IqsLahLYRHdbQN9er9tqhC0,997
44
- fabricatio/models/extra/problem.py,sha256=8tTU-3giFHOi5j7NJsvH__JJyYcaGrcfsRnkzQNm0Ew,7216
45
- fabricatio/models/extra/rag.py,sha256=C7ptZCuGJmT8WikjpF9KhZ0Bw-VicdB-s8EqEAgMLKE,3967
46
- fabricatio/models/extra/rule.py,sha256=WKahNiaIp8s_l2r_FG21F_PP3_hgNm4hfSVCSFyfoBE,2669
47
- fabricatio/models/generic.py,sha256=NQW2hfZ-_OTuok_gvIYepq49VThrl9guFPfN-68LbPw,27870
48
- fabricatio/models/kwargs_types.py,sha256=Ik8-Oi_NmwfkvC9B8K4NsoZc_vSWV85xKCSthA1Xv_k,3403
49
- fabricatio/models/role.py,sha256=PrVwmGUi3xh2uyxEDw0fygXDhllFOB65dKOuQnepoUc,4253
50
- fabricatio/models/task.py,sha256=XZ1l1P-iS02ZF9P8cXv8gEfJKBa17PFPNJ1SbhyhT4Q,11033
51
- fabricatio/models/tool.py,sha256=q2wDtZAebWMZlsFifgmJq8N3XvAhVNMb0aUIKkdruGc,12419
52
- fabricatio/models/usages.py,sha256=q2jLqa0vJ7ho9ZUkC-2uPuFpK8uClBLIS6TEEYHUotY,33041
53
- fabricatio/parser.py,sha256=dYFri9pDlsiwVpEJ-a5jmVU2nFuKN3uBHC8VsVpdEm8,4642
54
- fabricatio/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
55
- fabricatio/rust.cp312-win_amd64.pyd,sha256=PPNj55qdP98py7T6flmmi2nEnUuTkSo3G9YVnwB3G2g,7824896
56
- fabricatio/rust.pyi,sha256=gACnTKrPEU15AC3c_HfcNNzLcMa6VTdC8SoGRgm0Qdw,26337
57
- fabricatio/toolboxes/__init__.py,sha256=KBJi5OG_pExscdlM7Bnt_UF43j4I3Lv6G71kPVu4KQU,395
58
- fabricatio/toolboxes/arithmetic.py,sha256=WLqhY-Pikv11Y_0SGajwZx3WhsLNpHKf9drzAqOf_nY,1369
59
- fabricatio/toolboxes/fs.py,sha256=l4L1CVxJmjw9Ld2XUpIlWfV0_Fu_2Og6d3E13I-S4aE,736
60
- fabricatio/utils.py,sha256=WYhFB4tHk6jKmjZgAsYhRmg1ZvBjn4X2y4n7yz25HjE,5454
61
- fabricatio/workflows/__init__.py,sha256=5ScFSTA-bvhCesj3U9Mnmi6Law6N1fmh5UKyh58L3u8,51
62
- fabricatio/workflows/articles.py,sha256=ObYTFUqLUk_CzdmmnX6S7APfxcGmPFqnFr9pdjU7Z4Y,969
63
- fabricatio/workflows/rag.py,sha256=-YYp2tlE9Vtfgpg6ROpu6QVO8j8yVSPa6yDzlN3qVxs,520
64
- fabricatio-0.3.15.dev4.dist-info/RECORD,,