fabricatio 0.3.15.dev5__cp312-cp312-win_amd64.whl → 0.4.5.dev0__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/__init__.py +7 -8
- fabricatio/actions/__init__.py +69 -1
- fabricatio/capabilities/__init__.py +63 -1
- fabricatio/models/__init__.py +51 -0
- fabricatio/rust.cp312-win_amd64.pyd +0 -0
- fabricatio/toolboxes/__init__.py +2 -1
- fabricatio/toolboxes/arithmetic.py +1 -1
- fabricatio/toolboxes/fs.py +2 -2
- fabricatio/workflows/__init__.py +9 -0
- fabricatio-0.4.5.dev0.data/scripts/tdown.exe +0 -0
- {fabricatio-0.3.15.dev5.dist-info → fabricatio-0.4.5.dev0.dist-info}/METADATA +58 -27
- fabricatio-0.4.5.dev0.dist-info/RECORD +15 -0
- fabricatio/actions/article.py +0 -415
- fabricatio/actions/article_rag.py +0 -407
- fabricatio/actions/fs.py +0 -25
- fabricatio/actions/output.py +0 -247
- fabricatio/actions/rag.py +0 -96
- fabricatio/actions/rules.py +0 -83
- fabricatio/capabilities/advanced_judge.py +0 -20
- fabricatio/capabilities/advanced_rag.py +0 -61
- fabricatio/capabilities/censor.py +0 -105
- fabricatio/capabilities/check.py +0 -212
- fabricatio/capabilities/correct.py +0 -228
- fabricatio/capabilities/extract.py +0 -74
- fabricatio/capabilities/propose.py +0 -65
- fabricatio/capabilities/rag.py +0 -264
- fabricatio/capabilities/rating.py +0 -404
- fabricatio/capabilities/review.py +0 -114
- fabricatio/capabilities/task.py +0 -113
- fabricatio/decorators.py +0 -253
- fabricatio/emitter.py +0 -177
- fabricatio/fs/__init__.py +0 -35
- fabricatio/fs/curd.py +0 -153
- fabricatio/fs/readers.py +0 -61
- fabricatio/journal.py +0 -12
- fabricatio/models/action.py +0 -263
- fabricatio/models/adv_kwargs_types.py +0 -63
- fabricatio/models/extra/__init__.py +0 -1
- fabricatio/models/extra/advanced_judge.py +0 -32
- fabricatio/models/extra/aricle_rag.py +0 -286
- fabricatio/models/extra/article_base.py +0 -488
- fabricatio/models/extra/article_essence.py +0 -98
- fabricatio/models/extra/article_main.py +0 -285
- fabricatio/models/extra/article_outline.py +0 -45
- fabricatio/models/extra/article_proposal.py +0 -52
- fabricatio/models/extra/patches.py +0 -20
- fabricatio/models/extra/problem.py +0 -165
- fabricatio/models/extra/rag.py +0 -98
- fabricatio/models/extra/rule.py +0 -51
- fabricatio/models/generic.py +0 -904
- fabricatio/models/kwargs_types.py +0 -121
- fabricatio/models/role.py +0 -156
- fabricatio/models/task.py +0 -310
- fabricatio/models/tool.py +0 -328
- fabricatio/models/usages.py +0 -791
- fabricatio/parser.py +0 -114
- fabricatio/rust.pyi +0 -846
- fabricatio/utils.py +0 -156
- fabricatio/workflows/articles.py +0 -24
- fabricatio/workflows/rag.py +0 -11
- fabricatio-0.3.15.dev5.data/scripts/tdown.exe +0 -0
- fabricatio-0.3.15.dev5.data/scripts/ttm.exe +0 -0
- fabricatio-0.3.15.dev5.dist-info/RECORD +0 -63
- {fabricatio-0.3.15.dev5.dist-info → fabricatio-0.4.5.dev0.dist-info}/WHEEL +0 -0
- {fabricatio-0.3.15.dev5.dist-info → fabricatio-0.4.5.dev0.dist-info}/licenses/LICENSE +0 -0
fabricatio/rust.pyi
DELETED
@@ -1,846 +0,0 @@
|
|
1
|
-
"""Python interface definitions for Rust-based functionality.
|
2
|
-
|
3
|
-
This module provides type stubs and documentation for Rust-implemented utilities,
|
4
|
-
including template rendering, cryptographic hashing, language detection, and
|
5
|
-
bibliography management. The actual implementations are provided by Rust modules.
|
6
|
-
|
7
|
-
Key Features:
|
8
|
-
- TemplateManager: Handles Handlebars template rendering and management.
|
9
|
-
- BibManager: Manages BibTeX bibliography parsing and querying.
|
10
|
-
- Cryptographic utilities: BLAKE3 hashing.
|
11
|
-
- Text utilities: Word boundary splitting and word counting.
|
12
|
-
"""
|
13
|
-
|
14
|
-
from enum import StrEnum
|
15
|
-
from pathlib import Path
|
16
|
-
from typing import Any, Dict, List, Literal, Optional, Self, Tuple, Union, overload
|
17
|
-
|
18
|
-
from pydantic import JsonValue
|
19
|
-
|
20
|
-
class TemplateManager:
|
21
|
-
"""Template rendering engine using Handlebars templates.
|
22
|
-
|
23
|
-
This manager handles template discovery, loading, and rendering
|
24
|
-
through a wrapper around the handlebars-rust engine.
|
25
|
-
|
26
|
-
See: https://crates.io/crates/handlebars
|
27
|
-
"""
|
28
|
-
|
29
|
-
@property
|
30
|
-
def template_count(self) -> int:
|
31
|
-
"""Returns the number of currently loaded templates."""
|
32
|
-
|
33
|
-
def get_template_source(self, name: str) -> Optional[str]:
|
34
|
-
"""Get the filesystem path for a template.
|
35
|
-
|
36
|
-
Args:
|
37
|
-
name: Template name (without extension)
|
38
|
-
|
39
|
-
Returns:
|
40
|
-
Path to the template file if found, None otherwise
|
41
|
-
"""
|
42
|
-
|
43
|
-
def discover_templates(self) -> None:
|
44
|
-
"""Scan template directories and load available templates.
|
45
|
-
|
46
|
-
This refreshes the template cache, finding any new or modified templates.
|
47
|
-
"""
|
48
|
-
|
49
|
-
@overload
|
50
|
-
def render_template(self, name: str, data: Dict[str, Any]) -> str: ...
|
51
|
-
@overload
|
52
|
-
def render_template(self, name: str, data: List[Dict[str, Any]]) -> List[str]: ...
|
53
|
-
def render_template(self, name: str, data: Dict[str, Any] | List[Dict[str, Any]]) -> str | List[str]:
|
54
|
-
"""Render a template with context data.
|
55
|
-
|
56
|
-
Args:
|
57
|
-
name: Template name (without extension)
|
58
|
-
data: Context dictionary or list of dictionaries to provide variables to the template
|
59
|
-
|
60
|
-
Returns:
|
61
|
-
Rendered template content as string or list of strings
|
62
|
-
|
63
|
-
Raises:
|
64
|
-
RuntimeError: If template rendering fails
|
65
|
-
"""
|
66
|
-
|
67
|
-
@overload
|
68
|
-
def render_template_raw(self, template: str, data: Dict[str, Any]) -> str: ...
|
69
|
-
@overload
|
70
|
-
def render_template_raw(self, template: str, data: List[Dict[str, Any]]) -> List[str]: ...
|
71
|
-
def render_template_raw(self, template: str, data: Dict[str, Any] | List[Dict[str, Any]]) -> str | List[str]:
|
72
|
-
"""Render a template with context data.
|
73
|
-
|
74
|
-
Args:
|
75
|
-
template: The template string
|
76
|
-
data: Context dictionary or list of dictionaries to provide variables to the template
|
77
|
-
|
78
|
-
Returns:
|
79
|
-
Rendered template content as string or list of strings
|
80
|
-
"""
|
81
|
-
|
82
|
-
class BibManager:
|
83
|
-
"""BibTeX bibliography manager for parsing and querying citation data."""
|
84
|
-
|
85
|
-
def __init__(self, path: str) -> None:
|
86
|
-
"""Initialize the bibliography manager.
|
87
|
-
|
88
|
-
Args:
|
89
|
-
path: Path to BibTeX (.bib) file to load
|
90
|
-
|
91
|
-
Raises:
|
92
|
-
RuntimeError: If file cannot be read or parsed
|
93
|
-
"""
|
94
|
-
|
95
|
-
def get_cite_key_by_title(self, title: str) -> Optional[str]:
|
96
|
-
"""Find citation key by exact title match.
|
97
|
-
|
98
|
-
Args:
|
99
|
-
title: Full title to search for (case-insensitive)
|
100
|
-
|
101
|
-
Returns:
|
102
|
-
Citation key if exact match found, None otherwise
|
103
|
-
"""
|
104
|
-
|
105
|
-
def get_cite_key_by_title_fuzzy(self, title: str) -> Optional[str]:
|
106
|
-
"""Find citation key by fuzzy title match.
|
107
|
-
|
108
|
-
Args:
|
109
|
-
title: Search term to find in bibliography entries
|
110
|
-
|
111
|
-
Returns:
|
112
|
-
Citation key of best matching entry, or None if no good match
|
113
|
-
"""
|
114
|
-
|
115
|
-
def get_cite_key_fuzzy(self, query: str) -> Optional[str]:
|
116
|
-
"""Find best matching citation using fuzzy text search.
|
117
|
-
|
118
|
-
Args:
|
119
|
-
query: Search term to find in bibliography entries
|
120
|
-
|
121
|
-
Returns:
|
122
|
-
Citation key of best matching entry, or None if no good match
|
123
|
-
|
124
|
-
Notes:
|
125
|
-
Uses nucleo_matcher for high-quality fuzzy text searching
|
126
|
-
See: https://crates.io/crates/nucleo-matcher
|
127
|
-
"""
|
128
|
-
|
129
|
-
def list_titles(self, is_verbatim: Optional[bool] = False) -> List[str]:
|
130
|
-
"""List all titles in the bibliography.
|
131
|
-
|
132
|
-
Args:
|
133
|
-
is_verbatim: Whether to return verbatim titles (without formatting)
|
134
|
-
|
135
|
-
Returns:
|
136
|
-
List of all titles in the bibliography
|
137
|
-
"""
|
138
|
-
|
139
|
-
def get_author_by_key(self, key: str) -> Optional[List[str]]:
|
140
|
-
"""Retrieve authors by citation key.
|
141
|
-
|
142
|
-
Args:
|
143
|
-
key: Citation key
|
144
|
-
|
145
|
-
Returns:
|
146
|
-
List of authors if found, None otherwise
|
147
|
-
"""
|
148
|
-
|
149
|
-
def get_year_by_key(self, key: str) -> Optional[int]:
|
150
|
-
"""Retrieve the publication year by citation key.
|
151
|
-
|
152
|
-
Args:
|
153
|
-
key: Citation key
|
154
|
-
|
155
|
-
Returns:
|
156
|
-
Publication year if found, None otherwise
|
157
|
-
"""
|
158
|
-
|
159
|
-
def get_abstract_by_key(self, key: str) -> Optional[str]:
|
160
|
-
"""Retrieve the abstract by citation key.
|
161
|
-
|
162
|
-
Args:
|
163
|
-
key: Citation key
|
164
|
-
|
165
|
-
Returns:
|
166
|
-
Abstract if found, None otherwise
|
167
|
-
"""
|
168
|
-
|
169
|
-
def get_title_by_key(self, key: str) -> Optional[str]:
|
170
|
-
"""Retrieve the title by citation key.
|
171
|
-
|
172
|
-
Args:
|
173
|
-
key: Citation key
|
174
|
-
|
175
|
-
Returns:
|
176
|
-
Title if found, None otherwise
|
177
|
-
"""
|
178
|
-
|
179
|
-
def get_field_by_key(self, key: str, field: str) -> Optional[str]:
|
180
|
-
"""Retrieve a specific field by citation key.
|
181
|
-
|
182
|
-
Args:
|
183
|
-
key: Citation key
|
184
|
-
field: Field name
|
185
|
-
|
186
|
-
Returns:
|
187
|
-
Field value if found, None otherwise
|
188
|
-
"""
|
189
|
-
|
190
|
-
def blake3_hash(content: bytes) -> str:
|
191
|
-
"""Calculate the BLAKE3 cryptographic hash of data.
|
192
|
-
|
193
|
-
Args:
|
194
|
-
content: Bytes to be hashed
|
195
|
-
|
196
|
-
Returns:
|
197
|
-
Hex-encoded BLAKE3 hash string
|
198
|
-
"""
|
199
|
-
|
200
|
-
def detect_language(string: str) -> str:
|
201
|
-
"""Detect the language of a given string."""
|
202
|
-
|
203
|
-
def split_word_bounds(string: str) -> List[str]:
|
204
|
-
"""Split the string into words based on word boundaries.
|
205
|
-
|
206
|
-
Args:
|
207
|
-
string: The input string to be split.
|
208
|
-
|
209
|
-
Returns:
|
210
|
-
A list of words extracted from the string.
|
211
|
-
"""
|
212
|
-
|
213
|
-
def split_sentence_bounds(string: str) -> List[str]:
|
214
|
-
"""Split the string into sentences based on sentence boundaries.
|
215
|
-
|
216
|
-
Args:
|
217
|
-
string: The input string to be split.
|
218
|
-
|
219
|
-
Returns:
|
220
|
-
A list of sentences extracted from the string.
|
221
|
-
"""
|
222
|
-
|
223
|
-
def split_into_chunks(string: str, max_chunk_size: int, max_overlapping_rate: float = 0.3) -> List[str]:
|
224
|
-
"""Split the string into chunks of a specified size.
|
225
|
-
|
226
|
-
Args:
|
227
|
-
string: The input string to be split.
|
228
|
-
max_chunk_size: The maximum size of each chunk.
|
229
|
-
max_overlapping_rate: The minimum overlapping rate between chunks.
|
230
|
-
|
231
|
-
Returns:
|
232
|
-
A list of chunks extracted from the string.
|
233
|
-
"""
|
234
|
-
|
235
|
-
def word_count(string: str) -> int:
|
236
|
-
"""Count the number of words in the string.
|
237
|
-
|
238
|
-
Args:
|
239
|
-
string: The input string to count words from.
|
240
|
-
|
241
|
-
Returns:
|
242
|
-
The number of words in the string.
|
243
|
-
"""
|
244
|
-
|
245
|
-
def is_chinese(string: str) -> bool:
|
246
|
-
"""Check if the given string is in Chinese."""
|
247
|
-
|
248
|
-
def is_english(string: str) -> bool:
|
249
|
-
"""Check if the given string is in English."""
|
250
|
-
|
251
|
-
def is_japanese(string: str) -> bool:
|
252
|
-
"""Check if the given string is in Japanese."""
|
253
|
-
|
254
|
-
def is_korean(string: str) -> bool:
|
255
|
-
"""Check if the given string is in Korean."""
|
256
|
-
|
257
|
-
def is_arabic(string: str) -> bool:
|
258
|
-
"""Check if the given string is in Arabic."""
|
259
|
-
|
260
|
-
def is_russian(string: str) -> bool:
|
261
|
-
"""Check if the given string is in Russian."""
|
262
|
-
|
263
|
-
def is_german(string: str) -> bool:
|
264
|
-
"""Check if the given string is in German."""
|
265
|
-
|
266
|
-
def is_french(string: str) -> bool:
|
267
|
-
"""Check if the given string is in French."""
|
268
|
-
|
269
|
-
def is_hindi(string: str) -> bool:
|
270
|
-
"""Check if the given string is in Hindi."""
|
271
|
-
|
272
|
-
def is_italian(string: str) -> bool:
|
273
|
-
"""Check if the given string is in Italian."""
|
274
|
-
|
275
|
-
def is_dutch(string: str) -> bool:
|
276
|
-
"""Check if the given string is in Dutch."""
|
277
|
-
|
278
|
-
def is_portuguese(string: str) -> bool:
|
279
|
-
"""Check if the given string is in Portuguese."""
|
280
|
-
|
281
|
-
def is_swedish(string: str) -> bool:
|
282
|
-
"""Check if the given string is in Swedish."""
|
283
|
-
|
284
|
-
def is_turkish(string: str) -> bool:
|
285
|
-
"""Check if the given string is in Turkish."""
|
286
|
-
|
287
|
-
def is_vietnamese(string: str) -> bool:
|
288
|
-
"""Check if the given string is in Vietnamese."""
|
289
|
-
|
290
|
-
def tex_to_typst(string: str) -> str:
|
291
|
-
"""Convert TeX to Typst.
|
292
|
-
|
293
|
-
Args:
|
294
|
-
string: The input TeX string to be converted.
|
295
|
-
|
296
|
-
Returns:
|
297
|
-
The converted Typst string.
|
298
|
-
"""
|
299
|
-
|
300
|
-
def convert_all_tex_math(string: str) -> str:
|
301
|
-
r"""Unified function to convert all supported TeX math expressions in a string to Typst format.
|
302
|
-
|
303
|
-
Handles $...$, $$...$$, \\(...\\), and \\[...\\]
|
304
|
-
|
305
|
-
Args:
|
306
|
-
string: The input string containing TeX math expressions.
|
307
|
-
|
308
|
-
Returns:
|
309
|
-
The string with TeX math expressions converted to Typst format.
|
310
|
-
"""
|
311
|
-
|
312
|
-
def fix_misplaced_labels(string: str) -> str:
|
313
|
-
"""A func to fix labels in a string.
|
314
|
-
|
315
|
-
Args:
|
316
|
-
string: The input string containing misplaced labels.
|
317
|
-
|
318
|
-
Returns:
|
319
|
-
The fixed string with labels properly placed.
|
320
|
-
"""
|
321
|
-
|
322
|
-
def comment(string: str) -> str:
|
323
|
-
r"""Add comment to the string.
|
324
|
-
|
325
|
-
Args:
|
326
|
-
string: The input string to which comments will be added.
|
327
|
-
|
328
|
-
Returns:
|
329
|
-
The string with each line prefixed by '// '.
|
330
|
-
"""
|
331
|
-
|
332
|
-
def uncomment(string: str) -> str:
|
333
|
-
"""Remove comment from the string.
|
334
|
-
|
335
|
-
Args:
|
336
|
-
string: The input string from which comments will be removed.
|
337
|
-
|
338
|
-
Returns:
|
339
|
-
The string with comments (lines starting with '// ' or '//') removed.
|
340
|
-
"""
|
341
|
-
|
342
|
-
def strip_comment(string: str) -> str:
|
343
|
-
"""Remove leading and trailing comment lines from a multi-line string.
|
344
|
-
|
345
|
-
Args:
|
346
|
-
string: Input string that may have comment lines at start and/or end
|
347
|
-
|
348
|
-
Returns:
|
349
|
-
str: A new string with leading and trailing comment lines removed
|
350
|
-
"""
|
351
|
-
|
352
|
-
def split_out_metadata(string: str) -> Tuple[Optional[JsonValue], str]:
|
353
|
-
"""Split out metadata from a string.
|
354
|
-
|
355
|
-
Args:
|
356
|
-
string: The input string containing metadata.
|
357
|
-
|
358
|
-
Returns:
|
359
|
-
A tuple containing the metadata as a Python object (if parseable) and the remaining string.
|
360
|
-
"""
|
361
|
-
|
362
|
-
def to_metadata(data: JsonValue) -> str:
|
363
|
-
"""Convert a Python object to a YAML string.
|
364
|
-
|
365
|
-
Args:
|
366
|
-
data: The Python object to be converted to YAML.
|
367
|
-
|
368
|
-
Returns:
|
369
|
-
The YAML string representation of the input data.
|
370
|
-
"""
|
371
|
-
|
372
|
-
def replace_thesis_body(string: str, wrapper: str, new_body: str) -> Optional[str]:
|
373
|
-
"""Replace content between wrapper strings.
|
374
|
-
|
375
|
-
Args:
|
376
|
-
string: The input string containing content wrapped by delimiter strings.
|
377
|
-
wrapper: The delimiter string that marks the beginning and end of the content to replace.
|
378
|
-
new_body: The new content to place between the wrapper strings.
|
379
|
-
|
380
|
-
Returns:
|
381
|
-
A new string with the content between wrappers replaced.
|
382
|
-
|
383
|
-
"""
|
384
|
-
|
385
|
-
def extract_body(string: str, wrapper: str) -> Optional[str]:
|
386
|
-
"""Extract the content between two occurrences of a wrapper string.
|
387
|
-
|
388
|
-
Args:
|
389
|
-
string: The input string containing content wrapped by delimiter strings.
|
390
|
-
wrapper: The delimiter string that marks the beginning and end of the content to extract.
|
391
|
-
|
392
|
-
Returns:
|
393
|
-
The content between the first two occurrences of the wrapper string if found, otherwise None.
|
394
|
-
"""
|
395
|
-
|
396
|
-
class LLMConfig:
|
397
|
-
"""LLM configuration structure.
|
398
|
-
|
399
|
-
Contains parameters for configuring Language Learning Models.
|
400
|
-
"""
|
401
|
-
|
402
|
-
api_endpoint: Optional[str]
|
403
|
-
"""API endpoint URL for the LLM service."""
|
404
|
-
|
405
|
-
api_key: Optional[SecretStr]
|
406
|
-
"""Authentication key for the LLM service."""
|
407
|
-
|
408
|
-
timeout: Optional[int]
|
409
|
-
"""Maximum time in seconds to wait for a response."""
|
410
|
-
|
411
|
-
max_retries: Optional[int]
|
412
|
-
"""Number of retry attempts for failed requests."""
|
413
|
-
|
414
|
-
model: Optional[str]
|
415
|
-
"""Name of the LLM model to use."""
|
416
|
-
|
417
|
-
temperature: Optional[float]
|
418
|
-
"""Controls randomness in response generation (0.0-2.0)."""
|
419
|
-
|
420
|
-
stop_sign: Optional[List[str]]
|
421
|
-
"""Sequence(s) that signal the LLM to stop generating tokens."""
|
422
|
-
|
423
|
-
top_p: Optional[float]
|
424
|
-
"""Controls diversity via nucleus sampling (0.0-1.0)."""
|
425
|
-
|
426
|
-
generation_count: Optional[int]
|
427
|
-
"""Number of completions to generate for each prompt."""
|
428
|
-
|
429
|
-
stream: Optional[bool]
|
430
|
-
"""When true, responses are streamed as they're generated."""
|
431
|
-
|
432
|
-
max_tokens: Optional[int]
|
433
|
-
"""Maximum number of tokens to generate in the response."""
|
434
|
-
|
435
|
-
rpm: Optional[int]
|
436
|
-
"""Rate limit in requests per minute."""
|
437
|
-
|
438
|
-
tpm: Optional[int]
|
439
|
-
"""Rate limit in tokens per minute."""
|
440
|
-
|
441
|
-
presence_penalty: Optional[float]
|
442
|
-
"""Penalizes new tokens based on their presence in text so far (-2.0-2.0)."""
|
443
|
-
|
444
|
-
frequency_penalty: Optional[float]
|
445
|
-
"""Penalizes new tokens based on their frequency in text so far (-2.0-2.0)."""
|
446
|
-
|
447
|
-
class EmbeddingConfig:
|
448
|
-
"""Embedding configuration structure."""
|
449
|
-
|
450
|
-
model: Optional[str]
|
451
|
-
"""The embedding model name."""
|
452
|
-
|
453
|
-
dimensions: Optional[int]
|
454
|
-
"""The dimensions of the embedding."""
|
455
|
-
|
456
|
-
timeout: Optional[int]
|
457
|
-
"""The timeout of the embedding model in seconds."""
|
458
|
-
|
459
|
-
max_sequence_length: Optional[int]
|
460
|
-
"""The maximum sequence length of the embedding model."""
|
461
|
-
|
462
|
-
caching: Optional[bool]
|
463
|
-
"""Whether to cache the embedding."""
|
464
|
-
|
465
|
-
api_endpoint: Optional[str]
|
466
|
-
"""The API endpoint URL."""
|
467
|
-
|
468
|
-
api_key: Optional[SecretStr]
|
469
|
-
"""The API key."""
|
470
|
-
|
471
|
-
class RagConfig:
|
472
|
-
"""RAG (Retrieval Augmented Generation) configuration structure."""
|
473
|
-
|
474
|
-
milvus_uri: Optional[str]
|
475
|
-
"""The URI of the Milvus server."""
|
476
|
-
|
477
|
-
milvus_timeout: Optional[float]
|
478
|
-
"""The timeout of the Milvus server in seconds."""
|
479
|
-
|
480
|
-
milvus_token: Optional[SecretStr]
|
481
|
-
"""The token for Milvus authentication."""
|
482
|
-
|
483
|
-
milvus_dimensions: Optional[int]
|
484
|
-
"""The dimensions for Milvus vectors."""
|
485
|
-
|
486
|
-
class DebugConfig:
|
487
|
-
"""Debug configuration structure."""
|
488
|
-
|
489
|
-
log_level: Optional[str]
|
490
|
-
"""The logging level to use."""
|
491
|
-
|
492
|
-
class TemplateManagerConfig:
|
493
|
-
"""Template manager configuration structure."""
|
494
|
-
|
495
|
-
template_dir: List[Path]
|
496
|
-
"""The directories containing the templates."""
|
497
|
-
|
498
|
-
active_loading: Optional[bool]
|
499
|
-
"""Whether to enable active loading of templates."""
|
500
|
-
|
501
|
-
template_suffix: Optional[str]
|
502
|
-
"""The suffix of the templates."""
|
503
|
-
|
504
|
-
class TemplateConfig:
|
505
|
-
"""Template configuration structure."""
|
506
|
-
|
507
|
-
research_content_summary_template: str
|
508
|
-
"""The name of the research content summary template which will be used to generate a summary of research content."""
|
509
|
-
|
510
|
-
create_json_obj_template: str
|
511
|
-
"""The name of the create json object template which will be used to create a json object."""
|
512
|
-
|
513
|
-
draft_tool_usage_code_template: str
|
514
|
-
"""The name of the draft tool usage code template which will be used to draft tool usage code."""
|
515
|
-
|
516
|
-
make_choice_template: str
|
517
|
-
"""The name of the make choice template which will be used to make a choice."""
|
518
|
-
|
519
|
-
make_judgment_template: str
|
520
|
-
"""The name of the make judgment template which will be used to make a judgment."""
|
521
|
-
|
522
|
-
dependencies_template: str
|
523
|
-
"""The name of the dependencies template which will be used to manage dependencies."""
|
524
|
-
|
525
|
-
task_briefing_template: str
|
526
|
-
"""The name of the task briefing template which will be used to brief a task."""
|
527
|
-
|
528
|
-
rate_fine_grind_template: str
|
529
|
-
"""The name of the rate fine grind template which will be used to rate fine grind."""
|
530
|
-
|
531
|
-
draft_rating_manual_template: str
|
532
|
-
"""The name of the draft rating manual template which will be used to draft rating manual."""
|
533
|
-
|
534
|
-
draft_rating_criteria_template: str
|
535
|
-
"""The name of the draft rating criteria template which will be used to draft rating criteria."""
|
536
|
-
|
537
|
-
extract_reasons_from_examples_template: str
|
538
|
-
"""The name of the extract reasons from examples template which will be used to extract reasons from examples."""
|
539
|
-
|
540
|
-
extract_criteria_from_reasons_template: str
|
541
|
-
"""The name of the extract criteria from reasons template which will be used to extract criteria from reasons."""
|
542
|
-
|
543
|
-
draft_rating_weights_klee_template: str
|
544
|
-
"""The name of the draft rating weights klee template which will be used to draft rating weights with Klee method."""
|
545
|
-
|
546
|
-
retrieved_display_template: str
|
547
|
-
"""The name of the retrieved display template which will be used to display retrieved documents."""
|
548
|
-
|
549
|
-
liststr_template: str
|
550
|
-
"""The name of the liststr template which will be used to display a list of strings."""
|
551
|
-
|
552
|
-
refined_query_template: str
|
553
|
-
"""The name of the refined query template which will be used to refine a query."""
|
554
|
-
|
555
|
-
pathstr_template: str
|
556
|
-
"""The name of the pathstr template which will be used to acquire a path of strings."""
|
557
|
-
|
558
|
-
review_string_template: str
|
559
|
-
"""The name of the review string template which will be used to review a string."""
|
560
|
-
|
561
|
-
generic_string_template: str
|
562
|
-
"""The name of the generic string template which will be used to review a string."""
|
563
|
-
|
564
|
-
co_validation_template: str
|
565
|
-
"""The name of the co-validation template which will be used to co-validate a string."""
|
566
|
-
|
567
|
-
as_prompt_template: str
|
568
|
-
"""The name of the as prompt template which will be used to convert a string to a prompt."""
|
569
|
-
|
570
|
-
check_string_template: str
|
571
|
-
"""The name of the check string template which will be used to check a string."""
|
572
|
-
|
573
|
-
ruleset_requirement_breakdown_template: str
|
574
|
-
"""The name of the ruleset requirement breakdown template which will be used to breakdown a ruleset requirement."""
|
575
|
-
|
576
|
-
fix_troubled_obj_template: str
|
577
|
-
"""The name of the fix troubled object template which will be used to fix a troubled object."""
|
578
|
-
|
579
|
-
fix_troubled_string_template: str
|
580
|
-
"""The name of the fix troubled string template which will be used to fix a troubled string."""
|
581
|
-
|
582
|
-
rule_requirement_template: str
|
583
|
-
"""The name of the rule requirement template which will be used to generate a rule requirement."""
|
584
|
-
|
585
|
-
extract_template: str
|
586
|
-
"""The name of the extract template which will be used to extract model from string."""
|
587
|
-
|
588
|
-
chap_summary_template: str
|
589
|
-
"""The name of the chap summary template which will be used to generate a chapter summary."""
|
590
|
-
|
591
|
-
class RoutingConfig:
|
592
|
-
"""Routing configuration structure for controlling request dispatching behavior."""
|
593
|
-
|
594
|
-
max_parallel_requests: Optional[int]
|
595
|
-
"""The maximum number of parallel requests. None means not checked."""
|
596
|
-
|
597
|
-
allowed_fails: Optional[int]
|
598
|
-
"""The number of allowed fails before the routing is considered failed."""
|
599
|
-
|
600
|
-
retry_after: int
|
601
|
-
"""Minimum time to wait before retrying a failed request."""
|
602
|
-
|
603
|
-
cooldown_time: Optional[int]
|
604
|
-
"""Time to cooldown a deployment after failure in seconds."""
|
605
|
-
|
606
|
-
class GeneralConfig:
|
607
|
-
"""General configuration structure for application-wide settings."""
|
608
|
-
|
609
|
-
confirm_on_ops: bool
|
610
|
-
"""Whether to confirm operations before executing them."""
|
611
|
-
|
612
|
-
use_json_repair: bool
|
613
|
-
"""Whether to automatically repair malformed JSON."""
|
614
|
-
|
615
|
-
class ToolBoxConfig:
|
616
|
-
"""Configuration for toolbox functionality."""
|
617
|
-
|
618
|
-
tool_module_name: str
|
619
|
-
"""The name of the module containing the toolbox."""
|
620
|
-
|
621
|
-
data_module_name: str
|
622
|
-
"""The name of the module containing the data."""
|
623
|
-
|
624
|
-
class PymitterConfig:
|
625
|
-
"""Pymitter configuration structure for controlling event emission and listener behavior."""
|
626
|
-
|
627
|
-
delimiter: str
|
628
|
-
"""The delimiter used to separate the event name into segments."""
|
629
|
-
|
630
|
-
new_listener_event: bool
|
631
|
-
"""If set, a newListener event is emitted when a new listener is added."""
|
632
|
-
|
633
|
-
max_listeners: int
|
634
|
-
"""The maximum number of listeners per event. -1 means unlimited."""
|
635
|
-
|
636
|
-
class Config:
|
637
|
-
"""Configuration structure containing all system components."""
|
638
|
-
|
639
|
-
embedding: EmbeddingConfig
|
640
|
-
"""Embedding configuration."""
|
641
|
-
|
642
|
-
llm: LLMConfig
|
643
|
-
"""LLM configuration."""
|
644
|
-
|
645
|
-
debug: DebugConfig
|
646
|
-
"""Debug configuration."""
|
647
|
-
|
648
|
-
rag: RagConfig
|
649
|
-
"""RAG configuration."""
|
650
|
-
|
651
|
-
templates: TemplateConfig
|
652
|
-
"""Template configuration."""
|
653
|
-
|
654
|
-
template_manager: TemplateManagerConfig
|
655
|
-
"""Template manager configuration."""
|
656
|
-
|
657
|
-
routing: RoutingConfig
|
658
|
-
"""Routing configuration."""
|
659
|
-
|
660
|
-
general: GeneralConfig
|
661
|
-
"""General configuration."""
|
662
|
-
|
663
|
-
toolbox: ToolBoxConfig
|
664
|
-
"""Toolbox configuration."""
|
665
|
-
|
666
|
-
pymitter: PymitterConfig
|
667
|
-
"""Pymitter configuration."""
|
668
|
-
|
669
|
-
CONFIG: Config
|
670
|
-
|
671
|
-
class SecretStr:
|
672
|
-
"""A string that should not be exposed."""
|
673
|
-
|
674
|
-
def __init__(self, source: str) -> None: ...
|
675
|
-
def get_secret_value(self) -> str:
|
676
|
-
"""Expose the secret string."""
|
677
|
-
|
678
|
-
TEMPLATE_MANAGER: TemplateManager
|
679
|
-
|
680
|
-
class Event:
|
681
|
-
"""Event class that represents a hierarchical event with segments.
|
682
|
-
|
683
|
-
Events can be constructed from strings, lists of strings, or other Events.
|
684
|
-
"""
|
685
|
-
|
686
|
-
segments: List[str]
|
687
|
-
|
688
|
-
def __init__(self, segments: Optional[List[str]] = None) -> None:
|
689
|
-
"""Initialize a new Event with optional segments.
|
690
|
-
|
691
|
-
Args:
|
692
|
-
segments: Optional list of string segments
|
693
|
-
"""
|
694
|
-
|
695
|
-
@staticmethod
|
696
|
-
def instantiate_from(event: Union[str, Event, List[str]]) -> Event:
|
697
|
-
"""Create an Event from a string, list of strings, or another Event.
|
698
|
-
|
699
|
-
Args:
|
700
|
-
event: The source to create the Event from
|
701
|
-
|
702
|
-
Returns:
|
703
|
-
A new Event instance
|
704
|
-
|
705
|
-
Raises:
|
706
|
-
ValueError: If list elements are not strings
|
707
|
-
TypeError: If event is an invalid type
|
708
|
-
"""
|
709
|
-
|
710
|
-
@staticmethod
|
711
|
-
def quick_instantiate(event: Union[str, Event, List[str]]) -> Event:
|
712
|
-
"""Create an Event and append wildcard and pending status.
|
713
|
-
|
714
|
-
Args:
|
715
|
-
event: The source to create the Event from
|
716
|
-
|
717
|
-
Returns:
|
718
|
-
A new Event instance with wildcard and pending status appended
|
719
|
-
"""
|
720
|
-
|
721
|
-
def derive(self, event: Union[str, Event, List[str]]) -> Event:
|
722
|
-
"""Create a new Event by extending this one with another.
|
723
|
-
|
724
|
-
Args:
|
725
|
-
event: The Event to append
|
726
|
-
|
727
|
-
Returns:
|
728
|
-
A new Event that combines this Event with the provided one
|
729
|
-
"""
|
730
|
-
|
731
|
-
def collapse(self) -> str:
|
732
|
-
"""Convert the Event to a delimited string.
|
733
|
-
|
734
|
-
Returns:
|
735
|
-
String representation with segments joined by delimiter
|
736
|
-
"""
|
737
|
-
|
738
|
-
def fork(self) -> Event:
|
739
|
-
"""Create a copy of this Event.
|
740
|
-
|
741
|
-
Returns:
|
742
|
-
A new Event with the same segments
|
743
|
-
"""
|
744
|
-
|
745
|
-
def push(self, segment: str) -> Self:
|
746
|
-
"""Add a segment to the Event.
|
747
|
-
|
748
|
-
Args:
|
749
|
-
segment: String segment to add
|
750
|
-
|
751
|
-
Raises:
|
752
|
-
ValueError: If segment is empty or contains the delimiter
|
753
|
-
"""
|
754
|
-
|
755
|
-
def push_wildcard(self) -> Self:
|
756
|
-
"""Add a wildcard segment (*) to the Event."""
|
757
|
-
|
758
|
-
def push_pending(self) -> Self:
|
759
|
-
"""Add a pending status segment to the Event."""
|
760
|
-
|
761
|
-
def push_running(self) -> Self:
|
762
|
-
"""Add a running status segment to the Event."""
|
763
|
-
|
764
|
-
def push_finished(self) -> Self:
|
765
|
-
"""Add a finished status segment to the Event."""
|
766
|
-
|
767
|
-
def push_failed(self) -> Self:
|
768
|
-
"""Add a failed status segment to the Event."""
|
769
|
-
|
770
|
-
def push_cancelled(self) -> Self:
|
771
|
-
"""Add a cancelled status segment to the Event."""
|
772
|
-
|
773
|
-
def pop(self) -> Optional[str]:
|
774
|
-
"""Remove and return the last segment.
|
775
|
-
|
776
|
-
Returns:
|
777
|
-
The removed segment or None if the Event is empty
|
778
|
-
"""
|
779
|
-
|
780
|
-
def clear(self) -> Self:
|
781
|
-
"""Remove all segments from the Event."""
|
782
|
-
|
783
|
-
def concat(self, event: Union[str, Event, List[str]]) -> Self:
|
784
|
-
"""Append segments from another Event to this one.
|
785
|
-
|
786
|
-
Args:
|
787
|
-
event: The Event to append segments from
|
788
|
-
"""
|
789
|
-
|
790
|
-
def __hash__(self) -> int: ...
|
791
|
-
def __eq__(self, other: object) -> bool: ...
|
792
|
-
def __ne__(self, other: object) -> bool: ...
|
793
|
-
|
794
|
-
class TaskStatus(StrEnum, str):
|
795
|
-
"""Enumeration of possible task statuses."""
|
796
|
-
|
797
|
-
Pending: TaskStatus
|
798
|
-
"""Task is pending execution."""
|
799
|
-
|
800
|
-
Running: TaskStatus
|
801
|
-
"""Task is currently running."""
|
802
|
-
|
803
|
-
Finished: TaskStatus
|
804
|
-
"""Task has finished successfully."""
|
805
|
-
|
806
|
-
Failed: TaskStatus
|
807
|
-
"""Task has failed."""
|
808
|
-
|
809
|
-
Cancelled: TaskStatus
|
810
|
-
"""Task has been cancelled."""
|
811
|
-
|
812
|
-
class TEIClient:
|
813
|
-
"""Client for TEI reranking service.
|
814
|
-
|
815
|
-
Handles communication with a TEI reranking service to reorder text snippets
|
816
|
-
based on their relevance to a query.
|
817
|
-
"""
|
818
|
-
|
819
|
-
def __init__(self, base_url: str) -> None:
|
820
|
-
"""Initialize the TEI client.
|
821
|
-
|
822
|
-
Args:
|
823
|
-
base_url: URL to the TEI reranking service
|
824
|
-
"""
|
825
|
-
|
826
|
-
async def arerank(
|
827
|
-
self,
|
828
|
-
query: str,
|
829
|
-
texts: List[str],
|
830
|
-
truncate: bool = False,
|
831
|
-
truncation_direction: Literal["Left", "Right"] = "Left",
|
832
|
-
) -> List[Tuple[int, float]]:
|
833
|
-
"""Rerank texts based on relevance to query.
|
834
|
-
|
835
|
-
Args:
|
836
|
-
query: The query to match texts against
|
837
|
-
texts: List of text snippets to rerank
|
838
|
-
truncate: Whether to truncate texts to fit model context
|
839
|
-
truncation_direction: Direction to truncate from ("Left" or "Right")
|
840
|
-
|
841
|
-
Returns:
|
842
|
-
List of tuples containing (original_index, relevance_score)
|
843
|
-
|
844
|
-
Raises:
|
845
|
-
RuntimeError: If reranking fails or truncation_direction is invalid
|
846
|
-
"""
|