fabricatio 0.2.5.dev0__cp312-cp312-manylinux_2_34_x86_64.whl → 0.2.5.dev2__cp312-cp312-manylinux_2_34_x86_64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- fabricatio/__init__.py +2 -0
- fabricatio/_rust.cpython-312-x86_64-linux-gnu.so +0 -0
- fabricatio/_rust.pyi +65 -16
- fabricatio/_rust_instances.py +3 -0
- fabricatio/capabilities/rating.py +0 -2
- fabricatio/capabilities/review.py +92 -17
- fabricatio/config.py +19 -0
- fabricatio/models/kwargs_types.py +40 -1
- fabricatio/models/role.py +1 -1
- fabricatio/models/usages.py +21 -26
- fabricatio-0.2.5.dev2.data/scripts/tdown +0 -0
- {fabricatio-0.2.5.dev0.dist-info → fabricatio-0.2.5.dev2.dist-info}/METADATA +1 -2
- {fabricatio-0.2.5.dev0.dist-info → fabricatio-0.2.5.dev2.dist-info}/RECORD +15 -15
- fabricatio-0.2.5.dev0.data/scripts/tdown +0 -0
- {fabricatio-0.2.5.dev0.dist-info → fabricatio-0.2.5.dev2.dist-info}/WHEEL +0 -0
- {fabricatio-0.2.5.dev0.dist-info → fabricatio-0.2.5.dev2.dist-info}/licenses/LICENSE +0 -0
fabricatio/__init__.py
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
from importlib.util import find_spec
|
4
4
|
|
5
|
+
from fabricatio._rust import BibManager
|
5
6
|
from fabricatio._rust_instances import template_manager
|
6
7
|
from fabricatio.actions.article import ExtractArticleEssence, GenerateArticleProposal, GenerateOutline
|
7
8
|
from fabricatio.actions.output import DumpFinalizedOutput
|
@@ -22,6 +23,7 @@ from fabricatio.workflows.articles import WriteOutlineWorkFlow
|
|
22
23
|
__all__ = [
|
23
24
|
"Action",
|
24
25
|
"ArticleEssence",
|
26
|
+
"BibManager",
|
25
27
|
"Capture",
|
26
28
|
"CodeBlockCapture",
|
27
29
|
"DumpFinalizedOutput",
|
Binary file
|
fabricatio/_rust.pyi
CHANGED
@@ -2,52 +2,101 @@ from pathlib import Path
|
|
2
2
|
from typing import Any, Dict, List, Optional
|
3
3
|
|
4
4
|
class TemplateManager:
|
5
|
-
"""
|
5
|
+
"""Template rendering engine using Handlebars templates.
|
6
|
+
|
7
|
+
This manager handles template discovery, loading, and rendering
|
8
|
+
through a wrapper around the handlebars-rust engine.
|
9
|
+
|
10
|
+
See: https://crates.io/crates/handlebars
|
11
|
+
"""
|
6
12
|
def __init__(
|
7
13
|
self, template_dirs: List[Path], suffix: Optional[str] = None, active_loading: Optional[bool] = None
|
8
14
|
) -> None:
|
9
15
|
"""Initialize the template manager.
|
10
16
|
|
11
17
|
Args:
|
12
|
-
template_dirs
|
13
|
-
suffix
|
14
|
-
active_loading
|
18
|
+
template_dirs: List of directories containing template files
|
19
|
+
suffix: File extension for templates (defaults to 'hbs')
|
20
|
+
active_loading: Whether to enable dev mode for reloading templates on change
|
15
21
|
"""
|
16
22
|
|
17
23
|
@property
|
18
24
|
def template_count(self) -> int:
|
19
|
-
"""
|
25
|
+
"""Returns the number of currently loaded templates."""
|
20
26
|
|
21
27
|
def get_template_source(self, name: str) -> Optional[str]:
|
22
|
-
"""Get the
|
28
|
+
"""Get the filesystem path for a template.
|
23
29
|
|
24
30
|
Args:
|
25
|
-
name
|
31
|
+
name: Template name (without extension)
|
26
32
|
|
27
33
|
Returns:
|
28
|
-
|
34
|
+
Path to the template file if found, None otherwise
|
29
35
|
"""
|
30
36
|
|
31
37
|
def discover_templates(self) -> None:
|
32
|
-
"""
|
38
|
+
"""Scan template directories and load available templates.
|
39
|
+
|
40
|
+
This refreshes the template cache, finding any new or modified templates.
|
41
|
+
"""
|
33
42
|
|
34
43
|
def render_template(self, name: str, data: Dict[str, Any]) -> str:
|
35
|
-
"""Render a template with
|
44
|
+
"""Render a template with context data.
|
36
45
|
|
37
46
|
Args:
|
38
|
-
name
|
39
|
-
data
|
47
|
+
name: Template name (without extension)
|
48
|
+
data: Context dictionary to provide variables to the template
|
40
49
|
|
41
50
|
Returns:
|
42
|
-
|
51
|
+
Rendered template content as string
|
52
|
+
|
53
|
+
Raises:
|
54
|
+
RuntimeError: If template rendering fails
|
43
55
|
"""
|
44
56
|
|
45
57
|
def blake3_hash(content: bytes) -> str:
|
46
|
-
"""Calculate the BLAKE3 hash of
|
58
|
+
"""Calculate the BLAKE3 cryptographic hash of data.
|
47
59
|
|
48
60
|
Args:
|
49
|
-
content
|
61
|
+
content: Bytes to be hashed
|
50
62
|
|
51
63
|
Returns:
|
52
|
-
|
64
|
+
Hex-encoded BLAKE3 hash string
|
53
65
|
"""
|
66
|
+
|
67
|
+
class BibManager:
|
68
|
+
"""BibTeX bibliography manager for parsing and querying citation data."""
|
69
|
+
|
70
|
+
def __init__(self, path: str) -> None:
|
71
|
+
"""Initialize the bibliography manager.
|
72
|
+
|
73
|
+
Args:
|
74
|
+
path: Path to BibTeX (.bib) file to load
|
75
|
+
|
76
|
+
Raises:
|
77
|
+
RuntimeError: If file cannot be read or parsed
|
78
|
+
"""
|
79
|
+
|
80
|
+
def get_cite_key(self, title: str) -> Optional[str]:
|
81
|
+
"""Find citation key by exact title match.
|
82
|
+
|
83
|
+
Args:
|
84
|
+
title: Full title to search for (case-insensitive)
|
85
|
+
|
86
|
+
Returns:
|
87
|
+
Citation key if exact match found, None otherwise
|
88
|
+
"""
|
89
|
+
|
90
|
+
def get_cite_key_fuzzy(self, query: str) -> Optional[str]:
|
91
|
+
"""Find best matching citation using fuzzy text search.
|
92
|
+
|
93
|
+
Args:
|
94
|
+
query: Search term to find in bibliography entries
|
95
|
+
|
96
|
+
Returns:
|
97
|
+
Citation key of best matching entry, or None if no good match
|
98
|
+
|
99
|
+
Notes:
|
100
|
+
Uses nucleo_matcher for high-quality fuzzy text searching
|
101
|
+
See: https://crates.io/crates/nucleo-matcher
|
102
|
+
"""
|
fabricatio/_rust_instances.py
CHANGED
@@ -4,7 +4,6 @@ from asyncio import gather
|
|
4
4
|
from itertools import permutations
|
5
5
|
from typing import Dict, List, Set, Tuple, Union, Unpack, overload
|
6
6
|
|
7
|
-
from cache import AsyncLRU
|
8
7
|
from fabricatio._rust_instances import template_manager
|
9
8
|
from fabricatio.config import configs
|
10
9
|
from fabricatio.journal import logger
|
@@ -113,7 +112,6 @@ class GiveRating(WithBriefing, LLMUsage):
|
|
113
112
|
return await gather(*[self.rate_fine_grind(item, manual, score_range, **kwargs) for item in to_rate])
|
114
113
|
raise ValueError("to_rate must be a string or a list of strings")
|
115
114
|
|
116
|
-
@AsyncLRU(maxsize=32)
|
117
115
|
async def draft_rating_manual(
|
118
116
|
self, topic: str, criteria: Set[str], **kwargs: Unpack[ValidateKwargs]
|
119
117
|
) -> Dict[str, str]:
|
@@ -1,60 +1,135 @@
|
|
1
1
|
"""A module that provides functionality to rate tasks based on a rating manual and score range."""
|
2
2
|
|
3
|
-
from typing import List, Optional, Set, Unpack
|
3
|
+
from typing import List, Optional, Self, Set, Unpack
|
4
4
|
|
5
5
|
from fabricatio import template_manager
|
6
6
|
from fabricatio.capabilities.propose import Propose
|
7
7
|
from fabricatio.capabilities.rating import GiveRating
|
8
8
|
from fabricatio.config import configs
|
9
|
-
from fabricatio.models.generic import Display, ProposedAble, WithBriefing
|
9
|
+
from fabricatio.models.generic import Base, Display, ProposedAble, WithBriefing
|
10
10
|
from fabricatio.models.kwargs_types import GenerateKwargs, ReviewKwargs
|
11
11
|
from fabricatio.models.task import Task
|
12
12
|
from pydantic import PrivateAttr
|
13
|
+
from questionary import Choice, checkbox
|
14
|
+
|
15
|
+
|
16
|
+
class ProblemSolutions(Base):
|
17
|
+
"""Represents a problem-solution pair identified during a review process.
|
18
|
+
|
19
|
+
This class encapsulates a single problem with its corresponding potential solutions,
|
20
|
+
providing a structured way to manage review findings.
|
21
|
+
|
22
|
+
Attributes:
|
23
|
+
problem (str): The problem statement identified during review.
|
24
|
+
solutions (List[str]): A collection of potential solutions to address the problem.
|
25
|
+
"""
|
26
|
+
|
27
|
+
problem: str
|
28
|
+
"""The problem identified in the review."""
|
29
|
+
solutions: List[str]
|
30
|
+
"""A collection of potential solutions to address the problem."""
|
31
|
+
|
32
|
+
def update_problem(self, problem: str) -> Self:
|
33
|
+
"""Update the problem description.
|
34
|
+
|
35
|
+
Args:
|
36
|
+
problem (str): The new problem description to replace the current one.
|
37
|
+
|
38
|
+
Returns:
|
39
|
+
Self: The current instance with updated problem description.
|
40
|
+
"""
|
41
|
+
self.problem = problem
|
42
|
+
return self
|
43
|
+
|
44
|
+
def update_solutions(self, solutions: List[str]) -> Self:
|
45
|
+
"""Update the list of potential solutions.
|
46
|
+
|
47
|
+
Args:
|
48
|
+
solutions (List[str]): The new collection of solutions to replace the current ones.
|
49
|
+
|
50
|
+
Returns:
|
51
|
+
Self: The current instance with updated solutions.
|
52
|
+
"""
|
53
|
+
self.solutions = solutions
|
54
|
+
return self
|
13
55
|
|
14
56
|
|
15
57
|
class ReviewResult[T](ProposedAble, Display):
|
16
|
-
"""
|
58
|
+
"""Represents the outcome of a review process with identified problems and solutions.
|
17
59
|
|
18
|
-
This class
|
19
|
-
|
60
|
+
This class maintains a structured collection of problems found during a review,
|
61
|
+
their proposed solutions, and a reference to the original reviewed object.
|
20
62
|
|
21
63
|
Attributes:
|
22
|
-
|
23
|
-
|
64
|
+
review_topic (str): The subject or focus area of the review.
|
65
|
+
problem_solutions (List[ProblemSolutions]): Collection of problems identified
|
66
|
+
during review along with their potential solutions.
|
24
67
|
|
25
68
|
Type Parameters:
|
26
69
|
T: The type of the object being reviewed.
|
27
70
|
"""
|
28
71
|
|
29
|
-
|
30
|
-
"""
|
72
|
+
review_topic: str
|
73
|
+
"""The subject or focus area of the review."""
|
31
74
|
|
32
|
-
|
33
|
-
"""
|
75
|
+
problem_solutions: List[ProblemSolutions]
|
76
|
+
"""Collection of problems identified during review along with their potential solutions."""
|
34
77
|
|
35
78
|
_ref: T = PrivateAttr(None)
|
36
|
-
"""Reference to the object
|
79
|
+
"""Reference to the original object that was reviewed."""
|
37
80
|
|
38
81
|
def update_ref[K](self, ref: K) -> "ReviewResult[K]":
|
39
|
-
"""Update the reference to the object
|
82
|
+
"""Update the reference to the reviewed object.
|
40
83
|
|
41
84
|
Args:
|
42
|
-
ref (K): The new reference to
|
85
|
+
ref (K): The new reference object to be associated with this review.
|
43
86
|
|
44
87
|
Returns:
|
45
|
-
ReviewResult[K]: The
|
88
|
+
ReviewResult[K]: The current instance with updated reference type.
|
46
89
|
"""
|
47
90
|
self._ref = ref
|
48
91
|
return self
|
49
92
|
|
50
93
|
def deref(self) -> T:
|
51
|
-
"""
|
94
|
+
"""Retrieve the referenced object that was reviewed.
|
52
95
|
|
53
96
|
Returns:
|
54
|
-
T: The object
|
97
|
+
T: The original object that was reviewed.
|
55
98
|
"""
|
56
99
|
return self._ref
|
57
100
|
|
101
|
+
async def supervisor_check(self, check_solutions: bool = False) -> Self:
|
102
|
+
"""Perform an interactive review session to filter problems and solutions.
|
103
|
+
|
104
|
+
Presents an interactive prompt allowing a supervisor to select which
|
105
|
+
problems (and optionally solutions) should be retained in the final review.
|
106
|
+
|
107
|
+
Args:
|
108
|
+
check_solutions (bool, optional): When True, also prompts for filtering
|
109
|
+
individual solutions for each retained problem. Defaults to False.
|
110
|
+
|
111
|
+
Returns:
|
112
|
+
Self: The current instance with filtered problems and solutions.
|
113
|
+
"""
|
114
|
+
# Choose the problems to retain
|
115
|
+
chosen_ones: List[ProblemSolutions] = await checkbox(
|
116
|
+
f"Please choose the problems you want to retain, under the topic of `{self.review_topic}`.(Default: retain all)",
|
117
|
+
choices=[Choice(p.problem, p, checked=True) for p in self.problem_solutions],
|
118
|
+
).ask_async()
|
119
|
+
if not check_solutions:
|
120
|
+
self.problem_solutions = chosen_ones
|
121
|
+
return self
|
122
|
+
|
123
|
+
# Choose the solutions to retain
|
124
|
+
for to_exam in chosen_ones:
|
125
|
+
to_exam.update_solutions(
|
126
|
+
await checkbox(
|
127
|
+
f"Please choose the solutions you want to retain, under the problem of `{to_exam.problem}`.(Default: retain all)",
|
128
|
+
choices=[Choice(s, s, checked=True) for s in to_exam.solutions],
|
129
|
+
).ask_async()
|
130
|
+
)
|
131
|
+
return self
|
132
|
+
|
58
133
|
|
59
134
|
class Review(GiveRating, Propose):
|
60
135
|
"""Class that provides functionality to review tasks and strings using a language model.
|
fabricatio/config.py
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
from typing import List, Literal, Optional
|
4
4
|
|
5
5
|
from appdirs import user_config_dir
|
6
|
+
from litellm.types.caching import LiteLLMCacheType
|
6
7
|
from pydantic import (
|
7
8
|
BaseModel,
|
8
9
|
ConfigDict,
|
@@ -25,6 +26,8 @@ from pydantic_settings import (
|
|
25
26
|
TomlConfigSettingsSource,
|
26
27
|
)
|
27
28
|
|
29
|
+
from fabricatio.models.kwargs_types import CacheKwargs
|
30
|
+
|
28
31
|
ROAMING_DIR = user_config_dir("fabricatio", "", roaming=True)
|
29
32
|
|
30
33
|
|
@@ -265,6 +268,19 @@ class RagConfig(BaseModel):
|
|
265
268
|
"""The dimensions of the Milvus server."""
|
266
269
|
|
267
270
|
|
271
|
+
class CacheConfig(BaseModel):
|
272
|
+
"""cache configuration class, uses litellm as cache backend. more info see https://docs.litellm.ai/docs/caching/all_caches."""
|
273
|
+
|
274
|
+
model_config = ConfigDict(use_attribute_docstrings=True)
|
275
|
+
|
276
|
+
type: Optional[LiteLLMCacheType] = None
|
277
|
+
"""The type of cache to use. If None, the default cache type will be used."""
|
278
|
+
params: CacheKwargs = Field(default_factory=CacheKwargs)
|
279
|
+
"""The parameters for the cache. If type is None, the default parameters will be used."""
|
280
|
+
enabled: bool = Field(default=False)
|
281
|
+
"""Whether to enable cache."""
|
282
|
+
|
283
|
+
|
268
284
|
class Settings(BaseSettings):
|
269
285
|
"""Application settings class.
|
270
286
|
|
@@ -314,6 +330,9 @@ class Settings(BaseSettings):
|
|
314
330
|
rag: RagConfig = Field(default_factory=RagConfig)
|
315
331
|
"""RAG Configuration"""
|
316
332
|
|
333
|
+
cache: CacheConfig = Field(default_factory=CacheConfig)
|
334
|
+
"""Cache Configuration"""
|
335
|
+
|
317
336
|
@classmethod
|
318
337
|
def settings_customise_sources(
|
319
338
|
cls,
|
@@ -1,7 +1,9 @@
|
|
1
1
|
"""This module contains the types for the keyword arguments of the methods in the models module."""
|
2
2
|
|
3
|
-
from typing import List, NotRequired, Set, TypedDict
|
3
|
+
from typing import Any, List, NotRequired, Set, TypedDict
|
4
4
|
|
5
|
+
from litellm.caching.caching import CacheMode
|
6
|
+
from litellm.types.caching import CachingSupportedCallTypes
|
5
7
|
from pydantic import NonNegativeFloat, NonNegativeInt, PositiveInt
|
6
8
|
|
7
9
|
|
@@ -65,3 +67,40 @@ class ChooseKwargs(GenerateKwargs):
|
|
65
67
|
"""A type representing the keyword arguments for the choose method."""
|
66
68
|
|
67
69
|
k: NotRequired[NonNegativeInt]
|
70
|
+
|
71
|
+
|
72
|
+
class CacheKwargs(TypedDict, total=False):
|
73
|
+
"""A type representing the keyword arguments for the cache method."""
|
74
|
+
|
75
|
+
mode: NotRequired[CacheMode] # when default_on cache is always on, when default_off cache is opt in
|
76
|
+
host: NotRequired[str]
|
77
|
+
port: NotRequired[str]
|
78
|
+
password: NotRequired[str]
|
79
|
+
namespace: NotRequired[str]
|
80
|
+
ttl: NotRequired[float]
|
81
|
+
default_in_memory_ttl: NotRequired[float]
|
82
|
+
default_in_redis_ttl: NotRequired[float]
|
83
|
+
similarity_threshold: NotRequired[float]
|
84
|
+
supported_call_types: NotRequired[List[CachingSupportedCallTypes]]
|
85
|
+
# s3 Bucket, boto3 configuration
|
86
|
+
s3_bucket_name: NotRequired[str]
|
87
|
+
s3_region_name: NotRequired[str]
|
88
|
+
s3_api_version: NotRequired[str]
|
89
|
+
s3_use_ssl: NotRequired[bool]
|
90
|
+
s3_verify: NotRequired[bool | str]
|
91
|
+
s3_endpoint_url: NotRequired[str]
|
92
|
+
s3_aws_access_key_id: NotRequired[str]
|
93
|
+
s3_aws_secret_access_key: NotRequired[str]
|
94
|
+
s3_aws_session_token: NotRequired[str]
|
95
|
+
s3_config: NotRequired[Any]
|
96
|
+
s3_path: NotRequired[str]
|
97
|
+
redis_semantic_cache_use_async: bool
|
98
|
+
redis_semantic_cache_embedding_model: str
|
99
|
+
redis_flush_size: NotRequired[int]
|
100
|
+
redis_startup_nodes: NotRequired[List]
|
101
|
+
disk_cache_dir: Any
|
102
|
+
qdrant_api_base: NotRequired[str]
|
103
|
+
qdrant_api_key: NotRequired[str]
|
104
|
+
qdrant_collection_name: NotRequired[str]
|
105
|
+
qdrant_quantization_config: NotRequired[str]
|
106
|
+
qdrant_semantic_cache_embedding_model: str
|
fabricatio/models/role.py
CHANGED
@@ -15,7 +15,7 @@ from pydantic import Field
|
|
15
15
|
class Role(ProposeTask, HandleTask, Review):
|
16
16
|
"""Class that represents a role with a registry of events and workflows."""
|
17
17
|
|
18
|
-
registry: dict[Event | str, WorkFlow] = Field(
|
18
|
+
registry: dict[Event | str, WorkFlow] = Field(default_factory=dict)
|
19
19
|
""" The registry of events and workflows."""
|
20
20
|
|
21
21
|
toolboxes: Set[ToolBox] = Field(default_factory=set)
|
fabricatio/models/usages.py
CHANGED
@@ -25,6 +25,14 @@ from litellm.utils import CustomStreamWrapper
|
|
25
25
|
from more_itertools import duplicates_everseen
|
26
26
|
from pydantic import Field, NonNegativeInt, PositiveInt
|
27
27
|
|
28
|
+
if configs.cache.enabled:
|
29
|
+
from litellm.caching import Cache
|
30
|
+
|
31
|
+
if configs.cache.type is None:
|
32
|
+
Cache(**configs.cache.params)
|
33
|
+
else:
|
34
|
+
Cache(type=configs.cache.type, **configs.cache.params)
|
35
|
+
|
28
36
|
|
29
37
|
class LLMUsage(ScopedConfig):
|
30
38
|
"""Class that manages LLM (Large Language Model) usage parameters and methods."""
|
@@ -105,14 +113,14 @@ class LLMUsage(ScopedConfig):
|
|
105
113
|
async def aask(
|
106
114
|
self,
|
107
115
|
question: List[str],
|
108
|
-
system_message:
|
116
|
+
system_message: List[str],
|
109
117
|
**kwargs: Unpack[LLMKwargs],
|
110
118
|
) -> List[str]: ...
|
111
119
|
@overload
|
112
120
|
async def aask(
|
113
121
|
self,
|
114
122
|
question: str,
|
115
|
-
system_message:
|
123
|
+
system_message: List[str],
|
116
124
|
**kwargs: Unpack[LLMKwargs],
|
117
125
|
) -> List[str]: ...
|
118
126
|
@overload
|
@@ -148,36 +156,23 @@ class LLMUsage(ScopedConfig):
|
|
148
156
|
str | List[str]: The content of the model's response message.
|
149
157
|
"""
|
150
158
|
system_message = system_message or ""
|
151
|
-
match (
|
152
|
-
case (
|
159
|
+
match (question, system_message):
|
160
|
+
case (list(q_seq), list(sm_seq)):
|
153
161
|
res = await gather(
|
154
162
|
*[
|
155
163
|
self.ainvoke(n=1, question=q, system_message=sm, **kwargs)
|
156
|
-
for q, sm in zip(
|
164
|
+
for q, sm in zip(q_seq, sm_seq, strict=True)
|
157
165
|
]
|
158
166
|
)
|
159
167
|
return [r.pop().message.content for r in res]
|
160
|
-
case (
|
161
|
-
res = await gather(
|
162
|
-
*[self.ainvoke(n=1, question=q, system_message=system_message, **kwargs) for q in question]
|
163
|
-
)
|
168
|
+
case (list(q_seq), str(sm)):
|
169
|
+
res = await gather(*[self.ainvoke(n=1, question=q, system_message=sm, **kwargs) for q in q_seq])
|
164
170
|
return [r.pop().message.content for r in res]
|
165
|
-
case (
|
166
|
-
res = await gather(
|
167
|
-
*[self.ainvoke(n=1, question=question, system_message=sm, **kwargs) for sm in system_message]
|
168
|
-
)
|
171
|
+
case (str(q), list(sm_seq)):
|
172
|
+
res = await gather(*[self.ainvoke(n=1, question=q, system_message=sm, **kwargs) for sm in sm_seq])
|
169
173
|
return [r.pop().message.content for r in res]
|
170
|
-
case (
|
171
|
-
return (
|
172
|
-
(
|
173
|
-
await self.ainvoke(
|
174
|
-
n=1,
|
175
|
-
question=question,
|
176
|
-
system_message=system_message,
|
177
|
-
**kwargs,
|
178
|
-
)
|
179
|
-
).pop()
|
180
|
-
).message.content
|
174
|
+
case (str(q), str(sm)):
|
175
|
+
return ((await self.ainvoke(n=1, question=q, system_message=sm, **kwargs)).pop()).message.content
|
181
176
|
case _:
|
182
177
|
raise RuntimeError("Should not reach here.")
|
183
178
|
|
@@ -514,7 +509,7 @@ class ToolBoxUsage(LLMUsage):
|
|
514
509
|
logger.warning("No toolboxes available.")
|
515
510
|
return []
|
516
511
|
return await self.achoose(
|
517
|
-
instruction=task.briefing,
|
512
|
+
instruction=task.briefing,
|
518
513
|
choices=list(self.toolboxes),
|
519
514
|
k=k,
|
520
515
|
max_validations=max_validations,
|
@@ -548,7 +543,7 @@ class ToolBoxUsage(LLMUsage):
|
|
548
543
|
logger.warning(f"No tools available in toolbox {toolbox.name}.")
|
549
544
|
return []
|
550
545
|
return await self.achoose(
|
551
|
-
instruction=task.briefing,
|
546
|
+
instruction=task.briefing,
|
552
547
|
choices=toolbox.tools,
|
553
548
|
k=k,
|
554
549
|
max_validations=max_validations,
|
Binary file
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: fabricatio
|
3
|
-
Version: 0.2.5.
|
3
|
+
Version: 0.2.5.dev2
|
4
4
|
Classifier: License :: OSI Approved :: MIT License
|
5
5
|
Classifier: Programming Language :: Rust
|
6
6
|
Classifier: Programming Language :: Python :: 3.12
|
@@ -9,7 +9,6 @@ Classifier: Framework :: AsyncIO
|
|
9
9
|
Classifier: Framework :: Pydantic :: 2
|
10
10
|
Classifier: Typing :: Typed
|
11
11
|
Requires-Dist: appdirs>=1.4.4
|
12
|
-
Requires-Dist: async-cache>=1.1.1
|
13
12
|
Requires-Dist: asyncio>=3.4.3
|
14
13
|
Requires-Dist: asyncstdlib>=3.13.0
|
15
14
|
Requires-Dist: litellm>=1.60.0
|
@@ -1,15 +1,15 @@
|
|
1
|
-
fabricatio-0.2.5.
|
2
|
-
fabricatio-0.2.5.
|
3
|
-
fabricatio-0.2.5.
|
1
|
+
fabricatio-0.2.5.dev2.dist-info/METADATA,sha256=GdJ_ONACMtfHqATVU1a3FHdIGh2GTMrqwBpXXGBHIEU,8589
|
2
|
+
fabricatio-0.2.5.dev2.dist-info/WHEEL,sha256=RIvmwLDYujv60MYBx2jxyP4vdn1DD7X0kBgz1TQvZuc,108
|
3
|
+
fabricatio-0.2.5.dev2.dist-info/licenses/LICENSE,sha256=yDZaTLnOi03bi3Dk6f5IjhLUc5old2yOsihHWU0z-i0,1067
|
4
4
|
fabricatio/decorators.py,sha256=cJHsxxbnMhc4SzPl4454CPLuDP3H0qbTrzV_U2rLPrs,6372
|
5
5
|
fabricatio/core.py,sha256=MaEKZ6DDmbdScAY-7F1gwGA6fr7ADX6Mz5rNVi2msFA,6277
|
6
6
|
fabricatio/models/generic.py,sha256=dP5rNf13Yo-Zy0WpmunsDYOxNbJF3RpFcVBTrYaHnvc,12197
|
7
7
|
fabricatio/models/tool.py,sha256=m7gFo8nXywGj7J3zOfPC_wPUgcTY-76ZwAmHlQLWkb8,6836
|
8
|
-
fabricatio/models/role.py,sha256=
|
8
|
+
fabricatio/models/role.py,sha256=Xd-TYNefcY9FGeINAI8Q5sCu2pgBXl0l9XKxN0r4rZ0,1791
|
9
9
|
fabricatio/models/extra.py,sha256=svUxjM9iPtXCpNJwxYdkvRtvORsze8Fcz4Oql-46huQ,7295
|
10
|
-
fabricatio/models/kwargs_types.py,sha256=
|
10
|
+
fabricatio/models/kwargs_types.py,sha256=gHB7Uhk2aArXLdA8Cqb7JhGKoilNxIFD1MvPG5hhuHk,3486
|
11
11
|
fabricatio/models/utils.py,sha256=vahILaesw50ofFft-wZ9kZ_Qogqi6vIOISWczvwVXxk,4311
|
12
|
-
fabricatio/models/usages.py,sha256=
|
12
|
+
fabricatio/models/usages.py,sha256=f4oRQND4BSixYHsqCiIFwSNVYcDfMAJn2JDltnIiwDQ,25936
|
13
13
|
fabricatio/models/events.py,sha256=sBCKeNoYc4TFDoke-jhFEyA11RcdGu-wdF5ynAuVOMM,3983
|
14
14
|
fabricatio/models/task.py,sha256=BdBfCtxzgDzqHE0eP65liUGRmddAtKhim6optodzEcQ,10193
|
15
15
|
fabricatio/models/action.py,sha256=JgCjyddvY-YYnfQPdBwe7i-r4CJNTkGSMnuUW8666HQ,6326
|
@@ -20,22 +20,22 @@ fabricatio/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
20
20
|
fabricatio/fs/readers.py,sha256=JNjTaHpH0ljXxJ7SREJYL5gU8bbCe3lDEaVCmna1rww,1168
|
21
21
|
fabricatio/fs/curd.py,sha256=DjaL8_lROZVcPghC0U1u7mklLWFxbO9Vz1LWqp6aLl0,4010
|
22
22
|
fabricatio/fs/__init__.py,sha256=kfE2e_ijOQtDND_GUBGWDEwtgcP5pYAymCgT0H3qh6M,521
|
23
|
-
fabricatio/config.py,sha256=
|
23
|
+
fabricatio/config.py,sha256=tByDnt0HOthTOdEYK4KJwUqT74gJSVjUUxNOtc9Sa58,14422
|
24
24
|
fabricatio/journal.py,sha256=bzxZay48ZWI0VIkkDXm4Wc_Cc9lBQYa2VGx3Hxy_PtA,753
|
25
|
-
fabricatio/__init__.py,sha256=
|
25
|
+
fabricatio/__init__.py,sha256=kr86hyEDgUbxl1KmWTJqmW1R-aeC8Hd4KFp-2HFr0LM,1870
|
26
26
|
fabricatio/actions/output.py,sha256=0sKfU8C9y326IcgZMLeEoZZH3iMpgFGOLGoi9wYZz1U,663
|
27
27
|
fabricatio/actions/rag.py,sha256=tP1uKLq7mo19YhsJzFbGYryrcMx6xcvBc3n_Wzh0hjg,796
|
28
28
|
fabricatio/actions/article.py,sha256=-WKVYu1HrQOL5nyBraCvRG2bfbkTa_ylH_PyFSI6iLs,2704
|
29
|
-
fabricatio/_rust_instances.py,sha256=
|
29
|
+
fabricatio/_rust_instances.py,sha256=0jwXdYG0pmEaa5Jx8twvRMTtARLe-HeebGR4PEThiBU,305
|
30
30
|
fabricatio/workflows/articles.py,sha256=utvKDBFEJbcM76729-H2AvgMCNcsX1NquqMpHqGZq8E,565
|
31
31
|
fabricatio/workflows/rag.py,sha256=uOZXprD479fUhLA6sYvEM8RWcVcUZXXtP0xRbTMPdHE,509
|
32
32
|
fabricatio/parser.py,sha256=S-4p1mjvJZEgnQW6WKdkmE68MzqqWXGSiLbADdhE-W4,4791
|
33
33
|
fabricatio/capabilities/rag.py,sha256=mGUWaVsLbA1vNe0LRdAOeUlR4WMc6mwuOQ0vhPG8m74,15181
|
34
|
-
fabricatio/capabilities/rating.py,sha256=
|
35
|
-
fabricatio/capabilities/review.py,sha256=
|
34
|
+
fabricatio/capabilities/rating.py,sha256=czWKW7PEvJCJoWBhj23-kCbrMUK7k74eTs6mT_AmJvM,13331
|
35
|
+
fabricatio/capabilities/review.py,sha256=p3zhwqY4wiV1uAeMledYt8lelPWjWr5UGvEpJyKW3Yc,8715
|
36
36
|
fabricatio/capabilities/propose.py,sha256=oW9QKpY2mDkVPEvgsgqxXxDR2ylVqN5TEL8E0Wh_vJI,1714
|
37
37
|
fabricatio/capabilities/task.py,sha256=BISAFbMgBI4udW0otE3-iyq0RXc05YN_30N0yI5qLxQ,4504
|
38
|
-
fabricatio/_rust.pyi,sha256=
|
39
|
-
fabricatio/_rust.cpython-312-x86_64-linux-gnu.so,sha256=
|
40
|
-
fabricatio-0.2.5.
|
41
|
-
fabricatio-0.2.5.
|
38
|
+
fabricatio/_rust.pyi,sha256=UFWsfkDqeMQt-ipW-4pk1Dnr8u1eHqQ0y-IJNCnqr5M,3066
|
39
|
+
fabricatio/_rust.cpython-312-x86_64-linux-gnu.so,sha256=X-d8ziGuBqQEtJXheq6NTFAsxotGLiy2it6rteu9Cic,1898944
|
40
|
+
fabricatio-0.2.5.dev2.data/scripts/tdown,sha256=MsmVZJr1r5g1VXyayAS7DEtHgLj0O8a2YbGNf1u6SDw,4571832
|
41
|
+
fabricatio-0.2.5.dev2.dist-info/RECORD,,
|
Binary file
|
File without changes
|
File without changes
|