fabricatio 0.3.14.dev7__cp313-cp313-manylinux_2_34_x86_64.whl → 0.3.14.dev8__cp313-cp313-manylinux_2_34_x86_64.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_rag.py +52 -52
- fabricatio/decorators.py +2 -0
- fabricatio/models/extra/aricle_rag.py +4 -5
- fabricatio/models/extra/article_base.py +2 -2
- fabricatio/models/extra/article_main.py +3 -3
- fabricatio/models/role.py +24 -20
- fabricatio/rust.cpython-313-x86_64-linux-gnu.so +0 -0
- fabricatio/rust.pyi +8 -62
- {fabricatio-0.3.14.dev7.data → fabricatio-0.3.14.dev8.data}/scripts/tdown +0 -0
- {fabricatio-0.3.14.dev7.data → fabricatio-0.3.14.dev8.data}/scripts/ttm +0 -0
- {fabricatio-0.3.14.dev7.dist-info → fabricatio-0.3.14.dev8.dist-info}/METADATA +1 -1
- {fabricatio-0.3.14.dev7.dist-info → fabricatio-0.3.14.dev8.dist-info}/RECORD +14 -14
- {fabricatio-0.3.14.dev7.dist-info → fabricatio-0.3.14.dev8.dist-info}/WHEEL +1 -1
- {fabricatio-0.3.14.dev7.dist-info → fabricatio-0.3.14.dev8.dist-info}/licenses/LICENSE +0 -0
@@ -1,11 +1,11 @@
|
|
1
1
|
"""A module for writing articles using RAG (Retrieval-Augmented Generation) capabilities."""
|
2
2
|
|
3
3
|
from asyncio import gather
|
4
|
-
|
5
4
|
from pathlib import Path
|
6
|
-
from pydantic import Field, PositiveInt
|
7
5
|
from typing import ClassVar, List, Optional
|
8
6
|
|
7
|
+
from pydantic import Field, PositiveInt
|
8
|
+
|
9
9
|
from fabricatio.capabilities.advanced_rag import AdvancedRAG
|
10
10
|
from fabricatio.capabilities.censor import Censor
|
11
11
|
from fabricatio.capabilities.extract import Extract
|
@@ -75,11 +75,11 @@ class WriteArticleContentRAG(Action, Extract, AdvancedRAG):
|
|
75
75
|
tei_endpoint: Optional[str] = None
|
76
76
|
|
77
77
|
async def _execute(
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
78
|
+
self,
|
79
|
+
article_outline: ArticleOutline,
|
80
|
+
collection_name: Optional[str] = None,
|
81
|
+
supervisor: Optional[bool] = None,
|
82
|
+
**cxt,
|
83
83
|
) -> Article:
|
84
84
|
article = Article.from_outline(article_outline).update_ref(article_outline)
|
85
85
|
self.target_collection = collection_name or self.safe_target_collection
|
@@ -100,12 +100,12 @@ class WriteArticleContentRAG(Action, Extract, AdvancedRAG):
|
|
100
100
|
"questionary", "`questionary` is required for supervisor mode, please install it by `fabricatio[qa]`"
|
101
101
|
)
|
102
102
|
async def _supervisor_inner(
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
103
|
+
self,
|
104
|
+
article: Article,
|
105
|
+
article_outline: ArticleOutline,
|
106
|
+
chap: ArticleChapter,
|
107
|
+
sec: ArticleSection,
|
108
|
+
subsec: ArticleSubsection,
|
109
109
|
) -> ArticleSubsection:
|
110
110
|
from questionary import confirm, text
|
111
111
|
from rich import print as r_print
|
@@ -133,12 +133,12 @@ class WriteArticleContentRAG(Action, Extract, AdvancedRAG):
|
|
133
133
|
return await self.extract_new_subsec(subsec, raw_paras, cm)
|
134
134
|
|
135
135
|
async def _inner(
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
136
|
+
self,
|
137
|
+
article: Article,
|
138
|
+
article_outline: ArticleOutline,
|
139
|
+
chap: ArticleChapter,
|
140
|
+
sec: ArticleSection,
|
141
|
+
subsec: ArticleSubsection,
|
142
142
|
) -> ArticleSubsection:
|
143
143
|
cm = CitationManager()
|
144
144
|
|
@@ -154,7 +154,7 @@ class WriteArticleContentRAG(Action, Extract, AdvancedRAG):
|
|
154
154
|
return await self.extract_new_subsec(subsec, raw_paras, cm)
|
155
155
|
|
156
156
|
async def extract_new_subsec(
|
157
|
-
|
157
|
+
self, subsec: ArticleSubsection, raw_paras: str, cm: CitationManager
|
158
158
|
) -> ArticleSubsection:
|
159
159
|
"""Extract the new subsec."""
|
160
160
|
new_subsec = ok(
|
@@ -177,14 +177,14 @@ class WriteArticleContentRAG(Action, Extract, AdvancedRAG):
|
|
177
177
|
return subsec
|
178
178
|
|
179
179
|
async def write_raw(
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
180
|
+
self,
|
181
|
+
article: Article,
|
182
|
+
article_outline: ArticleOutline,
|
183
|
+
chap: ArticleChapter,
|
184
|
+
sec: ArticleSection,
|
185
|
+
subsec: ArticleSubsection,
|
186
|
+
cm: CitationManager,
|
187
|
+
extra_instruction: str = "",
|
188
188
|
) -> str:
|
189
189
|
"""Write the raw paragraphs of the subsec."""
|
190
190
|
return await self.aask(
|
@@ -200,14 +200,14 @@ class WriteArticleContentRAG(Action, Extract, AdvancedRAG):
|
|
200
200
|
)
|
201
201
|
|
202
202
|
async def search_database(
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
203
|
+
self,
|
204
|
+
article: Article,
|
205
|
+
article_outline: ArticleOutline,
|
206
|
+
chap: ArticleChapter,
|
207
|
+
sec: ArticleSection,
|
208
|
+
subsec: ArticleSubsection,
|
209
|
+
cm: CitationManager,
|
210
|
+
extra_instruction: str = "",
|
211
211
|
) -> None:
|
212
212
|
"""Search database for related references."""
|
213
213
|
search_req = (
|
@@ -312,12 +312,12 @@ class TweakArticleRAG(Action, RAG, Censor):
|
|
312
312
|
"""The limit of references to be retrieved"""
|
313
313
|
|
314
314
|
async def _execute(
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
315
|
+
self,
|
316
|
+
article: Article,
|
317
|
+
collection_name: str = "article_essence",
|
318
|
+
twk_rag_ruleset: Optional[RuleSet] = None,
|
319
|
+
parallel: bool = False,
|
320
|
+
**cxt,
|
321
321
|
) -> Article:
|
322
322
|
"""Write an article based on the provided outline.
|
323
323
|
|
@@ -372,10 +372,10 @@ class TweakArticleRAG(Action, RAG, Censor):
|
|
372
372
|
subsec,
|
373
373
|
ruleset=ruleset,
|
374
374
|
reference=f"{'\n\n'.join(d.display() for d in await self.aretrieve(refind_q, document_model=ArticleEssence, max_accepted=self.ref_limit))}\n\n"
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
375
|
+
f"You can use Reference above to rewrite the `{subsec.__class__.__name__}`.\n"
|
376
|
+
f"You should Always use `{subsec.language}` as written language, "
|
377
|
+
f"which is the original language of the `{subsec.title}`. "
|
378
|
+
f"since rewrite a `{subsec.__class__.__name__}` in a different language is usually a bad choice",
|
379
379
|
)
|
380
380
|
|
381
381
|
|
@@ -390,12 +390,12 @@ class ChunkArticle(Action):
|
|
390
390
|
"""The maximum overlapping rate between chunks."""
|
391
391
|
|
392
392
|
async def _execute(
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
393
|
+
self,
|
394
|
+
article_path: str | Path,
|
395
|
+
bib_manager: BibManager,
|
396
|
+
max_chunk_size: Optional[int] = None,
|
397
|
+
max_overlapping_rate: Optional[float] = None,
|
398
|
+
**_,
|
399
399
|
) -> List[ArticleChunk]:
|
400
400
|
return ArticleChunk.from_file(
|
401
401
|
article_path,
|
fabricatio/decorators.py
CHANGED
@@ -235,6 +235,7 @@ def logging_exec_time[**P, R](
|
|
235
235
|
@wraps(func)
|
236
236
|
async def _async_wrapper(*args: P.args, **kwargs: P.kwargs) -> R:
|
237
237
|
start_time = time()
|
238
|
+
logger.debug(f"Starting execution of {func.__name__}")
|
238
239
|
result = await func(*args, **kwargs)
|
239
240
|
logger.debug(f"Execution time of `{func.__name__}`: {time() - start_time:.2f} s")
|
240
241
|
return result
|
@@ -244,6 +245,7 @@ def logging_exec_time[**P, R](
|
|
244
245
|
@wraps(func)
|
245
246
|
def _wrapper(*args: P.args, **kwargs: P.kwargs) -> R:
|
246
247
|
start_time = time()
|
248
|
+
logger.debug(f"Starting execution of {func.__name__}")
|
247
249
|
result = func(*args, **kwargs)
|
248
250
|
logger.debug(f"Execution time of {func.__name__}: {(time() - start_time) * 1000:.2f} ms")
|
249
251
|
return result
|
@@ -1,13 +1,9 @@
|
|
1
1
|
"""A Module containing the article rag models."""
|
2
2
|
|
3
|
-
from itertools import groupby
|
4
|
-
|
5
3
|
import re
|
6
4
|
from dataclasses import dataclass, field
|
7
|
-
from
|
8
|
-
from more_itertools.recipes import flatten, unique
|
5
|
+
from itertools import groupby
|
9
6
|
from pathlib import Path
|
10
|
-
from pydantic import Field
|
11
7
|
from typing import ClassVar, Dict, List, Optional, Self, Unpack
|
12
8
|
|
13
9
|
from fabricatio.fs import safe_text_read
|
@@ -17,6 +13,9 @@ from fabricatio.models.generic import AsPrompt
|
|
17
13
|
from fabricatio.models.kwargs_types import ChunkKwargs
|
18
14
|
from fabricatio.rust import BibManager, blake3_hash, split_into_chunks
|
19
15
|
from fabricatio.utils import ok, wrapp_in_block
|
16
|
+
from more_itertools.more import first
|
17
|
+
from more_itertools.recipes import flatten, unique
|
18
|
+
from pydantic import Field
|
20
19
|
|
21
20
|
|
22
21
|
class ArticleChunk(MilvusDataBase):
|
@@ -3,7 +3,6 @@
|
|
3
3
|
from abc import ABC
|
4
4
|
from enum import StrEnum
|
5
5
|
from pathlib import Path
|
6
|
-
from pydantic import Field
|
7
6
|
from typing import ClassVar, Generator, List, Optional, Self, Tuple, Type
|
8
7
|
|
9
8
|
from fabricatio.capabilities.persist import PersistentAble
|
@@ -24,6 +23,7 @@ from fabricatio.models.generic import (
|
|
24
23
|
)
|
25
24
|
from fabricatio.rust import extract_body, replace_thesis_body, split_out_metadata, to_metadata, word_count
|
26
25
|
from fabricatio.utils import fallback_kwargs, ok
|
26
|
+
from pydantic import Field
|
27
27
|
|
28
28
|
ARTICLE_WRAPPER = "// =-=-=-=-=-=-=-=-=-="
|
29
29
|
|
@@ -275,7 +275,7 @@ class ArticleBase[T: ChapterBase](FinalizedDumpAble, AsPrompt, FromTypstCode, To
|
|
275
275
|
)
|
276
276
|
|
277
277
|
def iter_dfs_rev(
|
278
|
-
|
278
|
+
self,
|
279
279
|
) -> Generator[ArticleOutlineBase, None, None]:
|
280
280
|
"""Performs a depth-first search (DFS) through the article structure in reverse order.
|
281
281
|
|
@@ -1,6 +1,5 @@
|
|
1
1
|
"""ArticleBase and ArticleSubsection classes for managing hierarchical document components."""
|
2
2
|
|
3
|
-
from pydantic import Field, NonNegativeInt
|
4
3
|
from typing import ClassVar, Dict, Generator, List, Self, Tuple, Type, override
|
5
4
|
|
6
5
|
from fabricatio.capabilities.persist import PersistentAble
|
@@ -25,6 +24,7 @@ from fabricatio.rust import (
|
|
25
24
|
split_out_metadata,
|
26
25
|
word_count,
|
27
26
|
)
|
27
|
+
from pydantic import Field, NonNegativeInt
|
28
28
|
|
29
29
|
PARAGRAPH_SEP = "// - - -"
|
30
30
|
|
@@ -81,8 +81,8 @@ class ArticleSubsection(SubSectionBase):
|
|
81
81
|
if len(self.paragraphs) == 0:
|
82
82
|
summary += f"`{self.__class__.__name__}` titled `{self.title}` have no paragraphs, You should add some!\n"
|
83
83
|
if (
|
84
|
-
|
85
|
-
|
84
|
+
abs((wc := self.word_count) - self.expected_word_count) / self.expected_word_count
|
85
|
+
> self._max_word_count_deviation
|
86
86
|
):
|
87
87
|
summary += f"`{self.__class__.__name__}` titled `{self.title}` have {wc} words, expected {self.expected_word_count} words!"
|
88
88
|
|
fabricatio/models/role.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
"""Module that contains the Role class for managing workflows and their event registrations."""
|
2
2
|
|
3
3
|
from functools import partial
|
4
|
-
from typing import Any, Dict, Self
|
4
|
+
from typing import Any, Callable, Dict, Self, Type
|
5
5
|
|
6
6
|
from fabricatio.emitter import env
|
7
7
|
from fabricatio.journal import logger
|
@@ -68,28 +68,32 @@ class Role(WithBriefing):
|
|
68
68
|
workflow.inject_personality(self.briefing)
|
69
69
|
return self
|
70
70
|
|
71
|
-
def
|
72
|
-
|
73
|
-
|
71
|
+
def _propagate_config(
|
72
|
+
self,
|
73
|
+
workflow: WorkFlow,
|
74
|
+
has_capability: Callable[[Type], bool],
|
75
|
+
config_method_name: str,
|
76
|
+
capability_description: str,
|
77
|
+
) -> None:
|
78
|
+
"""Propagates configuration to workflow and its actions if they have a given capability."""
|
79
|
+
if not has_capability(self.__class__):
|
74
80
|
return
|
75
81
|
|
76
|
-
|
77
|
-
if
|
78
|
-
|
79
|
-
|
82
|
+
config_source_for_actions = self
|
83
|
+
if has_capability(workflow.__class__):
|
84
|
+
logger.debug(
|
85
|
+
f"Configuring {capability_description} inherited from `{self.name}` for workflow: `{workflow.name}`"
|
86
|
+
)
|
87
|
+
getattr(workflow, config_method_name)(self)
|
88
|
+
config_source_for_actions = workflow
|
80
89
|
|
81
|
-
for action in (
|
82
|
-
action
|
90
|
+
for action in (act for act in workflow.iter_actions() if has_capability(act.__class__)):
|
91
|
+
getattr(action, config_method_name)(config_source_for_actions)
|
92
|
+
|
93
|
+
def _configure_scoped_config(self, workflow: WorkFlow) -> None:
|
94
|
+
"""Configure scoped configuration for workflow and its actions."""
|
95
|
+
self._propagate_config(workflow, is_scoped_config, "fallback_to", "scoped config")
|
83
96
|
|
84
97
|
def _configure_toolbox_usage(self, workflow: WorkFlow) -> None:
|
85
98
|
"""Configure toolbox usage for workflow and its actions."""
|
86
|
-
|
87
|
-
return
|
88
|
-
|
89
|
-
supply_target = self
|
90
|
-
if is_toolbox_usage(workflow):
|
91
|
-
workflow.supply_tools_from(self)
|
92
|
-
supply_target = workflow
|
93
|
-
|
94
|
-
for action in (a for a in workflow.iter_actions() if is_toolbox_usage(a)):
|
95
|
-
action.supply_tools_from(supply_target)
|
99
|
+
self._propagate_config(workflow, is_toolbox_usage, "supply_tools_from", "toolbox usage")
|
Binary file
|
fabricatio/rust.pyi
CHANGED
@@ -12,9 +12,10 @@ Key Features:
|
|
12
12
|
"""
|
13
13
|
|
14
14
|
from enum import StrEnum
|
15
|
-
from
|
15
|
+
from pathlib import Path
|
16
16
|
from typing import Any, Dict, List, Literal, Optional, Self, Tuple, Union, overload
|
17
17
|
|
18
|
+
from pydantic import JsonValue
|
18
19
|
|
19
20
|
class TemplateManager:
|
20
21
|
"""Template rendering engine using Handlebars templates.
|
@@ -47,10 +48,8 @@ class TemplateManager:
|
|
47
48
|
|
48
49
|
@overload
|
49
50
|
def render_template(self, name: str, data: Dict[str, Any]) -> str: ...
|
50
|
-
|
51
51
|
@overload
|
52
52
|
def render_template(self, name: str, data: List[Dict[str, Any]]) -> List[str]: ...
|
53
|
-
|
54
53
|
def render_template(self, name: str, data: Dict[str, Any] | List[Dict[str, Any]]) -> str | List[str]:
|
55
54
|
"""Render a template with context data.
|
56
55
|
|
@@ -67,10 +66,8 @@ class TemplateManager:
|
|
67
66
|
|
68
67
|
@overload
|
69
68
|
def render_template_raw(self, template: str, data: Dict[str, Any]) -> str: ...
|
70
|
-
|
71
69
|
@overload
|
72
70
|
def render_template_raw(self, template: str, data: List[Dict[str, Any]]) -> List[str]: ...
|
73
|
-
|
74
71
|
def render_template_raw(self, template: str, data: Dict[str, Any] | List[Dict[str, Any]]) -> str | List[str]:
|
75
72
|
"""Render a template with context data.
|
76
73
|
|
@@ -82,7 +79,6 @@ class TemplateManager:
|
|
82
79
|
Rendered template content as string or list of strings
|
83
80
|
"""
|
84
81
|
|
85
|
-
|
86
82
|
class BibManager:
|
87
83
|
"""BibTeX bibliography manager for parsing and querying citation data."""
|
88
84
|
|
@@ -191,7 +187,6 @@ class BibManager:
|
|
191
187
|
Field value if found, None otherwise
|
192
188
|
"""
|
193
189
|
|
194
|
-
|
195
190
|
def blake3_hash(content: bytes) -> str:
|
196
191
|
"""Calculate the BLAKE3 cryptographic hash of data.
|
197
192
|
|
@@ -202,11 +197,9 @@ def blake3_hash(content: bytes) -> str:
|
|
202
197
|
Hex-encoded BLAKE3 hash string
|
203
198
|
"""
|
204
199
|
|
205
|
-
|
206
200
|
def detect_language(string: str) -> str:
|
207
201
|
"""Detect the language of a given string."""
|
208
202
|
|
209
|
-
|
210
203
|
def split_word_bounds(string: str) -> List[str]:
|
211
204
|
"""Split the string into words based on word boundaries.
|
212
205
|
|
@@ -217,7 +210,6 @@ def split_word_bounds(string: str) -> List[str]:
|
|
217
210
|
A list of words extracted from the string.
|
218
211
|
"""
|
219
212
|
|
220
|
-
|
221
213
|
def split_sentence_bounds(string: str) -> List[str]:
|
222
214
|
"""Split the string into sentences based on sentence boundaries.
|
223
215
|
|
@@ -228,7 +220,6 @@ def split_sentence_bounds(string: str) -> List[str]:
|
|
228
220
|
A list of sentences extracted from the string.
|
229
221
|
"""
|
230
222
|
|
231
|
-
|
232
223
|
def split_into_chunks(string: str, max_chunk_size: int, max_overlapping_rate: float = 0.3) -> List[str]:
|
233
224
|
"""Split the string into chunks of a specified size.
|
234
225
|
|
@@ -241,7 +232,6 @@ def split_into_chunks(string: str, max_chunk_size: int, max_overlapping_rate: fl
|
|
241
232
|
A list of chunks extracted from the string.
|
242
233
|
"""
|
243
234
|
|
244
|
-
|
245
235
|
def word_count(string: str) -> int:
|
246
236
|
"""Count the number of words in the string.
|
247
237
|
|
@@ -252,67 +242,51 @@ def word_count(string: str) -> int:
|
|
252
242
|
The number of words in the string.
|
253
243
|
"""
|
254
244
|
|
255
|
-
|
256
245
|
def is_chinese(string: str) -> bool:
|
257
246
|
"""Check if the given string is in Chinese."""
|
258
247
|
|
259
|
-
|
260
248
|
def is_english(string: str) -> bool:
|
261
249
|
"""Check if the given string is in English."""
|
262
250
|
|
263
|
-
|
264
251
|
def is_japanese(string: str) -> bool:
|
265
252
|
"""Check if the given string is in Japanese."""
|
266
253
|
|
267
|
-
|
268
254
|
def is_korean(string: str) -> bool:
|
269
255
|
"""Check if the given string is in Korean."""
|
270
256
|
|
271
|
-
|
272
257
|
def is_arabic(string: str) -> bool:
|
273
258
|
"""Check if the given string is in Arabic."""
|
274
259
|
|
275
|
-
|
276
260
|
def is_russian(string: str) -> bool:
|
277
261
|
"""Check if the given string is in Russian."""
|
278
262
|
|
279
|
-
|
280
263
|
def is_german(string: str) -> bool:
|
281
264
|
"""Check if the given string is in German."""
|
282
265
|
|
283
|
-
|
284
266
|
def is_french(string: str) -> bool:
|
285
267
|
"""Check if the given string is in French."""
|
286
268
|
|
287
|
-
|
288
269
|
def is_hindi(string: str) -> bool:
|
289
270
|
"""Check if the given string is in Hindi."""
|
290
271
|
|
291
|
-
|
292
272
|
def is_italian(string: str) -> bool:
|
293
273
|
"""Check if the given string is in Italian."""
|
294
274
|
|
295
|
-
|
296
275
|
def is_dutch(string: str) -> bool:
|
297
276
|
"""Check if the given string is in Dutch."""
|
298
277
|
|
299
|
-
|
300
278
|
def is_portuguese(string: str) -> bool:
|
301
279
|
"""Check if the given string is in Portuguese."""
|
302
280
|
|
303
|
-
|
304
281
|
def is_swedish(string: str) -> bool:
|
305
282
|
"""Check if the given string is in Swedish."""
|
306
283
|
|
307
|
-
|
308
284
|
def is_turkish(string: str) -> bool:
|
309
285
|
"""Check if the given string is in Turkish."""
|
310
286
|
|
311
|
-
|
312
287
|
def is_vietnamese(string: str) -> bool:
|
313
288
|
"""Check if the given string is in Vietnamese."""
|
314
289
|
|
315
|
-
|
316
290
|
def tex_to_typst(string: str) -> str:
|
317
291
|
"""Convert TeX to Typst.
|
318
292
|
|
@@ -323,7 +297,6 @@ def tex_to_typst(string: str) -> str:
|
|
323
297
|
The converted Typst string.
|
324
298
|
"""
|
325
299
|
|
326
|
-
|
327
300
|
def convert_all_tex_math(string: str) -> str:
|
328
301
|
r"""Unified function to convert all supported TeX math expressions in a string to Typst format.
|
329
302
|
|
@@ -336,7 +309,6 @@ def convert_all_tex_math(string: str) -> str:
|
|
336
309
|
The string with TeX math expressions converted to Typst format.
|
337
310
|
"""
|
338
311
|
|
339
|
-
|
340
312
|
def fix_misplaced_labels(string: str) -> str:
|
341
313
|
"""A func to fix labels in a string.
|
342
314
|
|
@@ -347,7 +319,6 @@ def fix_misplaced_labels(string: str) -> str:
|
|
347
319
|
The fixed string with labels properly placed.
|
348
320
|
"""
|
349
321
|
|
350
|
-
|
351
322
|
def comment(string: str) -> str:
|
352
323
|
r"""Add comment to the string.
|
353
324
|
|
@@ -358,7 +329,6 @@ def comment(string: str) -> str:
|
|
358
329
|
The string with each line prefixed by '// '.
|
359
330
|
"""
|
360
331
|
|
361
|
-
|
362
332
|
def uncomment(string: str) -> str:
|
363
333
|
"""Remove comment from the string.
|
364
334
|
|
@@ -369,7 +339,6 @@ def uncomment(string: str) -> str:
|
|
369
339
|
The string with comments (lines starting with '// ' or '//') removed.
|
370
340
|
"""
|
371
341
|
|
372
|
-
|
373
342
|
def split_out_metadata(string: str) -> Tuple[Optional[JsonValue], str]:
|
374
343
|
"""Split out metadata from a string.
|
375
344
|
|
@@ -380,7 +349,6 @@ def split_out_metadata(string: str) -> Tuple[Optional[JsonValue], str]:
|
|
380
349
|
A tuple containing the metadata as a Python object (if parseable) and the remaining string.
|
381
350
|
"""
|
382
351
|
|
383
|
-
|
384
352
|
def to_metadata(data: JsonValue) -> str:
|
385
353
|
"""Convert a Python object to a YAML string.
|
386
354
|
|
@@ -391,7 +359,6 @@ def to_metadata(data: JsonValue) -> str:
|
|
391
359
|
The YAML string representation of the input data.
|
392
360
|
"""
|
393
361
|
|
394
|
-
|
395
362
|
def replace_thesis_body(string: str, wrapper: str, new_body: str) -> Optional[str]:
|
396
363
|
"""Replace content between wrapper strings.
|
397
364
|
|
@@ -405,7 +372,6 @@ def replace_thesis_body(string: str, wrapper: str, new_body: str) -> Optional[st
|
|
405
372
|
|
406
373
|
"""
|
407
374
|
|
408
|
-
|
409
375
|
def extract_body(string: str, wrapper: str) -> Optional[str]:
|
410
376
|
"""Extract the content between two occurrences of a wrapper string.
|
411
377
|
|
@@ -417,7 +383,6 @@ def extract_body(string: str, wrapper: str) -> Optional[str]:
|
|
417
383
|
The content between the first two occurrences of the wrapper string if found, otherwise None.
|
418
384
|
"""
|
419
385
|
|
420
|
-
|
421
386
|
class LLMConfig:
|
422
387
|
"""LLM configuration structure.
|
423
388
|
|
@@ -469,7 +434,6 @@ class LLMConfig:
|
|
469
434
|
frequency_penalty: Optional[float]
|
470
435
|
"""Penalizes new tokens based on their frequency in text so far (-2.0-2.0)."""
|
471
436
|
|
472
|
-
|
473
437
|
class EmbeddingConfig:
|
474
438
|
"""Embedding configuration structure."""
|
475
439
|
|
@@ -494,7 +458,6 @@ class EmbeddingConfig:
|
|
494
458
|
api_key: Optional[SecretStr]
|
495
459
|
"""The API key."""
|
496
460
|
|
497
|
-
|
498
461
|
class RagConfig:
|
499
462
|
"""RAG (Retrieval Augmented Generation) configuration structure."""
|
500
463
|
|
@@ -510,18 +473,16 @@ class RagConfig:
|
|
510
473
|
milvus_dimensions: Optional[int]
|
511
474
|
"""The dimensions for Milvus vectors."""
|
512
475
|
|
513
|
-
|
514
476
|
class DebugConfig:
|
515
477
|
"""Debug configuration structure."""
|
516
478
|
|
517
479
|
log_level: Optional[str]
|
518
480
|
"""The logging level to use."""
|
519
481
|
|
520
|
-
|
521
482
|
class TemplateManagerConfig:
|
522
483
|
"""Template manager configuration structure."""
|
523
484
|
|
524
|
-
template_dir: List[
|
485
|
+
template_dir: List[Path]
|
525
486
|
"""The directories containing the templates."""
|
526
487
|
|
527
488
|
active_loading: Optional[bool]
|
@@ -530,7 +491,6 @@ class TemplateManagerConfig:
|
|
530
491
|
template_suffix: Optional[str]
|
531
492
|
"""The suffix of the templates."""
|
532
493
|
|
533
|
-
|
534
494
|
class TemplateConfig:
|
535
495
|
"""Template configuration structure."""
|
536
496
|
|
@@ -615,7 +575,6 @@ class TemplateConfig:
|
|
615
575
|
chap_summary_template: str
|
616
576
|
"""The name of the chap summary template which will be used to generate a chapter summary."""
|
617
577
|
|
618
|
-
|
619
578
|
class RoutingConfig:
|
620
579
|
"""Routing configuration structure for controlling request dispatching behavior."""
|
621
580
|
|
@@ -631,7 +590,6 @@ class RoutingConfig:
|
|
631
590
|
cooldown_time: Optional[int]
|
632
591
|
"""Time to cooldown a deployment after failure in seconds."""
|
633
592
|
|
634
|
-
|
635
593
|
class GeneralConfig:
|
636
594
|
"""General configuration structure for application-wide settings."""
|
637
595
|
|
@@ -641,7 +599,6 @@ class GeneralConfig:
|
|
641
599
|
use_json_repair: bool
|
642
600
|
"""Whether to automatically repair malformed JSON."""
|
643
601
|
|
644
|
-
|
645
602
|
class ToolBoxConfig:
|
646
603
|
"""Configuration for toolbox functionality."""
|
647
604
|
|
@@ -651,7 +608,6 @@ class ToolBoxConfig:
|
|
651
608
|
data_module_name: str
|
652
609
|
"""The name of the module containing the data."""
|
653
610
|
|
654
|
-
|
655
611
|
class PymitterConfig:
|
656
612
|
"""Pymitter configuration structure for controlling event emission and listener behavior."""
|
657
613
|
|
@@ -664,7 +620,6 @@ class PymitterConfig:
|
|
664
620
|
max_listeners: int
|
665
621
|
"""The maximum number of listeners per event. -1 means unlimited."""
|
666
622
|
|
667
|
-
|
668
623
|
class Config:
|
669
624
|
"""Configuration structure containing all system components."""
|
670
625
|
|
@@ -698,22 +653,17 @@ class Config:
|
|
698
653
|
pymitter: PymitterConfig
|
699
654
|
"""Pymitter configuration."""
|
700
655
|
|
701
|
-
|
702
656
|
CONFIG: Config
|
703
657
|
|
704
|
-
|
705
658
|
class SecretStr:
|
706
659
|
"""A string that should not be exposed."""
|
707
660
|
|
708
661
|
def __init__(self, source: str) -> None: ...
|
709
|
-
|
710
662
|
def get_secret_value(self) -> str:
|
711
663
|
"""Expose the secret string."""
|
712
664
|
|
713
|
-
|
714
665
|
TEMPLATE_MANAGER: TemplateManager
|
715
666
|
|
716
|
-
|
717
667
|
class Event:
|
718
668
|
"""Event class that represents a hierarchical event with segments.
|
719
669
|
|
@@ -825,12 +775,9 @@ class Event:
|
|
825
775
|
"""
|
826
776
|
|
827
777
|
def __hash__(self) -> int: ...
|
828
|
-
|
829
778
|
def __eq__(self, other: object) -> bool: ...
|
830
|
-
|
831
779
|
def __ne__(self, other: object) -> bool: ...
|
832
780
|
|
833
|
-
|
834
781
|
class TaskStatus(StrEnum, str):
|
835
782
|
"""Enumeration of possible task statuses."""
|
836
783
|
|
@@ -849,7 +796,6 @@ class TaskStatus(StrEnum, str):
|
|
849
796
|
Cancelled: TaskStatus
|
850
797
|
"""Task has been cancelled."""
|
851
798
|
|
852
|
-
|
853
799
|
class TEIClient:
|
854
800
|
"""Client for TEI reranking service.
|
855
801
|
|
@@ -865,11 +811,11 @@ class TEIClient:
|
|
865
811
|
"""
|
866
812
|
|
867
813
|
async def arerank(
|
868
|
-
|
869
|
-
|
870
|
-
|
871
|
-
|
872
|
-
|
814
|
+
self,
|
815
|
+
query: str,
|
816
|
+
texts: List[str],
|
817
|
+
truncate: bool = False,
|
818
|
+
truncation_direction: Literal["Left", "Right"] = "Left",
|
873
819
|
) -> List[Tuple[int, float]]:
|
874
820
|
"""Rerank texts based on relevance to query.
|
875
821
|
|
Binary file
|
Binary file
|
@@ -1,12 +1,12 @@
|
|
1
|
-
fabricatio-0.3.14.
|
2
|
-
fabricatio-0.3.14.
|
3
|
-
fabricatio-0.3.14.
|
4
|
-
fabricatio-0.3.14.
|
5
|
-
fabricatio-0.3.14.
|
1
|
+
fabricatio-0.3.14.dev8.data/scripts/tdown,sha256=op_mffGEO0MwNpPoDJVgVwtrHvVHizmgffZG2vc7aXE,4722624
|
2
|
+
fabricatio-0.3.14.dev8.data/scripts/ttm,sha256=497Iiu2C1OODIRb-pqOJ9WZdSL7wlHqfTDoPNkINJX8,3918760
|
3
|
+
fabricatio-0.3.14.dev8.dist-info/METADATA,sha256=pPky7D10BatBBFi46gZ4JXl6uVfgtnK_-BS5ydzBMlU,4969
|
4
|
+
fabricatio-0.3.14.dev8.dist-info/WHEEL,sha256=OZYXF4emuP5o7uCHyen8StXv3k74AF7eDhQe1rxgOqQ,108
|
5
|
+
fabricatio-0.3.14.dev8.dist-info/licenses/LICENSE,sha256=yDZaTLnOi03bi3Dk6f5IjhLUc5old2yOsihHWU0z-i0,1067
|
6
6
|
fabricatio/__init__.py,sha256=pSLe6QL4zQGaZXfhF9KW4fa1D8chqCQm_7yInCP6Kt8,732
|
7
7
|
fabricatio/actions/__init__.py,sha256=ZMa1LeM5BNeqp-J-D32W-f5bD53-kdXGyt0zuueJofM,47
|
8
8
|
fabricatio/actions/article.py,sha256=8ea9QZk7m21j5fw6_CO_znZtik9_o71JmX77Po5gyS4,12188
|
9
|
-
fabricatio/actions/article_rag.py,sha256=
|
9
|
+
fabricatio/actions/article_rag.py,sha256=2lQogjV_1iZkbYI4C9kGGpQH9TBeIDaQCkyi7ueqFus,17582
|
10
10
|
fabricatio/actions/fs.py,sha256=nlTmk-tYDW158nz_fzlsNfuYJwj7j4BHn_MFY5hxdqs,934
|
11
11
|
fabricatio/actions/output.py,sha256=3VRwDcvimBPrf4ypxbhJd_ScJ_JYiC0ucr6vGOqs9Fc,9687
|
12
12
|
fabricatio/actions/rag.py,sha256=GuRU6VJzIxo3V8dvGWNQ0uQbu6nF0g_qgVuC8NPRx2Y,3487
|
@@ -24,7 +24,7 @@ fabricatio/capabilities/rag.py,sha256=VSk4BKN8Clwi28-8bz-roqHRln9vu6mGnozr6snaPe
|
|
24
24
|
fabricatio/capabilities/rating.py,sha256=FSIh3h0E7G1OkBKAkY83VA4w0G6OZ2bXq27b40WRsL8,17411
|
25
25
|
fabricatio/capabilities/review.py,sha256=rxA_qdnJc8ehytL5EnlKo9QJ99stnF-n6YaBFRYLe5I,4947
|
26
26
|
fabricatio/capabilities/task.py,sha256=Ah14-xLUzXCMRydAemHoo85QDB-cLlXJslmaTCRsfms,4288
|
27
|
-
fabricatio/decorators.py,sha256=
|
27
|
+
fabricatio/decorators.py,sha256=t3fc9SRdpy8ksQclWzm9jLMv87Ls0o4wAVhN3kMUJ_Y,8841
|
28
28
|
fabricatio/emitter.py,sha256=QpMvs8dTy1zs5iDORFKzA615S3Lb1tm6AQxYBemQGcc,6164
|
29
29
|
fabricatio/fs/__init__.py,sha256=NQ_BnAwJ0iScY34QpCBH1dCq8vO5Zi4fh6VyEzrBIb8,678
|
30
30
|
fabricatio/fs/curd.py,sha256=x7Je9V1ydv-BdZTjlLc3syZ6380gkOhpfrfnhXstisg,4624
|
@@ -34,10 +34,10 @@ fabricatio/models/action.py,sha256=O8BLh8fRNqde_3PC7OFHBjLTdLRPvy5mtalMqQFaZXs,9
|
|
34
34
|
fabricatio/models/adv_kwargs_types.py,sha256=nmj1D0GVosZxKcdiw-B5vJB04Whr5zh30ZBJntSZUpY,2034
|
35
35
|
fabricatio/models/extra/__init__.py,sha256=0R9eZsCNu6OV-Xtf15H7FrqhfHTFBFf3fBrcd7ChsJ0,53
|
36
36
|
fabricatio/models/extra/advanced_judge.py,sha256=CKPP4Lseb_Ey8Y7i2V9HJfB-mZgCknFdqq7Zo41o6s4,1060
|
37
|
-
fabricatio/models/extra/aricle_rag.py,sha256=
|
38
|
-
fabricatio/models/extra/article_base.py,sha256=
|
37
|
+
fabricatio/models/extra/aricle_rag.py,sha256=KaryVIaMZRV6vpUYwkHDe09tgOihVWGPb1mGs1GXKSw,11723
|
38
|
+
fabricatio/models/extra/article_base.py,sha256=GmtgMa--sHSP_H4rJ-6fUxj6tYYfd-m8fOOBDXVyMZQ,16357
|
39
39
|
fabricatio/models/extra/article_essence.py,sha256=lAkfGj4Jqiy3dSmtloVVr2krej76TV1Ky-2Fr6pNE_Q,2692
|
40
|
-
fabricatio/models/extra/article_main.py,sha256=
|
40
|
+
fabricatio/models/extra/article_main.py,sha256=Lg0cT4SF-0Y9in5LfYU1l9Rq_OnMYH3cCqqEByEnOhE,10817
|
41
41
|
fabricatio/models/extra/article_outline.py,sha256=71mgx66KRiXBtdYId4WNkAYp9tJ7OhUqmQyOEe7IRxI,1627
|
42
42
|
fabricatio/models/extra/article_proposal.py,sha256=7OgcsS9ujjSi_06Z1ln4SCDQgrS4xPGrtgc2dv8EzGo,1857
|
43
43
|
fabricatio/models/extra/patches.py,sha256=_ghmnlvTZQq7UJyaH77mTZE9abjvxRJ2mgWHUbezUls,977
|
@@ -46,14 +46,14 @@ fabricatio/models/extra/rag.py,sha256=fwyEXOECQNe8LPUKGAxEcp9vp7o5356rna-TzGpkvn
|
|
46
46
|
fabricatio/models/extra/rule.py,sha256=TYtA_aSgunw8wRS3BfdNqBZbbdeS-VXLbVCJhz85Suk,2617
|
47
47
|
fabricatio/models/generic.py,sha256=dGap-ckYy7ZX_lXDNxv4d3yM45vdoLDYW4cl49BbCAY,27061
|
48
48
|
fabricatio/models/kwargs_types.py,sha256=VrzAJaOSlQ-xN5NIIi3k4KpIY0c9beuxcuUnF-mkEEk,3282
|
49
|
-
fabricatio/models/role.py,sha256=
|
49
|
+
fabricatio/models/role.py,sha256=KxiP_hsIP85QtJhOQL_UH0lKul87hqRcd49IdWr05qQ,4154
|
50
50
|
fabricatio/models/task.py,sha256=CdR1Zbf-lZN0jODj9iriTn1X2DxLxjXlvZgy3kEd6lI,10723
|
51
51
|
fabricatio/models/tool.py,sha256=jYdN6FWEz6pE-vEh3H78VHDPpSttUQE79nfXOD4FE6U,12091
|
52
52
|
fabricatio/models/usages.py,sha256=bpM-a9i-WpSOh-XL3LiYTa3AxQUd_ckn44lh-uuKM6M,32250
|
53
53
|
fabricatio/parser.py,sha256=3vT5u5SGpzDH4WLJdMwK5CP8RqO4g1MyQUYpiDKDoEo,4528
|
54
54
|
fabricatio/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
55
|
-
fabricatio/rust.cpython-313-x86_64-linux-gnu.so,sha256=
|
56
|
-
fabricatio/rust.pyi,sha256=
|
55
|
+
fabricatio/rust.cpython-313-x86_64-linux-gnu.so,sha256=xzXBPe9ePywwC0nHRFo7mouBTKUerBYu1YotXCT3NJU,7904464
|
56
|
+
fabricatio/rust.pyi,sha256=czqdl3jgSjmF05T_mUK6wwzpLaPEXQIFGHckRmuYspA,25026
|
57
57
|
fabricatio/toolboxes/__init__.py,sha256=dYm_Gd8XolSU_h4wnkA09dlaLDK146eeFz0CUgPZ8_c,380
|
58
58
|
fabricatio/toolboxes/arithmetic.py,sha256=sSTPkKI6-mb278DwQKFO9jKyzc9kCx45xNH7V6bGBpE,1307
|
59
59
|
fabricatio/toolboxes/fs.py,sha256=OQMdeokYxSNVrCZJAweJ0cYiK4k2QuEiNdIbS5IHIV8,705
|
@@ -61,4 +61,4 @@ fabricatio/utils.py,sha256=qvl4R8ThuNIIoBJuR1DGEuWYZ7jRFT_8SRx4I_FA8pU,5298
|
|
61
61
|
fabricatio/workflows/__init__.py,sha256=Lq9pFo2cudwFCrQUUNgSTr1CoU0J1Nw-HNEQN7cHLp8,50
|
62
62
|
fabricatio/workflows/articles.py,sha256=ZDV5nqUKRo1GOuuKWeSV7ZI32FYZU7WiTrD4YDuCeEo,945
|
63
63
|
fabricatio/workflows/rag.py,sha256=uOZXprD479fUhLA6sYvEM8RWcVcUZXXtP0xRbTMPdHE,509
|
64
|
-
fabricatio-0.3.14.
|
64
|
+
fabricatio-0.3.14.dev8.dist-info/RECORD,,
|
File without changes
|