fabricatio 0.2.11.dev0__cp312-cp312-win_amd64.whl → 0.2.11.dev1__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 +27 -8
- fabricatio/actions/article_rag.py +35 -23
- fabricatio/capabilities/extract.py +6 -1
- fabricatio/config.py +1 -1
- fabricatio/models/extra/aricle_rag.py +9 -8
- fabricatio/models/extra/article_main.py +9 -3
- fabricatio/models/extra/problem.py +3 -3
- fabricatio/models/generic.py +16 -25
- fabricatio/models/kwargs_types.py +1 -1
- fabricatio/rust.cp312-win_amd64.pyd +0 -0
- fabricatio/rust.pyi +5 -6
- fabricatio-0.2.11.dev1.data/scripts/tdown.exe +0 -0
- {fabricatio-0.2.11.dev0.dist-info → fabricatio-0.2.11.dev1.dist-info}/METADATA +1 -1
- {fabricatio-0.2.11.dev0.dist-info → fabricatio-0.2.11.dev1.dist-info}/RECORD +16 -16
- fabricatio-0.2.11.dev0.data/scripts/tdown.exe +0 -0
- {fabricatio-0.2.11.dev0.dist-info → fabricatio-0.2.11.dev1.dist-info}/WHEEL +0 -0
- {fabricatio-0.2.11.dev0.dist-info → fabricatio-0.2.11.dev1.dist-info}/licenses/LICENSE +0 -0
fabricatio/actions/article.py
CHANGED
@@ -5,8 +5,11 @@ from pathlib import Path
|
|
5
5
|
from typing import Callable, List, Optional
|
6
6
|
|
7
7
|
from more_itertools import filter_map
|
8
|
+
from pydantic import Field
|
9
|
+
from rich import print as r_print
|
8
10
|
|
9
11
|
from fabricatio.capabilities.censor import Censor
|
12
|
+
from fabricatio.capabilities.extract import Extract
|
10
13
|
from fabricatio.capabilities.propose import Propose
|
11
14
|
from fabricatio.fs import safe_text_read
|
12
15
|
from fabricatio.journal import logger
|
@@ -16,9 +19,10 @@ from fabricatio.models.extra.article_main import Article
|
|
16
19
|
from fabricatio.models.extra.article_outline import ArticleOutline
|
17
20
|
from fabricatio.models.extra.article_proposal import ArticleProposal
|
18
21
|
from fabricatio.models.extra.rule import RuleSet
|
22
|
+
from fabricatio.models.kwargs_types import ValidateKwargs
|
19
23
|
from fabricatio.models.task import Task
|
20
24
|
from fabricatio.rust import BibManager, detect_language
|
21
|
-
from fabricatio.utils import ok
|
25
|
+
from fabricatio.utils import ok, wrapp_in_block
|
22
26
|
|
23
27
|
|
24
28
|
class ExtractArticleEssence(Action, Propose):
|
@@ -130,30 +134,45 @@ class GenerateArticleProposal(Action, Propose):
|
|
130
134
|
).update_ref(briefing)
|
131
135
|
|
132
136
|
|
133
|
-
class GenerateInitialOutline(Action,
|
137
|
+
class GenerateInitialOutline(Action, Extract):
|
134
138
|
"""Generate the initial article outline based on the article proposal."""
|
135
139
|
|
136
140
|
output_key: str = "initial_article_outline"
|
137
141
|
"""The key of the output data."""
|
138
142
|
|
143
|
+
supervisor: bool = False
|
144
|
+
"""Whether to use the supervisor to fix the outline."""
|
145
|
+
|
146
|
+
extract_kwargs: ValidateKwargs[Optional[ArticleOutline]] = Field(default_factory=ValidateKwargs)
|
147
|
+
"""The kwargs to extract the outline."""
|
148
|
+
|
139
149
|
async def _execute(
|
140
150
|
self,
|
141
151
|
article_proposal: ArticleProposal,
|
142
152
|
**_,
|
143
153
|
) -> Optional[ArticleOutline]:
|
144
154
|
raw_outline = await self.aask(
|
145
|
-
f"{(article_proposal.as_prompt())}\n
|
155
|
+
f"{(article_proposal.as_prompt())}\n"
|
146
156
|
f"Design each chapter of a proper and academic and ready for release manner.\n"
|
147
157
|
f"You Must make sure every chapter have sections, and every section have subsections.\n"
|
148
158
|
f"Make the chapter and sections and subsections bing divided into a specific enough article component.\n"
|
149
|
-
f"Every chapter must have sections, every section must have subsections
|
159
|
+
f"Every chapter must have sections, every section must have subsections.\n"
|
160
|
+
f"Note that you SHALL use `{article_proposal.language}` as written language",
|
150
161
|
)
|
151
162
|
|
163
|
+
if self.supervisor:
|
164
|
+
from questionary import confirm, text
|
165
|
+
|
166
|
+
r_print(raw_outline)
|
167
|
+
while not await confirm("Accept this version and continue?", default=True).ask_async():
|
168
|
+
imp = await text("Enter the improvement:").ask_async()
|
169
|
+
raw_outline = await self.aask(
|
170
|
+
f"{article_proposal.as_prompt()}\n{wrapp_in_block(raw_outline, 'Previous ArticleOutline')}\n{imp}"
|
171
|
+
)
|
172
|
+
r_print(raw_outline)
|
173
|
+
|
152
174
|
return ok(
|
153
|
-
await self.
|
154
|
-
ArticleOutline,
|
155
|
-
f"{raw_outline}\n\n\n\noutline provided above is the outline i need to extract to a JSON,",
|
156
|
-
),
|
175
|
+
await self.extract(ArticleOutline, raw_outline, **self.extract_kwargs),
|
157
176
|
"Could not generate the initial outline.",
|
158
177
|
).update_ref(article_proposal)
|
159
178
|
|
@@ -6,7 +6,7 @@ from typing import List, Optional
|
|
6
6
|
|
7
7
|
from fabricatio import BibManager
|
8
8
|
from fabricatio.capabilities.censor import Censor
|
9
|
-
from fabricatio.capabilities.
|
9
|
+
from fabricatio.capabilities.extract import Extract
|
10
10
|
from fabricatio.capabilities.rag import RAG
|
11
11
|
from fabricatio.journal import logger
|
12
12
|
from fabricatio.models.action import Action
|
@@ -18,16 +18,37 @@ from fabricatio.models.extra.rule import RuleSet
|
|
18
18
|
from fabricatio.utils import ok
|
19
19
|
|
20
20
|
|
21
|
-
class WriteArticleContentRAG(Action, RAG,
|
21
|
+
class WriteArticleContentRAG(Action, RAG, Extract):
|
22
22
|
"""Write an article based on the provided outline."""
|
23
23
|
|
24
|
-
ref_limit: int =
|
24
|
+
ref_limit: int = 35
|
25
25
|
"""The limit of references to be retrieved"""
|
26
26
|
extractor_model: str
|
27
27
|
"""The model to use for extracting the content from the retrieved references."""
|
28
28
|
query_model: str
|
29
29
|
"""The model to use for querying the database"""
|
30
30
|
|
31
|
+
req: str = (
|
32
|
+
"citation number is REQUIRED to cite any reference!\n"
|
33
|
+
"Everything is build upon the typst language, which is similar to latex, \n"
|
34
|
+
"Legal citing syntax examples(seperated by |): [[1]]|[[1,2]]|[[1-3]]|[[12,13-15]]|[[1-3,5-7]]\n"
|
35
|
+
"Illegal citing syntax examples(seperated by |): [[1],[2],[3]]|[[1],[1-2]]\n"
|
36
|
+
"Those reference mark shall not be omitted during the extraction\n"
|
37
|
+
"It's recommended to cite multiple references that supports your conclusion at a time.\n"
|
38
|
+
"Wrapp inline expression using $ $, and wrapp block equation using $$ $$."
|
39
|
+
"In addition to that, you can add a label outside the block equation which can be used as a cross reference identifier, the label is a string wrapped in `<` and `>`,"
|
40
|
+
"you can refer to that label by using the syntax with prefix of `@eqt:`"
|
41
|
+
"Below is a usage example:\n"
|
42
|
+
"```typst\n"
|
43
|
+
"See @eqt:mass-energy-equation , it's the equation.\n"
|
44
|
+
"$$\n"
|
45
|
+
"E = m c^2"
|
46
|
+
"$$\n"
|
47
|
+
"<mass-energy-equation>"
|
48
|
+
"In @eqt:mass-energy-equation , we get the foundation of physics.\n"
|
49
|
+
"```"
|
50
|
+
)
|
51
|
+
|
31
52
|
async def _execute(
|
32
53
|
self,
|
33
54
|
article_outline: ArticleOutline,
|
@@ -64,20 +85,17 @@ class WriteArticleContentRAG(Action, RAG, Propose):
|
|
64
85
|
),
|
65
86
|
"Failed to refine query.",
|
66
87
|
)
|
67
|
-
ret = await self.aretrieve(ref_q, ArticleChunk, final_limit=self.ref_limit, result_per_query=
|
88
|
+
ret = await self.aretrieve(ref_q, ArticleChunk, final_limit=self.ref_limit, result_per_query=6)
|
68
89
|
ret.reverse()
|
69
90
|
cm = CitationManager().update_chunks(ret)
|
70
91
|
|
71
92
|
raw_paras = await self.aask(
|
72
|
-
f"{cm.as_prompt()}\nAbove is some related reference retrieved for you.
|
93
|
+
f"{cm.as_prompt()}\nAbove is some related reference retrieved for you."
|
73
94
|
f"{article.referenced.display()}\n\nAbove is my article outline, I m writing graduate thesis titled `{article.title}`. "
|
74
95
|
f"More specifically, i m witting the Chapter `{chap.title}` >> Section `{sec.title}` >> Subsection `{subsec.title}`.\n"
|
75
|
-
f"Please help me write the paragraphs of the subsec mentioned above, which is `{subsec.title}
|
76
|
-
f"
|
77
|
-
f"
|
78
|
-
f"It 's greatly recommended to cite multiple references that stands for the same opinion at a single sentences, like [[1,5,9]] for 1th,5th and 9th references,[[1-9,16]] for 1th to 9th and 16th references.\n"
|
79
|
-
f"citation number is REQUIRED to cite any reference!\n"
|
80
|
-
f"for paragraphs that need write equation you should also no forget to doing so. wrapp inline equation using $ $, and wrapp block equation using $$ $$.\n"
|
96
|
+
f"Please help me write the paragraphs of the subsec mentioned above, which is `{subsec.title}`.\n"
|
97
|
+
f"{self.req}\n"
|
98
|
+
f"You SHALL use `{article.language}` as writing language."
|
81
99
|
)
|
82
100
|
|
83
101
|
raw_paras = (
|
@@ -85,24 +103,18 @@ class WriteArticleContentRAG(Action, RAG, Propose):
|
|
85
103
|
)
|
86
104
|
|
87
105
|
new_subsec = ok(
|
88
|
-
await self.
|
106
|
+
await self.extract(
|
89
107
|
ArticleSubsection,
|
90
|
-
|
91
|
-
f"
|
92
|
-
f"
|
93
|
-
f"
|
94
|
-
f"`[[1,5,9]]` for 1th,5th and 9th references or "
|
95
|
-
f"`[[1-9,16]]` for 1th to 9th and 16th references\n"
|
96
|
-
f"Those reference mark shall not be omitted during the extraction\n"
|
97
|
-
f"Wrapp inline expression using $ $, and wrapp block equation using $$ $$\n\n\n"
|
98
|
-
f"{subsec.display()}",
|
99
|
-
model=self.extractor_model,
|
108
|
+
raw_paras,
|
109
|
+
f"Above is the subsection titled `{subsec.title}`.\n"
|
110
|
+
f"I need you to extract the content to update my subsection obj provided below.\n{self.req}"
|
111
|
+
f"{subsec.display()}\n",
|
100
112
|
),
|
101
113
|
"Failed to propose new subsection.",
|
102
114
|
)
|
103
115
|
|
104
116
|
for p in new_subsec.paragraphs:
|
105
|
-
p.content = cm.apply(p.content)
|
117
|
+
p.content = cm.apply(p.content).replace("$$", "\n$$\n")
|
106
118
|
|
107
119
|
subsec.update_from(new_subsec)
|
108
120
|
logger.debug(f"{subsec.title}:rpl\n{subsec.display()}")
|
@@ -18,6 +18,7 @@ class Extract(Propose):
|
|
18
18
|
cls: Type[M],
|
19
19
|
source: str,
|
20
20
|
extract_requirement: Optional[str] = None,
|
21
|
+
align_language: bool = True,
|
21
22
|
**kwargs: Unpack[ValidateKwargs[M]],
|
22
23
|
) -> M: ...
|
23
24
|
@overload
|
@@ -26,6 +27,7 @@ class Extract(Propose):
|
|
26
27
|
cls: Type[M],
|
27
28
|
source: str,
|
28
29
|
extract_requirement: Optional[str] = None,
|
30
|
+
align_language: bool = True,
|
29
31
|
**kwargs: Unpack[ValidateKwargs[None]],
|
30
32
|
) -> Optional[M]: ...
|
31
33
|
|
@@ -35,6 +37,7 @@ class Extract(Propose):
|
|
35
37
|
cls: Type[M],
|
36
38
|
source: List[str],
|
37
39
|
extract_requirement: Optional[str] = None,
|
40
|
+
align_language: bool = True,
|
38
41
|
**kwargs: Unpack[ValidateKwargs[M]],
|
39
42
|
) -> List[M]: ...
|
40
43
|
@overload
|
@@ -43,6 +46,7 @@ class Extract(Propose):
|
|
43
46
|
cls: Type[M],
|
44
47
|
source: List[str],
|
45
48
|
extract_requirement: Optional[str] = None,
|
49
|
+
align_language: bool = True,
|
46
50
|
**kwargs: Unpack[ValidateKwargs[None]],
|
47
51
|
) -> List[Optional[M]]: ...
|
48
52
|
async def extract[M: ProposedAble](
|
@@ -50,6 +54,7 @@ class Extract(Propose):
|
|
50
54
|
cls: Type[M],
|
51
55
|
source: List[str] | str,
|
52
56
|
extract_requirement: Optional[str] = None,
|
57
|
+
align_language: bool = True,
|
53
58
|
**kwargs: Unpack[ValidateKwargs[Optional[M]]],
|
54
59
|
) -> M | List[M] | Optional[M] | List[Optional[M]]:
|
55
60
|
"""Extract information from a given source to a model."""
|
@@ -59,7 +64,7 @@ class Extract(Propose):
|
|
59
64
|
configs.templates.extract_template,
|
60
65
|
[{"source": s, "extract_requirement": extract_requirement} for s in source]
|
61
66
|
if isinstance(source, list)
|
62
|
-
else {"source": source, "extract_requirement": extract_requirement},
|
67
|
+
else {"source": source, "extract_requirement": extract_requirement, "align_language": align_language},
|
63
68
|
),
|
64
69
|
**kwargs,
|
65
70
|
)
|
fabricatio/config.py
CHANGED
@@ -255,7 +255,7 @@ class TemplateConfig(BaseModel):
|
|
255
255
|
|
256
256
|
extract_template: str = Field(default="extract")
|
257
257
|
"""The name of the extract template which will be used to extract model from string."""
|
258
|
-
|
258
|
+
|
259
259
|
class MagikaConfig(BaseModel):
|
260
260
|
"""Magika configuration class."""
|
261
261
|
|
@@ -136,7 +136,7 @@ class ArticleChunk(MilvusDataBase, AsPrompt):
|
|
136
136
|
"""Purge numeric citation."""
|
137
137
|
import re
|
138
138
|
|
139
|
-
return re.sub(r"\[[\d\s,\\~–-]+]", "", string)
|
139
|
+
return re.sub(r"\[[\d\s,\\~–-]+]", "", string)
|
140
140
|
|
141
141
|
@property
|
142
142
|
def auther_firstnames(self) -> List[str]:
|
@@ -175,7 +175,7 @@ class CitationManager(AsPrompt):
|
|
175
175
|
article_chunks: List[ArticleChunk] = Field(default_factory=list)
|
176
176
|
"""Article chunks."""
|
177
177
|
|
178
|
-
pat: str = r"\[\[([\d\s,-]*)]]"
|
178
|
+
pat: str = r"(\[\[([\d\s,-]*)]])"
|
179
179
|
"""Regex pattern to match citations."""
|
180
180
|
sep: str = ","
|
181
181
|
"""Separator for citation numbers."""
|
@@ -202,14 +202,15 @@ class CitationManager(AsPrompt):
|
|
202
202
|
|
203
203
|
def apply(self, string: str) -> str:
|
204
204
|
"""Apply citation replacements to the input string."""
|
205
|
-
|
206
|
-
|
207
|
-
for m in matches:
|
205
|
+
for origin,m in re.findall(self.pat, string):
|
206
|
+
logger.info(f"Matching citation: {m}")
|
208
207
|
notations = self.convert_to_numeric_notations(m)
|
209
|
-
|
208
|
+
logger.info(f"Citing Notations: {notations}")
|
210
209
|
citation_number_seq = list(flatten(self.decode_expr(n) for n in notations))
|
210
|
+
logger.info(f"Citation Number Sequence: {citation_number_seq}")
|
211
211
|
dedup = self.deduplicate_citation(citation_number_seq)
|
212
|
-
|
212
|
+
logger.info(f"Deduplicated Citation Number Sequence: {dedup}")
|
213
|
+
string=string.replace(origin, self.unpack_cite_seq(dedup))
|
213
214
|
return string
|
214
215
|
|
215
216
|
def decode_expr(self, string: str) -> List[int]:
|
@@ -226,7 +227,7 @@ class CitationManager(AsPrompt):
|
|
226
227
|
def deduplicate_citation(self, citation_seq: List[int]) -> List[int]:
|
227
228
|
"""Deduplicate citation sequence."""
|
228
229
|
chunk_seq = [a for a in self.article_chunks if a.cite_number in citation_seq]
|
229
|
-
deduped = unique(chunk_seq, lambda a: a.
|
230
|
+
deduped = unique(chunk_seq, lambda a: a.bibtex_cite_key)
|
230
231
|
return [a.cite_number for a in deduped]
|
231
232
|
|
232
233
|
def unpack_cite_seq(self, citation_seq: List[int]) -> str:
|
@@ -16,7 +16,7 @@ from fabricatio.models.extra.article_outline import (
|
|
16
16
|
)
|
17
17
|
from fabricatio.models.generic import Described, PersistentAble, SequencePatch, SketchedAble, WithRef, WordCount
|
18
18
|
from fabricatio.rust import convert_all_block_tex, convert_all_inline_tex, word_count
|
19
|
-
from pydantic import Field
|
19
|
+
from pydantic import Field, NonNegativeInt
|
20
20
|
|
21
21
|
PARAGRAPH_SEP = "// - - -"
|
22
22
|
|
@@ -24,6 +24,9 @@ PARAGRAPH_SEP = "// - - -"
|
|
24
24
|
class Paragraph(SketchedAble, WordCount, Described):
|
25
25
|
"""Structured academic paragraph blueprint for controlled content generation."""
|
26
26
|
|
27
|
+
expected_word_count: NonNegativeInt = 0
|
28
|
+
"""The expected word count of this paragraph, 0 means not specified"""
|
29
|
+
|
27
30
|
description: str = Field(
|
28
31
|
alias="elaboration",
|
29
32
|
description=Described.model_fields["description"].description,
|
@@ -239,6 +242,9 @@ class Article(
|
|
239
242
|
@precheck_package(
|
240
243
|
"questionary", "'questionary' is required to run this function. Have you installed `fabricatio[qa]`?."
|
241
244
|
)
|
242
|
-
def edit_titles(self) -> Self:
|
245
|
+
async def edit_titles(self) -> Self:
|
246
|
+
"""Edits the titles of the article."""
|
247
|
+
from questionary import text
|
248
|
+
|
243
249
|
for a in self.iter_dfs():
|
244
|
-
|
250
|
+
a.title = await text(f"Edit `{a.title}`.", default=a.title).ask_async() or a.title
|
@@ -3,12 +3,11 @@
|
|
3
3
|
from itertools import chain
|
4
4
|
from typing import Any, List, Optional, Self, Tuple, Unpack
|
5
5
|
|
6
|
-
from pydantic import Field
|
7
|
-
from rich import print as r_print
|
8
|
-
|
9
6
|
from fabricatio.journal import logger
|
10
7
|
from fabricatio.models.generic import SketchedAble, WithBriefing
|
11
8
|
from fabricatio.utils import ask_edit
|
9
|
+
from pydantic import Field
|
10
|
+
from rich import print as r_print
|
12
11
|
|
13
12
|
|
14
13
|
class Problem(SketchedAble, WithBriefing):
|
@@ -74,6 +73,7 @@ class ProblemSolutions(SketchedAble):
|
|
74
73
|
return len(self.solutions) > 0
|
75
74
|
|
76
75
|
async def edit_problem(self) -> Self:
|
76
|
+
"""Interactively edit the problem description."""
|
77
77
|
from questionary import text
|
78
78
|
|
79
79
|
"""Interactively edit the problem description."""
|
fabricatio/models/generic.py
CHANGED
@@ -6,7 +6,13 @@ from pathlib import Path
|
|
6
6
|
from typing import Any, Callable, Dict, Iterable, List, Mapping, Optional, Self, Type, Union, final, overload
|
7
7
|
|
8
8
|
import ujson
|
9
|
+
from fabricatio.config import configs
|
10
|
+
from fabricatio.fs.readers import safe_text_read
|
11
|
+
from fabricatio.journal import logger
|
12
|
+
from fabricatio.parser import JsonCapture
|
9
13
|
from fabricatio.rust import blake3_hash, detect_language
|
14
|
+
from fabricatio.rust_instances import TEMPLATE_MANAGER
|
15
|
+
from fabricatio.utils import ok
|
10
16
|
from litellm.utils import token_counter
|
11
17
|
from pydantic import (
|
12
18
|
BaseModel,
|
@@ -21,13 +27,6 @@ from pydantic import (
|
|
21
27
|
)
|
22
28
|
from pydantic.json_schema import GenerateJsonSchema, JsonSchemaValue
|
23
29
|
|
24
|
-
from fabricatio.config import configs
|
25
|
-
from fabricatio.fs.readers import safe_text_read
|
26
|
-
from fabricatio.journal import logger
|
27
|
-
from fabricatio.parser import JsonCapture
|
28
|
-
from fabricatio.rust_instances import TEMPLATE_MANAGER
|
29
|
-
from fabricatio.utils import ok
|
30
|
-
|
31
30
|
|
32
31
|
class Base(BaseModel):
|
33
32
|
"""Base class for all models with Pydantic configuration.
|
@@ -75,9 +74,9 @@ class Display(Base):
|
|
75
74
|
str: Combined display output with boundary markers
|
76
75
|
"""
|
77
76
|
return (
|
78
|
-
|
79
|
-
|
80
|
-
|
77
|
+
"--- Start of Extra Info Sequence ---"
|
78
|
+
+ "\n".join(d.compact() if compact else d.display() for d in seq)
|
79
|
+
+ "--- End of Extra Info Sequence ---"
|
81
80
|
)
|
82
81
|
|
83
82
|
|
@@ -179,16 +178,13 @@ class WithRef[T](Base):
|
|
179
178
|
)
|
180
179
|
|
181
180
|
@overload
|
182
|
-
def update_ref[S: WithRef](self: S, reference: T) -> S:
|
183
|
-
...
|
181
|
+
def update_ref[S: WithRef](self: S, reference: T) -> S: ...
|
184
182
|
|
185
183
|
@overload
|
186
|
-
def update_ref[S: WithRef](self: S, reference: "WithRef[T]") -> S:
|
187
|
-
...
|
184
|
+
def update_ref[S: WithRef](self: S, reference: "WithRef[T]") -> S: ...
|
188
185
|
|
189
186
|
@overload
|
190
|
-
def update_ref[S: WithRef](self: S, reference: None = None) -> S:
|
191
|
-
...
|
187
|
+
def update_ref[S: WithRef](self: S, reference: None = None) -> S: ...
|
192
188
|
|
193
189
|
def update_ref[S: WithRef](self: S, reference: Union[T, "WithRef[T]", None] = None) -> S: # noqa: PYI019
|
194
190
|
"""Update the reference of the object.
|
@@ -472,9 +468,8 @@ class WithFormatedJsonSchema(Base):
|
|
472
468
|
str: The JSON schema of the model in a formatted string.
|
473
469
|
"""
|
474
470
|
return ujson.dumps(
|
475
|
-
cls.model_json_schema(schema_generator=UnsortGenerate),
|
476
|
-
|
477
|
-
).decode()
|
471
|
+
cls.model_json_schema(schema_generator=UnsortGenerate), indent=2, ensure_ascii=False, sort_keys=False
|
472
|
+
)
|
478
473
|
|
479
474
|
|
480
475
|
class CreateJsonObjPrompt(WithFormatedJsonSchema):
|
@@ -884,15 +879,11 @@ class Patch[T](ProposedAble):
|
|
884
879
|
# copy the desc info of each corresponding fields from `ref_cls`
|
885
880
|
for field_name in [f for f in cls.model_fields if f in ref_cls.model_fields]:
|
886
881
|
my_schema["properties"][field_name]["description"] = (
|
887
|
-
|
888
|
-
"description"]
|
882
|
+
ref_cls.model_fields[field_name].description or my_schema["properties"][field_name]["description"]
|
889
883
|
)
|
890
884
|
my_schema["description"] = ref_cls.__doc__
|
891
885
|
|
892
|
-
return ujson.dumps(
|
893
|
-
my_schema,
|
894
|
-
option=ujson.OPT_INDENT_2,
|
895
|
-
).decode()
|
886
|
+
return ujson.dumps(my_schema, indent=2, ensure_ascii=False, sort_keys=False)
|
896
887
|
|
897
888
|
|
898
889
|
class SequencePatch[T](ProposedUpdateAble):
|
Binary file
|
fabricatio/rust.pyi
CHANGED
@@ -14,7 +14,6 @@ Key Features:
|
|
14
14
|
from pathlib import Path
|
15
15
|
from typing import Any, Dict, List, Optional, overload
|
16
16
|
|
17
|
-
|
18
17
|
class TemplateManager:
|
19
18
|
"""Template rendering engine using Handlebars templates.
|
20
19
|
|
@@ -65,14 +64,14 @@ class TemplateManager:
|
|
65
64
|
|
66
65
|
def render_template(self, name: str, data: Dict[str, Any] | List[Dict[str, Any]]) -> str | List[str]:
|
67
66
|
"""Render a template with context data.
|
68
|
-
|
67
|
+
|
69
68
|
Args:
|
70
69
|
name: Template name (without extension)
|
71
70
|
data: Context dictionary or list of dictionaries to provide variables to the template
|
72
|
-
|
71
|
+
|
73
72
|
Returns:
|
74
73
|
Rendered template content as string or list of strings
|
75
|
-
|
74
|
+
|
76
75
|
Raises:
|
77
76
|
RuntimeError: If template rendering fails
|
78
77
|
"""
|
@@ -87,11 +86,11 @@ class TemplateManager:
|
|
87
86
|
|
88
87
|
def render_template_raw(self, template: str, data: Dict[str, Any] | List[Dict[str, Any]]) -> str | List[str]:
|
89
88
|
"""Render a template with context data.
|
90
|
-
|
89
|
+
|
91
90
|
Args:
|
92
91
|
template: The template string
|
93
92
|
data: Context dictionary or list of dictionaries to provide variables to the template
|
94
|
-
|
93
|
+
|
95
94
|
Returns:
|
96
95
|
Rendered template content as string or list of strings
|
97
96
|
"""
|
Binary file
|
@@ -1,8 +1,8 @@
|
|
1
|
-
fabricatio-0.2.11.
|
2
|
-
fabricatio-0.2.11.
|
3
|
-
fabricatio-0.2.11.
|
4
|
-
fabricatio/actions/article.py,sha256=
|
5
|
-
fabricatio/actions/article_rag.py,sha256=
|
1
|
+
fabricatio-0.2.11.dev1.dist-info/METADATA,sha256=GC-i85oxlfkyYU9coT5f3zIJUVGksKiKQFDJJBnAxGc,5178
|
2
|
+
fabricatio-0.2.11.dev1.dist-info/WHEEL,sha256=jABKVkLC9kJr8mi_er5jOqpiQUjARSLXDUIIxDqsS50,96
|
3
|
+
fabricatio-0.2.11.dev1.dist-info/licenses/LICENSE,sha256=do7J7EiCGbq0QPbMAL_FqLYufXpHnCnXBOuqVPwSV8Y,1088
|
4
|
+
fabricatio/actions/article.py,sha256=J2wneRmGDVzzyvsFw1Ux69Q6kI8Ty3Dty0l5eToSGX0,10237
|
5
|
+
fabricatio/actions/article_rag.py,sha256=rN-g3uQbgmMZbYtV63jOMYQ6ssOFtKbRtZGJ8ZOjXug,10710
|
6
6
|
fabricatio/actions/fs.py,sha256=gJR14U4ln35nt8Z7OWLVAZpqGaLnED-r1Yi-lX22tkI,959
|
7
7
|
fabricatio/actions/output.py,sha256=ttXLC2wZmtVN9Ik8zsA7g45rwBO656LyRjOGRdVSyJA,6977
|
8
8
|
fabricatio/actions/rag.py,sha256=KN-OWgcQjGmNgSZ-s5B8m4LpYKSGFJR8eq72mo2CP9k,3592
|
@@ -12,14 +12,14 @@ fabricatio/capabilities/advanced_judge.py,sha256=selB0Gwf1F4gGJlwBiRo6gI4KOUROgh
|
|
12
12
|
fabricatio/capabilities/censor.py,sha256=bBT5qy-kp7fh8g4Lz3labSwxwJ60gGd_vrkc6k1cZ1U,4719
|
13
13
|
fabricatio/capabilities/check.py,sha256=kYqzohhv2bZfl1aKSUt7a8snT8YEl2zgha_ZdAdMMfQ,8622
|
14
14
|
fabricatio/capabilities/correct.py,sha256=W_cInqlciNEhyMK0YI53jk4EvW9uAdge90IO9OElUmA,10420
|
15
|
-
fabricatio/capabilities/extract.py,sha256=
|
15
|
+
fabricatio/capabilities/extract.py,sha256=PMjkWvbsv57IYT7zzd_xbIu4eQqQjpcmBtJzqlWZhHY,2495
|
16
16
|
fabricatio/capabilities/propose.py,sha256=hkBeSlmcTdfYWT-ph6nlbtHXBozi_JXqXlWcnBy3W78,2007
|
17
17
|
fabricatio/capabilities/rag.py,sha256=kqcunWBC6oA4P1rzIG2Xu9zqSg73H3uKPF41JJQ1HVI,9595
|
18
18
|
fabricatio/capabilities/rating.py,sha256=iMtQs3H6vCjuEjiuuz4SRKMVaX7yff7MHWz-slYvi5g,17835
|
19
19
|
fabricatio/capabilities/review.py,sha256=-EMZe0ADFPT6fPGmra16UPjJC1M3rAs6dPFdTZ88Fgg,5060
|
20
20
|
fabricatio/capabilities/task.py,sha256=uks1U-4LNCUdwdRxAbJJjMc31hOw6jlrcYriuQQfb04,4475
|
21
21
|
fabricatio/capabilities/__init__.py,sha256=v1cHRHIJ2gxyqMLNCs6ERVcCakSasZNYzmMI4lqAcls,57
|
22
|
-
fabricatio/config.py,sha256=
|
22
|
+
fabricatio/config.py,sha256=okqrVoLhvmAjmfQXlLY3js4nC_qW4v7mxoYaGO2dMQ8,17984
|
23
23
|
fabricatio/constants.py,sha256=thfDuF6JEtJ5CHOnAJLfqvn5834n8ep6DH2jc6XGzQM,577
|
24
24
|
fabricatio/core.py,sha256=VQ_JKgUGIy2gZ8xsTBZCdr_IP7wC5aPg0_bsOmjQ588,6458
|
25
25
|
fabricatio/decorators.py,sha256=nYCYnJd7s0h-jcCLqt4XLcc4fXTUIc5DFnk7gne1GOo,8453
|
@@ -31,26 +31,26 @@ fabricatio/models/action.py,sha256=Kfa-zojgHQ1vPoC2lQp-thTTp0oySKn7k6I4ea6iYTs,9
|
|
31
31
|
fabricatio/models/adv_kwargs_types.py,sha256=kUO-SiZtFuz5cZCmMLnJJ9tjQ4-Zd_foo6R8HQMlM5A,1950
|
32
32
|
fabricatio/models/events.py,sha256=wiirk_ASg3iXDOZU_gIimci1VZVzWE1nDmxy-hQVJ9M,4150
|
33
33
|
fabricatio/models/extra/advanced_judge.py,sha256=INUl_41C8jkausDekkjnEmTwNfLCJ23TwFjq2cM23Cw,1092
|
34
|
-
fabricatio/models/extra/aricle_rag.py,sha256=
|
34
|
+
fabricatio/models/extra/aricle_rag.py,sha256=MYTzq_wDxMXDC7kXElQNJxX6b7w50o7LyEvkE4Yosk4,9503
|
35
35
|
fabricatio/models/extra/article_base.py,sha256=DxBex4UsMAFmHmriwXkcvGIuU-WTSD4ZfzDEk-no9TA,11894
|
36
36
|
fabricatio/models/extra/article_essence.py,sha256=mlIkkRMR3I1RtqiiOnmIE3Vy623L4eECumkRzryE1pw,2749
|
37
|
-
fabricatio/models/extra/article_main.py,sha256=
|
37
|
+
fabricatio/models/extra/article_main.py,sha256=4rjev0wpI2jf52NLNatRbqFQmN6rtKaMB9iy30hSEXM,9818
|
38
38
|
fabricatio/models/extra/article_outline.py,sha256=w7O0SHgC7exbptWVbR62FMHAueMgBpyWKVYMGGl_oj8,1427
|
39
39
|
fabricatio/models/extra/article_proposal.py,sha256=NbyjW-7UiFPtnVD9nte75re4xL2pD4qL29PpNV4Cg_M,1870
|
40
40
|
fabricatio/models/extra/patches.py,sha256=_WNCxtYzzsVfUxI16vu4IqsLahLYRHdbQN9er9tqhC0,997
|
41
|
-
fabricatio/models/extra/problem.py,sha256=
|
41
|
+
fabricatio/models/extra/problem.py,sha256=8tTU-3giFHOi5j7NJsvH__JJyYcaGrcfsRnkzQNm0Ew,7216
|
42
42
|
fabricatio/models/extra/rag.py,sha256=RMi8vhEPB0I5mVmjRLRLxYHUnm9pFhvVwysaIwmW2s0,3955
|
43
43
|
fabricatio/models/extra/rule.py,sha256=KQQELVhCLUXhEZ35jU3WGYqKHuCYEAkn0p6pxAE-hOU,2625
|
44
44
|
fabricatio/models/extra/__init__.py,sha256=XlYnS_2B9nhLhtQkjE7rvvfPmAAtXVdNi9bSDAR-Ge8,54
|
45
|
-
fabricatio/models/generic.py,sha256=
|
46
|
-
fabricatio/models/kwargs_types.py,sha256=
|
45
|
+
fabricatio/models/generic.py,sha256=7wcG01DN9g4q1DJGZsTUxSTMixQgwXX0xlX4HbbLc6U,31185
|
46
|
+
fabricatio/models/kwargs_types.py,sha256=GEw75ZiiDEFx_ImhCBENnPF7K0BcdTQ1ocH5jSPwMRs,4774
|
47
47
|
fabricatio/models/role.py,sha256=-CRcj5_M3_ciLPzwiNn92grBmwoSLQ-n4koVZiCNTBM,2953
|
48
48
|
fabricatio/models/task.py,sha256=SxWI-b5jlQcGmNsjQ2aKDyywXwGiUvCR1rgUhk-pli8,10503
|
49
49
|
fabricatio/models/tool.py,sha256=jQ51g4lwTPfsMF1nbreDJtBczbxIHoXcPuLSOqHliq8,12506
|
50
50
|
fabricatio/models/usages.py,sha256=B9kII7wP9uUj6-M69kbnTsWQpZcJ-gKZ2HplIxL0j1c,33358
|
51
51
|
fabricatio/parser.py,sha256=-RbW2yzfJiu2ARq-lZw4tfgsjY2rIZWtJpoUmaE6gJQ,6637
|
52
52
|
fabricatio/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
53
|
-
fabricatio/rust.pyi,sha256=
|
53
|
+
fabricatio/rust.pyi,sha256=g-lfJY5-5kLRNUFHXPHdf539RaTErm1r29HlHAvs8hs,10091
|
54
54
|
fabricatio/rust_instances.py,sha256=Byeo8KHW_dJiXujJq7YPGDLBX5bHNDYbBc4sY3uubVY,313
|
55
55
|
fabricatio/toolboxes/arithmetic.py,sha256=WLqhY-Pikv11Y_0SGajwZx3WhsLNpHKf9drzAqOf_nY,1369
|
56
56
|
fabricatio/toolboxes/fs.py,sha256=l4L1CVxJmjw9Ld2XUpIlWfV0_Fu_2Og6d3E13I-S4aE,736
|
@@ -60,6 +60,6 @@ fabricatio/workflows/articles.py,sha256=ObYTFUqLUk_CzdmmnX6S7APfxcGmPFqnFr9pdjU7
|
|
60
60
|
fabricatio/workflows/rag.py,sha256=-YYp2tlE9Vtfgpg6ROpu6QVO8j8yVSPa6yDzlN3qVxs,520
|
61
61
|
fabricatio/workflows/__init__.py,sha256=5ScFSTA-bvhCesj3U9Mnmi6Law6N1fmh5UKyh58L3u8,51
|
62
62
|
fabricatio/__init__.py,sha256=Rmvq2VgdS2u68vnOi2i5RbeWbAwrJDbk8D8D883PJWE,1022
|
63
|
-
fabricatio/rust.cp312-win_amd64.pyd,sha256=
|
64
|
-
fabricatio-0.2.11.
|
65
|
-
fabricatio-0.2.11.
|
63
|
+
fabricatio/rust.cp312-win_amd64.pyd,sha256=xuHK1JAwjOPlN_BojaTTIKycn8ILyBRuSUE8Mlj3qhM,4147712
|
64
|
+
fabricatio-0.2.11.dev1.data/scripts/tdown.exe,sha256=yx3AcvfP3lcjWcNlgPBXzH863MlWBnrJjqXkLoC39nk,3351040
|
65
|
+
fabricatio-0.2.11.dev1.dist-info/RECORD,,
|
Binary file
|
File without changes
|
File without changes
|