fabricatio 0.3.14.dev2__cp312-cp312-manylinux_2_34_x86_64.whl → 0.3.14.dev4__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 +5 -5
- fabricatio/models/action.py +2 -2
- fabricatio/models/extra/article_main.py +14 -13
- fabricatio/models/tool.py +5 -6
- fabricatio/models/usages.py +7 -3
- fabricatio/rust.cpython-312-x86_64-linux-gnu.so +0 -0
- {fabricatio-0.3.14.dev2.data → fabricatio-0.3.14.dev4.data}/scripts/tdown +0 -0
- {fabricatio-0.3.14.dev2.data → fabricatio-0.3.14.dev4.data}/scripts/ttm +0 -0
- {fabricatio-0.3.14.dev2.dist-info → fabricatio-0.3.14.dev4.dist-info}/METADATA +3 -7
- {fabricatio-0.3.14.dev2.dist-info → fabricatio-0.3.14.dev4.dist-info}/RECORD +12 -12
- {fabricatio-0.3.14.dev2.dist-info → fabricatio-0.3.14.dev4.dist-info}/WHEEL +0 -0
- {fabricatio-0.3.14.dev2.dist-info → fabricatio-0.3.14.dev4.dist-info}/licenses/LICENSE +0 -0
fabricatio/__init__.py
CHANGED
@@ -1,19 +1,17 @@
|
|
1
1
|
"""Fabricatio is a Python library for building llm app using event-based agent structure."""
|
2
2
|
|
3
|
-
from fabricatio import actions, capabilities, parser, toolboxes, workflows
|
3
|
+
from fabricatio import actions, capabilities, fs, models, parser, toolboxes, utils, workflows
|
4
4
|
from fabricatio.journal import logger
|
5
|
-
from fabricatio.models import extra
|
6
5
|
from fabricatio.models.action import Action, WorkFlow
|
7
6
|
from fabricatio.models.role import Role
|
8
7
|
from fabricatio.models.task import Task
|
9
8
|
from fabricatio.models.tool import ToolBox
|
10
|
-
from fabricatio.rust import CONFIG, TEMPLATE_MANAGER,
|
9
|
+
from fabricatio.rust import CONFIG, TEMPLATE_MANAGER, Event
|
11
10
|
|
12
11
|
__all__ = [
|
13
12
|
"CONFIG",
|
14
13
|
"TEMPLATE_MANAGER",
|
15
14
|
"Action",
|
16
|
-
"BibManager",
|
17
15
|
"Event",
|
18
16
|
"Role",
|
19
17
|
"Task",
|
@@ -21,9 +19,11 @@ __all__ = [
|
|
21
19
|
"WorkFlow",
|
22
20
|
"actions",
|
23
21
|
"capabilities",
|
24
|
-
"
|
22
|
+
"fs",
|
25
23
|
"logger",
|
24
|
+
"models",
|
26
25
|
"parser",
|
27
26
|
"toolboxes",
|
27
|
+
"utils",
|
28
28
|
"workflows",
|
29
29
|
]
|
fabricatio/models/action.py
CHANGED
@@ -125,10 +125,10 @@ class WorkFlow(WithBriefing):
|
|
125
125
|
steps: Sequence[Union[Type[Action], Action]] = Field(frozen=True)
|
126
126
|
"""The sequence of actions to be executed, can be action classes or instances."""
|
127
127
|
|
128
|
-
task_input_key: ClassVar[str] =
|
128
|
+
task_input_key: ClassVar[str] = INPUT_KEY
|
129
129
|
"""Key used to store the input task in the context dictionary."""
|
130
130
|
|
131
|
-
task_output_key: ClassVar[str] =
|
131
|
+
task_output_key: ClassVar[str] = OUTPUT_KEY
|
132
132
|
"""Key used to extract the final result from the context dictionary."""
|
133
133
|
|
134
134
|
extra_init_context: Dict[str, Any] = Field(default_factory=dict, frozen=True)
|
@@ -2,6 +2,15 @@
|
|
2
2
|
|
3
3
|
from typing import ClassVar, Dict, Generator, List, Self, Tuple, Type, override
|
4
4
|
|
5
|
+
from fabricatio.rust import (
|
6
|
+
convert_all_block_tex,
|
7
|
+
convert_all_inline_tex,
|
8
|
+
fix_misplaced_labels,
|
9
|
+
split_out_metadata,
|
10
|
+
word_count,
|
11
|
+
)
|
12
|
+
from pydantic import Field, NonNegativeInt
|
13
|
+
|
5
14
|
from fabricatio.capabilities.persist import PersistentAble
|
6
15
|
from fabricatio.decorators import precheck_package
|
7
16
|
from fabricatio.journal import logger
|
@@ -18,16 +27,8 @@ from fabricatio.models.extra.article_outline import (
|
|
18
27
|
ArticleSubsectionOutline,
|
19
28
|
)
|
20
29
|
from fabricatio.models.generic import Described, SequencePatch, SketchedAble, WithRef, WordCount
|
21
|
-
from fabricatio.rust import (
|
22
|
-
convert_all_block_tex,
|
23
|
-
convert_all_inline_tex,
|
24
|
-
fix_misplaced_labels,
|
25
|
-
split_out_metadata,
|
26
|
-
word_count,
|
27
|
-
)
|
28
|
-
from pydantic import Field, NonNegativeInt
|
29
30
|
|
30
|
-
PARAGRAPH_SEP = "
|
31
|
+
PARAGRAPH_SEP = "// - - -"
|
31
32
|
|
32
33
|
|
33
34
|
class Paragraph(SketchedAble, WordCount, Described):
|
@@ -50,7 +51,7 @@ class Paragraph(SketchedAble, WordCount, Described):
|
|
50
51
|
@classmethod
|
51
52
|
def from_content(cls, content: str) -> Self:
|
52
53
|
"""Create a Paragraph object from the given content."""
|
53
|
-
return cls(elaboration="", aims=[], expected_word_count=word_count(content), content=content)
|
54
|
+
return cls(elaboration="", aims=[], expected_word_count=word_count(content), content=content.strip())
|
54
55
|
|
55
56
|
@property
|
56
57
|
def exact_wordcount(self) -> int:
|
@@ -82,8 +83,8 @@ class ArticleSubsection(SubSectionBase):
|
|
82
83
|
if len(self.paragraphs) == 0:
|
83
84
|
summary += f"`{self.__class__.__name__}` titled `{self.title}` have no paragraphs, You should add some!\n"
|
84
85
|
if (
|
85
|
-
|
86
|
-
|
86
|
+
abs((wc := self.word_count) - self.expected_word_count) / self.expected_word_count
|
87
|
+
> self._max_word_count_deviation
|
87
88
|
):
|
88
89
|
summary += f"`{self.__class__.__name__}` titled `{self.title}` have {wc} words, expected {self.expected_word_count} words!"
|
89
90
|
|
@@ -103,7 +104,7 @@ class ArticleSubsection(SubSectionBase):
|
|
103
104
|
Returns:
|
104
105
|
str: Typst code snippet for rendering.
|
105
106
|
"""
|
106
|
-
return super().to_typst_code() + PARAGRAPH_SEP.join(p.content for p in self.paragraphs)
|
107
|
+
return super().to_typst_code() + f"\n\n{PARAGRAPH_SEP}\n\n".join(p.content for p in self.paragraphs)
|
107
108
|
|
108
109
|
@classmethod
|
109
110
|
def from_typst_code(cls, title: str, body: str, **kwargs) -> Self:
|
fabricatio/models/tool.py
CHANGED
@@ -3,18 +3,18 @@
|
|
3
3
|
This module provides classes for defining tools and toolboxes, which can be used to manage and execute callable functions
|
4
4
|
with additional functionalities such as logging, execution info, and briefing.
|
5
5
|
"""
|
6
|
-
|
7
6
|
from importlib.machinery import ModuleSpec
|
8
7
|
from importlib.util import module_from_spec
|
9
8
|
from inspect import iscoroutinefunction, signature
|
10
9
|
from types import CodeType, ModuleType
|
11
10
|
from typing import Any, Callable, Dict, List, Optional, Self, cast, overload
|
12
11
|
|
12
|
+
from fabricatio.rust import CONFIG
|
13
|
+
from pydantic import Field
|
14
|
+
|
13
15
|
from fabricatio.decorators import logging_execution_info, use_temp_module
|
14
16
|
from fabricatio.journal import logger
|
15
|
-
from fabricatio.models.generic import WithBriefing
|
16
|
-
from fabricatio.rust import CONFIG
|
17
|
-
from pydantic import BaseModel, ConfigDict, Field
|
17
|
+
from fabricatio.models.generic import Base, WithBriefing
|
18
18
|
|
19
19
|
|
20
20
|
class Tool[**P, R](WithBriefing):
|
@@ -181,7 +181,7 @@ class ToolBox(WithBriefing):
|
|
181
181
|
return hash(self.briefing)
|
182
182
|
|
183
183
|
|
184
|
-
class ToolExecutor(
|
184
|
+
class ToolExecutor(Base):
|
185
185
|
"""A class representing a tool executor with a sequence of tools to execute.
|
186
186
|
|
187
187
|
This class manages a sequence of tools and provides methods to inject tools and data into a module, execute the tools,
|
@@ -192,7 +192,6 @@ class ToolExecutor(BaseModel):
|
|
192
192
|
data (Dict[str, Any]): The data that could be used when invoking the tools.
|
193
193
|
"""
|
194
194
|
|
195
|
-
model_config = ConfigDict(use_attribute_docstrings=True)
|
196
195
|
candidates: List[Tool] = Field(default_factory=list, frozen=True)
|
197
196
|
"""The sequence of tools to execute."""
|
198
197
|
|
fabricatio/models/usages.py
CHANGED
@@ -6,7 +6,6 @@ from asyncio import gather
|
|
6
6
|
from typing import Callable, Dict, Iterable, List, Literal, Optional, Self, Sequence, Set, Union, Unpack, overload
|
7
7
|
|
8
8
|
import asyncstdlib
|
9
|
-
import litellm
|
10
9
|
from fabricatio.decorators import logging_exec_time
|
11
10
|
from fabricatio.journal import logger
|
12
11
|
from fabricatio.models.generic import ScopedConfig, WithBriefing
|
@@ -15,7 +14,12 @@ from fabricatio.models.task import Task
|
|
15
14
|
from fabricatio.models.tool import Tool, ToolBox
|
16
15
|
from fabricatio.rust import CONFIG, TEMPLATE_MANAGER
|
17
16
|
from fabricatio.utils import first_available, ok
|
18
|
-
from litellm import
|
17
|
+
from litellm import ( # pyright: ignore [reportPrivateImportUsage]
|
18
|
+
RateLimitError,
|
19
|
+
Router,
|
20
|
+
aembedding,
|
21
|
+
stream_chunk_builder,
|
22
|
+
)
|
19
23
|
from litellm.types.router import Deployment, LiteLLM_Params, ModelInfo
|
20
24
|
from litellm.types.utils import (
|
21
25
|
Choices,
|
@@ -534,7 +538,7 @@ class EmbeddingUsage(LLMUsage, ABC):
|
|
534
538
|
logger.error(err := f"Input text exceeds maximum sequence length {max_len}, got {length}.")
|
535
539
|
raise ValueError(err)
|
536
540
|
|
537
|
-
return await
|
541
|
+
return await aembedding(
|
538
542
|
input=input_text,
|
539
543
|
caching=caching or self.embedding_caching or CONFIG.embedding.caching,
|
540
544
|
dimensions=dimensions or self.embedding_dimensions or CONFIG.embedding.dimensions,
|
Binary file
|
Binary file
|
Binary file
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: fabricatio
|
3
|
-
Version: 0.3.14.
|
3
|
+
Version: 0.3.14.dev4
|
4
4
|
Classifier: License :: OSI Approved :: MIT License
|
5
5
|
Classifier: Programming Language :: Rust
|
6
6
|
Classifier: Programming Language :: Python :: 3.12
|
@@ -18,17 +18,13 @@ Requires-Dist: pydantic>=2.10.6
|
|
18
18
|
Requires-Dist: pymitter>=1.0.0
|
19
19
|
Requires-Dist: rich>=13.9.4
|
20
20
|
Requires-Dist: ujson>=5.10.0
|
21
|
-
Requires-Dist: fabricatio[
|
21
|
+
Requires-Dist: fabricatio[ftd,qa,rag,cli] ; extra == 'full'
|
22
22
|
Requires-Dist: pymilvus>=2.5.4 ; extra == 'rag'
|
23
|
-
Requires-Dist: sympy>=1.13.3 ; extra == 'calc'
|
24
|
-
Requires-Dist: matplotlib>=3.10.1 ; extra == 'plot'
|
25
23
|
Requires-Dist: questionary>=2.1.0 ; extra == 'qa'
|
26
24
|
Requires-Dist: magika>=0.6.1 ; extra == 'ftd'
|
27
25
|
Requires-Dist: typer-slim[standard]>=0.15.2 ; extra == 'cli'
|
28
26
|
Provides-Extra: full
|
29
27
|
Provides-Extra: rag
|
30
|
-
Provides-Extra: calc
|
31
|
-
Provides-Extra: plot
|
32
28
|
Provides-Extra: qa
|
33
29
|
Provides-Extra: ftd
|
34
30
|
Provides-Extra: cli
|
@@ -36,7 +32,7 @@ License-File: LICENSE
|
|
36
32
|
Summary: A LLM multi-agent framework.
|
37
33
|
Keywords: ai,agents,multi-agent,llm,pyo3
|
38
34
|
Author-email: Whth <zettainspector@foxmail.com>
|
39
|
-
Requires-Python: >=3.12, <3.
|
35
|
+
Requires-Python: >=3.12, <3.14
|
40
36
|
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
41
37
|
Project-URL: Homepage, https://github.com/Whth/fabricatio
|
42
38
|
Project-URL: Repository, https://github.com/Whth/fabricatio
|
@@ -1,6 +1,6 @@
|
|
1
|
-
fabricatio-0.3.14.
|
2
|
-
fabricatio-0.3.14.
|
3
|
-
fabricatio-0.3.14.
|
1
|
+
fabricatio-0.3.14.dev4.dist-info/METADATA,sha256=319FsTSToeF9P9D5tJQseEhgP0nOQDSdbU_AjT1Sf3g,4969
|
2
|
+
fabricatio-0.3.14.dev4.dist-info/WHEEL,sha256=7FgAcpQES0h1xhfN9Ugve9FTUilU6sRAr1WJ5ph2cuw,108
|
3
|
+
fabricatio-0.3.14.dev4.dist-info/licenses/LICENSE,sha256=yDZaTLnOi03bi3Dk6f5IjhLUc5old2yOsihHWU0z-i0,1067
|
4
4
|
fabricatio/emitter.py,sha256=QpMvs8dTy1zs5iDORFKzA615S3Lb1tm6AQxYBemQGcc,6164
|
5
5
|
fabricatio/capabilities/check.py,sha256=eiZZaiX78k-Zt7-Ik43Pn5visXHeOJLk8yLWgtqln40,8379
|
6
6
|
fabricatio/capabilities/propose.py,sha256=KqeXaUURJ6O-Ve0ijZYg88rgQYCZEFbuWoqIepI-nQ8,1965
|
@@ -16,10 +16,10 @@ fabricatio/capabilities/advanced_judge.py,sha256=wTiTyBxkZfOXsmzULOW4nX-QAwFMz9w
|
|
16
16
|
fabricatio/capabilities/review.py,sha256=rxA_qdnJc8ehytL5EnlKo9QJ99stnF-n6YaBFRYLe5I,4947
|
17
17
|
fabricatio/capabilities/__init__.py,sha256=skaJ43CqAQaZMH-mCRzF4Fps3x99P2SwJ8vSM9pInX8,56
|
18
18
|
fabricatio/parser.py,sha256=3vT5u5SGpzDH4WLJdMwK5CP8RqO4g1MyQUYpiDKDoEo,4528
|
19
|
-
fabricatio/models/action.py,sha256=
|
19
|
+
fabricatio/models/action.py,sha256=O8BLh8fRNqde_3PC7OFHBjLTdLRPvy5mtalMqQFaZXs,9789
|
20
20
|
fabricatio/models/extra/article_outline.py,sha256=71mgx66KRiXBtdYId4WNkAYp9tJ7OhUqmQyOEe7IRxI,1627
|
21
21
|
fabricatio/models/extra/article_essence.py,sha256=lAkfGj4Jqiy3dSmtloVVr2krej76TV1Ky-2Fr6pNE_Q,2692
|
22
|
-
fabricatio/models/extra/article_main.py,sha256=
|
22
|
+
fabricatio/models/extra/article_main.py,sha256=TeOhU8EDUok2t_lLl1oaUn5IhOmp3oZW_YFOSnybX3s,10993
|
23
23
|
fabricatio/models/extra/article_proposal.py,sha256=7OgcsS9ujjSi_06Z1ln4SCDQgrS4xPGrtgc2dv8EzGo,1857
|
24
24
|
fabricatio/models/extra/article_base.py,sha256=2auA10qomj8UnT2tunUf0oQnvhrJBKNV7GF6UWA9tjg,16347
|
25
25
|
fabricatio/models/extra/rag.py,sha256=fwyEXOECQNe8LPUKGAxEcp9vp7o5356rna-TzGpkvnE,3869
|
@@ -29,13 +29,13 @@ fabricatio/models/extra/patches.py,sha256=_ghmnlvTZQq7UJyaH77mTZE9abjvxRJ2mgWHUb
|
|
29
29
|
fabricatio/models/extra/advanced_judge.py,sha256=CKPP4Lseb_Ey8Y7i2V9HJfB-mZgCknFdqq7Zo41o6s4,1060
|
30
30
|
fabricatio/models/extra/aricle_rag.py,sha256=egUZPmHkzA48IU8s9f6WRhqVMI8B8Uz8Amx-WkLLWGE,11651
|
31
31
|
fabricatio/models/extra/__init__.py,sha256=0R9eZsCNu6OV-Xtf15H7FrqhfHTFBFf3fBrcd7ChsJ0,53
|
32
|
-
fabricatio/models/usages.py,sha256=
|
32
|
+
fabricatio/models/usages.py,sha256=bpM-a9i-WpSOh-XL3LiYTa3AxQUd_ckn44lh-uuKM6M,32250
|
33
33
|
fabricatio/models/generic.py,sha256=dGap-ckYy7ZX_lXDNxv4d3yM45vdoLDYW4cl49BbCAY,27061
|
34
34
|
fabricatio/models/adv_kwargs_types.py,sha256=nmj1D0GVosZxKcdiw-B5vJB04Whr5zh30ZBJntSZUpY,2034
|
35
35
|
fabricatio/models/role.py,sha256=tOwzILaTb8QUOddy9RrJRyhfB_pEVv_IiUBRuc6ylH8,3761
|
36
36
|
fabricatio/models/task.py,sha256=CdR1Zbf-lZN0jODj9iriTn1X2DxLxjXlvZgy3kEd6lI,10723
|
37
37
|
fabricatio/models/kwargs_types.py,sha256=VrzAJaOSlQ-xN5NIIi3k4KpIY0c9beuxcuUnF-mkEEk,3282
|
38
|
-
fabricatio/models/tool.py,sha256=
|
38
|
+
fabricatio/models/tool.py,sha256=_vL5aq5BFjclRxbcNkQCmsMtLUikysv-7Og5HRNc6-U,12091
|
39
39
|
fabricatio/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
40
40
|
fabricatio/rust.pyi,sha256=IzEpNSt3tgoR3L2xZNs7skdeGW73L72-eizXQCBWZFk,25410
|
41
41
|
fabricatio/actions/article.py,sha256=8ea9QZk7m21j5fw6_CO_znZtik9_o71JmX77Po5gyS4,12188
|
@@ -57,8 +57,8 @@ fabricatio/toolboxes/fs.py,sha256=OQMdeokYxSNVrCZJAweJ0cYiK4k2QuEiNdIbS5IHIV8,70
|
|
57
57
|
fabricatio/toolboxes/__init__.py,sha256=dYm_Gd8XolSU_h4wnkA09dlaLDK146eeFz0CUgPZ8_c,380
|
58
58
|
fabricatio/utils.py,sha256=qvl4R8ThuNIIoBJuR1DGEuWYZ7jRFT_8SRx4I_FA8pU,5298
|
59
59
|
fabricatio/journal.py,sha256=qZoaPdv17fc_9l2xVZ-ve7dXKmMFJ8MzPa8_vNXMGyE,204
|
60
|
-
fabricatio/__init__.py,sha256=
|
61
|
-
fabricatio/rust.cpython-312-x86_64-linux-gnu.so,sha256=
|
62
|
-
fabricatio-0.3.14.
|
63
|
-
fabricatio-0.3.14.
|
64
|
-
fabricatio-0.3.14.
|
60
|
+
fabricatio/__init__.py,sha256=pSLe6QL4zQGaZXfhF9KW4fa1D8chqCQm_7yInCP6Kt8,732
|
61
|
+
fabricatio/rust.cpython-312-x86_64-linux-gnu.so,sha256=aDA9n89GtZxKC6FRPoQu6d3lF2j-cDo0P9ZEOa9MYvI,7908728
|
62
|
+
fabricatio-0.3.14.dev4.data/scripts/tdown,sha256=IC8p9rZ8AzIwf51yUpOFChs_-1SE3Qq_LB1ZK6O2I3s,4726096
|
63
|
+
fabricatio-0.3.14.dev4.data/scripts/ttm,sha256=O_3KVKRssOajmBy5mEmY02QHQHH4IDAs5wCvz4GjeME,3925048
|
64
|
+
fabricatio-0.3.14.dev4.dist-info/RECORD,,
|
File without changes
|
File without changes
|