fabricatio-agent 0.1.1__cp313-cp313-manylinux_2_34_aarch64.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.
Potentially problematic release.
This version of fabricatio-agent might be problematic. Click here for more details.
- fabricatio_agent/__init__.py +1 -0
- fabricatio_agent/actions/__init__.py +1 -0
- fabricatio_agent/capabilities/__init__.py +1 -0
- fabricatio_agent/capabilities/agent.py +99 -0
- fabricatio_agent/config.py +24 -0
- fabricatio_agent/models/__init__.py +1 -0
- fabricatio_agent/models/agent.py +1 -0
- fabricatio_agent/py.typed +0 -0
- fabricatio_agent/rust.cpython-313-aarch64-linux-gnu.so +0 -0
- fabricatio_agent/rust.pyi +1 -0
- fabricatio_agent/workflows/__init__.py +1 -0
- fabricatio_agent-0.1.1.dist-info/METADATA +90 -0
- fabricatio_agent-0.1.1.dist-info/RECORD +14 -0
- fabricatio_agent-0.1.1.dist-info/WHEEL +4 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""An extension of fabricatio."""
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Actions defined in fabricatio-agent."""
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Capabilities defined in fabricatio-agent."""
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"""Agent capability implementation."""
|
|
2
|
+
|
|
3
|
+
from abc import ABC
|
|
4
|
+
from typing import Any, List, Optional, Unpack
|
|
5
|
+
|
|
6
|
+
from fabricatio_capabilities.capabilities.task import DispatchTask
|
|
7
|
+
from fabricatio_capable.capabilities.capable import Capable
|
|
8
|
+
from fabricatio_core.models.kwargs_types import GenerateKwargs
|
|
9
|
+
from fabricatio_core.rust import TEMPLATE_MANAGER
|
|
10
|
+
from fabricatio_core.utils import ok
|
|
11
|
+
from fabricatio_diff.capabilities.diff_edit import DiffEdit
|
|
12
|
+
from fabricatio_digest.capabilities.digest import Digest
|
|
13
|
+
from fabricatio_judge.capabilities.advanced_judge import EvidentlyJudge
|
|
14
|
+
from fabricatio_memory.capabilities.remember import Remember
|
|
15
|
+
from fabricatio_question.capabilities.questioning import Questioning
|
|
16
|
+
from fabricatio_rule.capabilities.censor import Censor
|
|
17
|
+
from fabricatio_team.capabilities.team import Cooperate
|
|
18
|
+
from fabricatio_thinking.capabilities.thinking import Thinking
|
|
19
|
+
from fabricatio_tool.capabilities.handle import Handle
|
|
20
|
+
|
|
21
|
+
from fabricatio_agent.config import agent_config
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class Agent(
|
|
25
|
+
Capable,
|
|
26
|
+
Digest,
|
|
27
|
+
Cooperate,
|
|
28
|
+
Remember,
|
|
29
|
+
Censor,
|
|
30
|
+
EvidentlyJudge,
|
|
31
|
+
DispatchTask,
|
|
32
|
+
DiffEdit,
|
|
33
|
+
Questioning,
|
|
34
|
+
Thinking,
|
|
35
|
+
Handle,
|
|
36
|
+
ABC,
|
|
37
|
+
):
|
|
38
|
+
"""Main agent class that integrates multiple capabilities to fulfill requests.
|
|
39
|
+
|
|
40
|
+
This class combines various capabilities like memory, thinking, task dispatching,
|
|
41
|
+
and team cooperation to process and fulfill user requests.
|
|
42
|
+
"""
|
|
43
|
+
|
|
44
|
+
async def fulfill(
|
|
45
|
+
self,
|
|
46
|
+
request: str,
|
|
47
|
+
sequential_thinking: Optional[bool] = None,
|
|
48
|
+
check_capable: bool = False,
|
|
49
|
+
memory: bool = False,
|
|
50
|
+
top_k: int = 100,
|
|
51
|
+
boost_recent: bool = True,
|
|
52
|
+
**kwargs: Unpack[GenerateKwargs],
|
|
53
|
+
) -> None | List[Any]:
|
|
54
|
+
"""Process and fulfill a request using various agent capabilities.
|
|
55
|
+
|
|
56
|
+
Args:
|
|
57
|
+
request (str): The request to be fulfilled.
|
|
58
|
+
sequential_thinking (Optional[bool], optional): Whether to use sequential thinking.
|
|
59
|
+
Defaults to None.
|
|
60
|
+
check_capable (bool, optional): Whether to check agent capabilities before processing.
|
|
61
|
+
Defaults to False.
|
|
62
|
+
memory (bool, optional): Whether to use memory in processing. Defaults to False.
|
|
63
|
+
top_k (int, optional): Number of top memories to recall. Defaults to 100.
|
|
64
|
+
boost_recent (bool, optional): Whether to boost recent memories. Defaults to True.
|
|
65
|
+
**kwargs (Unpack[GenerateKwargs]): Additional keyword arguments for generation.
|
|
66
|
+
|
|
67
|
+
Returns:
|
|
68
|
+
None | List[Any]: None if not capable, otherwise a list of execution results.
|
|
69
|
+
|
|
70
|
+
Note:
|
|
71
|
+
The method integrates multiple capabilities:
|
|
72
|
+
|
|
73
|
+
- Checks capabilities if required
|
|
74
|
+
- Recalls memories if enabled
|
|
75
|
+
- Performs sequential thinking if enabled
|
|
76
|
+
- Digests the request into tasks
|
|
77
|
+
- Executes the generated task list
|
|
78
|
+
"""
|
|
79
|
+
if (check_capable or agent_config.check_capable) and not await self.capable(request, **kwargs): # pyright: ignore [reportCallIssue]
|
|
80
|
+
return None
|
|
81
|
+
mem = ""
|
|
82
|
+
thought = ""
|
|
83
|
+
if memory or agent_config.memory:
|
|
84
|
+
mem = await self.recall(request, top_k, boost_recent, **kwargs)
|
|
85
|
+
|
|
86
|
+
if sequential_thinking or agent_config.sequential_thinking:
|
|
87
|
+
thought = (await self.thinking(request, **kwargs)).export_branch_string()
|
|
88
|
+
|
|
89
|
+
task_list = ok(
|
|
90
|
+
await self.digest(
|
|
91
|
+
TEMPLATE_MANAGER.render_template(
|
|
92
|
+
agent_config.fulfill_prompt_template, {"request": request, "mem": mem, "thoughts": thought}
|
|
93
|
+
),
|
|
94
|
+
self.team_members,
|
|
95
|
+
**kwargs,
|
|
96
|
+
)
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
return await task_list.execute()
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"""Module containing configuration classes for fabricatio-agent."""
|
|
2
|
+
|
|
3
|
+
from dataclasses import dataclass
|
|
4
|
+
|
|
5
|
+
from fabricatio_core import CONFIG
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@dataclass(frozen=True)
|
|
9
|
+
class AgentConfig:
|
|
10
|
+
"""Configuration for fabricatio-agent."""
|
|
11
|
+
|
|
12
|
+
memory: bool = False
|
|
13
|
+
"""Whether to use memory."""
|
|
14
|
+
sequential_thinking: bool = False
|
|
15
|
+
"""Whether to think sequentially."""
|
|
16
|
+
check_capable: bool = False
|
|
17
|
+
"""Whether to check if the agent is capable of performing the task."""
|
|
18
|
+
fulfill_prompt_template: str = "fulfill_prompt"
|
|
19
|
+
"""The prompt template to use for fulfill."""
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
agent_config = CONFIG.load("agent", AgentConfig)
|
|
23
|
+
|
|
24
|
+
__all__ = ["agent_config"]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Models defined in fabricatio-agent."""
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""This module contains the models for the agent."""
|
|
File without changes
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Rust bindings for the Rust API of fabricatio-agent."""
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Workflows defined in fabricatio-agent."""
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: fabricatio-agent
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
5
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
6
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
7
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
8
|
+
Classifier: Typing :: Typed
|
|
9
|
+
Requires-Dist: fabricatio-core
|
|
10
|
+
Requires-Dist: fabricatio-digest
|
|
11
|
+
Requires-Dist: fabricatio-memory
|
|
12
|
+
Requires-Dist: fabricatio-improve
|
|
13
|
+
Requires-Dist: fabricatio-rule
|
|
14
|
+
Requires-Dist: fabricatio-judge
|
|
15
|
+
Requires-Dist: fabricatio-capabilities
|
|
16
|
+
Requires-Dist: fabricatio-diff
|
|
17
|
+
Requires-Dist: fabricatio-thinking
|
|
18
|
+
Requires-Dist: fabricatio-question
|
|
19
|
+
Requires-Dist: fabricatio-tool
|
|
20
|
+
Requires-Dist: fabricatio-team
|
|
21
|
+
Requires-Dist: fabricatio-capable
|
|
22
|
+
Summary: An extension of fabricatio
|
|
23
|
+
Author-email: Whth <zettainspector@foxmail.com>
|
|
24
|
+
License: MIT
|
|
25
|
+
Requires-Python: >=3.12, <3.14
|
|
26
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
27
|
+
Project-URL: Homepage, https://github.com/Whth/fabricatio
|
|
28
|
+
Project-URL: Repository, https://github.com/Whth/fabricatio
|
|
29
|
+
Project-URL: Issues, https://github.com/Whth/fabricatio/issues
|
|
30
|
+
|
|
31
|
+
# `fabricatio-agent`
|
|
32
|
+
|
|
33
|
+
[MIT](https://img.shields.io/badge/license-MIT-blue.svg)
|
|
34
|
+

|
|
35
|
+
[](https://pypi.org/project/fabricatio-agent/)
|
|
36
|
+
[](https://pepy.tech/projects/fabricatio-agent)
|
|
37
|
+
[](https://pepy.tech/projects/fabricatio-agent)
|
|
38
|
+
[](https://github.com/PyO3/pyo3)
|
|
39
|
+
[](https://github.com/astral-sh/uv)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
An extension of fabricatio.
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## 📦 Installation
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
This package is part of the `fabricatio` monorepo and can be installed as an optional dependency:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
pip install fabricatio[agent]
|
|
54
|
+
|
|
55
|
+
# or with uv
|
|
56
|
+
# uv pip install fabricatio[agent]
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Or install `fabricatio-diff` along with all other components of `fabricatio`:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
pip install fabricatio[full]
|
|
63
|
+
|
|
64
|
+
# or with uv
|
|
65
|
+
# uv pip install fabricatio[full]
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## 🔍 Overview
|
|
69
|
+
|
|
70
|
+
Provides essential tools for:
|
|
71
|
+
|
|
72
|
+
...
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
## 🧩 Key Features
|
|
77
|
+
|
|
78
|
+
...
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
## 🔗 Dependencies
|
|
82
|
+
|
|
83
|
+
Core dependencies:
|
|
84
|
+
|
|
85
|
+
- `fabricatio-core` - Core interfaces and utilities
|
|
86
|
+
...
|
|
87
|
+
|
|
88
|
+
## 📄 License
|
|
89
|
+
|
|
90
|
+
This project is licensed under the MIT License.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
fabricatio_agent-0.1.1.dist-info/METADATA,sha256=bPr3RoB9FuQNlQiB0XXWH-dZBua40SO2mOUYqLiGMnw,2519
|
|
2
|
+
fabricatio_agent-0.1.1.dist-info/WHEEL,sha256=rYyIuLSSoeJWlT33OGt5AoFZdhWTT8H11Tddy2T0uFM,109
|
|
3
|
+
fabricatio_agent/__init__.py,sha256=2gnAk79LxfdFJxrioPkl-DyZJ4mm9CnYVZNz7o7iz4g,34
|
|
4
|
+
fabricatio_agent/actions/__init__.py,sha256=X60IRbz-BxjTXzZBUszNryxc8ZoK0PyVV0FumqrvsMU,43
|
|
5
|
+
fabricatio_agent/capabilities/__init__.py,sha256=yBGbqRldlCA-P7uvltc2OuVClW82WsSK8QvV3hTDWUw,48
|
|
6
|
+
fabricatio_agent/capabilities/agent.py,sha256=-2Oxk_XYfehGfsBKzWKJoWyFy_rCN9MOL3ibB9zsMCY,3764
|
|
7
|
+
fabricatio_agent/config.py,sha256=8VZF8u37H2qZOSeyxIofSb8ArOLcsZCjl_3xHVp-abo,656
|
|
8
|
+
fabricatio_agent/models/__init__.py,sha256=xZDYfjYSlYrZ9lvZp4-szNYJUro1POLWvC9WvX7kljs,42
|
|
9
|
+
fabricatio_agent/models/agent.py,sha256=MRI_iVNvhcEVNRJhK_e1-Mefps3vnYebnToOwI6468A,53
|
|
10
|
+
fabricatio_agent/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
11
|
+
fabricatio_agent/rust.cpython-313-aarch64-linux-gnu.so,sha256=Cojw1pWGu93Qeviqj7xNZ-Uo0nfrPy3vzuZdMPEBhgk,463656
|
|
12
|
+
fabricatio_agent/rust.pyi,sha256=eSP7u2nAHWFh9ylvqKKssypg2H0AewjjVBHAN9XGw-4,58
|
|
13
|
+
fabricatio_agent/workflows/__init__.py,sha256=UlBRP-wQsQ_z4yvKiGL5YkijHM-y09521tm9dDgRwG8,45
|
|
14
|
+
fabricatio_agent-0.1.1.dist-info/RECORD,,
|