fabricatio 0.3.14.dev4__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/__init__.py +29 -0
- fabricatio/actions/__init__.py +1 -0
- fabricatio/actions/article.py +319 -0
- fabricatio/actions/article_rag.py +416 -0
- fabricatio/actions/fs.py +25 -0
- fabricatio/actions/output.py +248 -0
- fabricatio/actions/rag.py +96 -0
- fabricatio/actions/rules.py +83 -0
- fabricatio/capabilities/__init__.py +1 -0
- fabricatio/capabilities/advanced_judge.py +20 -0
- fabricatio/capabilities/advanced_rag.py +61 -0
- fabricatio/capabilities/censor.py +105 -0
- fabricatio/capabilities/check.py +212 -0
- fabricatio/capabilities/correct.py +228 -0
- fabricatio/capabilities/extract.py +74 -0
- fabricatio/capabilities/persist.py +103 -0
- fabricatio/capabilities/propose.py +65 -0
- fabricatio/capabilities/rag.py +263 -0
- fabricatio/capabilities/rating.py +404 -0
- fabricatio/capabilities/review.py +114 -0
- fabricatio/capabilities/task.py +113 -0
- fabricatio/decorators.py +251 -0
- fabricatio/emitter.py +177 -0
- fabricatio/fs/__init__.py +35 -0
- fabricatio/fs/curd.py +153 -0
- fabricatio/fs/readers.py +61 -0
- fabricatio/journal.py +12 -0
- fabricatio/models/action.py +263 -0
- fabricatio/models/adv_kwargs_types.py +63 -0
- fabricatio/models/extra/__init__.py +1 -0
- fabricatio/models/extra/advanced_judge.py +32 -0
- fabricatio/models/extra/aricle_rag.py +284 -0
- fabricatio/models/extra/article_base.py +422 -0
- fabricatio/models/extra/article_essence.py +101 -0
- fabricatio/models/extra/article_main.py +285 -0
- fabricatio/models/extra/article_outline.py +46 -0
- fabricatio/models/extra/article_proposal.py +52 -0
- fabricatio/models/extra/patches.py +20 -0
- fabricatio/models/extra/problem.py +165 -0
- fabricatio/models/extra/rag.py +98 -0
- fabricatio/models/extra/rule.py +52 -0
- fabricatio/models/generic.py +812 -0
- fabricatio/models/kwargs_types.py +121 -0
- fabricatio/models/role.py +95 -0
- fabricatio/models/task.py +310 -0
- fabricatio/models/tool.py +328 -0
- fabricatio/models/usages.py +791 -0
- fabricatio/parser.py +114 -0
- fabricatio/py.typed +0 -0
- fabricatio/rust.cpython-313-x86_64-linux-gnu.so +0 -0
- fabricatio/rust.pyi +846 -0
- fabricatio/toolboxes/__init__.py +15 -0
- fabricatio/toolboxes/arithmetic.py +62 -0
- fabricatio/toolboxes/fs.py +31 -0
- fabricatio/utils.py +156 -0
- fabricatio/workflows/__init__.py +1 -0
- fabricatio/workflows/articles.py +24 -0
- fabricatio/workflows/rag.py +11 -0
- fabricatio-0.3.14.dev4.data/scripts/tdown +0 -0
- fabricatio-0.3.14.dev4.data/scripts/ttm +0 -0
- fabricatio-0.3.14.dev4.dist-info/METADATA +188 -0
- fabricatio-0.3.14.dev4.dist-info/RECORD +64 -0
- fabricatio-0.3.14.dev4.dist-info/WHEEL +4 -0
- fabricatio-0.3.14.dev4.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,15 @@
|
|
1
|
+
"""Contains the built-in toolboxes for the Fabricatio package."""
|
2
|
+
|
3
|
+
from typing import Set
|
4
|
+
|
5
|
+
from fabricatio.models.tool import ToolBox
|
6
|
+
from fabricatio.toolboxes.arithmetic import arithmetic_toolbox
|
7
|
+
from fabricatio.toolboxes.fs import fs_toolbox
|
8
|
+
|
9
|
+
basic_toolboxes: Set[ToolBox] = {arithmetic_toolbox}
|
10
|
+
|
11
|
+
__all__ = [
|
12
|
+
"arithmetic_toolbox",
|
13
|
+
"basic_toolboxes",
|
14
|
+
"fs_toolbox",
|
15
|
+
]
|
@@ -0,0 +1,62 @@
|
|
1
|
+
"""Arithmetic tools for Fabricatio."""
|
2
|
+
|
3
|
+
from fabricatio.models.tool import ToolBox
|
4
|
+
|
5
|
+
arithmetic_toolbox = ToolBox(name="ArithmeticToolBox", description="A toolbox for arithmetic operations.")
|
6
|
+
|
7
|
+
|
8
|
+
@arithmetic_toolbox.collect_tool
|
9
|
+
def add(a: float, b: float) -> float:
|
10
|
+
"""Add two numbers.
|
11
|
+
|
12
|
+
Args:
|
13
|
+
a (float): The first number.
|
14
|
+
b (float): The second number.
|
15
|
+
|
16
|
+
Returns:
|
17
|
+
float: The sum of the two numbers.
|
18
|
+
"""
|
19
|
+
return a + b
|
20
|
+
|
21
|
+
|
22
|
+
@arithmetic_toolbox.collect_tool
|
23
|
+
def subtract(a: float, b: float) -> float:
|
24
|
+
"""Subtract two numbers.
|
25
|
+
|
26
|
+
Args:
|
27
|
+
a (float): The first number.
|
28
|
+
b (float): The second number.
|
29
|
+
|
30
|
+
Returns:
|
31
|
+
float: The result of subtracting b from a.
|
32
|
+
"""
|
33
|
+
return a - b
|
34
|
+
|
35
|
+
|
36
|
+
@arithmetic_toolbox.collect_tool
|
37
|
+
def multiply(a: float, b: float) -> float:
|
38
|
+
"""Multiply two numbers.
|
39
|
+
|
40
|
+
Args:
|
41
|
+
a (float): The first number.
|
42
|
+
b (float): The second number.
|
43
|
+
|
44
|
+
Returns:
|
45
|
+
float: The product of the two numbers.
|
46
|
+
"""
|
47
|
+
return a * b
|
48
|
+
|
49
|
+
|
50
|
+
@arithmetic_toolbox.collect_tool
|
51
|
+
def divide(a: float, b: float) -> float:
|
52
|
+
"""Divide two numbers.
|
53
|
+
|
54
|
+
Args:
|
55
|
+
a (float): The numerator.
|
56
|
+
b (float): The denominator (must not be zero).
|
57
|
+
|
58
|
+
Returns:
|
59
|
+
float: The result of dividing a by b.
|
60
|
+
|
61
|
+
"""
|
62
|
+
return a / b
|
@@ -0,0 +1,31 @@
|
|
1
|
+
"""File system tool box."""
|
2
|
+
|
3
|
+
from fabricatio.fs import (
|
4
|
+
absolute_path,
|
5
|
+
copy_file,
|
6
|
+
create_directory,
|
7
|
+
delete_directory,
|
8
|
+
delete_file,
|
9
|
+
dump_text,
|
10
|
+
gather_files,
|
11
|
+
move_file,
|
12
|
+
safe_json_read,
|
13
|
+
safe_text_read,
|
14
|
+
tree,
|
15
|
+
)
|
16
|
+
from fabricatio.models.tool import ToolBox
|
17
|
+
|
18
|
+
fs_toolbox = (
|
19
|
+
ToolBox(name="FsToolBox", description="A toolbox for basic file system operations.")
|
20
|
+
.add_tool(dump_text)
|
21
|
+
.add_tool(copy_file)
|
22
|
+
.add_tool(move_file)
|
23
|
+
.add_tool(delete_file)
|
24
|
+
.add_tool(tree)
|
25
|
+
.add_tool(delete_directory)
|
26
|
+
.add_tool(create_directory)
|
27
|
+
.add_tool(absolute_path)
|
28
|
+
.add_tool(safe_text_read)
|
29
|
+
.add_tool(safe_json_read)
|
30
|
+
.add_tool(gather_files)
|
31
|
+
)
|
fabricatio/utils.py
ADDED
@@ -0,0 +1,156 @@
|
|
1
|
+
"""A collection of utility functions for the fabricatio package."""
|
2
|
+
|
3
|
+
from typing import Any, Dict, Iterable, List, Mapping, Optional, Tuple, Type, overload
|
4
|
+
|
5
|
+
from fabricatio.decorators import precheck_package
|
6
|
+
|
7
|
+
|
8
|
+
def is_subclass_of_base(cls: Type, base_module: str, base_name: str) -> bool:
|
9
|
+
"""Determines if the given class is a subclass of an unimported base class.
|
10
|
+
|
11
|
+
Args:
|
12
|
+
cls: The class to check
|
13
|
+
base_module: The module name of the base class
|
14
|
+
base_name: The class name of the base class
|
15
|
+
|
16
|
+
Returns:
|
17
|
+
bool: True if cls is a subclass of the specified base class, False otherwise
|
18
|
+
"""
|
19
|
+
return any(ancestor.__module__ == base_module and ancestor.__name__ == base_name for ancestor in cls.__mro__)
|
20
|
+
|
21
|
+
|
22
|
+
def is_subclass_of_any_base(cls: Type, bases: List[Tuple[str, str]]) -> bool:
|
23
|
+
"""Determines if the given class is a subclass of the candidate base classes.
|
24
|
+
|
25
|
+
Args:
|
26
|
+
cls: The class to check
|
27
|
+
bases: A list of tuples where each tuple contains (module_name, class_name)
|
28
|
+
|
29
|
+
Returns:
|
30
|
+
bool: True if cls is a subclass of the specified base classes, False otherwise
|
31
|
+
"""
|
32
|
+
for ancestor in cls.__mro__:
|
33
|
+
for base_module, base_name in bases:
|
34
|
+
if ancestor.__module__ == base_module and ancestor.__name__ == base_name:
|
35
|
+
return True
|
36
|
+
return False
|
37
|
+
|
38
|
+
|
39
|
+
@precheck_package(
|
40
|
+
"questionary", "'questionary' is required to run this function. Have you installed `fabricatio[qa]`?."
|
41
|
+
)
|
42
|
+
async def ask_edit(text_seq: List[str]) -> List[str]:
|
43
|
+
"""Asks the user to edit a list of texts.
|
44
|
+
|
45
|
+
Args:
|
46
|
+
text_seq (List[str]): A list of texts to be edited.
|
47
|
+
|
48
|
+
Returns:
|
49
|
+
List[str]: A list of edited texts.
|
50
|
+
If the user does not edit a text, it will not be included in the returned list.
|
51
|
+
"""
|
52
|
+
from questionary import text
|
53
|
+
|
54
|
+
res = []
|
55
|
+
for i, t in enumerate(text_seq):
|
56
|
+
edited = await text(f"[{i}] ", default=t).ask_async()
|
57
|
+
if edited:
|
58
|
+
res.append(edited)
|
59
|
+
return res
|
60
|
+
|
61
|
+
|
62
|
+
@overload
|
63
|
+
async def ask_retain[V](candidates: List[str]) -> List[str]: ...
|
64
|
+
|
65
|
+
|
66
|
+
@overload
|
67
|
+
async def ask_retain[V](candidates: List[str], value_mapping: List[V]) -> List[V]: ...
|
68
|
+
|
69
|
+
|
70
|
+
@precheck_package(
|
71
|
+
"questionary", "'questionary' is required to run this function. Have you installed `fabricatio[qa]`?."
|
72
|
+
)
|
73
|
+
async def ask_retain[V](candidates: List[str], value_mapping: Optional[List[V]] = None) -> List[str] | List[V]:
|
74
|
+
"""Asks the user to retain a list of candidates."""
|
75
|
+
from questionary import Choice, checkbox
|
76
|
+
|
77
|
+
return await checkbox(
|
78
|
+
"Please choose those that should be retained.",
|
79
|
+
choices=[Choice(p, value=p, checked=True) for p in candidates]
|
80
|
+
if value_mapping is None
|
81
|
+
else [Choice(p, value=v, checked=True) for p, v in zip(candidates, value_mapping, strict=True)],
|
82
|
+
).ask_async()
|
83
|
+
|
84
|
+
|
85
|
+
def override_kwargs(kwargs: Mapping[str, Any], **overrides) -> Dict[str, Any]:
|
86
|
+
"""Override the values in kwargs with the provided overrides."""
|
87
|
+
new_kwargs = dict(kwargs.items())
|
88
|
+
new_kwargs.update(overrides)
|
89
|
+
return new_kwargs
|
90
|
+
|
91
|
+
|
92
|
+
def fallback_kwargs(kwargs: Mapping[str, Any], **fallbacks) -> Dict[str, Any]:
|
93
|
+
"""Fallback the values in kwargs with the provided fallbacks."""
|
94
|
+
new_kwargs = dict(kwargs.items())
|
95
|
+
new_kwargs.update({k: v for k, v in fallbacks.items() if k not in new_kwargs})
|
96
|
+
return new_kwargs
|
97
|
+
|
98
|
+
|
99
|
+
def ok[T](val: Optional[T], msg: str = "Value is None") -> T:
|
100
|
+
"""Check if a value is None and raise a ValueError with the provided message if it is.
|
101
|
+
|
102
|
+
Args:
|
103
|
+
val: The value to check.
|
104
|
+
msg: The message to include in the ValueError if val is None.
|
105
|
+
|
106
|
+
Returns:
|
107
|
+
T: The value if it is not None.
|
108
|
+
"""
|
109
|
+
if val is None:
|
110
|
+
raise ValueError(msg)
|
111
|
+
return val
|
112
|
+
|
113
|
+
|
114
|
+
def first_available[T](iterable: Iterable[T], msg: str = "No available item found in the iterable.") -> T:
|
115
|
+
"""Return the first available item in the iterable that's not None.
|
116
|
+
|
117
|
+
This function searches through the provided iterable and returns the first
|
118
|
+
item that is not None. If all items are None or the iterable is empty,
|
119
|
+
it raises a ValueError.
|
120
|
+
|
121
|
+
Args:
|
122
|
+
iterable: The iterable collection to search through.
|
123
|
+
msg: The message to include in the ValueError if no non-None item is found.
|
124
|
+
|
125
|
+
Returns:
|
126
|
+
T: The first non-None item found in the iterable.
|
127
|
+
If no non-None item is found, it raises a ValueError.
|
128
|
+
|
129
|
+
Raises:
|
130
|
+
ValueError: If no non-None item is found in the iterable.
|
131
|
+
|
132
|
+
Examples:
|
133
|
+
>>> first_available([None, None, "value", "another"])
|
134
|
+
'value'
|
135
|
+
>>> first_available([1, 2, 3])
|
136
|
+
1
|
137
|
+
>>> assert (first_available([None, None]))
|
138
|
+
ValueError: No available item found in the iterable.
|
139
|
+
"""
|
140
|
+
if (first := next((item for item in iterable if item is not None), None)) is not None:
|
141
|
+
return first
|
142
|
+
raise ValueError(msg)
|
143
|
+
|
144
|
+
|
145
|
+
def wrapp_in_block(string: str, title: str, style: str = "-") -> str:
|
146
|
+
"""Wraps a string in a block with a title.
|
147
|
+
|
148
|
+
Args:
|
149
|
+
string: The string to wrap.
|
150
|
+
title: The title of the block.
|
151
|
+
style: The style of the block.
|
152
|
+
|
153
|
+
Returns:
|
154
|
+
str: The wrapped string.
|
155
|
+
"""
|
156
|
+
return f"--- Start of {title} ---\n{string}\n--- End of {title} ---".replace("-", style)
|
@@ -0,0 +1 @@
|
|
1
|
+
"""A module containing some builtin workflows."""
|
@@ -0,0 +1,24 @@
|
|
1
|
+
"""Store article essence in the database."""
|
2
|
+
|
3
|
+
from fabricatio.actions.article import GenerateArticleProposal, GenerateInitialOutline
|
4
|
+
from fabricatio.actions.output import DumpFinalizedOutput
|
5
|
+
from fabricatio.models.action import WorkFlow
|
6
|
+
|
7
|
+
WriteOutlineWorkFlow = WorkFlow(
|
8
|
+
name="Generate Article Outline",
|
9
|
+
description="Generate an outline for an article. dump the outline to the given path. in typst format.",
|
10
|
+
steps=(
|
11
|
+
GenerateArticleProposal,
|
12
|
+
GenerateInitialOutline(output_key="article_outline"),
|
13
|
+
DumpFinalizedOutput(output_key="task_output"),
|
14
|
+
),
|
15
|
+
)
|
16
|
+
WriteOutlineCorrectedWorkFlow = WorkFlow(
|
17
|
+
name="Generate Article Outline",
|
18
|
+
description="Generate an outline for an article. dump the outline to the given path. in typst format.",
|
19
|
+
steps=(
|
20
|
+
GenerateArticleProposal,
|
21
|
+
GenerateInitialOutline(output_key="article_outline"),
|
22
|
+
DumpFinalizedOutput(output_key="task_output"),
|
23
|
+
),
|
24
|
+
)
|
@@ -0,0 +1,11 @@
|
|
1
|
+
"""The workflow for extracting the essence of an article and storing it in the database."""
|
2
|
+
|
3
|
+
from fabricatio.actions.article import ExtractArticleEssence
|
4
|
+
from fabricatio.actions.rag import InjectToDB
|
5
|
+
from fabricatio.models.action import WorkFlow
|
6
|
+
|
7
|
+
StoreArticle = WorkFlow(
|
8
|
+
name="Extract Article Essence",
|
9
|
+
description="Extract the essence of an article in the given path, and store it in the database.",
|
10
|
+
steps=(ExtractArticleEssence(output_key="to_inject"), InjectToDB(output_key="task_output")),
|
11
|
+
)
|
Binary file
|
Binary file
|
@@ -0,0 +1,188 @@
|
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: fabricatio
|
3
|
+
Version: 0.3.14.dev4
|
4
|
+
Classifier: License :: OSI Approved :: MIT License
|
5
|
+
Classifier: Programming Language :: Rust
|
6
|
+
Classifier: Programming Language :: Python :: 3.12
|
7
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
8
|
+
Classifier: Framework :: AsyncIO
|
9
|
+
Classifier: Framework :: Pydantic :: 2
|
10
|
+
Classifier: Typing :: Typed
|
11
|
+
Requires-Dist: asyncio>=3.4.3
|
12
|
+
Requires-Dist: asyncstdlib>=3.13.0
|
13
|
+
Requires-Dist: json-repair>=0.39.1
|
14
|
+
Requires-Dist: litellm>=1.60.0
|
15
|
+
Requires-Dist: loguru>=0.7.3
|
16
|
+
Requires-Dist: more-itertools>=10.6.0
|
17
|
+
Requires-Dist: pydantic>=2.10.6
|
18
|
+
Requires-Dist: pymitter>=1.0.0
|
19
|
+
Requires-Dist: rich>=13.9.4
|
20
|
+
Requires-Dist: ujson>=5.10.0
|
21
|
+
Requires-Dist: fabricatio[ftd,qa,rag,cli] ; extra == 'full'
|
22
|
+
Requires-Dist: pymilvus>=2.5.4 ; extra == 'rag'
|
23
|
+
Requires-Dist: questionary>=2.1.0 ; extra == 'qa'
|
24
|
+
Requires-Dist: magika>=0.6.1 ; extra == 'ftd'
|
25
|
+
Requires-Dist: typer-slim[standard]>=0.15.2 ; extra == 'cli'
|
26
|
+
Provides-Extra: full
|
27
|
+
Provides-Extra: rag
|
28
|
+
Provides-Extra: qa
|
29
|
+
Provides-Extra: ftd
|
30
|
+
Provides-Extra: cli
|
31
|
+
License-File: LICENSE
|
32
|
+
Summary: A LLM multi-agent framework.
|
33
|
+
Keywords: ai,agents,multi-agent,llm,pyo3
|
34
|
+
Author-email: Whth <zettainspector@foxmail.com>
|
35
|
+
Requires-Python: >=3.12, <3.14
|
36
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
37
|
+
Project-URL: Homepage, https://github.com/Whth/fabricatio
|
38
|
+
Project-URL: Repository, https://github.com/Whth/fabricatio
|
39
|
+
Project-URL: Issues, https://github.com/Whth/fabricatio/issues
|
40
|
+
|
41
|
+
# Fabricatio
|
42
|
+
|
43
|
+

|
44
|
+
|
45
|
+
## Overview
|
46
|
+
|
47
|
+
Fabricatio is a streamlined Python library for building LLM applications using an event-based agent structure. It
|
48
|
+
leverages Rust for performance-critical tasks, Handlebars for templating, and PyO3 for Python bindings.
|
49
|
+
|
50
|
+
## Features
|
51
|
+
|
52
|
+
- **Event-Driven Architecture**: Robust task management through an EventEmitter pattern.
|
53
|
+
- **LLM Integration & Templating**: Seamlessly interact with large language models and dynamic content generation.
|
54
|
+
- **Async & Extensible**: Fully asynchronous execution with easy extension via custom actions and workflows.
|
55
|
+
|
56
|
+
## Installation
|
57
|
+
|
58
|
+
### Using UV (Recommended)
|
59
|
+
|
60
|
+
```bash
|
61
|
+
# Install uv if not already installed
|
62
|
+
pip install uv
|
63
|
+
|
64
|
+
# Clone the repository
|
65
|
+
git clone https://github.com/Whth/fabricatio.git
|
66
|
+
cd fabricatio
|
67
|
+
|
68
|
+
# Install the package in development mode with uv
|
69
|
+
uv --with-editable . maturin develop --uv -r
|
70
|
+
```
|
71
|
+
|
72
|
+
### Building Distribution
|
73
|
+
|
74
|
+
```bash
|
75
|
+
# Build distribution packages
|
76
|
+
make bdist
|
77
|
+
```
|
78
|
+
|
79
|
+
## Usage
|
80
|
+
|
81
|
+
### Basic Example
|
82
|
+
|
83
|
+
```python
|
84
|
+
import asyncio
|
85
|
+
from fabricatio import Action, Role, Task, logger, WorkFlow, Event
|
86
|
+
from typing import Any
|
87
|
+
|
88
|
+
|
89
|
+
class Hello(Action):
|
90
|
+
name: str = "hello"
|
91
|
+
output_key: str = "task_output"
|
92
|
+
|
93
|
+
async def _execute(self, task_input: Task[str], **_) -> Any:
|
94
|
+
ret = "Hello fabricatio!"
|
95
|
+
logger.info("executing talk action")
|
96
|
+
return ret
|
97
|
+
|
98
|
+
|
99
|
+
async def main() -> None:
|
100
|
+
Role(
|
101
|
+
name="talker",
|
102
|
+
description="talker role",
|
103
|
+
registry={Event.quick_instantiate("talk"): WorkFlow(name="talk", steps=(Hello,))}
|
104
|
+
)
|
105
|
+
|
106
|
+
task = Task(name="say hello", goals=["say hello"], description="say hello to the world")
|
107
|
+
result = await task.delegate("talk")
|
108
|
+
logger.success(f"Result: {result}")
|
109
|
+
|
110
|
+
|
111
|
+
if __name__ == "__main__":
|
112
|
+
asyncio.run(main())
|
113
|
+
```
|
114
|
+
|
115
|
+
### Examples
|
116
|
+
|
117
|
+
For various usage scenarios, refer to the following examples:
|
118
|
+
|
119
|
+
- Simple Chat
|
120
|
+
- Retrieval-Augmented Generation (RAG)
|
121
|
+
- Article Extraction
|
122
|
+
- Propose Task
|
123
|
+
- Code Review
|
124
|
+
- Write Outline
|
125
|
+
|
126
|
+
_(For full example details, please check our detailed documentation, see [Examples](./examples))_
|
127
|
+
|
128
|
+
## Configuration
|
129
|
+
|
130
|
+
The configuration for Fabricatio is managed via environment variables or TOML files. For example:
|
131
|
+
|
132
|
+
```toml
|
133
|
+
[llm]
|
134
|
+
api_endpoint = "https://api.openai.com"
|
135
|
+
api_key = "your_openai_api_key"
|
136
|
+
timeout = 300
|
137
|
+
max_retries = 3
|
138
|
+
model = "gpt-3.5-turbo"
|
139
|
+
temperature = 1.0
|
140
|
+
stop_sign = ["\n\n\n", "User:"]
|
141
|
+
top_p = 0.35
|
142
|
+
generation_count = 1
|
143
|
+
stream = false
|
144
|
+
max_tokens = 8192
|
145
|
+
```
|
146
|
+
|
147
|
+
## Development Setup
|
148
|
+
|
149
|
+
1. **Clone the Repository**:
|
150
|
+
```bash
|
151
|
+
git clone https://github.com/Whth/fabricatio.git
|
152
|
+
cd fabricatio
|
153
|
+
```
|
154
|
+
2. **Install Dependencies**:
|
155
|
+
```bash
|
156
|
+
uv --with-editable . maturin develop --uv -r
|
157
|
+
```
|
158
|
+
3. **Run Tests**:
|
159
|
+
```bash
|
160
|
+
make test
|
161
|
+
```
|
162
|
+
|
163
|
+
## TODO
|
164
|
+
|
165
|
+
- Add an element based format strategy
|
166
|
+
|
167
|
+
## Contributing
|
168
|
+
|
169
|
+
Contributions are welcome! Follow these steps:
|
170
|
+
|
171
|
+
1. Fork the repository.
|
172
|
+
2. Create your feature branch (`git checkout -b feature/new-feature`).
|
173
|
+
3. Commit your changes (`git commit -am 'Add new feature'`).
|
174
|
+
4. Push to the branch (`git push origin feature/new-feature`).
|
175
|
+
5. Create a new Pull Request.
|
176
|
+
|
177
|
+
## License
|
178
|
+
|
179
|
+
Fabricatio is licensed under the MIT License. See [LICENSE](LICENSE) for details.
|
180
|
+
|
181
|
+
## Acknowledgments
|
182
|
+
|
183
|
+
Special thanks to the contributors and maintainers of:
|
184
|
+
|
185
|
+
- [PyO3](https://github.com/PyO3/pyo3)
|
186
|
+
- [Maturin](https://github.com/PyO3/maturin)
|
187
|
+
- [Handlebars.rs](https://github.com/sunng87/handlebars-rust)
|
188
|
+
|
@@ -0,0 +1,64 @@
|
|
1
|
+
fabricatio-0.3.14.dev4.dist-info/METADATA,sha256=319FsTSToeF9P9D5tJQseEhgP0nOQDSdbU_AjT1Sf3g,4969
|
2
|
+
fabricatio-0.3.14.dev4.dist-info/WHEEL,sha256=0T3ERfOVy2_NA0spmJ9W283dd80DxGxyjANqE-4dteM,108
|
3
|
+
fabricatio-0.3.14.dev4.dist-info/licenses/LICENSE,sha256=yDZaTLnOi03bi3Dk6f5IjhLUc5old2yOsihHWU0z-i0,1067
|
4
|
+
fabricatio/emitter.py,sha256=QpMvs8dTy1zs5iDORFKzA615S3Lb1tm6AQxYBemQGcc,6164
|
5
|
+
fabricatio/capabilities/check.py,sha256=eiZZaiX78k-Zt7-Ik43Pn5visXHeOJLk8yLWgtqln40,8379
|
6
|
+
fabricatio/capabilities/propose.py,sha256=KqeXaUURJ6O-Ve0ijZYg88rgQYCZEFbuWoqIepI-nQ8,1965
|
7
|
+
fabricatio/capabilities/correct.py,sha256=z7KiMK1KykGXNdLVA0sB28x63LsQ6Hd4wbtYd0bkEKE,10175
|
8
|
+
fabricatio/capabilities/rating.py,sha256=FSIh3h0E7G1OkBKAkY83VA4w0G6OZ2bXq27b40WRsL8,17411
|
9
|
+
fabricatio/capabilities/censor.py,sha256=m90gGDAkEkkxkUKcZNkyhYsRwAxkcDut_-gZEBKrUCU,4640
|
10
|
+
fabricatio/capabilities/advanced_rag.py,sha256=2GYYUHFUP6O8rVOlLqxmPnU1Ve-JwxbUnLv3GRlOCCQ,2478
|
11
|
+
fabricatio/capabilities/persist.py,sha256=GAbj93lYLnGVPu74H_ImrINGWNAglIDH9aGSLJKMLkw,3318
|
12
|
+
fabricatio/capabilities/task.py,sha256=Ah14-xLUzXCMRydAemHoo85QDB-cLlXJslmaTCRsfms,4288
|
13
|
+
fabricatio/capabilities/rag.py,sha256=YF0RPPMutqGLdIVFvQsfUBCRJFeJZ95Bk5hrRzogf9k,10716
|
14
|
+
fabricatio/capabilities/extract.py,sha256=eLQagkRnHVLZ64yPBtLVcPELO7ubJlN3fbwoaNMWT70,2449
|
15
|
+
fabricatio/capabilities/advanced_judge.py,sha256=wTiTyBxkZfOXsmzULOW4nX-QAwFMz9wQqqAAM3aQ5XQ,662
|
16
|
+
fabricatio/capabilities/review.py,sha256=rxA_qdnJc8ehytL5EnlKo9QJ99stnF-n6YaBFRYLe5I,4947
|
17
|
+
fabricatio/capabilities/__init__.py,sha256=skaJ43CqAQaZMH-mCRzF4Fps3x99P2SwJ8vSM9pInX8,56
|
18
|
+
fabricatio/parser.py,sha256=3vT5u5SGpzDH4WLJdMwK5CP8RqO4g1MyQUYpiDKDoEo,4528
|
19
|
+
fabricatio/models/action.py,sha256=O8BLh8fRNqde_3PC7OFHBjLTdLRPvy5mtalMqQFaZXs,9789
|
20
|
+
fabricatio/models/extra/article_outline.py,sha256=71mgx66KRiXBtdYId4WNkAYp9tJ7OhUqmQyOEe7IRxI,1627
|
21
|
+
fabricatio/models/extra/article_essence.py,sha256=lAkfGj4Jqiy3dSmtloVVr2krej76TV1Ky-2Fr6pNE_Q,2692
|
22
|
+
fabricatio/models/extra/article_main.py,sha256=TeOhU8EDUok2t_lLl1oaUn5IhOmp3oZW_YFOSnybX3s,10993
|
23
|
+
fabricatio/models/extra/article_proposal.py,sha256=7OgcsS9ujjSi_06Z1ln4SCDQgrS4xPGrtgc2dv8EzGo,1857
|
24
|
+
fabricatio/models/extra/article_base.py,sha256=2auA10qomj8UnT2tunUf0oQnvhrJBKNV7GF6UWA9tjg,16347
|
25
|
+
fabricatio/models/extra/rag.py,sha256=fwyEXOECQNe8LPUKGAxEcp9vp7o5356rna-TzGpkvnE,3869
|
26
|
+
fabricatio/models/extra/rule.py,sha256=TYtA_aSgunw8wRS3BfdNqBZbbdeS-VXLbVCJhz85Suk,2617
|
27
|
+
fabricatio/models/extra/problem.py,sha256=1Sd8hsThQK6pXMXhErRhP1ft58z4PvqeB8AV8VcXiaI,7051
|
28
|
+
fabricatio/models/extra/patches.py,sha256=_ghmnlvTZQq7UJyaH77mTZE9abjvxRJ2mgWHUbezUls,977
|
29
|
+
fabricatio/models/extra/advanced_judge.py,sha256=CKPP4Lseb_Ey8Y7i2V9HJfB-mZgCknFdqq7Zo41o6s4,1060
|
30
|
+
fabricatio/models/extra/aricle_rag.py,sha256=egUZPmHkzA48IU8s9f6WRhqVMI8B8Uz8Amx-WkLLWGE,11651
|
31
|
+
fabricatio/models/extra/__init__.py,sha256=0R9eZsCNu6OV-Xtf15H7FrqhfHTFBFf3fBrcd7ChsJ0,53
|
32
|
+
fabricatio/models/usages.py,sha256=bpM-a9i-WpSOh-XL3LiYTa3AxQUd_ckn44lh-uuKM6M,32250
|
33
|
+
fabricatio/models/generic.py,sha256=dGap-ckYy7ZX_lXDNxv4d3yM45vdoLDYW4cl49BbCAY,27061
|
34
|
+
fabricatio/models/adv_kwargs_types.py,sha256=nmj1D0GVosZxKcdiw-B5vJB04Whr5zh30ZBJntSZUpY,2034
|
35
|
+
fabricatio/models/role.py,sha256=tOwzILaTb8QUOddy9RrJRyhfB_pEVv_IiUBRuc6ylH8,3761
|
36
|
+
fabricatio/models/task.py,sha256=CdR1Zbf-lZN0jODj9iriTn1X2DxLxjXlvZgy3kEd6lI,10723
|
37
|
+
fabricatio/models/kwargs_types.py,sha256=VrzAJaOSlQ-xN5NIIi3k4KpIY0c9beuxcuUnF-mkEEk,3282
|
38
|
+
fabricatio/models/tool.py,sha256=_vL5aq5BFjclRxbcNkQCmsMtLUikysv-7Og5HRNc6-U,12091
|
39
|
+
fabricatio/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
40
|
+
fabricatio/rust.pyi,sha256=IzEpNSt3tgoR3L2xZNs7skdeGW73L72-eizXQCBWZFk,25410
|
41
|
+
fabricatio/actions/article.py,sha256=8ea9QZk7m21j5fw6_CO_znZtik9_o71JmX77Po5gyS4,12188
|
42
|
+
fabricatio/actions/rules.py,sha256=07ILsiwR250AUcKLPHTUPpWD_mPhPCfWKSkEAKcPv3A,3557
|
43
|
+
fabricatio/actions/output.py,sha256=3VRwDcvimBPrf4ypxbhJd_ScJ_JYiC0ucr6vGOqs9Fc,9687
|
44
|
+
fabricatio/actions/rag.py,sha256=GuRU6VJzIxo3V8dvGWNQ0uQbu6nF0g_qgVuC8NPRx2Y,3487
|
45
|
+
fabricatio/actions/article_rag.py,sha256=1CoL5Jdvur5Pyn9S4GilBfAAiPL2--fmkFLTOwtrT1I,17991
|
46
|
+
fabricatio/actions/fs.py,sha256=nlTmk-tYDW158nz_fzlsNfuYJwj7j4BHn_MFY5hxdqs,934
|
47
|
+
fabricatio/actions/__init__.py,sha256=ZMa1LeM5BNeqp-J-D32W-f5bD53-kdXGyt0zuueJofM,47
|
48
|
+
fabricatio/fs/curd.py,sha256=x7Je9V1ydv-BdZTjlLc3syZ6380gkOhpfrfnhXstisg,4624
|
49
|
+
fabricatio/fs/readers.py,sha256=hFHfGw1E58Da0ndBXXWcD2t-4HNdR1FimeDxuMI4-oE,1690
|
50
|
+
fabricatio/fs/__init__.py,sha256=NQ_BnAwJ0iScY34QpCBH1dCq8vO5Zi4fh6VyEzrBIb8,678
|
51
|
+
fabricatio/decorators.py,sha256=7QU7FvTTZZ5cdVgw9VhG6wQBntGHbsfkBqifGm6wNjA,8711
|
52
|
+
fabricatio/workflows/articles.py,sha256=ZDV5nqUKRo1GOuuKWeSV7ZI32FYZU7WiTrD4YDuCeEo,945
|
53
|
+
fabricatio/workflows/rag.py,sha256=uOZXprD479fUhLA6sYvEM8RWcVcUZXXtP0xRbTMPdHE,509
|
54
|
+
fabricatio/workflows/__init__.py,sha256=Lq9pFo2cudwFCrQUUNgSTr1CoU0J1Nw-HNEQN7cHLp8,50
|
55
|
+
fabricatio/toolboxes/arithmetic.py,sha256=sSTPkKI6-mb278DwQKFO9jKyzc9kCx45xNH7V6bGBpE,1307
|
56
|
+
fabricatio/toolboxes/fs.py,sha256=OQMdeokYxSNVrCZJAweJ0cYiK4k2QuEiNdIbS5IHIV8,705
|
57
|
+
fabricatio/toolboxes/__init__.py,sha256=dYm_Gd8XolSU_h4wnkA09dlaLDK146eeFz0CUgPZ8_c,380
|
58
|
+
fabricatio/utils.py,sha256=qvl4R8ThuNIIoBJuR1DGEuWYZ7jRFT_8SRx4I_FA8pU,5298
|
59
|
+
fabricatio/journal.py,sha256=qZoaPdv17fc_9l2xVZ-ve7dXKmMFJ8MzPa8_vNXMGyE,204
|
60
|
+
fabricatio/__init__.py,sha256=pSLe6QL4zQGaZXfhF9KW4fa1D8chqCQm_7yInCP6Kt8,732
|
61
|
+
fabricatio/rust.cpython-313-x86_64-linux-gnu.so,sha256=y6jJKbJiA1sdE4X_H7On2k02X1cZRB4ohBxZS6RwzQg,7907320
|
62
|
+
fabricatio-0.3.14.dev4.data/scripts/tdown,sha256=IC8p9rZ8AzIwf51yUpOFChs_-1SE3Qq_LB1ZK6O2I3s,4726096
|
63
|
+
fabricatio-0.3.14.dev4.data/scripts/ttm,sha256=O_3KVKRssOajmBy5mEmY02QHQHH4IDAs5wCvz4GjeME,3925048
|
64
|
+
fabricatio-0.3.14.dev4.dist-info/RECORD,,
|
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2025 Whth Yotta
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|