fabricatio 0.2.3.dev3__tar.gz → 0.2.4__tar.gz

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.
Files changed (120) hide show
  1. {fabricatio-0.2.3.dev3 → fabricatio-0.2.4}/.github/workflows/build-package.yaml +12 -0
  2. {fabricatio-0.2.3.dev3 → fabricatio-0.2.4}/PKG-INFO +65 -177
  3. {fabricatio-0.2.3.dev3 → fabricatio-0.2.4}/README.md +65 -175
  4. fabricatio-0.2.4/examples/extract_article/extract.py +29 -0
  5. {fabricatio-0.2.3.dev3 → fabricatio-0.2.4}/examples/llm_usages/llm_usage.py +5 -12
  6. {fabricatio-0.2.3.dev3 → fabricatio-0.2.4}/examples/make_a_rating/rating.py +4 -10
  7. {fabricatio-0.2.3.dev3 → fabricatio-0.2.4}/examples/make_diary/diary.py +2 -8
  8. {fabricatio-0.2.3.dev3 → fabricatio-0.2.4}/examples/minor/hello_fabricatio.py +0 -1
  9. {fabricatio-0.2.3.dev3 → fabricatio-0.2.4}/examples/propose_task/propose.py +6 -7
  10. {fabricatio-0.2.3.dev3 → fabricatio-0.2.4}/examples/simple_chat/chat.py +1 -2
  11. fabricatio-0.2.4/examples/simple_rag/simple_rag.py +65 -0
  12. {fabricatio-0.2.3.dev3 → fabricatio-0.2.4}/examples/task_handle/handle_task.py +5 -17
  13. fabricatio-0.2.4/examples/write_outline/.gitignore +2 -0
  14. fabricatio-0.2.4/examples/write_outline/write_outline.py +24 -0
  15. {fabricatio-0.2.3.dev3 → fabricatio-0.2.4}/pyproject.toml +2 -4
  16. {fabricatio-0.2.3.dev3 → fabricatio-0.2.4}/python/fabricatio/__init__.py +18 -5
  17. fabricatio-0.2.4/python/fabricatio/actions/article.py +81 -0
  18. fabricatio-0.2.4/python/fabricatio/actions/output.py +21 -0
  19. fabricatio-0.2.4/python/fabricatio/actions/rag.py +25 -0
  20. fabricatio-0.2.4/python/fabricatio/capabilities/propose.py +55 -0
  21. fabricatio-0.2.4/python/fabricatio/capabilities/rag.py +366 -0
  22. {fabricatio-0.2.3.dev3 → fabricatio-0.2.4}/python/fabricatio/capabilities/rating.py +12 -36
  23. {fabricatio-0.2.3.dev3 → fabricatio-0.2.4}/python/fabricatio/capabilities/task.py +6 -23
  24. {fabricatio-0.2.3.dev3 → fabricatio-0.2.4}/python/fabricatio/config.py +43 -2
  25. fabricatio-0.2.4/python/fabricatio/fs/__init__.py +27 -0
  26. {fabricatio-0.2.3.dev3 → fabricatio-0.2.4}/python/fabricatio/fs/curd.py +14 -8
  27. {fabricatio-0.2.3.dev3 → fabricatio-0.2.4}/python/fabricatio/fs/readers.py +5 -2
  28. {fabricatio-0.2.3.dev3 → fabricatio-0.2.4}/python/fabricatio/models/action.py +19 -4
  29. {fabricatio-0.2.3.dev3 → fabricatio-0.2.4}/python/fabricatio/models/events.py +36 -0
  30. fabricatio-0.2.4/python/fabricatio/models/extra.py +168 -0
  31. fabricatio-0.2.4/python/fabricatio/models/generic.py +363 -0
  32. {fabricatio-0.2.3.dev3 → fabricatio-0.2.4}/python/fabricatio/models/kwargs_types.py +15 -0
  33. {fabricatio-0.2.3.dev3 → fabricatio-0.2.4}/python/fabricatio/models/task.py +5 -37
  34. {fabricatio-0.2.3.dev3 → fabricatio-0.2.4}/python/fabricatio/models/tool.py +3 -2
  35. {fabricatio-0.2.3.dev3 → fabricatio-0.2.4}/python/fabricatio/models/usages.py +153 -184
  36. {fabricatio-0.2.3.dev3 → fabricatio-0.2.4}/python/fabricatio/models/utils.py +19 -0
  37. {fabricatio-0.2.3.dev3 → fabricatio-0.2.4}/python/fabricatio/parser.py +35 -8
  38. {fabricatio-0.2.3.dev3 → fabricatio-0.2.4}/python/fabricatio/toolboxes/__init__.py +1 -3
  39. {fabricatio-0.2.3.dev3 → fabricatio-0.2.4}/python/fabricatio/toolboxes/fs.py +15 -1
  40. fabricatio-0.2.4/python/fabricatio/workflows/articles.py +15 -0
  41. fabricatio-0.2.4/python/fabricatio/workflows/rag.py +11 -0
  42. fabricatio-0.2.4/src/hbs_helpers.rs +15 -0
  43. {fabricatio-0.2.3.dev3 → fabricatio-0.2.4}/src/lib.rs +1 -0
  44. {fabricatio-0.2.3.dev3 → fabricatio-0.2.4}/src/templates.rs +7 -0
  45. fabricatio-0.2.4/templates/built-in/create_json_obj.hbs +68 -0
  46. fabricatio-0.2.4/templates/built-in/draft_rating_criteria.hbs +40 -0
  47. {fabricatio-0.2.3.dev3 → fabricatio-0.2.4}/templates/built-in/draft_rating_manual.hbs +20 -6
  48. fabricatio-0.2.4/templates/built-in/draft_rating_weights_klee.hbs +44 -0
  49. fabricatio-0.2.4/templates/built-in/draft_tool_usage_code.hbs +76 -0
  50. fabricatio-0.2.4/templates/built-in/extract_criteria_from_reasons.hbs +49 -0
  51. fabricatio-0.2.4/templates/built-in/extract_reasons_from_examples.hbs +48 -0
  52. fabricatio-0.2.4/templates/built-in/liststr.hbs +44 -0
  53. fabricatio-0.2.4/templates/built-in/make_choice.hbs +40 -0
  54. fabricatio-0.2.4/templates/built-in/make_judgment.hbs +35 -0
  55. fabricatio-0.2.4/templates/built-in/pathstr.hbs +3 -0
  56. fabricatio-0.2.4/templates/built-in/rate_fine_grind.hbs +51 -0
  57. fabricatio-0.2.4/templates/built-in/refined_query.hbs +36 -0
  58. {fabricatio-0.2.3.dev3 → fabricatio-0.2.4}/templates/built-in/retrieved_display.hbs +1 -1
  59. fabricatio-0.2.4/templates.tar.gz +0 -0
  60. {fabricatio-0.2.3.dev3 → fabricatio-0.2.4}/tests/test_models/test_action.py +4 -3
  61. {fabricatio-0.2.3.dev3 → fabricatio-0.2.4}/tests/test_models/test_generic.py +14 -6
  62. {fabricatio-0.2.3.dev3 → fabricatio-0.2.4}/tests/test_models/test_task.py +4 -3
  63. {fabricatio-0.2.3.dev3 → fabricatio-0.2.4}/uv.lock +1 -65
  64. fabricatio-0.2.3.dev3/examples/simple_rag/simple_rag.py +0 -33
  65. fabricatio-0.2.3.dev3/python/fabricatio/actions/__init__.py +0 -5
  66. fabricatio-0.2.3.dev3/python/fabricatio/actions/communication.py +0 -15
  67. fabricatio-0.2.3.dev3/python/fabricatio/actions/transmission.py +0 -23
  68. fabricatio-0.2.3.dev3/python/fabricatio/capabilities/rag.py +0 -225
  69. fabricatio-0.2.3.dev3/python/fabricatio/fs/__init__.py +0 -5
  70. fabricatio-0.2.3.dev3/python/fabricatio/models/generic.py +0 -152
  71. fabricatio-0.2.3.dev3/python/fabricatio/toolboxes/task.py +0 -6
  72. fabricatio-0.2.3.dev3/templates/built-in/draft_rating_criteria.hbs +0 -24
  73. fabricatio-0.2.3.dev3/templates/built-in/draft_rating_weights_klee.hbs +0 -23
  74. fabricatio-0.2.3.dev3/templates/built-in/draft_tool_usage_code.hbs +0 -66
  75. fabricatio-0.2.3.dev3/templates/built-in/extract_criteria_from_reasons.hbs +0 -24
  76. fabricatio-0.2.3.dev3/templates/built-in/extract_reasons_from_examples.hbs +0 -18
  77. fabricatio-0.2.3.dev3/templates/built-in/make_choice.hbs +0 -27
  78. fabricatio-0.2.3.dev3/templates/built-in/make_judgment.hbs +0 -27
  79. fabricatio-0.2.3.dev3/templates/built-in/propose_task.hbs +0 -12
  80. fabricatio-0.2.3.dev3/templates/built-in/rate_fine_grind.hbs +0 -39
  81. fabricatio-0.2.3.dev3/templates.tar.gz +0 -0
  82. {fabricatio-0.2.3.dev3 → fabricatio-0.2.4}/.github/workflows/ruff.yaml +0 -0
  83. {fabricatio-0.2.3.dev3 → fabricatio-0.2.4}/.github/workflows/tests.yaml +0 -0
  84. {fabricatio-0.2.3.dev3 → fabricatio-0.2.4}/.gitignore +0 -0
  85. {fabricatio-0.2.3.dev3 → fabricatio-0.2.4}/.python-version +0 -0
  86. {fabricatio-0.2.3.dev3 → fabricatio-0.2.4}/Cargo.lock +0 -0
  87. {fabricatio-0.2.3.dev3 → fabricatio-0.2.4}/Cargo.toml +0 -0
  88. {fabricatio-0.2.3.dev3 → fabricatio-0.2.4}/LICENSE +0 -0
  89. {fabricatio-0.2.3.dev3 → fabricatio-0.2.4}/Makefile +0 -0
  90. {fabricatio-0.2.3.dev3 → fabricatio-0.2.4}/examples/make_diary/commits.json +0 -0
  91. {fabricatio-0.2.3.dev3 → fabricatio-0.2.4}/python/fabricatio/_rust.pyi +0 -0
  92. {fabricatio-0.2.3.dev3 → fabricatio-0.2.4}/python/fabricatio/_rust_instances.py +0 -0
  93. {fabricatio-0.2.3.dev3 → fabricatio-0.2.4}/python/fabricatio/core.py +0 -0
  94. {fabricatio-0.2.3.dev3 → fabricatio-0.2.4}/python/fabricatio/decorators.py +0 -0
  95. {fabricatio-0.2.3.dev3 → fabricatio-0.2.4}/python/fabricatio/journal.py +0 -0
  96. {fabricatio-0.2.3.dev3 → fabricatio-0.2.4}/python/fabricatio/models/role.py +0 -0
  97. {fabricatio-0.2.3.dev3 → fabricatio-0.2.4}/python/fabricatio/py.typed +0 -0
  98. {fabricatio-0.2.3.dev3 → fabricatio-0.2.4}/python/fabricatio/toolboxes/arithmetic.py +0 -0
  99. {fabricatio-0.2.3.dev3 → fabricatio-0.2.4}/src/hash.rs +0 -0
  100. {fabricatio-0.2.3.dev3 → fabricatio-0.2.4}/templates/built-in/binary-exploitation-ctf-solver.hbs +0 -0
  101. {fabricatio-0.2.3.dev3 → fabricatio-0.2.4}/templates/built-in/claude-xml.hbs +0 -0
  102. {fabricatio-0.2.3.dev3 → fabricatio-0.2.4}/templates/built-in/clean-up-code.hbs +0 -0
  103. {fabricatio-0.2.3.dev3 → fabricatio-0.2.4}/templates/built-in/cryptography-ctf-solver.hbs +0 -0
  104. {fabricatio-0.2.3.dev3 → fabricatio-0.2.4}/templates/built-in/dependencies.hbs +0 -0
  105. {fabricatio-0.2.3.dev3 → fabricatio-0.2.4}/templates/built-in/document-the-code.hbs +0 -0
  106. {fabricatio-0.2.3.dev3 → fabricatio-0.2.4}/templates/built-in/find-security-vulnerabilities.hbs +0 -0
  107. {fabricatio-0.2.3.dev3 → fabricatio-0.2.4}/templates/built-in/fix-bugs.hbs +0 -0
  108. {fabricatio-0.2.3.dev3 → fabricatio-0.2.4}/templates/built-in/improve-performance.hbs +0 -0
  109. {fabricatio-0.2.3.dev3 → fabricatio-0.2.4}/templates/built-in/refactor.hbs +0 -0
  110. {fabricatio-0.2.3.dev3 → fabricatio-0.2.4}/templates/built-in/reverse-engineering-ctf-solver.hbs +0 -0
  111. {fabricatio-0.2.3.dev3 → fabricatio-0.2.4}/templates/built-in/task_briefing.hbs +0 -0
  112. {fabricatio-0.2.3.dev3 → fabricatio-0.2.4}/templates/built-in/web-ctf-solver.hbs +0 -0
  113. {fabricatio-0.2.3.dev3 → fabricatio-0.2.4}/templates/built-in/write-git-commit.hbs +0 -0
  114. {fabricatio-0.2.3.dev3 → fabricatio-0.2.4}/templates/built-in/write-github-pull-request.hbs +0 -0
  115. {fabricatio-0.2.3.dev3 → fabricatio-0.2.4}/templates/built-in/write-github-readme.hbs +0 -0
  116. {fabricatio-0.2.3.dev3 → fabricatio-0.2.4}/tests/test_config.py +0 -0
  117. {fabricatio-0.2.3.dev3 → fabricatio-0.2.4}/tests/test_models/test_advanced.py +0 -0
  118. {fabricatio-0.2.3.dev3 → fabricatio-0.2.4}/tests/test_models/test_role.py +0 -0
  119. {fabricatio-0.2.3.dev3 → fabricatio-0.2.4}/tests/test_models/test_tool.py +0 -0
  120. {fabricatio-0.2.3.dev3 → fabricatio-0.2.4}/tests/test_models/test_usages.py +0 -0
@@ -40,6 +40,16 @@ jobs:
40
40
  fi
41
41
  shell: bash
42
42
 
43
+ - name: check if is prerelease
44
+ id: check_prerelease
45
+ run: |
46
+ if [[ "${{ steps.get_version.outputs.CURRENT_VERSION }}" == *"-"* ]]; then
47
+ echo "IS_PRERELEASE=true" >> $GITHUB_OUTPUT
48
+ else
49
+ echo "IS_PRERELEASE=false" >> $GITHUB_OUTPUT
50
+ fi
51
+ shell: bash
52
+
43
53
  - name: Install the latest version of uv
44
54
  uses: astral-sh/setup-uv@v5
45
55
  with:
@@ -69,6 +79,8 @@ jobs:
69
79
  files: |
70
80
  dist/*
71
81
  templates.tar.gz
82
+ prerelease: ${{ steps.check_prerelease.outputs.IS_PRERELEASE }}
83
+ generate_release_notes: true
72
84
  env:
73
85
  GITHUB_TOKEN: ${{ secrets.PAT }}
74
86
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fabricatio
3
- Version: 0.2.3.dev3
3
+ Version: 0.2.4
4
4
  Classifier: License :: OSI Approved :: MIT License
5
5
  Classifier: Programming Language :: Rust
6
6
  Classifier: Programming Language :: Python :: 3.12
@@ -11,7 +11,6 @@ Classifier: Typing :: Typed
11
11
  Requires-Dist: appdirs>=1.4.4
12
12
  Requires-Dist: asyncio>=3.4.3
13
13
  Requires-Dist: asyncstdlib>=3.13.0
14
- Requires-Dist: gitpython>=3.1.44
15
14
  Requires-Dist: litellm>=1.60.0
16
15
  Requires-Dist: loguru>=0.7.3
17
16
  Requires-Dist: magika>=0.5.1
@@ -37,13 +36,14 @@ Project-URL: Homepage, https://github.com/Whth/fabricatio
37
36
  Project-URL: Repository, https://github.com/Whth/fabricatio
38
37
  Project-URL: Issues, https://github.com/Whth/fabricatio/issues
39
38
 
40
-
41
39
  # Fabricatio
42
40
 
43
41
  ![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)
44
42
  ![Python 3.12+](https://img.shields.io/badge/python-3.12+-blue.svg)
45
43
  ![Build Status](https://img.shields.io/badge/build-passing-brightgreen)
46
44
 
45
+ ## Overview
46
+
47
47
  Fabricatio is a Python library designed for building LLM (Large Language Model) applications using an event-based agent structure. It integrates Rust for performance-critical tasks, utilizes Handlebars for templating, and employs PyO3 for Python bindings.
48
48
 
49
49
  ## Features
@@ -73,6 +73,7 @@ cd fabricatio
73
73
  uv --with-editable . maturin develop --uv -r
74
74
  ```
75
75
 
76
+
76
77
  ### Building Distribution
77
78
 
78
79
  For production builds:
@@ -82,50 +83,47 @@ For production builds:
82
83
  make bdist
83
84
  ```
84
85
 
86
+
85
87
  This will generate distribution files in the `dist` directory.
86
88
 
87
89
  ## Usage
88
90
 
89
91
  ### Basic Example
90
92
 
91
- Below are some basic examples demonstrating how to use Fabricatio for different purposes.
92
-
93
93
  #### Simple Hello World Program
94
94
 
95
95
  ```python
96
96
  import asyncio
97
- from fabricatio import Action, Role, Task, logger
98
-
97
+ from fabricatio import Action, Role, Task, logger, WorkFlow
98
+ from typing import Any
99
99
 
100
100
  class Hello(Action):
101
- """Action that says hello."""
102
-
103
- name: str = "hello"
104
- output_key: str = "task_output"
105
-
106
- async def _execute(self, task_input: Task[str], **_) -> Any:
107
- ret = "Hello fabricatio!"
108
- logger.info("executing talk action")
109
- return ret
101
+ name: str = "hello"
102
+ output_key: str = "task_output"
110
103
 
104
+ async def _execute(self, task_input: Task[str], **_) -> Any:
105
+ ret = "Hello fabricatio!"
106
+ logger.info("executing talk action")
107
+ return ret
111
108
 
112
109
  async def main() -> None:
113
- """Main function."""
114
- role = Role(
115
- name="talker",
116
- description="talker role",
117
- registry={Task.pending_label: WorkFlow(name="talk", steps=(Hello,))}
118
- )
119
-
120
- task = Task(name="say hello", goals="say hello", description="say hello to the world")
121
- result = await task.delegate()
122
- logger.success(f"Result: {result}")
110
+ role = Role(
111
+ name="talker",
112
+ description="talker role",
113
+ registry={Task.pending_label: WorkFlow(name="talk", steps=(Hello,))}
114
+ )
123
115
 
116
+ task = Task(name="say hello", goals="say hello", description="say hello to the world")
117
+ result = await task.delegate()
118
+ logger.success(f"Result: {result}")
124
119
 
125
120
  if __name__ == "__main__":
126
- asyncio.run(main())
121
+ asyncio.run(main())
127
122
  ```
128
123
 
124
+
125
+ ### Advanced Examples
126
+
129
127
  #### Writing and Dumping Code
130
128
 
131
129
  ```python
@@ -134,21 +132,14 @@ from fabricatio import Action, Event, PythonCapture, Role, Task, ToolBox, WorkFl
134
132
 
135
133
 
136
134
  class WriteCode(Action):
137
- """Action that writes code based on a prompt."""
138
-
139
135
  name: str = "write code"
140
136
  output_key: str = "source_code"
141
137
 
142
138
  async def _execute(self, task_input: Task[str], **_) -> str:
143
- return await self.aask_validate(
144
- task_input.briefing,
145
- validator=PythonCapture.capture,
146
- )
139
+ return await self.aask_validate(task_input.briefing, validator=PythonCapture.capture)
147
140
 
148
141
 
149
142
  class DumpCode(Action):
150
- """Action that dumps code to the file system."""
151
-
152
143
  name: str = "dump code"
153
144
  description: str = "Dump code to file system"
154
145
  toolboxes: set[ToolBox] = {fs_toolbox}
@@ -160,20 +151,18 @@ class DumpCode(Action):
160
151
 
161
152
 
162
153
  async def main() -> None:
163
- """Main function."""
164
154
  role = Role(
165
155
  name="Coder",
166
156
  description="A python coder who can write and document code",
167
157
  registry={
168
158
  Event.instantiate_from("coding.*").push("pending"): WorkFlow(
169
159
  name="write code", steps=(WriteCode, DumpCode)
170
- ),
171
- },
160
+ )
161
+ }
172
162
  )
173
163
 
174
164
  prompt = "write a Python CLI app which prints 'hello world' n times with detailed Google-style docstring. Write the source code to `cli.py`."
175
-
176
- proposed_task = await role.propose(prompt)
165
+ proposed_task = await role.propose_task(prompt)
177
166
  path = await proposed_task.move_to("coding").delegate()
178
167
  logger.success(f"Code Path: {path}")
179
168
 
@@ -182,112 +171,8 @@ if __name__ == "__main__":
182
171
  asyncio.run(main())
183
172
  ```
184
173
 
185
- #### Proposing Tasks
186
-
187
- ```python
188
- import asyncio
189
- from typing import Any
190
-
191
- from fabricatio import Action, Role, Task, WorkFlow, logger
192
-
193
-
194
- class WriteDocumentation(Action):
195
- """Action that generates documentation for the code in markdown format."""
196
-
197
- name: str = "write documentation"
198
- description: str = "Write detailed documentation for the provided code."
199
- output_key: str = "task_output"
200
-
201
- async def _execute(self, task_input: Task[str], **_) -> str:
202
- return await self.aask(task_input.briefing)
203
-
204
-
205
- async def main() -> None:
206
- """Main function."""
207
- role = Role(
208
- name="Documenter",
209
- description="Role responsible for writing documentation.",
210
- registry={
211
- "doc.*": WorkFlow(name="write documentation", steps=(WriteDocumentation,))
212
- }
213
- )
214
-
215
- prompt = "write a Rust clap CLI that downloads an HTML page"
216
- proposed_task = await role.propose(prompt)
217
- documentation = await proposed_task.move_to("doc").delegate()
218
- logger.success(f"Documentation:\n{documentation}")
219
-
220
-
221
- if __name__ == "__main__":
222
- asyncio.run(main())
223
- ```
224
-
225
- #### Complex Workflow Handling
226
-
227
- ```python
228
- import asyncio
229
- from fabricatio import Action, Event, Role, Task, WorkFlow, logger
230
-
231
-
232
- class WriteCode(Action):
233
- """Action that writes code based on a prompt."""
234
-
235
- name: str = "write code"
236
- output_key: str = "source_code"
237
-
238
- async def _execute(self, task_input: Task[str], **_) -> str:
239
- return await self.aask_validate(
240
- task_input.briefing,
241
- validator=PythonCapture.capture,
242
- )
243
-
244
-
245
- class WriteDocumentation(Action):
246
- """Action that generates documentation for the code in markdown format."""
247
-
248
- name: str = "write documentation"
249
- description: str = "Write detailed documentation for the provided code."
250
- output_key: str = "task_output"
251
-
252
- async def _execute(self, task_input: Task[str], **_) -> str:
253
- return await self.aask(task_input.briefing)
254
-
255
-
256
- async def main() -> None:
257
- """Main function."""
258
- role = Role(
259
- name="Developer",
260
- description="A developer who can write code and documentation.",
261
- registry={
262
- Event.instantiate_from("coding.*").push("pending"): WorkFlow(
263
- name="write code", steps=(WriteCode,)
264
- ),
265
- Event.instantiate_from("doc.*").push("pending"): WorkFlow(
266
- name="write documentation", steps=(WriteDocumentation,)
267
- ),
268
- }
269
- )
270
-
271
- # Propose a coding task
272
- code_task_prompt = "write a Python CLI app which adds numbers from a file."
273
- proposed_task = await role.propose(code_task_prompt)
274
- code = await proposed_task.move_to("coding").delegate()
275
- logger.success(f"Code:\n{code}")
276
-
277
- # Propose a documentation task
278
- doc_task_prompt = f"{code}\n\nwrite Readme.md file for the above code."
279
- proposed_doc_task = await role.propose(doc_task_prompt)
280
- documentation = await proposed_doc_task.move_to("doc").delegate()
281
- logger.success(f"Documentation:\n{documentation}")
282
-
283
-
284
- if __name__ == "__main__":
285
- asyncio.run(main())
286
- ```
287
-
288
- ### Advanced Examples
289
174
 
290
- #### Template Management and Rendering
175
+ ### Template Management and Rendering
291
176
 
292
177
  ```python
293
178
  from fabricatio._rust_instances import template_manager
@@ -303,7 +188,8 @@ rendered_template = template_manager.render_template(template_name, data)
303
188
  print(rendered_template)
304
189
  ```
305
190
 
306
- #### Handling Security Vulnerabilities
191
+
192
+ ### Handling Security Vulnerabilities
307
193
 
308
194
  ```python
309
195
  from fabricatio.models.usages import ToolBoxUsage
@@ -311,21 +197,21 @@ from fabricatio.models.task import Task
311
197
 
312
198
  toolbox_usage = ToolBoxUsage()
313
199
 
314
-
315
200
  async def handle_security_vulnerabilities():
316
- task = Task(
317
- name="Security Check",
318
- goals=["Identify security vulnerabilities"],
319
- description="Perform a thorough security review on the project.",
320
- dependencies=["./src/main.py"]
321
- )
322
-
323
- vulnerabilities = await toolbox_usage.gather_tools_fine_grind(task)
324
- for vulnerability in vulnerabilities:
325
- print(f"Found vulnerability: {vulnerability.name}")
201
+ task = Task(
202
+ name="Security Check",
203
+ goals=["Identify security vulnerabilities"],
204
+ description="Perform a thorough security review on the project.",
205
+ dependencies=["./src/main.py"]
206
+ )
207
+
208
+ vulnerabilities = await toolbox_usage.gather_tools_fine_grind(task)
209
+ for vulnerability in vulnerabilities:
210
+ print(f"Found vulnerability: {vulnerability.name}")
326
211
  ```
327
212
 
328
- #### Managing CTF Challenges
213
+
214
+ ### Managing CTF Challenges
329
215
 
330
216
  ```python
331
217
  import asyncio
@@ -335,25 +221,24 @@ from fabricatio.models.task import Task
335
221
 
336
222
  toolbox_usage = ToolBoxUsage()
337
223
 
338
-
339
224
  async def solve_ctf_challenge(challenge_name: str, challenge_description: str, files: list[str]):
340
- task = Task(
341
- name=challenge_name,
342
- goals=[f"Solve {challenge_name} challenge"],
343
- description=challenge_description,
344
- dependencies=files
345
- )
346
-
347
- solution = await toolbox_usage.gather_tools_fine_grind(task)
348
- print(f"Challenge Solved: {solution}")
225
+ task = Task(
226
+ name=challenge_name,
227
+ goals=[f"Solve {challenge_name} challenge"],
228
+ description=challenge_description,
229
+ dependencies=files
230
+ )
349
231
 
232
+ solution = await toolbox_usage.gather_tools_fine_grind(task)
233
+ print(f"Challenge Solved: {solution}")
350
234
 
351
235
  if __name__ == "__main__":
352
- asyncio.run(
353
- solve_ctf_challenge("Binary Exploitation", "CTF Binary Exploitation Challenge", ["./challenges/binary_exploit"]))
236
+ asyncio.run(
237
+ solve_ctf_challenge("Binary Exploitation", "CTF Binary Exploitation Challenge", ["./challenges/binary_exploit"]))
354
238
  ```
355
239
 
356
- ### Configuration
240
+
241
+ ## Configuration
357
242
 
358
243
  The configuration for Fabricatio is managed via environment variables or TOML files. The default configuration file (`config.toml`) can be overridden by specifying a custom path.
359
244
 
@@ -374,7 +259,8 @@ stream = false
374
259
  max_tokens = 8192
375
260
  ```
376
261
 
377
- ### Development Setup
262
+
263
+ ## Development Setup
378
264
 
379
265
  To set up a development environment for Fabricatio:
380
266
 
@@ -384,22 +270,26 @@ To set up a development environment for Fabricatio:
384
270
  cd fabricatio
385
271
  ```
386
272
 
273
+
387
274
  2. **Install Dependencies**:
388
275
  ```bash
389
276
  uv --with-editable . maturin develop --uv -r
390
277
  ```
391
278
 
279
+
392
280
  3. **Run Tests**:
393
281
  ```bash
394
282
  make test
395
283
  ```
396
284
 
285
+
397
286
  4. **Build Documentation**:
398
287
  ```bash
399
288
  make docs
400
289
  ```
401
290
 
402
- ### Contributing
291
+
292
+ ## Contributing
403
293
 
404
294
  Contributions are welcome! Please follow these guidelines when contributing:
405
295
 
@@ -409,15 +299,13 @@ Contributions are welcome! Please follow these guidelines when contributing:
409
299
  4. Push to the branch (`git push origin feature/new-feature`).
410
300
  5. Create a new Pull Request.
411
301
 
412
- ### License
302
+ ## License
413
303
 
414
304
  Fabricatio is licensed under the MIT License. See [LICENSE](LICENSE) for more details.
415
305
 
416
- ### Acknowledgments
306
+ ## Acknowledgments
417
307
 
418
308
  Special thanks to the contributors and maintainers of:
419
309
  - [PyO3](https://github.com/PyO3/pyo3)
420
310
  - [Maturin](https://github.com/PyO3/maturin)
421
311
  - [Handlebars.rs](https://github.com/sunng87/handlebars-rust)
422
-
423
-