fabricatio 0.2.0.dev15__tar.gz → 0.2.0.dev17__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.0.dev15 → fabricatio-0.2.0.dev17}/PKG-INFO +6 -1
- {fabricatio-0.2.0.dev15 → fabricatio-0.2.0.dev17}/examples/llm_usages/llm_usage.py +2 -0
- {fabricatio-0.2.0.dev15 → fabricatio-0.2.0.dev17}/examples/minor/hello_fabricatio.py +2 -0
- {fabricatio-0.2.0.dev15 → fabricatio-0.2.0.dev17}/examples/propose_task/propose.py +2 -0
- {fabricatio-0.2.0.dev15 → fabricatio-0.2.0.dev17}/examples/simple_chat/chat.py +2 -0
- {fabricatio-0.2.0.dev15 → fabricatio-0.2.0.dev17}/pyproject.toml +9 -8
- {fabricatio-0.2.0.dev15 → fabricatio-0.2.0.dev17}/python/fabricatio/actions/communication.py +2 -0
- {fabricatio-0.2.0.dev15 → fabricatio-0.2.0.dev17}/python/fabricatio/actions/transmission.py +2 -0
- {fabricatio-0.2.0.dev15 → fabricatio-0.2.0.dev17}/python/fabricatio/config.py +13 -0
- {fabricatio-0.2.0.dev15 → fabricatio-0.2.0.dev17}/python/fabricatio/decorators.py +2 -0
- {fabricatio-0.2.0.dev15 → fabricatio-0.2.0.dev17}/python/fabricatio/models/advanced.py +4 -1
- {fabricatio-0.2.0.dev15 → fabricatio-0.2.0.dev17}/python/fabricatio/models/events.py +4 -2
- {fabricatio-0.2.0.dev15 → fabricatio-0.2.0.dev17}/python/fabricatio/models/tool.py +19 -9
- {fabricatio-0.2.0.dev15 → fabricatio-0.2.0.dev17}/python/fabricatio/models/usages.py +162 -174
- {fabricatio-0.2.0.dev15 → fabricatio-0.2.0.dev17}/python/fabricatio/toolboxes/fs.py +2 -0
- {fabricatio-0.2.0.dev15 → fabricatio-0.2.0.dev17}/python/fabricatio/toolboxes/task.py +2 -0
- fabricatio-0.2.0.dev17/templates.tar.gz +0 -0
- {fabricatio-0.2.0.dev15 → fabricatio-0.2.0.dev17}/uv.lock +17 -15
- fabricatio-0.2.0.dev15/templates.tar.gz +0 -0
- {fabricatio-0.2.0.dev15 → fabricatio-0.2.0.dev17}/.github/workflows/build-package.yaml +0 -0
- {fabricatio-0.2.0.dev15 → fabricatio-0.2.0.dev17}/.github/workflows/ruff.yaml +0 -0
- {fabricatio-0.2.0.dev15 → fabricatio-0.2.0.dev17}/.github/workflows/tests.yaml +0 -0
- {fabricatio-0.2.0.dev15 → fabricatio-0.2.0.dev17}/.gitignore +0 -0
- {fabricatio-0.2.0.dev15 → fabricatio-0.2.0.dev17}/.python-version +0 -0
- {fabricatio-0.2.0.dev15 → fabricatio-0.2.0.dev17}/Cargo.lock +0 -0
- {fabricatio-0.2.0.dev15 → fabricatio-0.2.0.dev17}/Cargo.toml +0 -0
- {fabricatio-0.2.0.dev15 → fabricatio-0.2.0.dev17}/LICENSE +0 -0
- {fabricatio-0.2.0.dev15 → fabricatio-0.2.0.dev17}/Makefile +0 -0
- {fabricatio-0.2.0.dev15 → fabricatio-0.2.0.dev17}/README.md +0 -0
- {fabricatio-0.2.0.dev15 → fabricatio-0.2.0.dev17}/python/fabricatio/__init__.py +0 -0
- {fabricatio-0.2.0.dev15 → fabricatio-0.2.0.dev17}/python/fabricatio/_rust.pyi +0 -0
- {fabricatio-0.2.0.dev15 → fabricatio-0.2.0.dev17}/python/fabricatio/_rust_instances.py +0 -0
- {fabricatio-0.2.0.dev15 → fabricatio-0.2.0.dev17}/python/fabricatio/actions/__init__.py +0 -0
- {fabricatio-0.2.0.dev15 → fabricatio-0.2.0.dev17}/python/fabricatio/core.py +0 -0
- {fabricatio-0.2.0.dev15 → fabricatio-0.2.0.dev17}/python/fabricatio/fs/__init__.py +0 -0
- {fabricatio-0.2.0.dev15 → fabricatio-0.2.0.dev17}/python/fabricatio/fs/curd.py +0 -0
- {fabricatio-0.2.0.dev15 → fabricatio-0.2.0.dev17}/python/fabricatio/fs/readers.py +0 -0
- {fabricatio-0.2.0.dev15 → fabricatio-0.2.0.dev17}/python/fabricatio/journal.py +0 -0
- {fabricatio-0.2.0.dev15 → fabricatio-0.2.0.dev17}/python/fabricatio/models/action.py +0 -0
- {fabricatio-0.2.0.dev15 → fabricatio-0.2.0.dev17}/python/fabricatio/models/generic.py +0 -0
- {fabricatio-0.2.0.dev15 → fabricatio-0.2.0.dev17}/python/fabricatio/models/role.py +0 -0
- {fabricatio-0.2.0.dev15 → fabricatio-0.2.0.dev17}/python/fabricatio/models/task.py +0 -0
- {fabricatio-0.2.0.dev15 → fabricatio-0.2.0.dev17}/python/fabricatio/models/utils.py +0 -0
- {fabricatio-0.2.0.dev15 → fabricatio-0.2.0.dev17}/python/fabricatio/parser.py +0 -0
- {fabricatio-0.2.0.dev15 → fabricatio-0.2.0.dev17}/python/fabricatio/py.typed +0 -0
- {fabricatio-0.2.0.dev15 → fabricatio-0.2.0.dev17}/python/fabricatio/toolboxes/__init__.py +0 -0
- {fabricatio-0.2.0.dev15 → fabricatio-0.2.0.dev17}/python/fabricatio/toolboxes/arithmetic.py +0 -0
- {fabricatio-0.2.0.dev15 → fabricatio-0.2.0.dev17}/src/lib.rs +0 -0
- {fabricatio-0.2.0.dev15 → fabricatio-0.2.0.dev17}/src/templates.rs +0 -0
- {fabricatio-0.2.0.dev15 → fabricatio-0.2.0.dev17}/templates/built-in/binary-exploitation-ctf-solver.hbs +0 -0
- {fabricatio-0.2.0.dev15 → fabricatio-0.2.0.dev17}/templates/built-in/claude-xml.hbs +0 -0
- {fabricatio-0.2.0.dev15 → fabricatio-0.2.0.dev17}/templates/built-in/clean-up-code.hbs +0 -0
- {fabricatio-0.2.0.dev15 → fabricatio-0.2.0.dev17}/templates/built-in/cryptography-ctf-solver.hbs +0 -0
- {fabricatio-0.2.0.dev15 → fabricatio-0.2.0.dev17}/templates/built-in/document-the-code.hbs +0 -0
- {fabricatio-0.2.0.dev15 → fabricatio-0.2.0.dev17}/templates/built-in/find-security-vulnerabilities.hbs +0 -0
- {fabricatio-0.2.0.dev15 → fabricatio-0.2.0.dev17}/templates/built-in/fix-bugs.hbs +0 -0
- {fabricatio-0.2.0.dev15 → fabricatio-0.2.0.dev17}/templates/built-in/improve-performance.hbs +0 -0
- {fabricatio-0.2.0.dev15 → fabricatio-0.2.0.dev17}/templates/built-in/make_choice.hbs +0 -0
- {fabricatio-0.2.0.dev15 → fabricatio-0.2.0.dev17}/templates/built-in/make_judgment.hbs +0 -0
- {fabricatio-0.2.0.dev15 → fabricatio-0.2.0.dev17}/templates/built-in/propose_task.hbs +0 -0
- {fabricatio-0.2.0.dev15 → fabricatio-0.2.0.dev17}/templates/built-in/refactor.hbs +0 -0
- {fabricatio-0.2.0.dev15 → fabricatio-0.2.0.dev17}/templates/built-in/reverse-engineering-ctf-solver.hbs +0 -0
- {fabricatio-0.2.0.dev15 → fabricatio-0.2.0.dev17}/templates/built-in/web-ctf-solver.hbs +0 -0
- {fabricatio-0.2.0.dev15 → fabricatio-0.2.0.dev17}/templates/built-in/write-git-commit.hbs +0 -0
- {fabricatio-0.2.0.dev15 → fabricatio-0.2.0.dev17}/templates/built-in/write-github-pull-request.hbs +0 -0
- {fabricatio-0.2.0.dev15 → fabricatio-0.2.0.dev17}/templates/built-in/write-github-readme.hbs +0 -0
- {fabricatio-0.2.0.dev15 → fabricatio-0.2.0.dev17}/tests/test_config.py +0 -0
- {fabricatio-0.2.0.dev15 → fabricatio-0.2.0.dev17}/tests/test_models/test_action.py +0 -0
- {fabricatio-0.2.0.dev15 → fabricatio-0.2.0.dev17}/tests/test_models/test_advanced.py +0 -0
- {fabricatio-0.2.0.dev15 → fabricatio-0.2.0.dev17}/tests/test_models/test_generic.py +0 -0
- {fabricatio-0.2.0.dev15 → fabricatio-0.2.0.dev17}/tests/test_models/test_role.py +0 -0
- {fabricatio-0.2.0.dev15 → fabricatio-0.2.0.dev17}/tests/test_models/test_task.py +0 -0
- {fabricatio-0.2.0.dev15 → fabricatio-0.2.0.dev17}/tests/test_models/test_tool.py +0 -0
- {fabricatio-0.2.0.dev15 → fabricatio-0.2.0.dev17}/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.0.
|
3
|
+
Version: 0.2.0.dev17
|
4
4
|
Classifier: License :: OSI Approved :: MIT License
|
5
5
|
Classifier: Programming Language :: Rust
|
6
6
|
Classifier: Programming Language :: Python :: 3.12
|
@@ -22,6 +22,11 @@ Requires-Dist: pymitter>=1.0.0
|
|
22
22
|
Requires-Dist: questionary>=2.1.0
|
23
23
|
Requires-Dist: regex>=2024.11.6
|
24
24
|
Requires-Dist: rich>=13.9.4
|
25
|
+
Requires-Dist: faiss-cpu>=1.10.0 ; extra == 'rag'
|
26
|
+
Requires-Dist: pymilvus>=2.5.4 ; extra == 'rag'
|
27
|
+
Requires-Dist: fabricatio[rag] ; extra == 'full'
|
28
|
+
Provides-Extra: rag
|
29
|
+
Provides-Extra: full
|
25
30
|
License-File: LICENSE
|
26
31
|
Summary: A LLM multi-agent framework.
|
27
32
|
Keywords: ai,agents,multi-agent,llm,pyo3
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[project]
|
2
2
|
name = "fabricatio"
|
3
|
-
version = "0.2.0-dev.
|
3
|
+
version = "0.2.0-dev.17"
|
4
4
|
description = "A LLM multi-agent framework."
|
5
5
|
readme = "README.md"
|
6
6
|
license = { file = "LICENSE" }
|
@@ -47,6 +47,8 @@ dependencies = [
|
|
47
47
|
Homepage = "https://github.com/Whth/fabricatio"
|
48
48
|
Repository = "https://github.com/Whth/fabricatio"
|
49
49
|
Issues = "https://github.com/Whth/fabricatio/issues"
|
50
|
+
|
51
|
+
|
50
52
|
[build-system]
|
51
53
|
requires = ["maturin>=1.0,<2.0"]
|
52
54
|
build-backend = "maturin"
|
@@ -59,6 +61,9 @@ data = "extra"
|
|
59
61
|
dev = [
|
60
62
|
"maturin>=1.8.2",
|
61
63
|
"maturin-import-hook>=0.2.0",
|
64
|
+
"ruff>=0.9.4",
|
65
|
+
"uv>=0.5.29",
|
66
|
+
"viztracer>=1.0.2",
|
62
67
|
"pytest>=8.3.4",
|
63
68
|
"pytest-asyncio>=0.25.3",
|
64
69
|
"pytest-cov>=6.0.0",
|
@@ -67,10 +72,9 @@ dev = [
|
|
67
72
|
"pytest-mock>=3.14.0",
|
68
73
|
"pytest-rerunfailures>=15.0",
|
69
74
|
"pytest-xdist>=3.6.1",
|
70
|
-
"ruff>=0.9.4",
|
71
|
-
"uv>=0.5.29",
|
72
|
-
"viztracer>=1.0.2",
|
73
75
|
]
|
76
|
+
|
77
|
+
[project.optional-dependencies]
|
74
78
|
rag = [
|
75
79
|
"faiss-cpu>=1.10.0",
|
76
80
|
"pymilvus>=2.5.4",
|
@@ -80,7 +84,6 @@ full = [
|
|
80
84
|
"fabricatio[rag]",
|
81
85
|
]
|
82
86
|
|
83
|
-
|
84
87
|
[tool.ruff]
|
85
88
|
include = ["pyproject.toml", "python/fabricatio/*.py","python/fabricatio/*.pyi", "examples/*.py"]
|
86
89
|
line-length = 120
|
@@ -117,10 +120,8 @@ select = [
|
|
117
120
|
"RUF", # Ruff-specific rules
|
118
121
|
]
|
119
122
|
ignore = [
|
120
|
-
"S101",
|
121
123
|
"ANN401",
|
122
124
|
"ANN003",
|
123
|
-
"D100",
|
124
125
|
"PYI063",
|
125
126
|
"PYI021",
|
126
127
|
"ASYNC109"
|
@@ -138,7 +139,7 @@ testpaths = [
|
|
138
139
|
]
|
139
140
|
|
140
141
|
[tool.uv.sources]
|
141
|
-
code2prompt = { git = "https://github.com/mufeedvh/code2prompt" }
|
142
|
+
code2prompt = { git = "https://github.com/mufeedvh/code2prompt", rev = "d157ee84827458bd6816142e213886487d28bd3d" }
|
142
143
|
|
143
144
|
[[tool.uv.index]]
|
144
145
|
url = "https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple"
|
@@ -148,6 +148,15 @@ class GeneralConfig(BaseModel):
|
|
148
148
|
"""Whether to confirm on file system operations."""
|
149
149
|
|
150
150
|
|
151
|
+
class ToolBoxConfig(BaseModel):
|
152
|
+
"""Toolbox configuration class."""
|
153
|
+
|
154
|
+
model_config = ConfigDict(use_attribute_docstrings=True)
|
155
|
+
|
156
|
+
tool_module_name: str = Field(default="Toolbox")
|
157
|
+
"""The name of the module containing the toolbox."""
|
158
|
+
|
159
|
+
|
151
160
|
class Settings(BaseSettings):
|
152
161
|
"""Application settings class.
|
153
162
|
|
@@ -185,6 +194,10 @@ class Settings(BaseSettings):
|
|
185
194
|
"""Magika Configuration"""
|
186
195
|
|
187
196
|
general: GeneralConfig = Field(default_factory=GeneralConfig)
|
197
|
+
"""General Configuration"""
|
198
|
+
|
199
|
+
toolbox: ToolBoxConfig = Field(default_factory=ToolBoxConfig)
|
200
|
+
"""Toolbox Configuration"""
|
188
201
|
|
189
202
|
@classmethod
|
190
203
|
def settings_customise_sources(
|
@@ -44,7 +44,10 @@ class ProposeTask(LLMUsage, WithBriefing):
|
|
44
44
|
Returns:
|
45
45
|
A Task object based on the proposal result.
|
46
46
|
"""
|
47
|
-
|
47
|
+
if not prompt:
|
48
|
+
err = f"{self.name}: Prompt must be provided."
|
49
|
+
logger.error(err)
|
50
|
+
raise ValueError(err)
|
48
51
|
|
49
52
|
def _validate_json(response: str) -> None | Task:
|
50
53
|
try:
|
@@ -47,8 +47,10 @@ class Event(BaseModel):
|
|
47
47
|
|
48
48
|
def push(self, segment: str) -> Self:
|
49
49
|
"""Push a segment to the event."""
|
50
|
-
|
51
|
-
|
50
|
+
if not segment:
|
51
|
+
raise ValueError("The segment must not be empty.")
|
52
|
+
if configs.pymitter.delimiter in segment:
|
53
|
+
raise ValueError("The segment must not contain the delimiter.")
|
52
54
|
|
53
55
|
self.segments.append(segment)
|
54
56
|
return self
|
@@ -1,9 +1,13 @@
|
|
1
1
|
"""A module for defining tools and toolboxes."""
|
2
2
|
|
3
|
+
from importlib.machinery import ModuleSpec
|
4
|
+
from importlib.util import module_from_spec
|
3
5
|
from inspect import iscoroutinefunction, signature
|
4
|
-
from
|
6
|
+
from sys import modules
|
7
|
+
from types import CodeType, ModuleType
|
5
8
|
from typing import Any, Callable, Dict, List, Optional, Self, overload
|
6
9
|
|
10
|
+
from fabricatio.config import configs
|
7
11
|
from fabricatio.journal import logger
|
8
12
|
from fabricatio.models.generic import WithBriefing
|
9
13
|
from pydantic import BaseModel, ConfigDict, Field
|
@@ -24,7 +28,9 @@ class Tool[**P, R](WithBriefing):
|
|
24
28
|
def model_post_init(self, __context: Any) -> None:
|
25
29
|
"""Initialize the tool with a name and a source function."""
|
26
30
|
self.name = self.name or self.source.__name__
|
27
|
-
|
31
|
+
|
32
|
+
if not self.name:
|
33
|
+
raise RuntimeError("The tool must have a source function.")
|
28
34
|
self.description = self.description or self.source.__doc__ or ""
|
29
35
|
self.description = self.description.strip()
|
30
36
|
|
@@ -102,13 +108,13 @@ class ToolBox(WithBriefing):
|
|
102
108
|
Tool: The tool instance with the specified name.
|
103
109
|
|
104
110
|
Raises:
|
105
|
-
|
111
|
+
ValueError: If no tool with the specified name is found.
|
106
112
|
"""
|
107
113
|
tool = next((tool for tool in self.tools if tool.name == name), None)
|
108
114
|
if tool is None:
|
109
115
|
err = f"No tool with the name {name} found in the toolbox."
|
110
116
|
logger.error(err)
|
111
|
-
raise
|
117
|
+
raise ValueError(err)
|
112
118
|
|
113
119
|
return tool
|
114
120
|
|
@@ -124,14 +130,18 @@ class ToolExecutor(BaseModel):
|
|
124
130
|
execute_sequence: List[Tool] = Field(default_factory=list, frozen=True)
|
125
131
|
"""The sequence of tools to execute."""
|
126
132
|
|
127
|
-
def inject_tools[
|
128
|
-
"""Inject the tools into the
|
129
|
-
|
130
|
-
|
133
|
+
def inject_tools[M: ModuleType](self, module: Optional[M] = None) -> M:
|
134
|
+
"""Inject the tools into the provided module."""
|
135
|
+
module = module or module_from_spec(spec=ModuleSpec(name=configs.toolbox.tool_module_name, loader=None))
|
136
|
+
for tool in self.execute_sequence:
|
137
|
+
setattr(module, tool.name, tool.invoke)
|
138
|
+
return module
|
131
139
|
|
132
140
|
def execute[C: Dict[str, Any]](self, source: CodeType, cxt: Optional[C] = None) -> C:
|
133
141
|
"""Execute the sequence of tools with the provided context."""
|
134
|
-
|
142
|
+
modules[configs.toolbox.tool_module_name] = self.inject_tools()
|
143
|
+
exec(source, cxt) # noqa: S102
|
144
|
+
modules.pop(configs.toolbox.tool_module_name)
|
135
145
|
return cxt
|
136
146
|
|
137
147
|
@overload
|
@@ -1,20 +1,34 @@
|
|
1
1
|
"""This module contains classes that manage the usage of language models and tools in tasks."""
|
2
2
|
|
3
|
-
from typing import Callable, Dict, Iterable, List, Optional, Self, Set, Union
|
3
|
+
from typing import Callable, Dict, Iterable, List, NotRequired, Optional, Self, Set, TypedDict, Union, Unpack
|
4
4
|
|
5
5
|
import litellm
|
6
6
|
import orjson
|
7
7
|
from fabricatio._rust_instances import template_manager
|
8
8
|
from fabricatio.config import configs
|
9
|
+
from fabricatio.journal import logger
|
9
10
|
from fabricatio.models.generic import Base, WithBriefing
|
10
11
|
from fabricatio.models.task import Task
|
11
|
-
from fabricatio.models.tool import ToolBox
|
12
|
+
from fabricatio.models.tool import Tool, ToolBox
|
12
13
|
from fabricatio.models.utils import Messages
|
13
14
|
from fabricatio.parser import JsonCapture
|
14
15
|
from litellm.types.utils import Choices, ModelResponse, StreamingChoices
|
15
16
|
from pydantic import Field, HttpUrl, NonNegativeFloat, NonNegativeInt, PositiveInt, SecretStr
|
16
17
|
|
17
18
|
|
19
|
+
class LLMKwargs(TypedDict):
|
20
|
+
"""A type representing the keyword arguments for the LLM (Large Language Model) usage."""
|
21
|
+
|
22
|
+
model: NotRequired[str]
|
23
|
+
temperature: NotRequired[NonNegativeFloat]
|
24
|
+
stop: NotRequired[str | List[str]]
|
25
|
+
top_p: NotRequired[NonNegativeFloat]
|
26
|
+
max_tokens: NotRequired[PositiveInt]
|
27
|
+
stream: NotRequired[bool]
|
28
|
+
timeout: NotRequired[PositiveInt]
|
29
|
+
max_retries: NotRequired[PositiveInt]
|
30
|
+
|
31
|
+
|
18
32
|
class LLMUsage(Base):
|
19
33
|
"""Class that manages LLM (Large Language Model) usage parameters and methods."""
|
20
34
|
|
@@ -54,29 +68,15 @@ class LLMUsage(Base):
|
|
54
68
|
async def aquery(
|
55
69
|
self,
|
56
70
|
messages: List[Dict[str, str]],
|
57
|
-
model: str | None = None,
|
58
|
-
temperature: NonNegativeFloat | None = None,
|
59
|
-
stop: str | List[str] | None = None,
|
60
|
-
top_p: NonNegativeFloat | None = None,
|
61
|
-
max_tokens: PositiveInt | None = None,
|
62
71
|
n: PositiveInt | None = None,
|
63
|
-
|
64
|
-
timeout: PositiveInt | None = None,
|
65
|
-
max_retries: PositiveInt | None = None,
|
72
|
+
**kwargs: Unpack[LLMKwargs],
|
66
73
|
) -> ModelResponse:
|
67
74
|
"""Asynchronously queries the language model to generate a response based on the provided messages and parameters.
|
68
75
|
|
69
76
|
Args:
|
70
77
|
messages (List[Dict[str, str]]): A list of messages, where each message is a dictionary containing the role and content of the message.
|
71
|
-
|
72
|
-
|
73
|
-
stop (str | None): A sequence at which to stop the generation of the response.
|
74
|
-
top_p (NonNegativeFloat | None): Controls the diversity of the output through nucleus sampling.
|
75
|
-
max_tokens (PositiveInt | None): The maximum number of tokens to generate in the response.
|
76
|
-
n (PositiveInt | None): The number of responses to generate.
|
77
|
-
stream (bool | None): Whether to receive the response in a streaming fashion.
|
78
|
-
timeout (PositiveInt | None): The timeout duration for the request.
|
79
|
-
max_retries (PositiveInt | None): The maximum number of retries in case of failure.
|
78
|
+
n (PositiveInt | None): The number of responses to generate. Defaults to the instance's `llm_generation_count` or the global configuration.
|
79
|
+
**kwargs (Unpack[LLMKwargs]): Additional keyword arguments for the LLM usage, such as `model`, `temperature`, `stop`, `top_p`, `max_tokens`, `stream`, `timeout`, and `max_retries`.
|
80
80
|
|
81
81
|
Returns:
|
82
82
|
ModelResponse: An object containing the generated response and other metadata from the model.
|
@@ -84,15 +84,15 @@ class LLMUsage(Base):
|
|
84
84
|
# Call the underlying asynchronous completion function with the provided and default parameters
|
85
85
|
return await litellm.acompletion(
|
86
86
|
messages=messages,
|
87
|
-
model=model or self.llm_model or configs.llm.model,
|
88
|
-
temperature=temperature or self.llm_temperature or configs.llm.temperature,
|
89
|
-
stop=stop or self.llm_stop_sign or configs.llm.stop_sign,
|
90
|
-
top_p=top_p or self.llm_top_p or configs.llm.top_p,
|
91
|
-
max_tokens=max_tokens or self.llm_max_tokens or configs.llm.max_tokens,
|
92
87
|
n=n or self.llm_generation_count or configs.llm.generation_count,
|
93
|
-
|
94
|
-
|
95
|
-
|
88
|
+
model=kwargs.get("model") or self.llm_model or configs.llm.model,
|
89
|
+
temperature=kwargs.get("temperature") or self.llm_temperature or configs.llm.temperature,
|
90
|
+
stop=kwargs.get("stop") or self.llm_stop_sign or configs.llm.stop_sign,
|
91
|
+
top_p=kwargs.get("top_p") or self.llm_top_p or configs.llm.top_p,
|
92
|
+
max_tokens=kwargs.get("max_tokens") or self.llm_max_tokens or configs.llm.max_tokens,
|
93
|
+
stream=kwargs.get("stream") or self.llm_stream or configs.llm.stream,
|
94
|
+
timeout=kwargs.get("timeout") or self.llm_timeout or configs.llm.timeout,
|
95
|
+
max_retries=kwargs.get("max_retries") or self.llm_max_retries or configs.llm.max_retries,
|
96
96
|
api_key=self.llm_api_key.get_secret_value() if self.llm_api_key else configs.llm.api_key.get_secret_value(),
|
97
97
|
base_url=self.llm_api_endpoint.unicode_string()
|
98
98
|
if self.llm_api_endpoint
|
@@ -103,30 +103,16 @@ class LLMUsage(Base):
|
|
103
103
|
self,
|
104
104
|
question: str,
|
105
105
|
system_message: str = "",
|
106
|
-
model: str | None = None,
|
107
|
-
temperature: NonNegativeFloat | None = None,
|
108
|
-
stop: str | List[str] | None = None,
|
109
|
-
top_p: NonNegativeFloat | None = None,
|
110
|
-
max_tokens: PositiveInt | None = None,
|
111
106
|
n: PositiveInt | None = None,
|
112
|
-
|
113
|
-
timeout: PositiveInt | None = None,
|
114
|
-
max_retries: PositiveInt | None = None,
|
107
|
+
**kwargs: Unpack[LLMKwargs],
|
115
108
|
) -> List[Choices | StreamingChoices]:
|
116
109
|
"""Asynchronously invokes the language model with a question and optional system message.
|
117
110
|
|
118
111
|
Args:
|
119
112
|
question (str): The question to ask the model.
|
120
|
-
system_message (str): The system message to provide context to the model.
|
121
|
-
|
122
|
-
|
123
|
-
stop (str | None): A sequence at which to stop the generation of the response.
|
124
|
-
top_p (NonNegativeFloat | None): Controls the diversity of the output through nucleus sampling.
|
125
|
-
max_tokens (PositiveInt | None): The maximum number of tokens to generate in the response.
|
126
|
-
n (PositiveInt | None): The number of responses to generate.
|
127
|
-
stream (bool | None): Whether to receive the response in a streaming fashion.
|
128
|
-
timeout (PositiveInt | None): The timeout duration for the request.
|
129
|
-
max_retries (PositiveInt | None): The maximum number of retries in case of failure.
|
113
|
+
system_message (str): The system message to provide context to the model. Defaults to an empty string.
|
114
|
+
n (PositiveInt | None): The number of responses to generate. Defaults to the instance's `llm_generation_count` or the global configuration.
|
115
|
+
**kwargs (Unpack[LLMKwargs]): Additional keyword arguments for the LLM usage, such as `model`, `temperature`, `stop`, `top_p`, `max_tokens`, `stream`, `timeout`, and `max_retries`.
|
130
116
|
|
131
117
|
Returns:
|
132
118
|
List[Choices | StreamingChoices]: A list of choices or streaming choices from the model response.
|
@@ -134,15 +120,8 @@ class LLMUsage(Base):
|
|
134
120
|
return (
|
135
121
|
await self.aquery(
|
136
122
|
messages=Messages().add_system_message(system_message).add_user_message(question),
|
137
|
-
model=model,
|
138
|
-
temperature=temperature,
|
139
|
-
stop=stop,
|
140
|
-
top_p=top_p,
|
141
|
-
max_tokens=max_tokens,
|
142
123
|
n=n,
|
143
|
-
|
144
|
-
timeout=timeout,
|
145
|
-
max_retries=max_retries,
|
124
|
+
**kwargs,
|
146
125
|
)
|
147
126
|
).choices
|
148
127
|
|
@@ -150,28 +129,14 @@ class LLMUsage(Base):
|
|
150
129
|
self,
|
151
130
|
question: str,
|
152
131
|
system_message: str = "",
|
153
|
-
|
154
|
-
temperature: NonNegativeFloat | None = None,
|
155
|
-
stop: str | List[str] | None = None,
|
156
|
-
top_p: NonNegativeFloat | None = None,
|
157
|
-
max_tokens: PositiveInt | None = None,
|
158
|
-
stream: bool | None = None,
|
159
|
-
timeout: PositiveInt | None = None,
|
160
|
-
max_retries: PositiveInt | None = None,
|
132
|
+
**kwargs: Unpack[LLMKwargs],
|
161
133
|
) -> str:
|
162
134
|
"""Asynchronously asks the language model a question and returns the response content.
|
163
135
|
|
164
136
|
Args:
|
165
137
|
question (str): The question to ask the model.
|
166
|
-
system_message (str): The system message to provide context to the model.
|
167
|
-
|
168
|
-
temperature (NonNegativeFloat | None): Controls the randomness of the output. Lower values make the output more deterministic.
|
169
|
-
stop (str | None): A sequence at which to stop the generation of the response.
|
170
|
-
top_p (NonNegativeFloat | None): Controls the diversity of the output through nucleus sampling.
|
171
|
-
max_tokens (PositiveInt | None): The maximum number of tokens to generate in the response.
|
172
|
-
stream (bool | None): Whether to receive the response in a streaming fashion.
|
173
|
-
timeout (PositiveInt | None): The timeout duration for the request.
|
174
|
-
max_retries (PositiveInt | None): The maximum number of retries in case of failure.
|
138
|
+
system_message (str): The system message to provide context to the model. Defaults to an empty string.
|
139
|
+
**kwargs (Unpack[LLMKwargs]): Additional keyword arguments for the LLM usage, such as `model`, `temperature`, `stop`, `top_p`, `max_tokens`, `stream`, `timeout`, and `max_retries`.
|
175
140
|
|
176
141
|
Returns:
|
177
142
|
str: The content of the model's response message.
|
@@ -182,14 +147,7 @@ class LLMUsage(Base):
|
|
182
147
|
n=1,
|
183
148
|
question=question,
|
184
149
|
system_message=system_message,
|
185
|
-
|
186
|
-
temperature=temperature,
|
187
|
-
stop=stop,
|
188
|
-
top_p=top_p,
|
189
|
-
max_tokens=max_tokens,
|
190
|
-
stream=stream,
|
191
|
-
timeout=timeout,
|
192
|
-
max_retries=max_retries,
|
150
|
+
**kwargs,
|
193
151
|
)
|
194
152
|
)
|
195
153
|
.pop()
|
@@ -202,30 +160,16 @@ class LLMUsage(Base):
|
|
202
160
|
validator: Callable[[str], T | None],
|
203
161
|
max_validations: PositiveInt = 2,
|
204
162
|
system_message: str = "",
|
205
|
-
|
206
|
-
temperature: NonNegativeFloat | None = None,
|
207
|
-
stop: str | List[str] | None = None,
|
208
|
-
top_p: NonNegativeFloat | None = None,
|
209
|
-
max_tokens: PositiveInt | None = None,
|
210
|
-
stream: bool | None = None,
|
211
|
-
timeout: PositiveInt | None = None,
|
212
|
-
max_retries: PositiveInt | None = None,
|
163
|
+
**kwargs: Unpack[LLMKwargs],
|
213
164
|
) -> T:
|
214
|
-
"""Asynchronously
|
165
|
+
"""Asynchronously asks a question and validates the response using a given validator.
|
215
166
|
|
216
167
|
Args:
|
217
168
|
question (str): The question to ask.
|
218
169
|
validator (Callable[[str], T | None]): A function to validate the response.
|
219
|
-
max_validations (PositiveInt): Maximum number of validation attempts.
|
220
|
-
system_message (str): System message to include in the request.
|
221
|
-
|
222
|
-
temperature (NonNegativeFloat | None): Temperature setting for the request.
|
223
|
-
stop (str | None): Stop sequence for the request.
|
224
|
-
top_p (NonNegativeFloat | None): Top-p sampling parameter.
|
225
|
-
max_tokens (PositiveInt | None): Maximum number of tokens in the response.
|
226
|
-
stream (bool | None): Whether to stream the response.
|
227
|
-
timeout (PositiveInt | None): Timeout for the request.
|
228
|
-
max_retries (PositiveInt | None): Maximum number of retries for the request.
|
170
|
+
max_validations (PositiveInt): Maximum number of validation attempts. Defaults to 2.
|
171
|
+
system_message (str): System message to include in the request. Defaults to an empty string.
|
172
|
+
**kwargs (Unpack[LLMKwargs]): Additional keyword arguments for the LLM usage, such as `model`, `temperature`, `stop`, `top_p`, `max_tokens`, `stream`, `timeout`, and `max_retries`.
|
229
173
|
|
230
174
|
Returns:
|
231
175
|
T: The validated response.
|
@@ -238,14 +182,7 @@ class LLMUsage(Base):
|
|
238
182
|
response := await self.aask(
|
239
183
|
question=question,
|
240
184
|
system_message=system_message,
|
241
|
-
|
242
|
-
temperature=temperature,
|
243
|
-
stop=stop,
|
244
|
-
top_p=top_p,
|
245
|
-
max_tokens=max_tokens,
|
246
|
-
stream=stream,
|
247
|
-
timeout=timeout,
|
248
|
-
max_retries=max_retries,
|
185
|
+
**kwargs,
|
249
186
|
)
|
250
187
|
) and (validated := validator(response)):
|
251
188
|
return validated
|
@@ -258,31 +195,17 @@ class LLMUsage(Base):
|
|
258
195
|
k: NonNegativeInt = 0,
|
259
196
|
max_validations: PositiveInt = 2,
|
260
197
|
system_message: str = "",
|
261
|
-
|
262
|
-
temperature: NonNegativeFloat | None = None,
|
263
|
-
stop: str | List[str] | None = None,
|
264
|
-
top_p: NonNegativeFloat | None = None,
|
265
|
-
max_tokens: PositiveInt | None = None,
|
266
|
-
stream: bool | None = None,
|
267
|
-
timeout: PositiveInt | None = None,
|
268
|
-
max_retries: PositiveInt | None = None,
|
198
|
+
**kwargs: Unpack[LLMKwargs],
|
269
199
|
) -> List[T]:
|
270
200
|
"""Asynchronously executes a multi-choice decision-making process, generating a prompt based on the instruction and options, and validates the returned selection results.
|
271
201
|
|
272
202
|
Args:
|
273
|
-
instruction: The user-provided instruction/question description.
|
274
|
-
choices: A list of candidate options, requiring elements to have `name` and `briefing` fields.
|
275
|
-
k: The number of choices to select, 0 means infinite.
|
276
|
-
max_validations: Maximum number of validation failures, default is 2.
|
277
|
-
system_message: Custom system-level prompt, defaults to an empty string.
|
278
|
-
|
279
|
-
temperature: Sampling temperature to control randomness in generation.
|
280
|
-
stop: Stop condition string or list for generation.
|
281
|
-
top_p: Core sampling probability threshold.
|
282
|
-
max_tokens: Maximum token limit for the generated result.
|
283
|
-
stream: Whether to enable streaming response mode.
|
284
|
-
timeout: Request timeout in seconds.
|
285
|
-
max_retries: Maximum number of retries.
|
203
|
+
instruction (str): The user-provided instruction/question description.
|
204
|
+
choices (List[T]): A list of candidate options, requiring elements to have `name` and `briefing` fields.
|
205
|
+
k (NonNegativeInt): The number of choices to select, 0 means infinite. Defaults to 0.
|
206
|
+
max_validations (PositiveInt): Maximum number of validation failures, default is 2.
|
207
|
+
system_message (str): Custom system-level prompt, defaults to an empty string.
|
208
|
+
**kwargs (Unpack[LLMKwargs]): Additional keyword arguments for the LLM usage, such as `model`, `temperature`, `stop`, `top_p`, `max_tokens`, `stream`, `timeout`, and `max_retries`.
|
286
209
|
|
287
210
|
Returns:
|
288
211
|
List[T]: The final validated selection result list, with element types matching the input `choices`.
|
@@ -315,14 +238,7 @@ class LLMUsage(Base):
|
|
315
238
|
validator=_validate,
|
316
239
|
max_validations=max_validations,
|
317
240
|
system_message=system_message,
|
318
|
-
|
319
|
-
temperature=temperature,
|
320
|
-
stop=stop,
|
321
|
-
top_p=top_p,
|
322
|
-
max_tokens=max_tokens,
|
323
|
-
stream=stream,
|
324
|
-
timeout=timeout,
|
325
|
-
max_retries=max_retries,
|
241
|
+
**kwargs,
|
326
242
|
)
|
327
243
|
|
328
244
|
async def ajudge(
|
@@ -332,31 +248,17 @@ class LLMUsage(Base):
|
|
332
248
|
deny_case: str = "",
|
333
249
|
max_validations: PositiveInt = 2,
|
334
250
|
system_message: str = "",
|
335
|
-
|
336
|
-
temperature: NonNegativeFloat | None = None,
|
337
|
-
stop: str | List[str] | None = None,
|
338
|
-
top_p: NonNegativeFloat | None = None,
|
339
|
-
max_tokens: PositiveInt | None = None,
|
340
|
-
stream: bool | None = None,
|
341
|
-
timeout: PositiveInt | None = None,
|
342
|
-
max_retries: PositiveInt | None = None,
|
251
|
+
**kwargs: Unpack[LLMKwargs],
|
343
252
|
) -> bool:
|
344
253
|
"""Asynchronously judges a prompt using AI validation.
|
345
254
|
|
346
255
|
Args:
|
347
256
|
prompt (str): The input prompt to be judged.
|
348
|
-
affirm_case (str
|
349
|
-
deny_case (str
|
350
|
-
max_validations (PositiveInt
|
351
|
-
system_message (str
|
352
|
-
|
353
|
-
temperature (NonNegativeFloat | None, optional): Sampling temperature. Defaults to None.
|
354
|
-
stop (str | List[str] | None, optional): Stop sequences. Defaults to None.
|
355
|
-
top_p (NonNegativeFloat | None, optional): Nucleus sampling parameter. Defaults to None.
|
356
|
-
max_tokens (PositiveInt | None, optional): Maximum number of tokens to generate. Defaults to None.
|
357
|
-
stream (bool | None, optional): Whether to stream the response. Defaults to None.
|
358
|
-
timeout (PositiveInt | None, optional): Timeout in seconds. Defaults to None.
|
359
|
-
max_retries (PositiveInt | None, optional): Maximum number of retries. Defaults to None.
|
257
|
+
affirm_case (str): The affirmative case for the AI model. Defaults to an empty string.
|
258
|
+
deny_case (str): The negative case for the AI model. Defaults to an empty string.
|
259
|
+
max_validations (PositiveInt): Maximum number of validation attempts. Defaults to 2.
|
260
|
+
system_message (str): System message for the AI model. Defaults to an empty string.
|
261
|
+
**kwargs (Unpack[LLMKwargs]): Additional keyword arguments for the LLM usage, such as `model`, `temperature`, `stop`, `top_p`, `max_tokens`, `stream`, `timeout`, and `max_retries`.
|
360
262
|
|
361
263
|
Returns:
|
362
264
|
bool: The judgment result (True or False) based on the AI's response.
|
@@ -379,14 +281,7 @@ class LLMUsage(Base):
|
|
379
281
|
validator=_validate,
|
380
282
|
max_validations=max_validations,
|
381
283
|
system_message=system_message,
|
382
|
-
|
383
|
-
temperature=temperature,
|
384
|
-
stop=stop,
|
385
|
-
top_p=top_p,
|
386
|
-
max_tokens=max_tokens,
|
387
|
-
stream=stream,
|
388
|
-
timeout=timeout,
|
389
|
-
max_retries=max_retries,
|
284
|
+
**kwargs,
|
390
285
|
)
|
391
286
|
|
392
287
|
def fallback_to(self, other: "LLMUsage") -> Self:
|
@@ -424,30 +319,123 @@ class LLMUsage(Base):
|
|
424
319
|
setattr(other, attr_name, attr)
|
425
320
|
|
426
321
|
|
322
|
+
class ChooseKwargs(LLMKwargs):
|
323
|
+
"""A type representing the keyword arguments for the choose method."""
|
324
|
+
|
325
|
+
max_validations: NotRequired[PositiveInt]
|
326
|
+
system_message: NotRequired[str]
|
327
|
+
k: NotRequired[NonNegativeInt]
|
328
|
+
|
329
|
+
|
427
330
|
class ToolBoxUsage(LLMUsage):
|
428
331
|
"""A class representing the usage of tools in a task."""
|
429
332
|
|
430
333
|
toolboxes: Set[ToolBox] = Field(default_factory=set)
|
431
334
|
"""A set of toolboxes used by the instance."""
|
432
335
|
|
433
|
-
async def choose_toolboxes(self, task: Task):
|
434
|
-
# TODO: Implement this method
|
435
|
-
pass
|
436
|
-
|
437
|
-
async def choose_tool(self, task, toolbox: ToolBox | str):
|
438
|
-
# TODO Implement this method
|
439
|
-
pass
|
440
|
-
|
441
336
|
@property
|
442
337
|
def available_toolbox_names(self) -> List[str]:
|
443
338
|
"""Return a list of available toolbox names."""
|
444
339
|
return [toolbox.name for toolbox in self.toolboxes]
|
445
340
|
|
446
|
-
def
|
341
|
+
async def choose_toolboxes(
|
342
|
+
self,
|
343
|
+
task: Task,
|
344
|
+
system_message: str = "",
|
345
|
+
k: NonNegativeInt = 0,
|
346
|
+
max_validations: PositiveInt = 2,
|
347
|
+
**kwargs: Unpack[LLMKwargs],
|
348
|
+
) -> List[ToolBox]:
|
349
|
+
"""Asynchronously executes a multi-choice decision-making process to choose toolboxes.
|
350
|
+
|
351
|
+
Args:
|
352
|
+
task (Task): The task for which to choose toolboxes.
|
353
|
+
system_message (str): Custom system-level prompt, defaults to an empty string.
|
354
|
+
k (NonNegativeInt): The number of toolboxes to select, 0 means infinite. Defaults to 0.
|
355
|
+
max_validations (PositiveInt): Maximum number of validation failures, default is 2.
|
356
|
+
**kwargs (Unpack[LLMKwargs]): Additional keyword arguments for the LLM usage, such as `model`, `temperature`, `stop`, `top_p`, `max_tokens`, `stream`, `timeout`, and `max_retries`.
|
357
|
+
|
358
|
+
Returns:
|
359
|
+
List[ToolBox]: The selected toolboxes.
|
360
|
+
"""
|
361
|
+
if not self.toolboxes:
|
362
|
+
logger.warning("No toolboxes available.")
|
363
|
+
return []
|
364
|
+
return await self.achoose(
|
365
|
+
instruction=task.briefing,
|
366
|
+
choices=list(self.toolboxes),
|
367
|
+
k=k,
|
368
|
+
max_validations=max_validations,
|
369
|
+
system_message=system_message,
|
370
|
+
**kwargs,
|
371
|
+
)
|
372
|
+
|
373
|
+
async def choose_tools(
|
374
|
+
self,
|
375
|
+
task: Task,
|
376
|
+
toolbox: ToolBox,
|
377
|
+
system_message: str = "",
|
378
|
+
k: NonNegativeInt = 0,
|
379
|
+
max_validations: PositiveInt = 2,
|
380
|
+
**kwargs: Unpack[LLMKwargs],
|
381
|
+
) -> List[Tool]:
|
382
|
+
"""Asynchronously executes a multi-choice decision-making process to choose tools.
|
383
|
+
|
384
|
+
Args:
|
385
|
+
task (Task): The task for which to choose tools.
|
386
|
+
toolbox (ToolBox): The toolbox from which to choose tools.
|
387
|
+
system_message (str): Custom system-level prompt, defaults to an empty string.
|
388
|
+
k (NonNegativeInt): The number of tools to select, 0 means infinite. Defaults to 0.
|
389
|
+
max_validations (PositiveInt): Maximum number of validation failures, default is 2.
|
390
|
+
**kwargs (Unpack[LLMKwargs]): Additional keyword arguments for the LLM usage, such as `model`, `temperature`, `stop`, `top_p`, `max_tokens`, `stream`, `timeout`, and `max_retries`.
|
391
|
+
|
392
|
+
Returns:
|
393
|
+
List[Tool]: The selected tools.
|
394
|
+
"""
|
395
|
+
if not toolbox.tools:
|
396
|
+
logger.warning(f"No tools available in toolbox {toolbox.name}.")
|
397
|
+
return []
|
398
|
+
return await self.achoose(
|
399
|
+
instruction=task.briefing,
|
400
|
+
choices=toolbox.tools,
|
401
|
+
k=k,
|
402
|
+
max_validations=max_validations,
|
403
|
+
system_message=system_message,
|
404
|
+
**kwargs,
|
405
|
+
)
|
406
|
+
|
407
|
+
async def gather_tools(
|
408
|
+
self,
|
409
|
+
task: Task,
|
410
|
+
box_choose_kwargs: Optional[ChooseKwargs] = None,
|
411
|
+
tool_choose_kwargs: Optional[ChooseKwargs] = None,
|
412
|
+
) -> List[Tool]:
|
413
|
+
"""Asynchronously gathers tools based on the provided task and toolbox and tool selection criteria.
|
414
|
+
|
415
|
+
Args:
|
416
|
+
task (Task): The task for which to gather tools.
|
417
|
+
box_choose_kwargs (Optional[ChooseKwargs]): Keyword arguments for choosing toolboxes, such as `system_message`, `k`, `max_validations`, `model`, `temperature`, `stop`, `top_p`, `max_tokens`, `stream`, `timeout`, and `max_retries`.
|
418
|
+
tool_choose_kwargs (Optional[ChooseKwargs]): Keyword arguments for choosing tools, such as `system_message`, `k`, `max_validations`, `model`, `temperature`, `stop`, `top_p`, `max_tokens`, `stream`, `timeout`, and `max_retries`.
|
419
|
+
|
420
|
+
Returns:
|
421
|
+
List[Tool]: A list of tools gathered based on the provided task and toolbox and tool selection criteria.
|
422
|
+
"""
|
423
|
+
box_choose_kwargs = box_choose_kwargs or {}
|
424
|
+
tool_choose_kwargs = tool_choose_kwargs or {}
|
425
|
+
|
426
|
+
# Choose the toolboxes
|
427
|
+
chosen_toolboxes = await self.choose_toolboxes(task, **box_choose_kwargs)
|
428
|
+
# Choose the tools
|
429
|
+
chosen_tools = []
|
430
|
+
for toolbox in chosen_toolboxes:
|
431
|
+
chosen_tools.extend(await self.choose_tools(task, toolbox, **tool_choose_kwargs))
|
432
|
+
return chosen_tools
|
433
|
+
|
434
|
+
def supply_tools_from[S: "ToolBoxUsage"](self, others: Union[S, Iterable[S]]) -> Self:
|
447
435
|
"""Supplies tools from other ToolUsage instances to this instance.
|
448
436
|
|
449
437
|
Args:
|
450
|
-
others (
|
438
|
+
others (ToolBoxUsage | Iterable[ToolBoxUsage]): A single ToolUsage instance or an iterable of ToolUsage instances
|
451
439
|
from which to take tools.
|
452
440
|
|
453
441
|
Returns:
|
@@ -459,11 +447,11 @@ class ToolBoxUsage(LLMUsage):
|
|
459
447
|
self.toolboxes.update(other.toolboxes)
|
460
448
|
return self
|
461
449
|
|
462
|
-
def provide_tools_to(self, others: Union[
|
450
|
+
def provide_tools_to[S: "ToolBoxUsage"](self, others: Union[S, Iterable[S]]) -> Self:
|
463
451
|
"""Provides tools from this instance to other ToolUsage instances.
|
464
452
|
|
465
453
|
Args:
|
466
|
-
others (
|
454
|
+
others (ToolBoxUsage | Iterable[ToolBoxUsage]): A single ToolUsage instance or an iterable of ToolUsage instances
|
467
455
|
to which to provide tools.
|
468
456
|
|
469
457
|
Returns:
|
Binary file
|
@@ -179,7 +179,7 @@ wheels = [
|
|
179
179
|
[[package]]
|
180
180
|
name = "code2prompt"
|
181
181
|
version = "2.0.0"
|
182
|
-
source = { git = "https://github.com/mufeedvh/code2prompt#
|
182
|
+
source = { git = "https://github.com/mufeedvh/code2prompt?rev=d157ee84827458bd6816142e213886487d28bd3d#d157ee84827458bd6816142e213886487d28bd3d" }
|
183
183
|
|
184
184
|
[[package]]
|
185
185
|
name = "colorama"
|
@@ -260,7 +260,7 @@ wheels = [
|
|
260
260
|
|
261
261
|
[[package]]
|
262
262
|
name = "fabricatio"
|
263
|
-
version = "0.2.0.
|
263
|
+
version = "0.2.0.dev17"
|
264
264
|
source = { editable = "." }
|
265
265
|
dependencies = [
|
266
266
|
{ name = "appdirs" },
|
@@ -279,6 +279,16 @@ dependencies = [
|
|
279
279
|
{ name = "rich" },
|
280
280
|
]
|
281
281
|
|
282
|
+
[package.optional-dependencies]
|
283
|
+
full = [
|
284
|
+
{ name = "faiss-cpu" },
|
285
|
+
{ name = "pymilvus" },
|
286
|
+
]
|
287
|
+
rag = [
|
288
|
+
{ name = "faiss-cpu" },
|
289
|
+
{ name = "pymilvus" },
|
290
|
+
]
|
291
|
+
|
282
292
|
[package.dev-dependencies]
|
283
293
|
dev = [
|
284
294
|
{ name = "maturin" },
|
@@ -295,19 +305,14 @@ dev = [
|
|
295
305
|
{ name = "uv" },
|
296
306
|
{ name = "viztracer" },
|
297
307
|
]
|
298
|
-
full = [
|
299
|
-
{ name = "fabricatio" },
|
300
|
-
]
|
301
|
-
rag = [
|
302
|
-
{ name = "faiss-cpu" },
|
303
|
-
{ name = "pymilvus" },
|
304
|
-
]
|
305
308
|
|
306
309
|
[package.metadata]
|
307
310
|
requires-dist = [
|
308
311
|
{ name = "appdirs", specifier = ">=1.4.4" },
|
309
312
|
{ name = "asyncio", specifier = ">=3.4.3" },
|
310
|
-
{ name = "code2prompt", git = "https://github.com/mufeedvh/code2prompt" },
|
313
|
+
{ name = "code2prompt", git = "https://github.com/mufeedvh/code2prompt?rev=d157ee84827458bd6816142e213886487d28bd3d" },
|
314
|
+
{ name = "fabricatio", extras = ["rag"], marker = "extra == 'full'" },
|
315
|
+
{ name = "faiss-cpu", marker = "extra == 'rag'", specifier = ">=1.10.0" },
|
311
316
|
{ name = "gitpython", specifier = ">=3.1.44" },
|
312
317
|
{ name = "litellm", specifier = ">=1.60.0" },
|
313
318
|
{ name = "loguru", specifier = ">=0.7.3" },
|
@@ -315,11 +320,13 @@ requires-dist = [
|
|
315
320
|
{ name = "orjson", specifier = ">=3.10.15" },
|
316
321
|
{ name = "pydantic", specifier = ">=2.10.6" },
|
317
322
|
{ name = "pydantic-settings", specifier = ">=2.7.1" },
|
323
|
+
{ name = "pymilvus", marker = "extra == 'rag'", specifier = ">=2.5.4" },
|
318
324
|
{ name = "pymitter", specifier = ">=1.0.0" },
|
319
325
|
{ name = "questionary", specifier = ">=2.1.0" },
|
320
326
|
{ name = "regex", specifier = ">=2024.11.6" },
|
321
327
|
{ name = "rich", specifier = ">=13.9.4" },
|
322
328
|
]
|
329
|
+
provides-extras = ["rag", "full"]
|
323
330
|
|
324
331
|
[package.metadata.requires-dev]
|
325
332
|
dev = [
|
@@ -337,11 +344,6 @@ dev = [
|
|
337
344
|
{ name = "uv", specifier = ">=0.5.29" },
|
338
345
|
{ name = "viztracer", specifier = ">=1.0.2" },
|
339
346
|
]
|
340
|
-
full = [{ name = "fabricatio", extras = ["rag"] }]
|
341
|
-
rag = [
|
342
|
-
{ name = "faiss-cpu", specifier = ">=1.10.0" },
|
343
|
-
{ name = "pymilvus", specifier = ">=2.5.4" },
|
344
|
-
]
|
345
347
|
|
346
348
|
[[package]]
|
347
349
|
name = "faiss-cpu"
|
Binary file
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{fabricatio-0.2.0.dev15 → fabricatio-0.2.0.dev17}/templates/built-in/cryptography-ctf-solver.hbs
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{fabricatio-0.2.0.dev15 → fabricatio-0.2.0.dev17}/templates/built-in/improve-performance.hbs
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{fabricatio-0.2.0.dev15 → fabricatio-0.2.0.dev17}/templates/built-in/write-github-pull-request.hbs
RENAMED
File without changes
|
{fabricatio-0.2.0.dev15 → fabricatio-0.2.0.dev17}/templates/built-in/write-github-readme.hbs
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|