fabricatio 0.2.0.dev20__cp312-cp312-win_amd64.whl → 0.2.1__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/_rust.cp312-win_amd64.pyd +0 -0
- fabricatio/actions/communication.py +6 -6
- fabricatio/actions/transmission.py +0 -11
- fabricatio/config.py +6 -3
- fabricatio/decorators.py +118 -11
- fabricatio/fs/curd.py +21 -7
- fabricatio/models/action.py +2 -2
- fabricatio/models/advanced.py +23 -14
- fabricatio/models/generic.py +21 -1
- fabricatio/models/role.py +1 -2
- fabricatio/models/task.py +8 -8
- fabricatio/models/tool.py +25 -9
- fabricatio/models/usages.py +44 -4
- fabricatio/parser.py +8 -4
- fabricatio/toolboxes/fs.py +3 -2
- fabricatio-0.2.1.data/scripts/tdown.exe +0 -0
- fabricatio-0.2.1.dist-info/METADATA +420 -0
- fabricatio-0.2.1.dist-info/RECORD +35 -0
- fabricatio-0.2.0.dev20.data/scripts/tdown.exe +0 -0
- fabricatio-0.2.0.dev20.dist-info/METADATA +0 -342
- fabricatio-0.2.0.dev20.dist-info/RECORD +0 -35
- {fabricatio-0.2.0.dev20.dist-info → fabricatio-0.2.1.dist-info}/WHEEL +0 -0
- {fabricatio-0.2.0.dev20.dist-info → fabricatio-0.2.1.dist-info}/licenses/LICENSE +0 -0
@@ -1,342 +0,0 @@
|
|
1
|
-
Metadata-Version: 2.4
|
2
|
-
Name: fabricatio
|
3
|
-
Version: 0.2.0.dev20
|
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: appdirs>=1.4.4
|
12
|
-
Requires-Dist: asyncio>=3.4.3
|
13
|
-
Requires-Dist: asyncstdlib>=3.13.0
|
14
|
-
Requires-Dist: code2prompt
|
15
|
-
Requires-Dist: gitpython>=3.1.44
|
16
|
-
Requires-Dist: litellm>=1.60.0
|
17
|
-
Requires-Dist: loguru>=0.7.3
|
18
|
-
Requires-Dist: magika>=0.5.1
|
19
|
-
Requires-Dist: orjson>=3.10.15
|
20
|
-
Requires-Dist: pydantic>=2.10.6
|
21
|
-
Requires-Dist: pydantic-settings>=2.7.1
|
22
|
-
Requires-Dist: pymitter>=1.0.0
|
23
|
-
Requires-Dist: questionary>=2.1.0
|
24
|
-
Requires-Dist: regex>=2024.11.6
|
25
|
-
Requires-Dist: rich>=13.9.4
|
26
|
-
Requires-Dist: faiss-cpu>=1.10.0 ; extra == 'rag'
|
27
|
-
Requires-Dist: pymilvus>=2.5.4 ; extra == 'rag'
|
28
|
-
Requires-Dist: fabricatio[rag] ; extra == 'full'
|
29
|
-
Provides-Extra: rag
|
30
|
-
Provides-Extra: full
|
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
|
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
|
-
Fabricatio is a powerful framework designed to facilitate the creation and management of tasks, actions, and workflows. It leverages modern Python features and libraries to provide a robust and flexible environment for building applications that require task automation and orchestration.
|
46
|
-
|
47
|
-
## Table of Contents
|
48
|
-
|
49
|
-
- [Installation](#installation)
|
50
|
-
- [Usage](#usage)
|
51
|
-
- [Defining a Task](#defining-a-task)
|
52
|
-
- [Creating an Action](#creating-an-action)
|
53
|
-
- [Assigning a Role](#assigning-a-role)
|
54
|
-
- [Logging](#logging)
|
55
|
-
- [Configuration](#configuration)
|
56
|
-
- [LLM Configuration](#llm-configuration)
|
57
|
-
- [Debug Configuration](#debug-configuration)
|
58
|
-
- [Examples](#examples)
|
59
|
-
- [Simple Task Example](#simple-task-example)
|
60
|
-
- [Complex Workflow Example](#complex-workflow-example)
|
61
|
-
- [Contributing](#contributing)
|
62
|
-
- [License](#license)
|
63
|
-
|
64
|
-
## Installation
|
65
|
-
|
66
|
-
To install Fabricatio, you can use pip:
|
67
|
-
|
68
|
-
```bash
|
69
|
-
pip install fabricatio
|
70
|
-
```
|
71
|
-
|
72
|
-
|
73
|
-
Alternatively, you can clone the repository and install it manually:
|
74
|
-
|
75
|
-
```bash
|
76
|
-
git clone https://github.com/your-repo/fabricatio.git
|
77
|
-
cd fabricatio
|
78
|
-
pip install .
|
79
|
-
```
|
80
|
-
|
81
|
-
|
82
|
-
## Usage
|
83
|
-
|
84
|
-
### Defining a Task
|
85
|
-
|
86
|
-
A task in Fabricatio is defined using the `Task` class. You can specify the name, goal, and description of the task.
|
87
|
-
|
88
|
-
```python
|
89
|
-
from fabricatio.models.task import Task
|
90
|
-
|
91
|
-
task = Task(name="say hello", goal="say hello", description="say hello to the world")
|
92
|
-
```
|
93
|
-
|
94
|
-
|
95
|
-
### Creating an Action
|
96
|
-
|
97
|
-
Actions are the building blocks of workflows. They perform specific tasks and can be asynchronous.
|
98
|
-
|
99
|
-
```python
|
100
|
-
from fabricatio import Action, logger
|
101
|
-
from fabricatio.models.task import Task
|
102
|
-
|
103
|
-
class Talk(Action):
|
104
|
-
async def _execute(self, task_input: Task[str], **_) -> str:
|
105
|
-
ret = "Hello fabricatio!"
|
106
|
-
logger.info("executing talk action")
|
107
|
-
return ret
|
108
|
-
```
|
109
|
-
|
110
|
-
|
111
|
-
### Assigning a Role
|
112
|
-
|
113
|
-
Roles in Fabricatio are responsible for executing workflows. You can define a role with a set of actions.
|
114
|
-
|
115
|
-
```python
|
116
|
-
from fabricatio.models.role import Role
|
117
|
-
from fabricatio.models.action import WorkFlow
|
118
|
-
|
119
|
-
class TestWorkflow(WorkFlow):
|
120
|
-
pass
|
121
|
-
|
122
|
-
role = Role(name="Test Role", actions=[TestWorkflow()])
|
123
|
-
```
|
124
|
-
|
125
|
-
|
126
|
-
### Logging
|
127
|
-
|
128
|
-
Fabricatio uses Loguru for logging. You can configure the log level and file in the `config.py` file.
|
129
|
-
|
130
|
-
```python
|
131
|
-
from fabricatio.config import DebugConfig
|
132
|
-
|
133
|
-
debug_config = DebugConfig(log_level="DEBUG", log_file="fabricatio.log")
|
134
|
-
```
|
135
|
-
|
136
|
-
|
137
|
-
## Configuration
|
138
|
-
|
139
|
-
Fabricatio uses Pydantic for configuration management. You can define your settings in the `config.py` file.
|
140
|
-
|
141
|
-
### LLM Configuration
|
142
|
-
|
143
|
-
The Large Language Model (LLM) configuration is managed by the `LLMConfig` class.
|
144
|
-
|
145
|
-
```python
|
146
|
-
from fabricatio.config import LLMConfig
|
147
|
-
|
148
|
-
llm_config = LLMConfig(api_endpoint="https://api.example.com")
|
149
|
-
```
|
150
|
-
|
151
|
-
|
152
|
-
### Debug Configuration
|
153
|
-
|
154
|
-
The debug configuration is managed by the `DebugConfig` class.
|
155
|
-
|
156
|
-
```python
|
157
|
-
from fabricatio.config import DebugConfig
|
158
|
-
|
159
|
-
debug_config = DebugConfig(log_level="DEBUG", log_file="fabricatio.log")
|
160
|
-
```
|
161
|
-
|
162
|
-
|
163
|
-
## Examples
|
164
|
-
|
165
|
-
### Simple Task Example
|
166
|
-
|
167
|
-
Here is a simple example of a task that prints "Hello fabricatio!".
|
168
|
-
|
169
|
-
```python
|
170
|
-
import asyncio
|
171
|
-
from fabricatio import Action, Role, Task, WorkFlow, logger
|
172
|
-
|
173
|
-
task = Task(name="say hello", goal="say hello", description="say hello to the world")
|
174
|
-
|
175
|
-
class Talk(Action):
|
176
|
-
async def _execute(self, task_input: Task[str], **_) -> Any:
|
177
|
-
ret = "Hello fabricatio!"
|
178
|
-
logger.info("executing talk action")
|
179
|
-
return ret
|
180
|
-
|
181
|
-
class TestWorkflow(WorkFlow):
|
182
|
-
pass
|
183
|
-
|
184
|
-
role = Role(name="Test Role", actions=[TestWorkflow()])
|
185
|
-
|
186
|
-
async def main() -> None:
|
187
|
-
await role.act(task)
|
188
|
-
|
189
|
-
if __name__ == "__main__":
|
190
|
-
asyncio.run(main())
|
191
|
-
```
|
192
|
-
|
193
|
-
|
194
|
-
### Complex Workflow Example
|
195
|
-
|
196
|
-
Here is a more complex example that demonstrates how to create a workflow with multiple actions.
|
197
|
-
|
198
|
-
```python
|
199
|
-
import asyncio
|
200
|
-
from fabricatio import Action, Role, Task, WorkFlow, logger
|
201
|
-
|
202
|
-
task = Task(name="complex task", goal="perform complex operations", description="a task with multiple actions")
|
203
|
-
|
204
|
-
class ActionOne(Action):
|
205
|
-
async def _execute(self, task_input: Task[str], **_) -> Any:
|
206
|
-
ret = "Action One executed"
|
207
|
-
logger.info(ret)
|
208
|
-
return ret
|
209
|
-
|
210
|
-
class ActionTwo(Action):
|
211
|
-
async def _execute(self, task_input: Task[str], **_) -> Any:
|
212
|
-
ret = "Action Two executed"
|
213
|
-
logger.info(ret)
|
214
|
-
return ret
|
215
|
-
|
216
|
-
class ComplexWorkflow(WorkFlow):
|
217
|
-
actions = [ActionOne(), ActionTwo()]
|
218
|
-
|
219
|
-
role = Role(name="Complex Role", actions=[ComplexWorkflow()])
|
220
|
-
|
221
|
-
async def main() -> None:
|
222
|
-
await role.act(task)
|
223
|
-
|
224
|
-
if __name__ == "__main__":
|
225
|
-
asyncio.run(main())
|
226
|
-
```
|
227
|
-
|
228
|
-
|
229
|
-
## Contributing
|
230
|
-
|
231
|
-
Contributions to Fabricatio are welcome! Please submit a pull request with your changes.
|
232
|
-
|
233
|
-
## License
|
234
|
-
|
235
|
-
Fabricatio is licensed under the MIT License. See the [LICENSE](LICENSE) file for more information.
|
236
|
-
|
237
|
-
---
|
238
|
-
|
239
|
-
### Additional Features and Modules
|
240
|
-
|
241
|
-
#### Advanced Models and Functionalities
|
242
|
-
|
243
|
-
The `advanced.py` module provides advanced models and functionalities for handling complex tasks and workflows.
|
244
|
-
|
245
|
-
```python
|
246
|
-
from fabricatio.models.advanced import ProposeTask, HandleTask
|
247
|
-
|
248
|
-
class ProposeTaskExample(ProposeTask):
|
249
|
-
pass
|
250
|
-
|
251
|
-
class HandleTaskExample(HandleTask):
|
252
|
-
pass
|
253
|
-
```
|
254
|
-
|
255
|
-
|
256
|
-
#### Toolboxes
|
257
|
-
|
258
|
-
Fabricatio includes various toolboxes for different types of operations. For example, the `arithmetic.py` toolbox provides arithmetic operations.
|
259
|
-
|
260
|
-
```python
|
261
|
-
from fabricatio.toolboxes.arithmetic import add, subtract, multiply, divide
|
262
|
-
|
263
|
-
result = add(1, 2)
|
264
|
-
print(result) # Output: 3
|
265
|
-
```
|
266
|
-
|
267
|
-
|
268
|
-
#### File System Operations
|
269
|
-
|
270
|
-
The `fs.py` toolbox offers tools for file system operations such as copying, moving, deleting files, and creating directories.
|
271
|
-
|
272
|
-
```python
|
273
|
-
from fabricatio.toolboxes.fs import copy_file, move_file, delete_file, create_directory
|
274
|
-
|
275
|
-
copy_file("source.txt", "destination.txt")
|
276
|
-
move_file("old_location.txt", "new_location.txt")
|
277
|
-
delete_file("file_to_delete.txt")
|
278
|
-
create_directory("new_directory")
|
279
|
-
```
|
280
|
-
|
281
|
-
|
282
|
-
#### Logging Setup
|
283
|
-
|
284
|
-
The logging setup in Fabricatio is handled by the `journal.py` module, which configures Loguru for logging.
|
285
|
-
|
286
|
-
```python
|
287
|
-
from fabricatio.journal import logger
|
288
|
-
|
289
|
-
logger.debug("This is a debug message.")
|
290
|
-
logger.info("This is an info message.")
|
291
|
-
logger.success("This is a success message.")
|
292
|
-
logger.warning("This is a warning message.")
|
293
|
-
logger.error("This is an error message.")
|
294
|
-
logger.critical("This is a critical message.")
|
295
|
-
```
|
296
|
-
|
297
|
-
|
298
|
-
#### Configuration Management
|
299
|
-
|
300
|
-
The configuration management in Fabricatio is handled by the `config.py` module, which uses Pydantic for defining and validating configurations.
|
301
|
-
|
302
|
-
```python
|
303
|
-
from fabricatio.config import Settings, LLMConfig, DebugConfig
|
304
|
-
|
305
|
-
settings = Settings()
|
306
|
-
llm_config = LLMConfig(api_endpoint="https://api.example.com")
|
307
|
-
debug_config = DebugConfig(log_level="DEBUG", log_file="fabricatio.log")
|
308
|
-
```
|
309
|
-
|
310
|
-
|
311
|
-
#### Testing
|
312
|
-
|
313
|
-
Fabricatio includes a suite of test cases to ensure the stability and correctness of the codebase. The tests are located in the `tests` directory and cover various modules and functionalities.
|
314
|
-
|
315
|
-
```python
|
316
|
-
# Example of a test case for the config module
|
317
|
-
import pytest
|
318
|
-
from fabricatio.config import DebugConfig
|
319
|
-
|
320
|
-
def test_debug_config_initialization():
|
321
|
-
temp_log_file = "fabricatio.log"
|
322
|
-
debug_config = DebugConfig(log_level="DEBUG", log_file=temp_log_file)
|
323
|
-
assert debug_config.log_level == "DEBUG"
|
324
|
-
assert str(debug_config.log_file) == temp_log_file
|
325
|
-
```
|
326
|
-
|
327
|
-
|
328
|
-
---
|
329
|
-
|
330
|
-
### Conclusion
|
331
|
-
|
332
|
-
Fabricatio is a versatile and powerful framework for managing tasks, actions, and workflows. It provides a robust set of tools and features to facilitate task automation and orchestration. Whether you're building a simple script or a complex application, Fabricatio has the capabilities to meet your needs.
|
333
|
-
|
334
|
-
For more detailed information and examples, please refer to the [official documentation](https://fabricatio.readthedocs.io).
|
335
|
-
|
336
|
-
---
|
337
|
-
|
338
|
-
If you have any questions or need further assistance, feel free to reach out to the community or open an issue on the GitHub repository.
|
339
|
-
|
340
|
-
Happy coding!
|
341
|
-
|
342
|
-
|
@@ -1,35 +0,0 @@
|
|
1
|
-
fabricatio-0.2.0.dev20.dist-info/METADATA,sha256=YliY1ygZl8El9BvZ9DCsdSUUwteSNDhX3i-vyXJ6yXo,9664
|
2
|
-
fabricatio-0.2.0.dev20.dist-info/WHEEL,sha256=tpW5AN9B-9qsM9WW2FXG2r193YXiqexDadpKp0A2daI,96
|
3
|
-
fabricatio-0.2.0.dev20.dist-info/licenses/LICENSE,sha256=do7J7EiCGbq0QPbMAL_FqLYufXpHnCnXBOuqVPwSV8Y,1088
|
4
|
-
fabricatio/actions/communication.py,sha256=uNZY0YBJzWNPWjoKeX5Gks9MI4k9uOwjTuvkYzfm6ws,488
|
5
|
-
fabricatio/actions/transmission.py,sha256=fU-xL8fDG3oRDD9x7Q94OU2Sb9G6xQfrj5IMlMYsgiM,1240
|
6
|
-
fabricatio/actions/__init__.py,sha256=eFmFVPQvtNgFynIXBVr3eP-vWQDWCPng60YY5LXvZgg,115
|
7
|
-
fabricatio/config.py,sha256=FsmqfYJBwn_i2luiMFd1K04OOGMU3em9hBrdQprsNtk,10166
|
8
|
-
fabricatio/core.py,sha256=yQK2ZrbPYDJOaNDp0Bky3muTkB-ZaQ1ld_Qfflm2dY0,5938
|
9
|
-
fabricatio/decorators.py,sha256=XCnFmBoQMBB2rrJe58Kg8UP3lAyWwH9cGL7myh4FJNA,2630
|
10
|
-
fabricatio/fs/curd.py,sha256=wBBAxZqTNdjLL5y0b61_YoAT9X0cQDhokrk96muqiA4,3569
|
11
|
-
fabricatio/fs/readers.py,sha256=eDL9QhKEd6xfJBZaiwraObpGJWWpUd9NVYHoIvWgVqY,551
|
12
|
-
fabricatio/fs/__init__.py,sha256=lWcKYg0v3mv2LnnSegOQaTtlVDODU0vtw_s6iKU5IqQ,122
|
13
|
-
fabricatio/journal.py,sha256=siqimKF0M_QaaOCMxtjr_BJVNyUIAQWILzE9Q4T6-7c,781
|
14
|
-
fabricatio/models/action.py,sha256=3UWSyLjJEqGcvw8QcrbgIuXzNaxfboZgcA_5IACkbhQ,5658
|
15
|
-
fabricatio/models/advanced.py,sha256=VJJTWItMC-fDBdpJ7wx2tAlNq9NsXceexAb8AHZNL1E,4725
|
16
|
-
fabricatio/models/events.py,sha256=mrihNEFgQ5o7qFWja1z_qX8dnaTLwPBoJdVlzxQV5oM,2719
|
17
|
-
fabricatio/models/generic.py,sha256=_RR3Z20AjY7L9FbXVL49Is7lf1qdMEVX9kjnF7HAGyQ,4108
|
18
|
-
fabricatio/models/kwargs_types.py,sha256=lSZAxOnhFdQwRkm-NrbJVMSyBbfdeuVNx807LvJpEOo,901
|
19
|
-
fabricatio/models/role.py,sha256=Uqkqp06J3dSvrniGouonRA1ZRWjj8bKUGQwhuDq3b3A,1856
|
20
|
-
fabricatio/models/task.py,sha256=8xBHQv1GifvSFRQSPQqUBBA33wCDhM9qIvP2CG1WG04,9215
|
21
|
-
fabricatio/models/tool.py,sha256=mD0rlG7hpMxTd_pI6JfRxAVsqPaXGdw1VLThAlbrqFE,6385
|
22
|
-
fabricatio/models/usages.py,sha256=ZXjVq4QvBqWMbybY41knDStUgYC-MOvuPnMl26qvGtA,21787
|
23
|
-
fabricatio/models/utils.py,sha256=i_kpcQpct04mQFk1nbcVGV-pl1YThWu4Qk3wbewzKkc,2535
|
24
|
-
fabricatio/parser.py,sha256=R4dKANSacrt6StUWtlHyVVvFLivlXmdGD3v6HI62xh8,3358
|
25
|
-
fabricatio/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
26
|
-
fabricatio/toolboxes/arithmetic.py,sha256=WLqhY-Pikv11Y_0SGajwZx3WhsLNpHKf9drzAqOf_nY,1369
|
27
|
-
fabricatio/toolboxes/fs.py,sha256=q5weqzAPv4RddC73blEeYYMTeXoIZjHuK55Us1yVlj0,455
|
28
|
-
fabricatio/toolboxes/task.py,sha256=kU4a501awIDV7GwNDuSlK3_Ym-5OhCp5sS-insTmUmQ,269
|
29
|
-
fabricatio/toolboxes/__init__.py,sha256=b13KmASO8q5fBLwew964fn9oH86ER5g-S1PgA4fZ_xs,482
|
30
|
-
fabricatio/_rust.pyi,sha256=0wCqtwWkVxxoqprvk8T27T8QYKIAKHS7xgsmdMNjQKc,1756
|
31
|
-
fabricatio/_rust_instances.py,sha256=dl0-yZ4UvT5g20tQgnPJpmqtkjFGXNG_YK4eLfi_ugQ,279
|
32
|
-
fabricatio/__init__.py,sha256=opIrN8lGyT-h2If4Qez0bRuWBa3uIT9GsM9CZy7_XJ0,1100
|
33
|
-
fabricatio/_rust.cp312-win_amd64.pyd,sha256=fT-yxY85rLQmuH7LJvj0aDrrwx1AKzfeWjfseDsRifo,1256960
|
34
|
-
fabricatio-0.2.0.dev20.data/scripts/tdown.exe,sha256=Mvfseba7QyujspdgUXx8VTzBIgGuMlpoVgcRzwrK2sM,3379200
|
35
|
-
fabricatio-0.2.0.dev20.dist-info/RECORD,,
|
File without changes
|
File without changes
|