fabricatio 0.2.9.dev4__cp312-cp312-win_amd64.whl → 0.2.10__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.
- fabricatio/actions/article.py +20 -106
- fabricatio/actions/article_rag.py +153 -22
- fabricatio/actions/fs.py +25 -0
- fabricatio/actions/output.py +17 -3
- fabricatio/actions/rag.py +40 -18
- fabricatio/actions/rules.py +14 -3
- fabricatio/capabilities/check.py +2 -1
- fabricatio/capabilities/rag.py +41 -231
- fabricatio/config.py +4 -2
- fabricatio/constants.py +20 -0
- fabricatio/decorators.py +23 -0
- fabricatio/models/adv_kwargs_types.py +35 -0
- fabricatio/models/events.py +6 -6
- fabricatio/models/extra/advanced_judge.py +2 -2
- fabricatio/models/extra/aricle_rag.py +170 -0
- fabricatio/models/extra/article_base.py +2 -186
- fabricatio/models/extra/article_essence.py +8 -7
- fabricatio/models/extra/article_main.py +39 -107
- fabricatio/models/extra/problem.py +12 -17
- fabricatio/models/extra/rag.py +98 -0
- fabricatio/models/extra/rule.py +1 -2
- fabricatio/models/generic.py +35 -12
- fabricatio/models/kwargs_types.py +8 -36
- fabricatio/models/task.py +3 -3
- fabricatio/models/usages.py +80 -6
- fabricatio/rust.cp312-win_amd64.pyd +0 -0
- fabricatio/rust.pyi +138 -6
- fabricatio/utils.py +62 -4
- fabricatio-0.2.10.data/scripts/tdown.exe +0 -0
- {fabricatio-0.2.9.dev4.dist-info → fabricatio-0.2.10.dist-info}/METADATA +1 -4
- fabricatio-0.2.10.dist-info/RECORD +64 -0
- fabricatio/models/utils.py +0 -148
- fabricatio-0.2.9.dev4.data/scripts/tdown.exe +0 -0
- fabricatio-0.2.9.dev4.dist-info/RECORD +0 -61
- {fabricatio-0.2.9.dev4.dist-info → fabricatio-0.2.10.dist-info}/WHEEL +0 -0
- {fabricatio-0.2.9.dev4.dist-info → fabricatio-0.2.10.dist-info}/licenses/LICENSE +0 -0
fabricatio/rust.pyi
CHANGED
@@ -12,9 +12,8 @@ Key Features:
|
|
12
12
|
"""
|
13
13
|
|
14
14
|
from pathlib import Path
|
15
|
-
from typing import List, Optional
|
15
|
+
from typing import Any, Dict, List, Optional
|
16
16
|
|
17
|
-
from pydantic import JsonValue
|
18
17
|
|
19
18
|
class TemplateManager:
|
20
19
|
"""Template rendering engine using Handlebars templates.
|
@@ -26,7 +25,7 @@ class TemplateManager:
|
|
26
25
|
"""
|
27
26
|
|
28
27
|
def __init__(
|
29
|
-
|
28
|
+
self, template_dirs: List[Path], suffix: Optional[str] = None, active_loading: Optional[bool] = None
|
30
29
|
) -> None:
|
31
30
|
"""Initialize the template manager.
|
32
31
|
|
@@ -56,7 +55,7 @@ class TemplateManager:
|
|
56
55
|
This refreshes the template cache, finding any new or modified templates.
|
57
56
|
"""
|
58
57
|
|
59
|
-
def render_template(self, name: str, data:
|
58
|
+
def render_template(self, name: str, data: Dict[str, Any]) -> str:
|
60
59
|
"""Render a template with context data.
|
61
60
|
|
62
61
|
Args:
|
@@ -70,7 +69,7 @@ class TemplateManager:
|
|
70
69
|
RuntimeError: If template rendering fails
|
71
70
|
"""
|
72
71
|
|
73
|
-
def render_template_raw(self, template: str, data:
|
72
|
+
def render_template_raw(self, template: str, data: Dict[str, Any]) -> str:
|
74
73
|
"""Render a template with context data.
|
75
74
|
|
76
75
|
Args:
|
@@ -81,6 +80,7 @@ class TemplateManager:
|
|
81
80
|
Rendered template content as string
|
82
81
|
"""
|
83
82
|
|
83
|
+
|
84
84
|
def blake3_hash(content: bytes) -> str:
|
85
85
|
"""Calculate the BLAKE3 cryptographic hash of data.
|
86
86
|
|
@@ -91,9 +91,11 @@ def blake3_hash(content: bytes) -> str:
|
|
91
91
|
Hex-encoded BLAKE3 hash string
|
92
92
|
"""
|
93
93
|
|
94
|
+
|
94
95
|
def detect_language(string: str) -> str:
|
95
96
|
"""Detect the language of a given string."""
|
96
97
|
|
98
|
+
|
97
99
|
def split_word_bounds(string: str) -> List[str]:
|
98
100
|
"""Split the string into words based on word boundaries.
|
99
101
|
|
@@ -104,6 +106,31 @@ def split_word_bounds(string: str) -> List[str]:
|
|
104
106
|
A list of words extracted from the string.
|
105
107
|
"""
|
106
108
|
|
109
|
+
|
110
|
+
def split_sentence_bounds(string: str) -> List[str]:
|
111
|
+
"""Split the string into sentences based on sentence boundaries.
|
112
|
+
|
113
|
+
Args:
|
114
|
+
string: The input string to be split.
|
115
|
+
|
116
|
+
Returns:
|
117
|
+
A list of sentences extracted from the string.
|
118
|
+
"""
|
119
|
+
|
120
|
+
|
121
|
+
def split_into_chunks(string: str, max_chunk_size: int, max_overlapping_rate: float = 0.3) -> List[str]:
|
122
|
+
"""Split the string into chunks of a specified size.
|
123
|
+
|
124
|
+
Args:
|
125
|
+
string: The input string to be split.
|
126
|
+
max_chunk_size: The maximum size of each chunk.
|
127
|
+
max_overlapping_rate: The minimum overlapping rate between chunks.
|
128
|
+
|
129
|
+
Returns:
|
130
|
+
A list of chunks extracted from the string.
|
131
|
+
"""
|
132
|
+
|
133
|
+
|
107
134
|
def word_count(string: str) -> int:
|
108
135
|
"""Count the number of words in the string.
|
109
136
|
|
@@ -114,6 +141,100 @@ def word_count(string: str) -> int:
|
|
114
141
|
The number of words in the string.
|
115
142
|
"""
|
116
143
|
|
144
|
+
|
145
|
+
def is_chinese(string: str) -> bool:
|
146
|
+
"""Check if the given string is in Chinese."""
|
147
|
+
|
148
|
+
|
149
|
+
def is_english(string: str) -> bool:
|
150
|
+
"""Check if the given string is in English."""
|
151
|
+
|
152
|
+
|
153
|
+
def is_japanese(string: str) -> bool:
|
154
|
+
"""Check if the given string is in Japanese."""
|
155
|
+
|
156
|
+
|
157
|
+
def is_korean(string: str) -> bool:
|
158
|
+
"""Check if the given string is in Korean."""
|
159
|
+
|
160
|
+
|
161
|
+
def is_arabic(string: str) -> bool:
|
162
|
+
"""Check if the given string is in Arabic."""
|
163
|
+
|
164
|
+
|
165
|
+
def is_russian(string: str) -> bool:
|
166
|
+
"""Check if the given string is in Russian."""
|
167
|
+
|
168
|
+
|
169
|
+
def is_german(string: str) -> bool:
|
170
|
+
"""Check if the given string is in German."""
|
171
|
+
|
172
|
+
|
173
|
+
def is_french(string: str) -> bool:
|
174
|
+
"""Check if the given string is in French."""
|
175
|
+
|
176
|
+
|
177
|
+
def is_hindi(string: str) -> bool:
|
178
|
+
"""Check if the given string is in Hindi."""
|
179
|
+
|
180
|
+
|
181
|
+
def is_italian(string: str) -> bool:
|
182
|
+
"""Check if the given string is in Italian."""
|
183
|
+
|
184
|
+
|
185
|
+
def is_dutch(string: str) -> bool:
|
186
|
+
"""Check if the given string is in Dutch."""
|
187
|
+
|
188
|
+
|
189
|
+
def is_portuguese(string: str) -> bool:
|
190
|
+
"""Check if the given string is in Portuguese."""
|
191
|
+
|
192
|
+
|
193
|
+
def is_swedish(string: str) -> bool:
|
194
|
+
"""Check if the given string is in Swedish."""
|
195
|
+
|
196
|
+
|
197
|
+
def is_turkish(string: str) -> bool:
|
198
|
+
"""Check if the given string is in Turkish."""
|
199
|
+
|
200
|
+
|
201
|
+
def is_vietnamese(string: str) -> bool:
|
202
|
+
"""Check if the given string is in Vietnamese."""
|
203
|
+
|
204
|
+
|
205
|
+
def tex_to_typst(string: str) -> str:
|
206
|
+
"""Convert TeX to Typst.
|
207
|
+
|
208
|
+
Args:
|
209
|
+
string: The input TeX string to be converted.
|
210
|
+
|
211
|
+
Returns:
|
212
|
+
The converted Typst string.
|
213
|
+
"""
|
214
|
+
|
215
|
+
|
216
|
+
def convert_all_inline_tex(string: str) -> str:
|
217
|
+
"""Convert all inline TeX code in the string.
|
218
|
+
|
219
|
+
Args:
|
220
|
+
string: The input string containing inline TeX code wrapped in $code$.
|
221
|
+
|
222
|
+
Returns:
|
223
|
+
The converted string with inline TeX code replaced.
|
224
|
+
"""
|
225
|
+
|
226
|
+
|
227
|
+
def convert_all_block_tex(string: str) -> str:
|
228
|
+
"""Convert all block TeX code in the string.
|
229
|
+
|
230
|
+
Args:
|
231
|
+
string: The input string containing block TeX code wrapped in $$code$$.
|
232
|
+
|
233
|
+
Returns:
|
234
|
+
The converted string with block TeX code replaced.
|
235
|
+
"""
|
236
|
+
|
237
|
+
|
117
238
|
class BibManager:
|
118
239
|
"""BibTeX bibliography manager for parsing and querying citation data."""
|
119
240
|
|
@@ -127,7 +248,7 @@ class BibManager:
|
|
127
248
|
RuntimeError: If file cannot be read or parsed
|
128
249
|
"""
|
129
250
|
|
130
|
-
def
|
251
|
+
def get_cite_key_by_title(self, title: str) -> Optional[str]:
|
131
252
|
"""Find citation key by exact title match.
|
132
253
|
|
133
254
|
Args:
|
@@ -137,6 +258,16 @@ class BibManager:
|
|
137
258
|
Citation key if exact match found, None otherwise
|
138
259
|
"""
|
139
260
|
|
261
|
+
def get_cite_key_by_title_fuzzy(self, title: str) -> Optional[str]:
|
262
|
+
"""Find citation key by fuzzy title match.
|
263
|
+
|
264
|
+
Args:
|
265
|
+
title: Search term to find in bibliography entries
|
266
|
+
|
267
|
+
Returns:
|
268
|
+
Citation key of best matching entry, or None if no good match
|
269
|
+
"""
|
270
|
+
|
140
271
|
def get_cite_key_fuzzy(self, query: str) -> Optional[str]:
|
141
272
|
"""Find best matching citation using fuzzy text search.
|
142
273
|
|
@@ -190,6 +321,7 @@ class BibManager:
|
|
190
321
|
Returns:
|
191
322
|
Abstract if found, None otherwise
|
192
323
|
"""
|
324
|
+
|
193
325
|
def get_title_by_key(self, key: str) -> Optional[str]:
|
194
326
|
"""Retrieve the title by citation key.
|
195
327
|
|
fabricatio/utils.py
CHANGED
@@ -2,11 +2,9 @@
|
|
2
2
|
|
3
3
|
from typing import Any, Dict, List, Mapping, Optional
|
4
4
|
|
5
|
-
from questionary import text
|
6
|
-
|
7
5
|
|
8
6
|
async def ask_edit(
|
9
|
-
|
7
|
+
text_seq: List[str],
|
10
8
|
) -> List[str]:
|
11
9
|
"""Asks the user to edit a list of texts.
|
12
10
|
|
@@ -17,6 +15,8 @@ async def ask_edit(
|
|
17
15
|
List[str]: A list of edited texts.
|
18
16
|
If the user does not edit a text, it will not be included in the returned list.
|
19
17
|
"""
|
18
|
+
from questionary import text
|
19
|
+
|
20
20
|
res = []
|
21
21
|
for i, t in enumerate(text_seq):
|
22
22
|
edited = await text(f"[{i}] ", default=t).ask_async()
|
@@ -25,7 +25,7 @@ async def ask_edit(
|
|
25
25
|
return res
|
26
26
|
|
27
27
|
|
28
|
-
def override_kwargs(kwargs: Mapping[str,Any], **overrides) -> Dict[str, Any]:
|
28
|
+
def override_kwargs(kwargs: Mapping[str, Any], **overrides) -> Dict[str, Any]:
|
29
29
|
"""Override the values in kwargs with the provided overrides."""
|
30
30
|
new_kwargs = dict(kwargs.items())
|
31
31
|
new_kwargs.update({k: v for k, v in overrides.items() if v is not None})
|
@@ -52,3 +52,61 @@ def ok[T](val: Optional[T], msg: str = "Value is None") -> T:
|
|
52
52
|
if val is None:
|
53
53
|
raise ValueError(msg)
|
54
54
|
return val
|
55
|
+
|
56
|
+
|
57
|
+
def wrapp_in_block(string: str, title: str) -> str:
|
58
|
+
"""Wraps a string in a block with a title.
|
59
|
+
|
60
|
+
Args:
|
61
|
+
string: The string to wrap.
|
62
|
+
title: The title of the block.
|
63
|
+
|
64
|
+
Returns:
|
65
|
+
str: The wrapped string.
|
66
|
+
"""
|
67
|
+
return f"--- Start of {title} ---\n{string}\n--- End of {title} ---"
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
def replace_brackets(s: str) -> str:
|
72
|
+
"""Replace sequences within double brackets with each number wrapped in double brackets.
|
73
|
+
|
74
|
+
This function processes a string to find sequences enclosed in double brackets (e.g., [[1, 2, 3-5]]).
|
75
|
+
It splits these sequences by commas and hyphens, expands any ranges (e.g., 3-5 becomes 3, 4, 5),
|
76
|
+
and wraps each number in double brackets.
|
77
|
+
|
78
|
+
Args:
|
79
|
+
s (str): The input string containing sequences within double brackets.
|
80
|
+
|
81
|
+
Returns:
|
82
|
+
str: The processed string with each number in the sequences wrapped in double brackets.
|
83
|
+
"""
|
84
|
+
import regex
|
85
|
+
# Find all sequences within double brackets
|
86
|
+
matches = regex.findall(r'\[\[(.*?)\]\]', s)
|
87
|
+
|
88
|
+
# Process each match to wrap each number in double brackets
|
89
|
+
processed_sequences = []
|
90
|
+
for match in matches:
|
91
|
+
# Split the match by commas and hyphens, and strip whitespace
|
92
|
+
parts = [part.strip() for part in regex.split(r'[,]', match)]
|
93
|
+
|
94
|
+
numbers = []
|
95
|
+
for part in parts:
|
96
|
+
if '-' in part:
|
97
|
+
# Expand the range if there's a hyphen
|
98
|
+
start, end = map(int, part.split('-'))
|
99
|
+
numbers.extend(str(i) for i in range(start, end + 1))
|
100
|
+
else:
|
101
|
+
numbers.append(part)
|
102
|
+
|
103
|
+
# Wrap each number in double brackets
|
104
|
+
wrapped_numbers = ''.join(f'[[{num}]]' for num in numbers)
|
105
|
+
processed_sequences.append(wrapped_numbers)
|
106
|
+
|
107
|
+
# Replace the original matches with the processed sequences
|
108
|
+
for original, processed in zip(matches, processed_sequences):
|
109
|
+
s = s.replace(f'[[{original}]]', processed)
|
110
|
+
|
111
|
+
return s
|
112
|
+
|
Binary file
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: fabricatio
|
3
|
-
Version: 0.2.
|
3
|
+
Version: 0.2.10
|
4
4
|
Classifier: License :: OSI Approved :: MIT License
|
5
5
|
Classifier: Programming Language :: Rust
|
6
6
|
Classifier: Programming Language :: Python :: 3.12
|
@@ -23,7 +23,6 @@ Requires-Dist: pymitter>=1.0.0
|
|
23
23
|
Requires-Dist: questionary>=2.1.0
|
24
24
|
Requires-Dist: regex>=2024.11.6
|
25
25
|
Requires-Dist: rich>=13.9.4
|
26
|
-
Requires-Dist: rtoml>=0.12.0
|
27
26
|
Requires-Dist: pymilvus>=2.5.4 ; extra == 'rag'
|
28
27
|
Requires-Dist: fabricatio[calc,plot,rag] ; extra == 'full'
|
29
28
|
Requires-Dist: sympy>=1.13.3 ; extra == 'calc'
|
@@ -45,8 +44,6 @@ Project-URL: Issues, https://github.com/Whth/fabricatio/issues
|
|
45
44
|
# Fabricatio
|
46
45
|
|
47
46
|

|
48
|
-

|
49
|
-

|
50
47
|
|
51
48
|
## Overview
|
52
49
|
|
@@ -0,0 +1,64 @@
|
|
1
|
+
fabricatio-0.2.10.dist-info/METADATA,sha256=vGRjxXvJ9oUzJnFh1q-_8IxG9xfYHGqM6y8QloMsfJc,5113
|
2
|
+
fabricatio-0.2.10.dist-info/WHEEL,sha256=jABKVkLC9kJr8mi_er5jOqpiQUjARSLXDUIIxDqsS50,96
|
3
|
+
fabricatio-0.2.10.dist-info/licenses/LICENSE,sha256=do7J7EiCGbq0QPbMAL_FqLYufXpHnCnXBOuqVPwSV8Y,1088
|
4
|
+
fabricatio/actions/article.py,sha256=nvpp_jwbwxllGOgifV1_f4W_3UVcZyg3D_sF7rzEdD8,9389
|
5
|
+
fabricatio/actions/article_rag.py,sha256=HaZRUUK4WLY64qpQssn7nm38v00nWGjFO30gGbsgJZw,11360
|
6
|
+
fabricatio/actions/fs.py,sha256=gJR14U4ln35nt8Z7OWLVAZpqGaLnED-r1Yi-lX22tkI,959
|
7
|
+
fabricatio/actions/output.py,sha256=ttXLC2wZmtVN9Ik8zsA7g45rwBO656LyRjOGRdVSyJA,6977
|
8
|
+
fabricatio/actions/rag.py,sha256=9fM4oR5B4AJNhKmWfUlNIeF4QkUntQscICNVo_zWPSA,3580
|
9
|
+
fabricatio/actions/rules.py,sha256=dkvCgNDjt2KSO1VgPRsxT4YBmIIMeetZb5tiz-slYkU,3640
|
10
|
+
fabricatio/actions/__init__.py,sha256=wVENCFtpVb1rLFxoOFJt9-8smLWXuJV7IwA8P3EfFz4,48
|
11
|
+
fabricatio/capabilities/advanced_judge.py,sha256=selB0Gwf1F4gGJlwBiRo6gI4KOUROgh3WnzO3mZFEls,706
|
12
|
+
fabricatio/capabilities/censor.py,sha256=bBT5qy-kp7fh8g4Lz3labSwxwJ60gGd_vrkc6k1cZ1U,4719
|
13
|
+
fabricatio/capabilities/check.py,sha256=kYqzohhv2bZfl1aKSUt7a8snT8YEl2zgha_ZdAdMMfQ,8622
|
14
|
+
fabricatio/capabilities/correct.py,sha256=W_cInqlciNEhyMK0YI53jk4EvW9uAdge90IO9OElUmA,10420
|
15
|
+
fabricatio/capabilities/propose.py,sha256=hkBeSlmcTdfYWT-ph6nlbtHXBozi_JXqXlWcnBy3W78,2007
|
16
|
+
fabricatio/capabilities/rag.py,sha256=kqcunWBC6oA4P1rzIG2Xu9zqSg73H3uKPF41JJQ1HVI,9595
|
17
|
+
fabricatio/capabilities/rating.py,sha256=Wt_H5fA1H4XuZGIMI8pr0cp_6jnXJABlo8lfU_4Fp5A,17645
|
18
|
+
fabricatio/capabilities/review.py,sha256=-EMZe0ADFPT6fPGmra16UPjJC1M3rAs6dPFdTZ88Fgg,5060
|
19
|
+
fabricatio/capabilities/task.py,sha256=JahC61X233UIPsjovxJgc_yqj_BjWZJBCzJZq11M2Xk,4417
|
20
|
+
fabricatio/capabilities/__init__.py,sha256=v1cHRHIJ2gxyqMLNCs6ERVcCakSasZNYzmMI4lqAcls,57
|
21
|
+
fabricatio/config.py,sha256=Y66kWovjm-_wUdXnl6wpw8RvRoqyzuMDKaisc_twFE4,17831
|
22
|
+
fabricatio/constants.py,sha256=thfDuF6JEtJ5CHOnAJLfqvn5834n8ep6DH2jc6XGzQM,577
|
23
|
+
fabricatio/core.py,sha256=VQ_JKgUGIy2gZ8xsTBZCdr_IP7wC5aPg0_bsOmjQ588,6458
|
24
|
+
fabricatio/decorators.py,sha256=-rLj9OXRfzY2E2euLKAHNRcWXjA1teLElg4zZYdIojs,8291
|
25
|
+
fabricatio/fs/curd.py,sha256=p8y0LGKgVDk-CWOlm37E6wg7RK6RCD6denKo-VsW28c,4763
|
26
|
+
fabricatio/fs/readers.py,sha256=M5kojKWsJQMQpE4CBbYvas0JKmPaiaYSfWmiqJx1SP4,1884
|
27
|
+
fabricatio/fs/__init__.py,sha256=PCf0s_9KDjVfNw7AfPoJzGt3jMq4gJOfbcT4pb0D0ZY,588
|
28
|
+
fabricatio/journal.py,sha256=stnEP88aUBA_GmU9gfTF2EZI8FS2OyMLGaMSTgK4QgA,476
|
29
|
+
fabricatio/models/action.py,sha256=Kfa-zojgHQ1vPoC2lQp-thTTp0oySKn7k6I4ea6iYTs,9837
|
30
|
+
fabricatio/models/adv_kwargs_types.py,sha256=kUO-SiZtFuz5cZCmMLnJJ9tjQ4-Zd_foo6R8HQMlM5A,1950
|
31
|
+
fabricatio/models/events.py,sha256=wiirk_ASg3iXDOZU_gIimci1VZVzWE1nDmxy-hQVJ9M,4150
|
32
|
+
fabricatio/models/extra/advanced_judge.py,sha256=INUl_41C8jkausDekkjnEmTwNfLCJ23TwFjq2cM23Cw,1092
|
33
|
+
fabricatio/models/extra/aricle_rag.py,sha256=2sQ1l8erOIESE9jYy4l4WWACNuLaLEIReQwH8PP5dFQ,7137
|
34
|
+
fabricatio/models/extra/article_base.py,sha256=DxBex4UsMAFmHmriwXkcvGIuU-WTSD4ZfzDEk-no9TA,11894
|
35
|
+
fabricatio/models/extra/article_essence.py,sha256=mlIkkRMR3I1RtqiiOnmIE3Vy623L4eECumkRzryE1pw,2749
|
36
|
+
fabricatio/models/extra/article_main.py,sha256=IcBbBE9cPcBMMd5J9BRLQ-c_AUKCDsajSbOle91_q3U,9143
|
37
|
+
fabricatio/models/extra/article_outline.py,sha256=w7O0SHgC7exbptWVbR62FMHAueMgBpyWKVYMGGl_oj8,1427
|
38
|
+
fabricatio/models/extra/article_proposal.py,sha256=NbyjW-7UiFPtnVD9nte75re4xL2pD4qL29PpNV4Cg_M,1870
|
39
|
+
fabricatio/models/extra/patches.py,sha256=_WNCxtYzzsVfUxI16vu4IqsLahLYRHdbQN9er9tqhC0,997
|
40
|
+
fabricatio/models/extra/problem.py,sha256=zZEnjBW2XGRVpJpUp09f1J_w5A1zU-LhxX78AVCq9ts,7113
|
41
|
+
fabricatio/models/extra/rag.py,sha256=RMi8vhEPB0I5mVmjRLRLxYHUnm9pFhvVwysaIwmW2s0,3955
|
42
|
+
fabricatio/models/extra/rule.py,sha256=KQQELVhCLUXhEZ35jU3WGYqKHuCYEAkn0p6pxAE-hOU,2625
|
43
|
+
fabricatio/models/extra/__init__.py,sha256=XlYnS_2B9nhLhtQkjE7rvvfPmAAtXVdNi9bSDAR-Ge8,54
|
44
|
+
fabricatio/models/generic.py,sha256=fl1Ac_tzCDBai0fPb8hukpj2D77MMHnmohPpxHXzeoU,31174
|
45
|
+
fabricatio/models/kwargs_types.py,sha256=_nHrreKvX-0nLKbok28hyVBqQubYtgnC5K45zbclEMo,4806
|
46
|
+
fabricatio/models/role.py,sha256=-CRcj5_M3_ciLPzwiNn92grBmwoSLQ-n4koVZiCNTBM,2953
|
47
|
+
fabricatio/models/task.py,sha256=SxWI-b5jlQcGmNsjQ2aKDyywXwGiUvCR1rgUhk-pli8,10503
|
48
|
+
fabricatio/models/tool.py,sha256=jQ51g4lwTPfsMF1nbreDJtBczbxIHoXcPuLSOqHliq8,12506
|
49
|
+
fabricatio/models/usages.py,sha256=ERBSR1sNc2nhXhXs6-Kv-5LNKLVSyo7NT6a4mz3sFuY,34643
|
50
|
+
fabricatio/parser.py,sha256=qN2godNsArmb90btOMxgqlol57166DyYsV2JlU8DlHs,6532
|
51
|
+
fabricatio/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
52
|
+
fabricatio/rust.pyi,sha256=FXPy0qNkRGbL4JAvrJtwd6gK5lhin5ADzQJyvfCxXGU,9479
|
53
|
+
fabricatio/rust_instances.py,sha256=Byeo8KHW_dJiXujJq7YPGDLBX5bHNDYbBc4sY3uubVY,313
|
54
|
+
fabricatio/toolboxes/arithmetic.py,sha256=WLqhY-Pikv11Y_0SGajwZx3WhsLNpHKf9drzAqOf_nY,1369
|
55
|
+
fabricatio/toolboxes/fs.py,sha256=l4L1CVxJmjw9Ld2XUpIlWfV0_Fu_2Og6d3E13I-S4aE,736
|
56
|
+
fabricatio/toolboxes/__init__.py,sha256=KBJi5OG_pExscdlM7Bnt_UF43j4I3Lv6G71kPVu4KQU,395
|
57
|
+
fabricatio/utils.py,sha256=hYYL4-GCv-nCzGgkb3J8fLtm1G9Es-qSkqXOGdmKfMA,3753
|
58
|
+
fabricatio/workflows/articles.py,sha256=ObYTFUqLUk_CzdmmnX6S7APfxcGmPFqnFr9pdjU7Z4Y,969
|
59
|
+
fabricatio/workflows/rag.py,sha256=-YYp2tlE9Vtfgpg6ROpu6QVO8j8yVSPa6yDzlN3qVxs,520
|
60
|
+
fabricatio/workflows/__init__.py,sha256=5ScFSTA-bvhCesj3U9Mnmi6Law6N1fmh5UKyh58L3u8,51
|
61
|
+
fabricatio/__init__.py,sha256=Rmvq2VgdS2u68vnOi2i5RbeWbAwrJDbk8D8D883PJWE,1022
|
62
|
+
fabricatio/rust.cp312-win_amd64.pyd,sha256=ZkyNSzELS01YB98m8oCp227OfUGwgYtpmMi-xdWb100,4177920
|
63
|
+
fabricatio-0.2.10.data/scripts/tdown.exe,sha256=O-y6yGSiWr4FRUDfS435GntS5CaiWb3-VhiDwm5_hOU,3363840
|
64
|
+
fabricatio-0.2.10.dist-info/RECORD,,
|
fabricatio/models/utils.py
DELETED
@@ -1,148 +0,0 @@
|
|
1
|
-
"""A module containing utility classes for the models."""
|
2
|
-
|
3
|
-
from enum import Enum
|
4
|
-
from typing import Any, Dict, List, Literal, Optional, Self
|
5
|
-
|
6
|
-
from pydantic import BaseModel, ConfigDict, Field
|
7
|
-
|
8
|
-
|
9
|
-
class Message(BaseModel):
|
10
|
-
"""A class representing a message."""
|
11
|
-
|
12
|
-
model_config = ConfigDict(use_attribute_docstrings=True)
|
13
|
-
role: Literal["user", "system", "assistant"]
|
14
|
-
"""
|
15
|
-
Who is sending the message.
|
16
|
-
"""
|
17
|
-
content: str
|
18
|
-
"""
|
19
|
-
The content of the message.
|
20
|
-
"""
|
21
|
-
|
22
|
-
|
23
|
-
class Messages(list):
|
24
|
-
"""A list of messages."""
|
25
|
-
|
26
|
-
def add_message(self, role: Literal["user", "system", "assistant"], content: str) -> Self:
|
27
|
-
"""Adds a message to the list with the specified role and content.
|
28
|
-
|
29
|
-
Args:
|
30
|
-
role (Literal["user", "system", "assistant"]): The role of the message sender.
|
31
|
-
content (str): The content of the message.
|
32
|
-
|
33
|
-
Returns:
|
34
|
-
Self: The current instance of Messages to allow method chaining.
|
35
|
-
"""
|
36
|
-
if content:
|
37
|
-
self.append(Message(role=role, content=content))
|
38
|
-
return self
|
39
|
-
|
40
|
-
def add_user_message(self, content: str) -> Self:
|
41
|
-
"""Adds a user message to the list with the specified content.
|
42
|
-
|
43
|
-
Args:
|
44
|
-
content (str): The content of the user message.
|
45
|
-
|
46
|
-
Returns:
|
47
|
-
Self: The current instance of Messages to allow method chaining.
|
48
|
-
"""
|
49
|
-
return self.add_message("user", content)
|
50
|
-
|
51
|
-
def add_system_message(self, content: str) -> Self:
|
52
|
-
"""Adds a system message to the list with the specified content.
|
53
|
-
|
54
|
-
Args:
|
55
|
-
content (str): The content of the system message.
|
56
|
-
|
57
|
-
Returns:
|
58
|
-
Self: The current instance of Messages to allow method chaining.
|
59
|
-
"""
|
60
|
-
return self.add_message("system", content)
|
61
|
-
|
62
|
-
def add_assistant_message(self, content: str) -> Self:
|
63
|
-
"""Adds an assistant message to the list with the specified content.
|
64
|
-
|
65
|
-
Args:
|
66
|
-
content (str): The content of the assistant message.
|
67
|
-
|
68
|
-
Returns:
|
69
|
-
Self: The current instance of Messages to allow method chaining.
|
70
|
-
"""
|
71
|
-
return self.add_message("assistant", content)
|
72
|
-
|
73
|
-
def as_list(self) -> List[Dict[str, str]]:
|
74
|
-
"""Converts the messages to a list of dictionaries.
|
75
|
-
|
76
|
-
Returns:
|
77
|
-
list[dict]: A list of dictionaries representing the messages.
|
78
|
-
"""
|
79
|
-
return [message.model_dump() for message in self]
|
80
|
-
|
81
|
-
|
82
|
-
class MilvusData(BaseModel):
|
83
|
-
"""A class representing data stored in Milvus."""
|
84
|
-
|
85
|
-
model_config = ConfigDict(use_attribute_docstrings=True)
|
86
|
-
id: Optional[int] = Field(default=None)
|
87
|
-
"""The identifier of the data."""
|
88
|
-
|
89
|
-
vector: List[float]
|
90
|
-
"""The vector representation of the data."""
|
91
|
-
|
92
|
-
text: str
|
93
|
-
"""The text representation of the data."""
|
94
|
-
|
95
|
-
subject: Optional[str] = Field(default=None)
|
96
|
-
"""A subject label that we use to demo metadata filtering later."""
|
97
|
-
|
98
|
-
def prepare_insertion(self) -> Dict[str, Any]:
|
99
|
-
"""Prepares the data for insertion into Milvus.
|
100
|
-
|
101
|
-
Returns:
|
102
|
-
dict: A dictionary containing the data to be inserted into Milvus.
|
103
|
-
"""
|
104
|
-
return self.model_dump(exclude_none=True)
|
105
|
-
|
106
|
-
def update_subject(self, new_subject: str) -> Self:
|
107
|
-
"""Updates the subject label of the data.
|
108
|
-
|
109
|
-
Args:
|
110
|
-
new_subject (str): The new subject label.
|
111
|
-
|
112
|
-
Returns:
|
113
|
-
Self: The updated instance of MilvusData.
|
114
|
-
"""
|
115
|
-
self.subject = new_subject
|
116
|
-
return self
|
117
|
-
|
118
|
-
def update_id(self, new_id: int) -> Self:
|
119
|
-
"""Updates the identifier of the data.
|
120
|
-
|
121
|
-
Args:
|
122
|
-
new_id (int): The new identifier.
|
123
|
-
|
124
|
-
Returns:
|
125
|
-
Self: The updated instance of MilvusData.
|
126
|
-
"""
|
127
|
-
self.id = new_id
|
128
|
-
return self
|
129
|
-
|
130
|
-
|
131
|
-
class TaskStatus(Enum):
|
132
|
-
"""An enumeration representing the status of a task.
|
133
|
-
|
134
|
-
Attributes:
|
135
|
-
Pending: The task is pending.
|
136
|
-
Running: The task is currently running.
|
137
|
-
Finished: The task has been successfully completed.
|
138
|
-
Failed: The task has failed.
|
139
|
-
Cancelled: The task has been cancelled.
|
140
|
-
"""
|
141
|
-
|
142
|
-
Pending = "pending"
|
143
|
-
Running = "running"
|
144
|
-
Finished = "finished"
|
145
|
-
Failed = "failed"
|
146
|
-
Cancelled = "cancelled"
|
147
|
-
|
148
|
-
|
Binary file
|
@@ -1,61 +0,0 @@
|
|
1
|
-
fabricatio-0.2.9.dev4.dist-info/METADATA,sha256=qo6WjSrz5Br7ypVenUufk1zhMg9yW_Qzt_hoLuOPFKo,5288
|
2
|
-
fabricatio-0.2.9.dev4.dist-info/WHEEL,sha256=jABKVkLC9kJr8mi_er5jOqpiQUjARSLXDUIIxDqsS50,96
|
3
|
-
fabricatio-0.2.9.dev4.dist-info/licenses/LICENSE,sha256=do7J7EiCGbq0QPbMAL_FqLYufXpHnCnXBOuqVPwSV8Y,1088
|
4
|
-
fabricatio/actions/article.py,sha256=uwRXKCzTp5C-vwIMuCJOsTwCU_F2uJ3cVNKS74AABbo,12669
|
5
|
-
fabricatio/actions/article_rag.py,sha256=itGH-VCKTVFm7hrYIOOT4FyFXP8CbL042kpYNI9a2BE,4735
|
6
|
-
fabricatio/actions/output.py,sha256=gkC2u_VpMJ6jOnbyRAJN24UVK7iDAMzhItYukaW8Spk,6498
|
7
|
-
fabricatio/actions/rag.py,sha256=5nSih3YUkdt1uU02hSAMW6sADq9mkMOR1wDv7zIrIGQ,2737
|
8
|
-
fabricatio/actions/rules.py,sha256=SNvAvQx4xUare16Za_dEpYlYI_PJNnbiO-E0XDa5JT4,2857
|
9
|
-
fabricatio/actions/__init__.py,sha256=wVENCFtpVb1rLFxoOFJt9-8smLWXuJV7IwA8P3EfFz4,48
|
10
|
-
fabricatio/capabilities/advanced_judge.py,sha256=selB0Gwf1F4gGJlwBiRo6gI4KOUROgh3WnzO3mZFEls,706
|
11
|
-
fabricatio/capabilities/censor.py,sha256=bBT5qy-kp7fh8g4Lz3labSwxwJ60gGd_vrkc6k1cZ1U,4719
|
12
|
-
fabricatio/capabilities/check.py,sha256=q12h9mQyGGjWiJp4r7JgYWeuWzj0fT3DxtL7s4n-0pY,8520
|
13
|
-
fabricatio/capabilities/correct.py,sha256=W_cInqlciNEhyMK0YI53jk4EvW9uAdge90IO9OElUmA,10420
|
14
|
-
fabricatio/capabilities/propose.py,sha256=hkBeSlmcTdfYWT-ph6nlbtHXBozi_JXqXlWcnBy3W78,2007
|
15
|
-
fabricatio/capabilities/rag.py,sha256=8TTJSV2Tz0naXyOQ5c_RQ4h9ZxyOOSE7BvyWxKkQMU0,17722
|
16
|
-
fabricatio/capabilities/rating.py,sha256=Wt_H5fA1H4XuZGIMI8pr0cp_6jnXJABlo8lfU_4Fp5A,17645
|
17
|
-
fabricatio/capabilities/review.py,sha256=-EMZe0ADFPT6fPGmra16UPjJC1M3rAs6dPFdTZ88Fgg,5060
|
18
|
-
fabricatio/capabilities/task.py,sha256=JahC61X233UIPsjovxJgc_yqj_BjWZJBCzJZq11M2Xk,4417
|
19
|
-
fabricatio/capabilities/__init__.py,sha256=v1cHRHIJ2gxyqMLNCs6ERVcCakSasZNYzmMI4lqAcls,57
|
20
|
-
fabricatio/config.py,sha256=gqhdKxoj4S0EmQKprAEWUARn7yJg-w5UJ7d7GPlyttw,17631
|
21
|
-
fabricatio/core.py,sha256=VQ_JKgUGIy2gZ8xsTBZCdr_IP7wC5aPg0_bsOmjQ588,6458
|
22
|
-
fabricatio/decorators.py,sha256=C0Gi7wcXC-0sWITqsSv3JdBGcgVJOlRvOt0FfO0aUsA,7554
|
23
|
-
fabricatio/fs/curd.py,sha256=p8y0LGKgVDk-CWOlm37E6wg7RK6RCD6denKo-VsW28c,4763
|
24
|
-
fabricatio/fs/readers.py,sha256=M5kojKWsJQMQpE4CBbYvas0JKmPaiaYSfWmiqJx1SP4,1884
|
25
|
-
fabricatio/fs/__init__.py,sha256=PCf0s_9KDjVfNw7AfPoJzGt3jMq4gJOfbcT4pb0D0ZY,588
|
26
|
-
fabricatio/journal.py,sha256=stnEP88aUBA_GmU9gfTF2EZI8FS2OyMLGaMSTgK4QgA,476
|
27
|
-
fabricatio/models/action.py,sha256=Kfa-zojgHQ1vPoC2lQp-thTTp0oySKn7k6I4ea6iYTs,9837
|
28
|
-
fabricatio/models/adv_kwargs_types.py,sha256=dcYMLn6xcnWLZTLTBdtpgUZWi-VBeub721GzHRZFT1g,860
|
29
|
-
fabricatio/models/events.py,sha256=QvlnS8FEELg6KNabcJMeh2GV_y0ZBzKOPphcteKYWYU,4183
|
30
|
-
fabricatio/models/extra/advanced_judge.py,sha256=x2FxicxqpN1eKD7PnL7--wYvxZsWnueAlCyHodRuFrU,1022
|
31
|
-
fabricatio/models/extra/article_base.py,sha256=WWfa8LJVjrs_yJGBCI81KF5VtW62rq_IcdFvBqZ2nq0,20075
|
32
|
-
fabricatio/models/extra/article_essence.py,sha256=xd6j-PDqjhrMjgUmyfk6HqkyMLu-sS9feUo0sZ3QABY,2825
|
33
|
-
fabricatio/models/extra/article_main.py,sha256=main-2eh-dH1SYN_zW2kFajMOrpatAVQVgQ-_7Yvsj4,11669
|
34
|
-
fabricatio/models/extra/article_outline.py,sha256=w7O0SHgC7exbptWVbR62FMHAueMgBpyWKVYMGGl_oj8,1427
|
35
|
-
fabricatio/models/extra/article_proposal.py,sha256=NbyjW-7UiFPtnVD9nte75re4xL2pD4qL29PpNV4Cg_M,1870
|
36
|
-
fabricatio/models/extra/patches.py,sha256=_WNCxtYzzsVfUxI16vu4IqsLahLYRHdbQN9er9tqhC0,997
|
37
|
-
fabricatio/models/extra/problem.py,sha256=RyvHQM8XgMVqDT7BCtXU0SEgODWGvTPBQIoHOURF5Oc,6656
|
38
|
-
fabricatio/models/extra/rule.py,sha256=ogJJYmV5F-CIRG2Dl95plgShskT8jzuh_0KWKHRonbA,2668
|
39
|
-
fabricatio/models/extra/__init__.py,sha256=XlYnS_2B9nhLhtQkjE7rvvfPmAAtXVdNi9bSDAR-Ge8,54
|
40
|
-
fabricatio/models/generic.py,sha256=7M1GZpgle7iwrSpzMmTBxpPx7zxCLH13l61h75woa_E,30237
|
41
|
-
fabricatio/models/kwargs_types.py,sha256=sMDA85SoC1AOJ5k6qC8qUiUv0Ne0_5ThU9FZITRNen4,5673
|
42
|
-
fabricatio/models/role.py,sha256=-CRcj5_M3_ciLPzwiNn92grBmwoSLQ-n4koVZiCNTBM,2953
|
43
|
-
fabricatio/models/task.py,sha256=YXvO3upJkTqMQjPgUGfp0bIiSyZzek2f4IagHdMW5Ik,10491
|
44
|
-
fabricatio/models/tool.py,sha256=jQ51g4lwTPfsMF1nbreDJtBczbxIHoXcPuLSOqHliq8,12506
|
45
|
-
fabricatio/models/usages.py,sha256=PX13lUCYB9XSM5tKrpYK-ov5jKclWlF9xGmPgUoovLk,32030
|
46
|
-
fabricatio/models/utils.py,sha256=Ac5g-8ic6q_w7dhNuh-iiofpL1sqOACxbjPPTljP2LY,4417
|
47
|
-
fabricatio/parser.py,sha256=qN2godNsArmb90btOMxgqlol57166DyYsV2JlU8DlHs,6532
|
48
|
-
fabricatio/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
49
|
-
fabricatio/rust.pyi,sha256=5xfla5dCACfKTkHztMc5_iCEmdDZtDH9HPG2YC92L8o,6266
|
50
|
-
fabricatio/rust_instances.py,sha256=Byeo8KHW_dJiXujJq7YPGDLBX5bHNDYbBc4sY3uubVY,313
|
51
|
-
fabricatio/toolboxes/arithmetic.py,sha256=WLqhY-Pikv11Y_0SGajwZx3WhsLNpHKf9drzAqOf_nY,1369
|
52
|
-
fabricatio/toolboxes/fs.py,sha256=l4L1CVxJmjw9Ld2XUpIlWfV0_Fu_2Og6d3E13I-S4aE,736
|
53
|
-
fabricatio/toolboxes/__init__.py,sha256=KBJi5OG_pExscdlM7Bnt_UF43j4I3Lv6G71kPVu4KQU,395
|
54
|
-
fabricatio/utils.py,sha256=uy-W5b1d8oM1UTk2IT1lLGKIn_Pmo3XU5xbahjyDESE,1710
|
55
|
-
fabricatio/workflows/articles.py,sha256=ObYTFUqLUk_CzdmmnX6S7APfxcGmPFqnFr9pdjU7Z4Y,969
|
56
|
-
fabricatio/workflows/rag.py,sha256=-YYp2tlE9Vtfgpg6ROpu6QVO8j8yVSPa6yDzlN3qVxs,520
|
57
|
-
fabricatio/workflows/__init__.py,sha256=5ScFSTA-bvhCesj3U9Mnmi6Law6N1fmh5UKyh58L3u8,51
|
58
|
-
fabricatio/__init__.py,sha256=Rmvq2VgdS2u68vnOi2i5RbeWbAwrJDbk8D8D883PJWE,1022
|
59
|
-
fabricatio/rust.cp312-win_amd64.pyd,sha256=5rWQDW_NkAoojnwNoStr9qIfa-JMcNlhEf1RLYSHM2o,2193920
|
60
|
-
fabricatio-0.2.9.dev4.data/scripts/tdown.exe,sha256=bgxOSFt8NMWHddSQ27fn9f_AyO47PlYNcK1EuUJRYJo,3364864
|
61
|
-
fabricatio-0.2.9.dev4.dist-info/RECORD,,
|
File without changes
|
File without changes
|