fabricatio 0.2.1__tar.gz → 0.2.1.dev1__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.
- {fabricatio-0.2.1 → fabricatio-0.2.1.dev1}/.gitignore +1 -1
- {fabricatio-0.2.1 → fabricatio-0.2.1.dev1}/Makefile +1 -0
- {fabricatio-0.2.1 → fabricatio-0.2.1.dev1}/PKG-INFO +2 -3
- fabricatio-0.2.1.dev1/examples/make_diary/commits.json +23 -0
- fabricatio-0.2.1.dev1/examples/make_diary/diary.py +96 -0
- {fabricatio-0.2.1 → fabricatio-0.2.1.dev1}/pyproject.toml +2 -6
- fabricatio-0.2.1.dev1/python/fabricatio/fs/readers.py +43 -0
- {fabricatio-0.2.1 → fabricatio-0.2.1.dev1}/python/fabricatio/models/generic.py +11 -3
- {fabricatio-0.2.1 → fabricatio-0.2.1.dev1}/python/fabricatio/models/usages.py +75 -19
- fabricatio-0.2.1.dev1/templates.tar.gz +0 -0
- {fabricatio-0.2.1 → fabricatio-0.2.1.dev1}/uv.lock +5 -291
- fabricatio-0.2.1/python/fabricatio/fs/readers.py +0 -24
- fabricatio-0.2.1/templates.tar.gz +0 -0
- {fabricatio-0.2.1 → fabricatio-0.2.1.dev1}/.github/workflows/build-package.yaml +0 -0
- {fabricatio-0.2.1 → fabricatio-0.2.1.dev1}/.github/workflows/ruff.yaml +0 -0
- {fabricatio-0.2.1 → fabricatio-0.2.1.dev1}/.github/workflows/tests.yaml +0 -0
- {fabricatio-0.2.1 → fabricatio-0.2.1.dev1}/.python-version +0 -0
- {fabricatio-0.2.1 → fabricatio-0.2.1.dev1}/Cargo.lock +0 -0
- {fabricatio-0.2.1 → fabricatio-0.2.1.dev1}/Cargo.toml +0 -0
- {fabricatio-0.2.1 → fabricatio-0.2.1.dev1}/LICENSE +0 -0
- {fabricatio-0.2.1 → fabricatio-0.2.1.dev1}/README.md +0 -0
- {fabricatio-0.2.1 → fabricatio-0.2.1.dev1}/examples/llm_usages/llm_usage.py +0 -0
- {fabricatio-0.2.1 → fabricatio-0.2.1.dev1}/examples/minor/hello_fabricatio.py +0 -0
- {fabricatio-0.2.1 → fabricatio-0.2.1.dev1}/examples/propose_task/propose.py +0 -0
- {fabricatio-0.2.1 → fabricatio-0.2.1.dev1}/examples/simple_chat/chat.py +0 -0
- {fabricatio-0.2.1 → fabricatio-0.2.1.dev1}/examples/task_handle/handle_task.py +0 -0
- {fabricatio-0.2.1 → fabricatio-0.2.1.dev1}/python/fabricatio/__init__.py +0 -0
- {fabricatio-0.2.1 → fabricatio-0.2.1.dev1}/python/fabricatio/_rust.pyi +0 -0
- {fabricatio-0.2.1 → fabricatio-0.2.1.dev1}/python/fabricatio/_rust_instances.py +0 -0
- {fabricatio-0.2.1 → fabricatio-0.2.1.dev1}/python/fabricatio/actions/__init__.py +0 -0
- {fabricatio-0.2.1 → fabricatio-0.2.1.dev1}/python/fabricatio/actions/communication.py +0 -0
- {fabricatio-0.2.1 → fabricatio-0.2.1.dev1}/python/fabricatio/actions/transmission.py +0 -0
- {fabricatio-0.2.1 → fabricatio-0.2.1.dev1}/python/fabricatio/config.py +0 -0
- {fabricatio-0.2.1 → fabricatio-0.2.1.dev1}/python/fabricatio/core.py +0 -0
- {fabricatio-0.2.1 → fabricatio-0.2.1.dev1}/python/fabricatio/decorators.py +0 -0
- {fabricatio-0.2.1 → fabricatio-0.2.1.dev1}/python/fabricatio/fs/__init__.py +0 -0
- {fabricatio-0.2.1 → fabricatio-0.2.1.dev1}/python/fabricatio/fs/curd.py +0 -0
- {fabricatio-0.2.1 → fabricatio-0.2.1.dev1}/python/fabricatio/journal.py +0 -0
- {fabricatio-0.2.1 → fabricatio-0.2.1.dev1}/python/fabricatio/models/action.py +0 -0
- {fabricatio-0.2.1 → fabricatio-0.2.1.dev1}/python/fabricatio/models/advanced.py +0 -0
- {fabricatio-0.2.1 → fabricatio-0.2.1.dev1}/python/fabricatio/models/events.py +0 -0
- {fabricatio-0.2.1 → fabricatio-0.2.1.dev1}/python/fabricatio/models/kwargs_types.py +0 -0
- {fabricatio-0.2.1 → fabricatio-0.2.1.dev1}/python/fabricatio/models/role.py +0 -0
- {fabricatio-0.2.1 → fabricatio-0.2.1.dev1}/python/fabricatio/models/task.py +0 -0
- {fabricatio-0.2.1 → fabricatio-0.2.1.dev1}/python/fabricatio/models/tool.py +0 -0
- {fabricatio-0.2.1 → fabricatio-0.2.1.dev1}/python/fabricatio/models/utils.py +0 -0
- {fabricatio-0.2.1 → fabricatio-0.2.1.dev1}/python/fabricatio/parser.py +0 -0
- {fabricatio-0.2.1 → fabricatio-0.2.1.dev1}/python/fabricatio/py.typed +0 -0
- {fabricatio-0.2.1 → fabricatio-0.2.1.dev1}/python/fabricatio/toolboxes/__init__.py +0 -0
- {fabricatio-0.2.1 → fabricatio-0.2.1.dev1}/python/fabricatio/toolboxes/arithmetic.py +0 -0
- {fabricatio-0.2.1 → fabricatio-0.2.1.dev1}/python/fabricatio/toolboxes/fs.py +0 -0
- {fabricatio-0.2.1 → fabricatio-0.2.1.dev1}/python/fabricatio/toolboxes/task.py +0 -0
- {fabricatio-0.2.1 → fabricatio-0.2.1.dev1}/src/hash.rs +0 -0
- {fabricatio-0.2.1 → fabricatio-0.2.1.dev1}/src/lib.rs +0 -0
- {fabricatio-0.2.1 → fabricatio-0.2.1.dev1}/src/templates.rs +0 -0
- {fabricatio-0.2.1 → fabricatio-0.2.1.dev1}/templates/built-in/binary-exploitation-ctf-solver.hbs +0 -0
- {fabricatio-0.2.1 → fabricatio-0.2.1.dev1}/templates/built-in/claude-xml.hbs +0 -0
- {fabricatio-0.2.1 → fabricatio-0.2.1.dev1}/templates/built-in/clean-up-code.hbs +0 -0
- {fabricatio-0.2.1 → fabricatio-0.2.1.dev1}/templates/built-in/cryptography-ctf-solver.hbs +0 -0
- {fabricatio-0.2.1 → fabricatio-0.2.1.dev1}/templates/built-in/dependencies.hbs +0 -0
- {fabricatio-0.2.1 → fabricatio-0.2.1.dev1}/templates/built-in/document-the-code.hbs +0 -0
- {fabricatio-0.2.1 → fabricatio-0.2.1.dev1}/templates/built-in/draft_tool_usage_code.hbs +0 -0
- {fabricatio-0.2.1 → fabricatio-0.2.1.dev1}/templates/built-in/find-security-vulnerabilities.hbs +0 -0
- {fabricatio-0.2.1 → fabricatio-0.2.1.dev1}/templates/built-in/fix-bugs.hbs +0 -0
- {fabricatio-0.2.1 → fabricatio-0.2.1.dev1}/templates/built-in/improve-performance.hbs +0 -0
- {fabricatio-0.2.1 → fabricatio-0.2.1.dev1}/templates/built-in/make_choice.hbs +0 -0
- {fabricatio-0.2.1 → fabricatio-0.2.1.dev1}/templates/built-in/make_judgment.hbs +0 -0
- {fabricatio-0.2.1 → fabricatio-0.2.1.dev1}/templates/built-in/propose_task.hbs +0 -0
- {fabricatio-0.2.1 → fabricatio-0.2.1.dev1}/templates/built-in/refactor.hbs +0 -0
- {fabricatio-0.2.1 → fabricatio-0.2.1.dev1}/templates/built-in/reverse-engineering-ctf-solver.hbs +0 -0
- {fabricatio-0.2.1 → fabricatio-0.2.1.dev1}/templates/built-in/task_briefing.hbs +0 -0
- {fabricatio-0.2.1 → fabricatio-0.2.1.dev1}/templates/built-in/web-ctf-solver.hbs +0 -0
- {fabricatio-0.2.1 → fabricatio-0.2.1.dev1}/templates/built-in/write-git-commit.hbs +0 -0
- {fabricatio-0.2.1 → fabricatio-0.2.1.dev1}/templates/built-in/write-github-pull-request.hbs +0 -0
- {fabricatio-0.2.1 → fabricatio-0.2.1.dev1}/templates/built-in/write-github-readme.hbs +0 -0
- {fabricatio-0.2.1 → fabricatio-0.2.1.dev1}/tests/test_config.py +0 -0
- {fabricatio-0.2.1 → fabricatio-0.2.1.dev1}/tests/test_models/test_action.py +0 -0
- {fabricatio-0.2.1 → fabricatio-0.2.1.dev1}/tests/test_models/test_advanced.py +0 -0
- {fabricatio-0.2.1 → fabricatio-0.2.1.dev1}/tests/test_models/test_generic.py +0 -0
- {fabricatio-0.2.1 → fabricatio-0.2.1.dev1}/tests/test_models/test_role.py +0 -0
- {fabricatio-0.2.1 → fabricatio-0.2.1.dev1}/tests/test_models/test_task.py +0 -0
- {fabricatio-0.2.1 → fabricatio-0.2.1.dev1}/tests/test_models/test_tool.py +0 -0
- {fabricatio-0.2.1 → fabricatio-0.2.1.dev1}/tests/test_models/test_usages.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: fabricatio
|
3
|
-
Version: 0.2.1
|
3
|
+
Version: 0.2.1.dev1
|
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: code2prompt
|
15
14
|
Requires-Dist: gitpython>=3.1.44
|
16
15
|
Requires-Dist: litellm>=1.60.0
|
17
16
|
Requires-Dist: loguru>=0.7.3
|
@@ -32,7 +31,7 @@ License-File: LICENSE
|
|
32
31
|
Summary: A LLM multi-agent framework.
|
33
32
|
Keywords: ai,agents,multi-agent,llm,pyo3
|
34
33
|
Author-email: Whth <zettainspector@foxmail.com>
|
35
|
-
Requires-Python: >=3.12
|
34
|
+
Requires-Python: >=3.12, <3.13
|
36
35
|
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
37
36
|
Project-URL: Homepage, https://github.com/Whth/fabricatio
|
38
37
|
Project-URL: Repository, https://github.com/Whth/fabricatio
|
@@ -0,0 +1,23 @@
|
|
1
|
+
{
|
2
|
+
"2025-02-22": "fix: update .gitignore to ignore all files in extra/scripts directory",
|
3
|
+
"2025-02-20": "refactor(role): change toolboxes default to empty set for better initialization refactor(parser): improve error logging in text conversion process feat(curd): add dump_text function to write text to a file refactor(advanced): improve task logging format for better readability refactor(action): update WorkFlow class to allow action types in steps feat(models): enhance code drafting with data dependencies and debugging feat(config): add data module name to settings refactor(python): improve ToolExecutor and introduce data injection feat(decorators): add use_temp_module decorator refactor(task): change task goal to list of strings refactor(task_briefing): improve dependency and goal display format feat(template-download): add template copy functionality feat(usages): add apick method for asynchronous single choice selection with AI validation chore(build): update dependency installation to use PyPI index chore(version): bump version to 0.2.0-dev.20 fix(llm_usage): update output_key to be more descriptive build(deps): add asyncstdlib as a dependency feat(usages): enhance aquery method to support CustomStreamWrapper response type feat(debug): add log file rotation and retention configuration fix(fabricatio): add warning when task output key is missing in the context refactor(task): enhance task logging and status updates docs(README): add additional features and modules sections test(models): add comprehensive tests for LLMUsage and ToolBoxUsage test: improve test coverage and add new test cases feat(llm_usages): implement code and documentation writing using LLM refactor(examples): update propose.py to simplify _execute method fix(models): update dependency name extraction for paths feat(task): implement task briefing template and update dependencies template",
|
4
|
+
"2025-02-21": "feat: update version to 0.2.1-dev0 and adjust Python requirements in pyproject.toml; add upload step in Makefile fix: bump version to 0.2.1 in pyproject.toml feat(core): update logging and task handling Merge remote-tracking branch 'origin/master' docs: enhance README.md with detailed installation, usage instructions, and examples docs: enhance README.md with detailed installation, usage instructions, and examples fix(tests): update Task goal parameter to accept list format in test cases ci: update workflow files to correct job structure for OS matrix ci: restructure workflow file formats- Update build-package.yaml and tests.yaml workflow files - Adjust job structure for better readability and consistency - Reorder sections to match recommended GitHub Actions format Merge remote-tracking branch 'origin/master' feat(tests): enhance CI workflow to support multiple OS environments feat(tests): enhance CI workflow to support multiple OS environments refactor(template_download): streamline template directory path retrieval chore(version): update version to 0.2.0 in project files feat(actions): add WriteCode, DumpCode, and WriteDocumentation actions refactor(fabricatio): improve function execution and confirmation process chore(version): bump version to 0.2.0-dev.21 in project files refactor(fabricatio): enhance tool handling and logging refactor(actions): rename and repurpose Talk action to Examining fix(fs): fix typo in dump_text docstring and update fs toolbox refactor(fabricatio): enhance task briefing and choice making",
|
5
|
+
"2025-02-08": "refactor(hello_fabricatio): update task handling and imports feat(task): add delegate method to Task class feat(task): add task publishing mechanism- Implement a new `publish` method in the Task class - This method emits a pending label to the environment- Logging is added for better traceability feat(config): add pyproject_toml_table_header configuration feat(tool): enhance Tool and ToolBox classes",
|
6
|
+
"2025-02-09": "build: bump version to 0.1.1 docs(README): add usage instructions and configuration examples build(deps): add uv as a dependency docs(init): update library documentation and code structure build(dependencies): update project dependencies and linting rules refactor(fabricatio): improve type annotations and class documentation refactor(examples): improve structure and documentation of hello_fabricatio.py- Add docstrings to Action and main function - Include type annotations for better code clarity - Update class and function ci: update linting rules and remove unused imports ci: update branch name and add pull request trigger ci: remove ruff check and format steps refactor(fabricatio): organize imports and adjust code structure ci: replace pre-commit with ruff refactor(models): update Role class and improve type annotations test: remove unused event handler test- Remove the entire test_env_on_event function from test_core.py - This test was likely an old API test that is no longer relevant build(dev): add pytest-asyncio dependency test(models): add tests for tool and toolbox briefing style(models): add empty lines for better code separation feat(task): implement simple task creation and task toolbox feat(parser): add specific captures for JSON and Python code blocks refactor(fabricatio/models/generic.py): improve code structure and usability- Update class docstrings for better code organization and understanding - Refactor LLMUsage class to provide more user-friendly methods - Add asynchronous methods for invoking and asking LLM - Improve method documentation across all classes - Standardize argument descriptions and return types feat(parser): enhance Capture class to support code block extraction",
|
7
|
+
"2025-02-02": "feat(config): implement configuration management for Fabrik build(fabrik): add dependencies and configure package mirrors ci(fabrik): add GitHub Actions for build, release, and pre-commit feat(fabrik): initialize new Python project with basic structure",
|
8
|
+
"2025-02-03": "refactor(models): abstract Action and integrate WithBriefing refactor(fabricatio/models/generic.py): reorganize import statements for better readability refactor(models): update Tool class with ParamSpec and TypeVar refactor: remove unused Deposit model and TODO functionality feat(models): implement ToolBox and Tool classes feat(logger): add rich traceback support- Import rich traceback module for enhanced error handling - Install rich traceback to improve error message formatting build(deps): add rich as a dependency build(deps): remove rich and tiktoken dependencies feat(models): implement generic models and rename project refactor: rename package from fabrik to fabricatio feat(config): add debug configuration and implement logging docs: add MIT LICENSE file feat(config): enhance LLM configuration with new parameters",
|
9
|
+
"2025-02-04": "feat(models): enhance Action class and add LLM configuration methods build: update dependency litellm from 1.60.0 to 1.60.2- Update litellm package from version 1.60.0 to 1.60.2- Update corresponding URLs and hash values for the new version test(models): update test cases to include name parameters test: update config tests and remove logger tests build(dependencies): add development and CLI dependencies refactor(fabricatio): update imports and refactor message serialization test: add unit tests for fabricatio modules feat(__init__.py): update module exports and remove hello function feat(models): integrate LLMUsage with Action, Workflow, and Role style(fabricatio): apply formatting and import optimizations refactor(pyproject): update project classifiers and dependencies feat(core): implement Env class for event handling feat(models): implement Event class for event handling refactor(fabricatio): add model config for pydantic docstring usage build(dependencies): update email and add optional dependencies feat(core): implement event emitter and fs capabilities feat(models): implement WorkFlow and update Role",
|
10
|
+
"2025-02-05": "refactor(fabricatio/models/generic.py): make LLMUsage attributes optional and add fallback mechanism",
|
11
|
+
"2025-02-06": "refactor(fabricatio): implement Task model and update Action interface feat(parser): add Capture class for regex pattern matching build(deps): add regex and remove llm-ie dependencies test(core): add unit tests for Event class and Env's event handling methods- Add tests for Event class methods: clone, pop, concat, collapse, eq, push, clear - Add tests for Env class methods: on, once, emit, emit_async - Move Event import to Env test file for better organization refactor(models): add docstrings and improve method descriptions feat(core): implement task management and workflow execution refactor(fabricatio): update type annotation in LLMUsage.fallback_to feat(events): add hash and equality support for Event objects refactor(core): improve type annotations and code formatting feat(pyproject): add llm-ie dependency and configure ruff",
|
12
|
+
"2025-02-07": "feat(core): implement configurable EventEmitter options- Add new_listener_event and max_listeners options to PyMitterConfig- Initialize EventEmitter in Fabricatio class with configurable options ci: upload to PyPI when version changes refactor(logging): rename logging module to journal and update logging setup fix(models): remove unnecessary context call and update output key chore(examples): add logger output for task emission in hello_fabricatio.py refactor(fabricatio): implement async workflow and task handling feat(core): implement task output queue and improve action execution logging refactor(fabricatio): update default factory for WorkFlow._context feat(config): add PymitterConfig and update Event handling feat(models/role): add logging for workflow registration docs(parser): remove examples from Capture class documentation refactor(fabricatio): improve workflow handling and event management",
|
13
|
+
"2025-02-19": "build: update package version to 0.2.0-dev.19 refactor(models): update Action and WorkFlow classes feat(__init__.py): import and expose new toolboxes feat(fs): add confirmation prompt for potentially destructive file operations feat(fs): add safe_text_read function for error-free file reading refactor(examples): improve task example logging output feat(fabricatio): implement advanced template handling and prompt generation refactor(fabricatio): consolidate template rendering functions and improve data handling refactor(fabricatio): rewrite TemplateManager for efficiency and usability feat(fabricatio): add BLAKE3 hash function",
|
14
|
+
"2025-02-18": "refactor(models): replace template names with config variables refactor(fabricatio): enhance response validation with logging refactor(workflow): improve context initialization and adjust stop sign feat(task): enhance task movement and improve logging refactor(fabricatio/models/role.py): improve Role class structure and functionality feat(parser): improve code block capturing for Fabricatio refactor(fabricatio): update EventLike type alias refactor(models): add type hinting to `propose` method feat(toolboxes): add fs_toolbox to basic_toolboxes set build: update package version to 0.2.0-dev.18 feat(models): add tool usage code drafting functionality feat(models): implement task handling and tool usage drafting",
|
15
|
+
"2025-02-13": "feat: implement Python bindings for Rust code feat: add CLI tool to download and extract templates from GitHub build: switch to maturin and remove unused dependencies docs: add module docstrings to all source files",
|
16
|
+
"2025-02-12": "refactor(models): remove unused classes and update documentation build(fabricatio): update dependency and ignore lint warnings feat(template_download): add default output directory for templates build(deps): update fabricatio to latest version ci: add GitHub Actions workflow for tests refactor(fabricatio): improve template directory handling and configuration test: refactor test code and add new test cases feat(template): implement template manager and update related modules build: update package version to 0.2.0-dev.2- Increment package version from 0.2.0-dev.1 to0.2.0-dev.2 feat(template): add template download and extraction functionality refactor(fabricatio): reorganize modules and update task proposal mechanism- Move `ProposeTask` class from `generic.py` to `task.py` - Update `Role` class to use the new location of `ProposeTask` - Refactor `hello_fabricatio.py` example to use a more descriptive class name - Update `transmission.py` to remove unnecessary comments - Modify `__init__.py` files to include new imports and exclude unused ones - Update `config.py` to change template directory and add template suffix field ci: add template packaging and release upload feat: add built-in templates for various coding tasks perf(models): chain workflow setup methods- Combine fallback_to and inject_personality method calls for efficiency - Improve code readability by using method chaining feat(deps): add viztracer and update dependencies feat(core): implement propose task functionality and enhance workflows build: update package version to 0.2.0-dev.1- Increment package version from 0.2.0-dev.0 to0.2.0-dev.1 refactor(actions): rename SendTask to PublishTask and improve task transmission feat(models): enhance WorkFlow class with generic type and extra initialization context docs(README): add comprehensive documentation and examples build(deps): remove shutilwhich dependency build(deps): add shutilwhich dependency and update package sources build(deps): add questionary and update dependencies docs(simple_chat): add basic chatbot example feat(config): add Magika configuration and integrate with Code2Prompt build(deps): add magika to the list of dependencies feat(models): add `WithDependency` class for managing file dependencies feat(task): add move_to method and update dependencies feat(config): update log file path and template directory",
|
17
|
+
"2025-02-11": "feat(config): add code2prompt configuration and improve config file handling feat(parser): add generic code block capture refactor(events): introduce EventLike type for event instantiation and derivation feat(decorators): add depend_on_external_cmd decorator build(deps): add code2prompt and update dependencies refactor(fabricatio): enhance Event instantiation and equality comparison feat(task): add dependencies and namespace properties feat(events): add wildcard segment support- Implement push_wildcard method in Event class - Add wildcard segment to support more flexible event patterns refactor(task): enhance task publishing and delegation feat(task): implement task namespaces and simplify event handling feat(task): add file dependencies to tasks build: bump version to 0.1.3 docs(fabricatio/actions): add module docstring and update __init__.py feat(actions): implement SendTask action for task transmission feat(task): enhance Task class with event handling and improve documentation feat(events): enhance Event.concat to accept string input",
|
18
|
+
"2025-02-10": "build: bump version to 0.1.2 feat(role): implement task proposal with JSON validation feat(config): add additional stop sign for LLM model feat(parser): add regex flags to Pattern model test(test_parser): improve test_capture function build: update .gitignore to exclude virtual environment directories refactor(models): remove model_post_init and update aquery to use configs- Remove model_post_init method to simplify model initialization - Update aquery method to use configs for API key and endpoint - Improve code readability and reduce redundancy test(test_action): update task status assertion feat(config): update `stop_sign` to accept list of strings and set default value refactor(task): make Task a WithJsonExample and enhance its attributes feat(llm): enhance LLMUsage with validation and JSON example build(deps): add orjson and bump version",
|
19
|
+
"2025-02-17": "refactor(models): split kwargs types into separate module build(deps): update code2prompt to specific revision build: update package version to 0.2.0-dev.16 refactor(models): improve error handling and validation feat(toolbox): implement tool selection and gathering functionality refactor(models): consolidate LLM usage parameters and improve type safety refactor(llm): implement kwargs handling for LLM usage and add toolbox selection method refactor(fabricatio): add docstrings and improve error handling feat(toolbox): implement dynamic toolbox configuration and loading build: update package version to 0.2.0-dev.15 feat(models): add ToolExecutor class and enhance ToolBox docs(fs): add module docstrings for curd and readers test(models): update test cases and remove unused imports refactor(models): split models into separate modules build(deps): update fabricatio version feat(models): relocate and extend toolbox functionality refactor(decorators): improve error handling and user confirmation for external commands- Update depend_on_external_cmd decorator to handle optional install tips - Improve error message for missing binaries - Modify user confirmation prompt for better readability - Update logger messages with more detailed function signatures",
|
20
|
+
"2025-02-16": "feat(decorators): add confirm_to_execute decorator for function confirmation feat(config): add general configuration options- Introduce GeneralConfig class for global settings - Add workspace directory and file system operation confirmation options - Update Settings class to include general configuration feat(fs): add CRUD operations for file system feat(decorators): enhance depend_on_external_cmd decorator feat(template): add template suffix support and refactor template management build: update package version to 0.2.0-dev.14 feat(core): implement toolboxes and update related components build: update package version to 0.2.0-dev.13 feat(models): enhance `ajudge` function with conditional cases feat(llm): add judgment method and multi-choice support",
|
21
|
+
"2025-02-15": "chore: add project URLs and update arithmetic toolbox build: bump version to 0.2.0-dev.12- Update project version from 0.2.0-dev.11 to 0.2.0-dev.12 in pyproject.toml feat(models): implement multi-choice decision making and improve tool handling refactor(action): implement hold_to method and simplify fallback handling refactor(models): improve LLMUsage class and update imports feat(models): add ToolUsage class and enhance Tool class feat(toolbox): add arithmetic toolbox and refactor tool briefing build: bump version to 0.2.0-dev.11- Update project version from 0.2.0-dev.10 to 0.2.0-dev.11 in pyproject.toml refactor(fabricatio): remove unused imports and reorganize code refactor(fabricatio): implement template-based task proposal",
|
22
|
+
"2025-02-14": "build: bump version to 0.2.0-dev.10- Update project version from 0.2.0-dev.9 to0.2.0-dev.10 in pyproject.toml feat(template): implement template manager in Rust and update Python bindings refactor(fabricatio): remove TemplateManager implementation and update type stubs- Remove TemplateManager class implementation from templates refactor(python): improve Python bindings for TemplateManager feat(template): implement TemplateManager for Rust chore(template_download): remove compressed file after extraction feat(tools): update template downloader and add config directory support ci(build): update workflow and packaging scripts ci(build): update version and add Linux build ci: rearrange build steps for improved clarity build(fabricatio): update dependency installation and versioning chore(deps): add maturin-import-hook and update related files build: bump version to 0.2.0-dev.5 ci: update package publishing process build: bump version to 0.2.0-dev.4 build: update `bdist` target to use editable mode build: update Cargo projects and remove maturin installation step ci: set nightly as default rust version ci(build-package): rearrange rust nightly installation step build: update Cargo projects to Rust2024 edition build: downgrade Rust edition and update dev dependencies build(deps): remove unused dev dependencies build(ci): update workflow and add maturin installation ci(build-package): update Rust toolchain installation process ci(github-actions): add minimal nightly toolchain install step refactor(fabricatio): reorganize import statements for better readability build: bump version to 0.2.0-dev.3 build: implement Maturin-based build process for the project"
|
23
|
+
}
|
@@ -0,0 +1,96 @@
|
|
1
|
+
"""Example of using the library."""
|
2
|
+
|
3
|
+
import asyncio
|
4
|
+
from datetime import datetime
|
5
|
+
from typing import Optional, Set, Unpack
|
6
|
+
|
7
|
+
from fabricatio import Action, Event, Role, Task, WorkFlow, fs_toolbox, logger
|
8
|
+
from fabricatio.fs.readers import safe_json_read
|
9
|
+
from fabricatio.models.tool import ToolBox
|
10
|
+
from pydantic import Field
|
11
|
+
|
12
|
+
|
13
|
+
class WriteDiary(Action):
|
14
|
+
"""Write a diary according to the given commit messages in json format."""
|
15
|
+
|
16
|
+
name: str = "write diary"
|
17
|
+
description: str = "write a diary according to the given commit messages in json format"
|
18
|
+
output_key: str = "dump_text"
|
19
|
+
|
20
|
+
async def _execute(self, task_input: Task[str], **_) -> str:
|
21
|
+
task_input.goal.clear()
|
22
|
+
task_input.goal.extend(
|
23
|
+
[
|
24
|
+
"write a Internship Diary according to the given commit messages",
|
25
|
+
"the diary should include the main dev target of the day, and the exact content"
|
26
|
+
", and make a summary of the day, what have been learned, and what had felt",
|
27
|
+
"diary should be written in markdown format, and using Chinese to write",
|
28
|
+
"write dev target and exact content under the heading names `# 实习主要项目和内容`",
|
29
|
+
"write summary under the heading names `# 主要收获和总结`",
|
30
|
+
]
|
31
|
+
)
|
32
|
+
|
33
|
+
# 2025-02-22 format
|
34
|
+
json_data = task_input.pop_dependence(reader=safe_json_read)
|
35
|
+
seq = sorted(json_data.items(), key=lambda x: datetime.strptime(x[0], "%Y-%m-%d"))
|
36
|
+
|
37
|
+
res = await self.aask(
|
38
|
+
task_input.briefing,
|
39
|
+
system_message=[
|
40
|
+
f"{c}\nWrite a diary for the {d},according to the commits, 不要太流水账或者只是将commit翻译为中文,应该着重与高级的设计抉择和设计思考,保持日记整体200字左右。"
|
41
|
+
for d, c in seq
|
42
|
+
],
|
43
|
+
temperature=1.5,
|
44
|
+
top_p=1.0,
|
45
|
+
)
|
46
|
+
|
47
|
+
return "\n\n\n".join(res)
|
48
|
+
|
49
|
+
|
50
|
+
class DumpText(Action):
|
51
|
+
"""Dump the text to a file."""
|
52
|
+
|
53
|
+
name: str = "dump text"
|
54
|
+
description: str = "dump text to a file"
|
55
|
+
toolboxes: Set[ToolBox] = Field(default_factory=lambda: {fs_toolbox})
|
56
|
+
output_key: str = "task_output"
|
57
|
+
|
58
|
+
async def _execute(self, task_input: Task, dump_text: str, **_: Unpack) -> Optional[str]:
|
59
|
+
logger.debug(f"Dumping text: \n{dump_text}")
|
60
|
+
task_input.update_task(
|
61
|
+
["dump the text contained in `text_to_dump` to a file", "only return the path of the written file"]
|
62
|
+
)
|
63
|
+
|
64
|
+
path = await self.handle_fin_grind(
|
65
|
+
task_input,
|
66
|
+
{"text_to_dump": dump_text},
|
67
|
+
)
|
68
|
+
if path:
|
69
|
+
return path[0]
|
70
|
+
|
71
|
+
return None
|
72
|
+
|
73
|
+
|
74
|
+
async def main() -> None:
|
75
|
+
"""Main function."""
|
76
|
+
role = Role(
|
77
|
+
name="Coder",
|
78
|
+
description="A python coder who can ",
|
79
|
+
registry={
|
80
|
+
Event.instantiate_from("doc").push_wildcard().push("pending"): WorkFlow(
|
81
|
+
name="write documentation", steps=(WriteDiary, DumpText)
|
82
|
+
),
|
83
|
+
},
|
84
|
+
)
|
85
|
+
|
86
|
+
task = await role.propose(
|
87
|
+
"Write a diary according to the given commit messages in json format. and dump to `diary.md` at `output` dir,"
|
88
|
+
"In the json the key is the day in which the commit messages in value was committed,"
|
89
|
+
"you need to separately write diary for each day.",
|
90
|
+
)
|
91
|
+
task.override_dependencies("./commits.json")
|
92
|
+
await task.move_to("doc").delegate()
|
93
|
+
|
94
|
+
|
95
|
+
if __name__ == "__main__":
|
96
|
+
asyncio.run(main())
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[project]
|
2
2
|
name = "fabricatio"
|
3
|
-
version = "0.2.1"
|
3
|
+
version = "0.2.1-dev1"
|
4
4
|
description = "A LLM multi-agent framework."
|
5
5
|
readme = "README.md"
|
6
6
|
license = { file = "LICENSE" }
|
@@ -25,12 +25,11 @@ keywords = [
|
|
25
25
|
]
|
26
26
|
|
27
27
|
|
28
|
-
requires-python = ">=3.12"
|
28
|
+
requires-python = ">=3.12,<3.13"
|
29
29
|
dependencies = [
|
30
30
|
"appdirs>=1.4.4",
|
31
31
|
"asyncio>=3.4.3",
|
32
32
|
"asyncstdlib>=3.13.0",
|
33
|
-
"code2prompt",
|
34
33
|
"gitpython>=3.1.44",
|
35
34
|
"litellm>=1.60.0",
|
36
35
|
"loguru>=0.7.3",
|
@@ -141,9 +140,6 @@ testpaths = [
|
|
141
140
|
asyncio_mode = "auto"
|
142
141
|
asyncio_default_fixture_loop_scope = "function"
|
143
142
|
|
144
|
-
[tool.uv.sources]
|
145
|
-
code2prompt = { git = "https://github.com/mufeedvh/code2prompt", rev = "d157ee84827458bd6816142e213886487d28bd3d" }
|
146
|
-
|
147
143
|
[[tool.uv.index]]
|
148
144
|
url = "https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple"
|
149
145
|
|
@@ -0,0 +1,43 @@
|
|
1
|
+
"""Filesystem readers for Fabricatio."""
|
2
|
+
|
3
|
+
from pathlib import Path
|
4
|
+
from typing import Dict
|
5
|
+
|
6
|
+
from magika import Magika
|
7
|
+
from orjson import orjson
|
8
|
+
|
9
|
+
from fabricatio.config import configs
|
10
|
+
|
11
|
+
magika = Magika(model_dir=configs.magika.model_dir)
|
12
|
+
|
13
|
+
|
14
|
+
def safe_text_read(path: Path | str) -> str:
|
15
|
+
"""Safely read the text from a file.
|
16
|
+
|
17
|
+
Args:
|
18
|
+
path (Path|str): The path to the file.
|
19
|
+
|
20
|
+
Returns:
|
21
|
+
str: The text from the file.
|
22
|
+
"""
|
23
|
+
path = Path(path)
|
24
|
+
try:
|
25
|
+
return path.read_text(encoding="utf-8")
|
26
|
+
except (UnicodeDecodeError, IsADirectoryError, FileNotFoundError):
|
27
|
+
return ""
|
28
|
+
|
29
|
+
|
30
|
+
def safe_json_read(path: Path | str) -> Dict:
|
31
|
+
"""Safely read the JSON from a file.
|
32
|
+
|
33
|
+
Args:
|
34
|
+
path (Path|str): The path to the file.
|
35
|
+
|
36
|
+
Returns:
|
37
|
+
dict: The JSON from the file.
|
38
|
+
"""
|
39
|
+
path = Path(path)
|
40
|
+
try:
|
41
|
+
return orjson.loads(path.read_text(encoding="utf-8"))
|
42
|
+
except (orjson.JSONDecodeError, IsADirectoryError, FileNotFoundError):
|
43
|
+
return {}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
"""This module defines generic classes for models in the Fabricatio library."""
|
2
2
|
|
3
3
|
from pathlib import Path
|
4
|
-
from typing import List, Self
|
4
|
+
from typing import Callable, List, Self
|
5
5
|
|
6
6
|
import orjson
|
7
7
|
from fabricatio._rust import blake3_hash
|
@@ -108,17 +108,25 @@ class WithDependency(Base):
|
|
108
108
|
self.dependencies.clear()
|
109
109
|
return self
|
110
110
|
|
111
|
-
def override_dependencies[P: str | Path](self, dependencies: List[P]) -> Self:
|
111
|
+
def override_dependencies[P: str | Path](self, dependencies: List[P] | P) -> Self:
|
112
112
|
"""Override the file dependencies of the task.
|
113
113
|
|
114
114
|
Args:
|
115
|
-
dependencies (List[str | Path]): The file dependencies to override the task's dependencies.
|
115
|
+
dependencies (List[str | Path] | str | Path): The file dependencies to override the task's dependencies.
|
116
116
|
|
117
117
|
Returns:
|
118
118
|
Self: The current instance of the task.
|
119
119
|
"""
|
120
120
|
return self.clear_dependencies().add_dependency(dependencies)
|
121
121
|
|
122
|
+
def pop_dependence[T](self, idx: int = -1, reader: Callable[[str], T] = safe_text_read) -> T:
|
123
|
+
"""Pop the file dependencies from the task.
|
124
|
+
|
125
|
+
Returns:
|
126
|
+
str: The popped file dependency
|
127
|
+
"""
|
128
|
+
return reader(self.dependencies.pop(idx))
|
129
|
+
|
122
130
|
@property
|
123
131
|
def dependencies_prompt(self) -> str:
|
124
132
|
"""Generate a prompt for the task based on the file dependencies.
|
@@ -1,6 +1,7 @@
|
|
1
1
|
"""This module contains classes that manage the usage of language models and tools in tasks."""
|
2
2
|
|
3
|
-
from
|
3
|
+
from asyncio import gather
|
4
|
+
from typing import Callable, Dict, Iterable, List, Optional, Self, Set, Union, Unpack, overload
|
4
5
|
|
5
6
|
import asyncstdlib
|
6
7
|
import litellm
|
@@ -130,12 +131,42 @@ class LLMUsage(Base):
|
|
130
131
|
logger.critical(err := f"Unexpected response type: {type(resp)}")
|
131
132
|
raise ValueError(err)
|
132
133
|
|
134
|
+
@overload
|
135
|
+
async def aask(
|
136
|
+
self,
|
137
|
+
question: List[str],
|
138
|
+
system_message: Optional[List[str]] = None,
|
139
|
+
**kwargs: Unpack[LLMKwargs],
|
140
|
+
) -> List[str]: ...
|
141
|
+
@overload
|
133
142
|
async def aask(
|
134
143
|
self,
|
135
144
|
question: str,
|
136
|
-
system_message: str =
|
145
|
+
system_message: Optional[List[str]] = None,
|
146
|
+
**kwargs: Unpack[LLMKwargs],
|
147
|
+
) -> List[str]: ...
|
148
|
+
@overload
|
149
|
+
async def aask(
|
150
|
+
self,
|
151
|
+
question: List[str],
|
152
|
+
system_message: Optional[str] = None,
|
137
153
|
**kwargs: Unpack[LLMKwargs],
|
138
|
-
) -> str:
|
154
|
+
) -> List[str]: ...
|
155
|
+
|
156
|
+
@overload
|
157
|
+
async def aask(
|
158
|
+
self,
|
159
|
+
question: str,
|
160
|
+
system_message: Optional[str] = None,
|
161
|
+
**kwargs: Unpack[LLMKwargs],
|
162
|
+
) -> str: ...
|
163
|
+
|
164
|
+
async def aask(
|
165
|
+
self,
|
166
|
+
question: str | List[str],
|
167
|
+
system_message: Optional[str | List[str]] = None,
|
168
|
+
**kwargs: Unpack[LLMKwargs],
|
169
|
+
) -> str | List[str]:
|
139
170
|
"""Asynchronously asks the language model a question and returns the response content.
|
140
171
|
|
141
172
|
Args:
|
@@ -146,16 +177,39 @@ class LLMUsage(Base):
|
|
146
177
|
Returns:
|
147
178
|
str: The content of the model's response message.
|
148
179
|
"""
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
180
|
+
system_message = system_message or ""
|
181
|
+
match (isinstance(question, list), isinstance(system_message, list)):
|
182
|
+
case (True, True):
|
183
|
+
res = await gather(
|
184
|
+
*[
|
185
|
+
self.ainvoke(n=1, question=q, system_message=sm, **kwargs)
|
186
|
+
for q, sm in zip(question, system_message, strict=True)
|
187
|
+
]
|
188
|
+
)
|
189
|
+
return [r.pop().message.content for r in res]
|
190
|
+
case (True, False):
|
191
|
+
res = await gather(
|
192
|
+
*[self.ainvoke(n=1, question=q, system_message=system_message, **kwargs) for q in question]
|
156
193
|
)
|
157
|
-
|
158
|
-
|
194
|
+
return [r.pop().message.content for r in res]
|
195
|
+
case (False, True):
|
196
|
+
res = await gather(
|
197
|
+
*[self.ainvoke(n=1, question=question, system_message=sm, **kwargs) for sm in system_message]
|
198
|
+
)
|
199
|
+
return [r.pop().message.content for r in res]
|
200
|
+
case (False, False):
|
201
|
+
return (
|
202
|
+
(
|
203
|
+
await self.ainvoke(
|
204
|
+
n=1,
|
205
|
+
question=question,
|
206
|
+
system_message=system_message,
|
207
|
+
**kwargs,
|
208
|
+
)
|
209
|
+
).pop()
|
210
|
+
).message.content
|
211
|
+
case _:
|
212
|
+
raise RuntimeError("Should not reach here.")
|
159
213
|
|
160
214
|
async def aask_validate[T](
|
161
215
|
self,
|
@@ -278,13 +332,15 @@ class LLMUsage(Base):
|
|
278
332
|
Raises:
|
279
333
|
ValueError: If validation fails after maximum attempts or if no valid selection is made.
|
280
334
|
"""
|
281
|
-
return
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
335
|
+
return (
|
336
|
+
await self.achoose(
|
337
|
+
instruction=instruction,
|
338
|
+
choices=choices,
|
339
|
+
k=1,
|
340
|
+
max_validations=max_validations,
|
341
|
+
system_message=system_message,
|
342
|
+
**kwargs,
|
343
|
+
)
|
288
344
|
)[0]
|
289
345
|
|
290
346
|
async def ajudge(
|
Binary file
|