fabricatio 0.2.13.dev3__cp312-cp312-win_amd64.whl → 0.3.14.dev0__cp312-cp312-win_amd64.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.
Files changed (42) hide show
  1. fabricatio/__init__.py +5 -10
  2. fabricatio/actions/article.py +32 -34
  3. fabricatio/actions/article_rag.py +58 -58
  4. fabricatio/actions/output.py +22 -21
  5. fabricatio/actions/rag.py +4 -3
  6. fabricatio/capabilities/check.py +29 -30
  7. fabricatio/capabilities/correct.py +23 -23
  8. fabricatio/capabilities/extract.py +36 -32
  9. fabricatio/capabilities/rag.py +34 -35
  10. fabricatio/capabilities/rating.py +77 -72
  11. fabricatio/capabilities/review.py +12 -11
  12. fabricatio/capabilities/task.py +4 -5
  13. fabricatio/core.py +22 -24
  14. fabricatio/decorators.py +10 -10
  15. fabricatio/fs/__init__.py +1 -2
  16. fabricatio/journal.py +2 -9
  17. fabricatio/models/action.py +8 -22
  18. fabricatio/models/extra/aricle_rag.py +10 -9
  19. fabricatio/models/extra/article_base.py +5 -6
  20. fabricatio/models/extra/article_main.py +11 -10
  21. fabricatio/models/generic.py +33 -60
  22. fabricatio/models/kwargs_types.py +1 -46
  23. fabricatio/models/role.py +45 -25
  24. fabricatio/models/task.py +9 -9
  25. fabricatio/models/tool.py +5 -4
  26. fabricatio/models/usages.py +170 -161
  27. fabricatio/parser.py +2 -2
  28. fabricatio/rust.cp312-win_amd64.pyd +0 -0
  29. fabricatio/rust.pyi +435 -17
  30. fabricatio/utils.py +38 -4
  31. fabricatio-0.3.14.dev0.data/scripts/tdown.exe +0 -0
  32. {fabricatio-0.2.13.dev3.data → fabricatio-0.3.14.dev0.data}/scripts/ttm.exe +0 -0
  33. {fabricatio-0.2.13.dev3.dist-info → fabricatio-0.3.14.dev0.dist-info}/METADATA +1 -3
  34. fabricatio-0.3.14.dev0.dist-info/RECORD +63 -0
  35. fabricatio/config.py +0 -430
  36. fabricatio/constants.py +0 -20
  37. fabricatio/models/events.py +0 -120
  38. fabricatio/rust_instances.py +0 -10
  39. fabricatio-0.2.13.dev3.data/scripts/tdown.exe +0 -0
  40. fabricatio-0.2.13.dev3.dist-info/RECORD +0 -67
  41. {fabricatio-0.2.13.dev3.dist-info → fabricatio-0.3.14.dev0.dist-info}/WHEEL +0 -0
  42. {fabricatio-0.2.13.dev3.dist-info → fabricatio-0.3.14.dev0.dist-info}/licenses/LICENSE +0 -0
fabricatio/config.py DELETED
@@ -1,430 +0,0 @@
1
- """Configuration module for the Fabricatio application."""
2
-
3
- from pathlib import Path
4
- from typing import List, Literal, Optional
5
-
6
- from appdirs import user_config_dir
7
- from litellm.types.caching import LiteLLMCacheType
8
- from pydantic import (
9
- BaseModel,
10
- ConfigDict,
11
- DirectoryPath,
12
- Field,
13
- FilePath,
14
- HttpUrl,
15
- NonNegativeFloat,
16
- PositiveFloat,
17
- PositiveInt,
18
- SecretStr,
19
- )
20
- from pydantic_settings import (
21
- BaseSettings,
22
- PydanticBaseSettingsSource,
23
- PyprojectTomlConfigSettingsSource,
24
- SettingsConfigDict,
25
- TomlConfigSettingsSource,
26
- )
27
-
28
- from fabricatio.models.kwargs_types import CacheKwargs
29
-
30
- ROAMING_DIR = user_config_dir("fabricatio", "", roaming=True)
31
-
32
-
33
- class LLMConfig(BaseModel):
34
- """LLM configuration class.
35
-
36
- Attributes:
37
- api_endpoint (HttpUrl): OpenAI API Endpoint.
38
- api_key (SecretStr): OpenAI API key. Empty by default for security reasons, should be set before use.
39
- timeout (PositiveInt): The timeout of the LLM model in seconds. Default is 300 seconds as per request.
40
- max_retries (PositiveInt): The maximum number of retries. Default is 3 retries.
41
- model (str): The LLM model name. Set to 'gpt-3.5-turbo' as per request.
42
- temperature (NonNegativeFloat): The temperature of the LLM model. Controls randomness in generation. Set to 1.0 as per request.
43
- stop_sign (str): The stop sign of the LLM model. No default stop sign specified.
44
- top_p (NonNegativeFloat): The top p of the LLM model. Controls diversity via nucleus sampling. Set to 0.35 as per request.
45
- generation_count (PositiveInt): The number of generations to generate. Default is 1.
46
- stream (bool): Whether to stream the LLM model's response. Default is False.
47
- max_tokens (PositiveInt): The maximum number of tokens to generate.
48
- """
49
-
50
- model_config = ConfigDict(use_attribute_docstrings=True)
51
- api_endpoint: Optional[HttpUrl] = Field(default=HttpUrl("https://api.openai.com"))
52
- """OpenAI API Endpoint."""
53
-
54
- api_key: Optional[SecretStr] = Field(default=SecretStr("sk-setyourkey"))
55
- """OpenAI API key. Empty by default for security reasons, should be set before use."""
56
-
57
- timeout: Optional[PositiveInt] = Field(default=300)
58
- """The timeout of the LLM model in seconds. Default is 300 seconds as per request."""
59
-
60
- max_retries: Optional[PositiveInt] = Field(default=3)
61
- """The maximum number of retries. Default is 3 retries."""
62
-
63
- model: Optional[str] = Field(default="gpt-3.5-turbo")
64
- """The LLM model name. Set to 'gpt-3.5-turbo' as per request."""
65
-
66
- temperature: Optional[NonNegativeFloat] = Field(default=1.0)
67
- """The temperature of the LLM model. Controls randomness in generation. Set to 1.0 as per request."""
68
-
69
- stop_sign: Optional[str | List[str]] = Field(default=None)
70
- """The stop sign of the LLM model. No default stop sign specified."""
71
-
72
- top_p: Optional[NonNegativeFloat] = Field(default=0.35)
73
- """The top p of the LLM model. Controls diversity via nucleus sampling. Set to 0.35 as per request."""
74
-
75
- generation_count: Optional[PositiveInt] = Field(default=1)
76
- """The number of generations to generate. Default is 1."""
77
-
78
- stream: Optional[bool] = Field(default=False)
79
- """Whether to stream the LLM model's response. Default is False."""
80
-
81
- max_tokens: Optional[PositiveInt] = Field(default=None)
82
- """The maximum number of tokens to generate."""
83
-
84
- rpm: Optional[PositiveInt] = Field(default=100)
85
- """The rate limit of the LLM model in requests per minute. None means not checked."""
86
-
87
- tpm: Optional[PositiveInt] = Field(default=1000000)
88
- """The rate limit of the LLM model in tokens per minute. None means not checked."""
89
- presence_penalty: Optional[PositiveFloat] = None
90
- """The presence penalty of the LLM model."""
91
- frequency_penalty: Optional[PositiveFloat] = None
92
- """The frequency penalty of the LLM model."""
93
-
94
-
95
- class EmbeddingConfig(BaseModel):
96
- """Embedding configuration class."""
97
-
98
- model_config = ConfigDict(use_attribute_docstrings=True)
99
-
100
- model: Optional[str] = Field(default="text-embedding-ada-002")
101
- """The embedding model name. """
102
-
103
- dimensions: Optional[PositiveInt] = Field(default=None)
104
- """The dimensions of the embedding. None means not checked."""
105
-
106
- timeout: Optional[PositiveInt] = Field(default=None)
107
- """The timeout of the embedding model in seconds."""
108
-
109
- max_sequence_length: Optional[PositiveInt] = Field(default=8192)
110
- """The maximum sequence length of the embedding model. Default is 8192 as per request."""
111
-
112
- caching: Optional[bool] = Field(default=False)
113
- """Whether to cache the embedding. Default is False."""
114
-
115
- api_endpoint: Optional[HttpUrl] = None
116
- """The OpenAI API endpoint."""
117
-
118
- api_key: Optional[SecretStr] = None
119
- """The OpenAI API key."""
120
-
121
-
122
- class PymitterConfig(BaseModel):
123
- """Pymitter configuration class.
124
-
125
- Attributes:
126
- delimiter (str): The delimiter used to separate the event name into segments.
127
- new_listener_event (bool): If set, a newListener event is emitted when a new listener is added.
128
- max_listeners (int): The maximum number of listeners per event.
129
- """
130
-
131
- model_config = ConfigDict(use_attribute_docstrings=True)
132
- delimiter: str = Field(default="::", frozen=True)
133
- """The delimiter used to separate the event name into segments."""
134
-
135
- new_listener_event: bool = Field(default=False, frozen=True)
136
- """If set, a newListener event is emitted when a new listener is added."""
137
-
138
- max_listeners: int = Field(default=-1, frozen=True)
139
- """The maximum number of listeners per event."""
140
-
141
-
142
- class DebugConfig(BaseModel):
143
- """Debug configuration class.
144
-
145
- Attributes:
146
- log_level (Literal["DEBUG", "INFO", "SUCCESS", "WARNING", "ERROR", "CRITICAL"]): The log level of the application.
147
- log_file (FilePath): The log file of the application.
148
- """
149
-
150
- model_config = ConfigDict(use_attribute_docstrings=True)
151
-
152
- log_level: Literal["DEBUG", "INFO", "SUCCESS", "WARNING", "ERROR", "CRITICAL"] = Field(default="INFO")
153
- """The log level of the application."""
154
-
155
- log_file: FilePath = Field(default=Path(rf"{ROAMING_DIR}\fabricatio.log"), frozen=True)
156
- """The log file of the application."""
157
-
158
- rotation: int = Field(default=1, frozen=True)
159
- """The rotation of the log file. in weeks."""
160
-
161
- retention: int = Field(default=2, frozen=True)
162
- """The retention of the log file. in weeks."""
163
-
164
- streaming_visible: bool = Field(default=False)
165
- """Whether to print the llm output when streaming."""
166
-
167
-
168
- class TemplateConfig(BaseModel):
169
- """Template configuration class."""
170
-
171
- model_config = ConfigDict(use_attribute_docstrings=True)
172
- template_dir: List[DirectoryPath] = Field(
173
- default_factory=lambda: [Path(r".\templates"), Path(rf"{ROAMING_DIR}\templates")]
174
- )
175
- """The directory containing the templates."""
176
- active_loading: bool = Field(default=False)
177
- """Whether to enable active loading of templates."""
178
-
179
- template_suffix: str = Field(default="hbs", frozen=True)
180
- """The suffix of the templates."""
181
-
182
- create_json_obj_template: str = Field(default="create_json_obj")
183
- """The name of the create json object template which will be used to create a json object."""
184
-
185
- draft_tool_usage_code_template: str = Field(default="draft_tool_usage_code")
186
- """The name of the draft tool usage code template which will be used to draft tool usage code."""
187
-
188
- make_choice_template: str = Field(default="make_choice")
189
- """The name of the make choice template which will be used to make a choice."""
190
-
191
- make_judgment_template: str = Field(default="make_judgment")
192
- """The name of the make judgment template which will be used to make a judgment."""
193
-
194
- dependencies_template: str = Field(default="dependencies")
195
- """The name of the dependencies template which will be used to manage dependencies."""
196
-
197
- task_briefing_template: str = Field(default="task_briefing")
198
- """The name of the task briefing template which will be used to brief a task."""
199
-
200
- rate_fine_grind_template: str = Field(default="rate_fine_grind")
201
- """The name of the rate fine grind template which will be used to rate fine grind."""
202
-
203
- draft_rating_manual_template: str = Field(default="draft_rating_manual")
204
- """The name of the draft rating manual template which will be used to draft rating manual."""
205
-
206
- draft_rating_criteria_template: str = Field(default="draft_rating_criteria")
207
- """The name of the draft rating criteria template which will be used to draft rating criteria."""
208
-
209
- extract_reasons_from_examples_template: str = Field(default="extract_reasons_from_examples")
210
- """The name of the extract reasons from examples template which will be used to extract reasons from examples."""
211
-
212
- extract_criteria_from_reasons_template: str = Field(default="extract_criteria_from_reasons")
213
- """The name of the extract criteria from reasons template which will be used to extract criteria from reasons."""
214
-
215
- draft_rating_weights_klee_template: str = Field(default="draft_rating_weights_klee")
216
- """The name of the draft rating weights klee template which will be used to draft rating weights with Klee method."""
217
-
218
- retrieved_display_template: str = Field(default="retrieved_display")
219
- """The name of the retrieved display template which will be used to display retrieved documents."""
220
-
221
- liststr_template: str = Field(default="liststr")
222
- """The name of the liststr template which will be used to display a list of strings."""
223
-
224
- refined_query_template: str = Field(default="refined_query")
225
- """The name of the refined query template which will be used to refine a query."""
226
-
227
- pathstr_template: str = Field(default="pathstr")
228
- """The name of the pathstr template which will be used to acquire a path of strings."""
229
-
230
- review_string_template: str = Field(default="review_string")
231
- """The name of the review string template which will be used to review a string."""
232
-
233
- generic_string_template: str = Field(default="generic_string")
234
- """The name of the generic string template which will be used to review a string."""
235
-
236
- co_validation_template: str = Field(default="co_validation")
237
- """The name of the co-validation template which will be used to co-validate a string."""
238
-
239
- as_prompt_template: str = Field(default="as_prompt")
240
- """The name of the as prompt template which will be used to convert a string to a prompt."""
241
-
242
- check_string_template: str = Field(default="check_string")
243
- """The name of the check string template which will be used to check a string."""
244
-
245
- ruleset_requirement_breakdown_template: str = Field(default="ruleset_requirement_breakdown")
246
- """The name of the ruleset requirement breakdown template which will be used to breakdown a ruleset requirement."""
247
-
248
- fix_troubled_obj_template: str = Field(default="fix_troubled_obj")
249
- """The name of the fix troubled object template which will be used to fix a troubled object."""
250
-
251
- fix_troubled_string_template: str = Field(default="fix_troubled_string")
252
- """The name of the fix troubled string template which will be used to fix a troubled string."""
253
-
254
- rule_requirement_template: str = Field(default="rule_requirement")
255
- """The name of the rule requirement template which will be used to generate a rule requirement."""
256
-
257
- extract_template: str = Field(default="extract")
258
- """The name of the extract template which will be used to extract model from string."""
259
-
260
- chap_summary_template: str = Field(default="chap_summary")
261
- """The name of the chap summary template which will be used to generate a chapter summary."""
262
-
263
-
264
- class MagikaConfig(BaseModel):
265
- """Magika configuration class."""
266
-
267
- model_config = ConfigDict(use_attribute_docstrings=True)
268
- model_dir: Optional[DirectoryPath] = Field(default=None)
269
- """The directory containing the models for magika."""
270
-
271
-
272
- class GeneralConfig(BaseModel):
273
- """Global configuration class."""
274
-
275
- model_config = ConfigDict(use_attribute_docstrings=True)
276
- workspace: DirectoryPath = Field(default=Path())
277
- """The workspace directory for the application."""
278
-
279
- confirm_on_ops: bool = Field(default=True)
280
- """Whether to confirm on operations."""
281
-
282
- use_json_repair: bool = Field(default=True)
283
- """Whether to use JSON repair."""
284
-
285
-
286
- class ToolBoxConfig(BaseModel):
287
- """Toolbox configuration class."""
288
-
289
- model_config = ConfigDict(use_attribute_docstrings=True)
290
-
291
- tool_module_name: str = Field(default="Toolbox")
292
- """The name of the module containing the toolbox."""
293
-
294
- data_module_name: str = Field(default="Data")
295
- """The name of the module containing the data."""
296
-
297
-
298
- class RagConfig(BaseModel):
299
- """RAG configuration class."""
300
-
301
- model_config = ConfigDict(use_attribute_docstrings=True)
302
-
303
- milvus_uri: Optional[HttpUrl] = Field(default=HttpUrl("http://localhost:19530"))
304
- """The URI of the Milvus server."""
305
- milvus_timeout: Optional[PositiveFloat] = Field(default=30.0)
306
- """The timeout of the Milvus server."""
307
- milvus_token: Optional[SecretStr] = Field(default=None)
308
- """The token of the Milvus server."""
309
- milvus_dimensions: Optional[PositiveInt] = Field(default=None)
310
- """The dimensions of the Milvus server."""
311
-
312
-
313
- class CacheConfig(BaseModel):
314
- """cache configuration class, uses litellm as cache backend. more info see https://docs.litellm.ai/docs/caching/all_caches."""
315
-
316
- model_config = ConfigDict(use_attribute_docstrings=True)
317
-
318
- type: LiteLLMCacheType = LiteLLMCacheType.LOCAL
319
- """The type of cache to use. If None, the default cache type will be used."""
320
- params: CacheKwargs = Field(default_factory=CacheKwargs)
321
- """The parameters for the cache. If type is None, the default parameters will be used."""
322
- enabled: bool = Field(default=False)
323
- """Whether to enable cache."""
324
-
325
-
326
- class RoutingConfig(BaseModel):
327
- """Routing configuration class."""
328
-
329
- model_config = ConfigDict(use_attribute_docstrings=True)
330
-
331
- max_parallel_requests: Optional[int] = 60
332
- """The maximum number of parallel requests. None means not checked."""
333
- allowed_fails: Optional[int] = 3
334
- """The number of allowed fails before the routing is considered failed."""
335
- retry_after: int = 15
336
- """Minimum time to wait before retrying a failed request."""
337
- cooldown_time: Optional[int] = 60
338
- """Time to cooldown a deployment after failure in seconds."""
339
-
340
-
341
- class Settings(BaseSettings):
342
- """Application settings class.
343
-
344
- Attributes:
345
- llm (LLMConfig): LLM Configuration
346
- debug (DebugConfig): Debug Configuration
347
- pymitter (PymitterConfig): Pymitter Configuration
348
- templates (TemplateConfig): Template Configuration
349
- magika (MagikaConfig): Magika Configuration
350
- """
351
-
352
- model_config = SettingsConfigDict(
353
- env_prefix="FABRIK_",
354
- env_nested_delimiter="__",
355
- pyproject_toml_depth=1,
356
- pyproject_toml_table_header=("tool", "fabricatio"),
357
- toml_file=["fabricatio.toml", rf"{ROAMING_DIR}\fabricatio.toml"],
358
- env_file=[".env", ".envrc"],
359
- use_attribute_docstrings=True,
360
- extra="ignore",
361
- )
362
-
363
- llm: LLMConfig = Field(default_factory=LLMConfig)
364
- """LLM Configuration"""
365
-
366
- routing: RoutingConfig = Field(default_factory=RoutingConfig)
367
- """Routing Configuration"""
368
-
369
- embedding: EmbeddingConfig = Field(default_factory=EmbeddingConfig)
370
- """Embedding Configuration"""
371
-
372
- debug: DebugConfig = Field(default_factory=DebugConfig)
373
- """Debug Configuration"""
374
-
375
- pymitter: PymitterConfig = Field(default_factory=PymitterConfig)
376
- """Pymitter Configuration"""
377
-
378
- templates: TemplateConfig = Field(default_factory=TemplateConfig)
379
- """Template Configuration"""
380
-
381
- magika: MagikaConfig = Field(default_factory=MagikaConfig)
382
- """Magika Configuration"""
383
-
384
- general: GeneralConfig = Field(default_factory=GeneralConfig)
385
- """General Configuration"""
386
-
387
- toolbox: ToolBoxConfig = Field(default_factory=ToolBoxConfig)
388
- """Toolbox Configuration"""
389
-
390
- rag: RagConfig = Field(default_factory=RagConfig)
391
- """RAG Configuration"""
392
-
393
- cache: CacheConfig = Field(default_factory=CacheConfig)
394
- """Cache Configuration"""
395
-
396
- @classmethod
397
- def settings_customise_sources(
398
- cls,
399
- settings_cls: type[BaseSettings],
400
- init_settings: PydanticBaseSettingsSource,
401
- env_settings: PydanticBaseSettingsSource,
402
- dotenv_settings: PydanticBaseSettingsSource,
403
- file_secret_settings: PydanticBaseSettingsSource,
404
- ) -> tuple[PydanticBaseSettingsSource, ...]:
405
- """Customize settings sources.
406
-
407
- This method customizes the settings sources used by the application. It returns a tuple of settings sources, including
408
- the dotenv settings source, environment settings source, a custom TomlConfigSettingsSource, and a custom
409
-
410
- Args:
411
- settings_cls (type[BaseSettings]): The settings class.
412
- init_settings (PydanticBaseSettingsSource): Initial settings source.
413
- env_settings (PydanticBaseSettingsSource): Environment settings source.
414
- dotenv_settings (PydanticBaseSettingsSource): Dotenv settings source.
415
- file_secret_settings (PydanticBaseSettingsSource): File secret settings source.
416
-
417
- Returns:
418
- tuple[PydanticBaseSettingsSource, ...]: A tuple of settings sources.
419
- """
420
- return (
421
- init_settings,
422
- dotenv_settings,
423
- env_settings,
424
- file_secret_settings,
425
- PyprojectTomlConfigSettingsSource(settings_cls),
426
- TomlConfigSettingsSource(settings_cls),
427
- )
428
-
429
-
430
- configs: Settings = Settings()
fabricatio/constants.py DELETED
@@ -1,20 +0,0 @@
1
- """A module containing constants used throughout the library."""
2
- from enum import StrEnum
3
-
4
-
5
- class TaskStatus(StrEnum):
6
- """An enumeration representing the status of a task.
7
-
8
- Attributes:
9
- Pending: The task is pending.
10
- Running: The task is currently running.
11
- Finished: The task has been successfully completed.
12
- Failed: The task has failed.
13
- Cancelled: The task has been cancelled.
14
- """
15
-
16
- Pending = "pending"
17
- Running = "running"
18
- Finished = "finished"
19
- Failed = "failed"
20
- Cancelled = "cancelled"
@@ -1,120 +0,0 @@
1
- """The module containing the Event class."""
2
-
3
- from typing import List, Self, Union
4
-
5
- from fabricatio.config import configs
6
- from fabricatio.constants import TaskStatus
7
- from pydantic import BaseModel, ConfigDict, Field
8
-
9
- type EventLike = Union[str, List[str], "Event"]
10
-
11
-
12
- class Event(BaseModel):
13
- """A class representing an event."""
14
-
15
- model_config = ConfigDict(use_attribute_docstrings=True)
16
-
17
- segments: List[str] = Field(default_factory=list, frozen=True)
18
- """ The segments of the namespaces."""
19
-
20
- @classmethod
21
- def instantiate_from(cls, event: EventLike) -> "Event":
22
- """Create an Event instance from a string or list of strings or an Event instance.
23
-
24
- Args:
25
- event (EventLike): The event to instantiate from.
26
-
27
- Returns:
28
- Event: The Event instance.
29
- """
30
- if isinstance(event, Event):
31
- return event.clone()
32
- if isinstance(event, str):
33
- event = event.split(configs.pymitter.delimiter)
34
-
35
- return cls(segments=event)
36
-
37
- @classmethod
38
- def quick_instantiate(cls, event: EventLike) -> "Event":
39
- """Create an Event instance from a string or list of strings or an Event instance and push a wildcard and pending segment.
40
-
41
- Args:
42
- event (EventLike): The event to instantiate from.
43
-
44
- Returns:
45
- Event: The Event instance.
46
-
47
- Notes:
48
- This method is used to create an Event instance from a string or list of strings or an Event instance and push a wildcard and pending segment.
49
- """
50
- return cls.instantiate_from(event).push_wildcard().push_pending()
51
-
52
- def derive(self, event: EventLike) -> Self:
53
- """Derive a new event from this event and another event or a string."""
54
- return self.clone().concat(event)
55
-
56
- def collapse(self) -> str:
57
- """Collapse the event into a string."""
58
- return configs.pymitter.delimiter.join(self.segments)
59
-
60
- def clone(self) -> Self:
61
- """Clone the event."""
62
- return self.__class__(segments=list(self.segments))
63
-
64
- def push(self, segment: str) -> Self:
65
- """Push a segment to the event."""
66
- if not segment:
67
- raise ValueError("The segment must not be empty.")
68
- if configs.pymitter.delimiter in segment:
69
- raise ValueError("The segment must not contain the delimiter.")
70
-
71
- self.segments.append(segment)
72
- return self
73
-
74
- def push_wildcard(self) -> Self:
75
- """Push a wildcard segment to the event."""
76
- return self.push("*")
77
-
78
- def push_pending(self) -> Self:
79
- """Push a pending segment to the event."""
80
- return self.push(TaskStatus.Pending)
81
-
82
- def push_running(self) -> Self:
83
- """Push a running segment to the event."""
84
- return self.push(TaskStatus.Running)
85
-
86
- def push_finished(self) -> Self:
87
- """Push a finished segment to the event."""
88
- return self.push(TaskStatus.Finished)
89
-
90
- def push_failed(self) -> Self:
91
- """Push a failed segment to the event."""
92
- return self.push(TaskStatus.Failed)
93
-
94
- def push_cancelled(self) -> Self:
95
- """Push a cancelled segment to the event."""
96
- return self.push(TaskStatus.Cancelled)
97
-
98
- def pop(self) -> str:
99
- """Pop a segment from the event."""
100
- return self.segments.pop()
101
-
102
- def clear(self) -> Self:
103
- """Clear the event."""
104
- self.segments.clear()
105
- return self
106
-
107
- def concat(self, event: EventLike) -> Self:
108
- """Concatenate another event to this event."""
109
- self.segments.extend(Event.instantiate_from(event).segments)
110
- return self
111
-
112
- def __hash__(self) -> int:
113
- """Return the hash of the event, using the collapsed string."""
114
- return hash(self.collapse())
115
-
116
- def __eq__(self, other: object) -> bool:
117
- """Check if the event is equal to another event or a string."""
118
- if not isinstance(other, (str , list , Event)):
119
- return False
120
- return self.collapse() == Event.instantiate_from(other).collapse()
@@ -1,10 +0,0 @@
1
- """Some necessary instances."""
2
-
3
- from fabricatio.config import configs
4
- from fabricatio.rust import TemplateManager
5
-
6
- TEMPLATE_MANAGER = TemplateManager(
7
- template_dirs=configs.templates.template_dir,
8
- suffix=configs.templates.template_suffix,
9
- active_loading=configs.templates.active_loading,
10
- )
@@ -1,67 +0,0 @@
1
- fabricatio-0.2.13.dev3.dist-info/METADATA,sha256=4VR-__6SDN1KEhH8cc6CMFqlD9dgq7Van2SValZiX1I,5316
2
- fabricatio-0.2.13.dev3.dist-info/WHEEL,sha256=jABKVkLC9kJr8mi_er5jOqpiQUjARSLXDUIIxDqsS50,96
3
- fabricatio-0.2.13.dev3.dist-info/licenses/LICENSE,sha256=do7J7EiCGbq0QPbMAL_FqLYufXpHnCnXBOuqVPwSV8Y,1088
4
- fabricatio/actions/article.py,sha256=c9HfLM1p0kkdEcQrl8w6Qa5p8riPnkEO--QbNZj88HQ,12562
5
- fabricatio/actions/article_rag.py,sha256=HJOiDblADZM1XXtBv3-v6lgh4gAFrS9LxKn5qKxR8Dw,18425
6
- fabricatio/actions/fs.py,sha256=gJR14U4ln35nt8Z7OWLVAZpqGaLnED-r1Yi-lX22tkI,959
7
- fabricatio/actions/output.py,sha256=lX0HkDse3ypCzZgeF-8Dr-EnNFdBiE-WQ1iLPFlGM1g,8302
8
- fabricatio/actions/rag.py,sha256=KN-OWgcQjGmNgSZ-s5B8m4LpYKSGFJR8eq72mo2CP9k,3592
9
- fabricatio/actions/rules.py,sha256=dkvCgNDjt2KSO1VgPRsxT4YBmIIMeetZb5tiz-slYkU,3640
10
- fabricatio/actions/__init__.py,sha256=wVENCFtpVb1rLFxoOFJt9-8smLWXuJV7IwA8P3EfFz4,48
11
- fabricatio/capabilities/advanced_judge.py,sha256=selB0Gwf1F4gGJlwBiRo6gI4KOUROgh3WnzO3mZFEls,706
12
- fabricatio/capabilities/advanced_rag.py,sha256=FaXHGOqS4VleGSLsnC5qm4S4EBcHZLZbj8TjXRieKBs,2513
13
- fabricatio/capabilities/censor.py,sha256=bBT5qy-kp7fh8g4Lz3labSwxwJ60gGd_vrkc6k1cZ1U,4719
14
- fabricatio/capabilities/check.py,sha256=kYqzohhv2bZfl1aKSUt7a8snT8YEl2zgha_ZdAdMMfQ,8622
15
- fabricatio/capabilities/correct.py,sha256=W_cInqlciNEhyMK0YI53jk4EvW9uAdge90IO9OElUmA,10420
16
- fabricatio/capabilities/extract.py,sha256=PMjkWvbsv57IYT7zzd_xbIu4eQqQjpcmBtJzqlWZhHY,2495
17
- fabricatio/capabilities/propose.py,sha256=hkBeSlmcTdfYWT-ph6nlbtHXBozi_JXqXlWcnBy3W78,2007
18
- fabricatio/capabilities/rag.py,sha256=icJgFwEX4eOlZdtchDaITjFRBrAON6xezyFfPmzehI8,11058
19
- fabricatio/capabilities/rating.py,sha256=iMtQs3H6vCjuEjiuuz4SRKMVaX7yff7MHWz-slYvi5g,17835
20
- fabricatio/capabilities/review.py,sha256=-EMZe0ADFPT6fPGmra16UPjJC1M3rAs6dPFdTZ88Fgg,5060
21
- fabricatio/capabilities/task.py,sha256=uks1U-4LNCUdwdRxAbJJjMc31hOw6jlrcYriuQQfb04,4475
22
- fabricatio/capabilities/__init__.py,sha256=v1cHRHIJ2gxyqMLNCs6ERVcCakSasZNYzmMI4lqAcls,57
23
- fabricatio/config.py,sha256=XoGU5PMqVNW8p_5VD2qE3_g3UpjpSBHUzvjXlgNS0lM,18126
24
- fabricatio/constants.py,sha256=thfDuF6JEtJ5CHOnAJLfqvn5834n8ep6DH2jc6XGzQM,577
25
- fabricatio/core.py,sha256=VQ_JKgUGIy2gZ8xsTBZCdr_IP7wC5aPg0_bsOmjQ588,6458
26
- fabricatio/decorators.py,sha256=RFMYUlQPf561-BIHetpMd7fPig5bZ2brzWiQTgoLOlY,8966
27
- fabricatio/fs/curd.py,sha256=652nHulbJ3gwt0Z3nywtPMmjhEyglDvEfc3p7ieJNNA,4777
28
- fabricatio/fs/readers.py,sha256=UXvcJO3UCsxHu9PPkg34Yh55Zi-miv61jD_wZQJgKRs,1751
29
- fabricatio/fs/__init__.py,sha256=FydmlEY_3QY74r1BpGDc5lFLhE6g6gkwOAtE30Fo-aI,786
30
- fabricatio/journal.py,sha256=stnEP88aUBA_GmU9gfTF2EZI8FS2OyMLGaMSTgK4QgA,476
31
- fabricatio/models/action.py,sha256=qxPeOD_nYNN94MzOhCzRDhySZFvM8uoZb_hhA7d_yn4,10609
32
- fabricatio/models/adv_kwargs_types.py,sha256=IBV3ZcsNLvvEjO_2hBpYg_wLSpNKaMx6Ndam3qXJCw8,2097
33
- fabricatio/models/events.py,sha256=wiirk_ASg3iXDOZU_gIimci1VZVzWE1nDmxy-hQVJ9M,4150
34
- fabricatio/models/extra/advanced_judge.py,sha256=INUl_41C8jkausDekkjnEmTwNfLCJ23TwFjq2cM23Cw,1092
35
- fabricatio/models/extra/aricle_rag.py,sha256=6mkuxNZD_8cdWINmxP8ajmTwdwSH45jcdUSBmY6ZZfQ,11685
36
- fabricatio/models/extra/article_base.py,sha256=0dVVbcv5GjjqJOGvobpM9CaIS876ymye8GH9EZ2jUCk,16762
37
- fabricatio/models/extra/article_essence.py,sha256=mlIkkRMR3I1RtqiiOnmIE3Vy623L4eECumkRzryE1pw,2749
38
- fabricatio/models/extra/article_main.py,sha256=zUkFQRLv6cLoPBbo7H21rrRScjgGv_SzhFd0Y514FsA,11211
39
- fabricatio/models/extra/article_outline.py,sha256=mw7eOuKMJgns4bihjcjOEIpAy38i0g-x6T6Vx3J0T5A,1629
40
- fabricatio/models/extra/article_proposal.py,sha256=NbyjW-7UiFPtnVD9nte75re4xL2pD4qL29PpNV4Cg_M,1870
41
- fabricatio/models/extra/patches.py,sha256=_WNCxtYzzsVfUxI16vu4IqsLahLYRHdbQN9er9tqhC0,997
42
- fabricatio/models/extra/problem.py,sha256=8tTU-3giFHOi5j7NJsvH__JJyYcaGrcfsRnkzQNm0Ew,7216
43
- fabricatio/models/extra/rag.py,sha256=RMi8vhEPB0I5mVmjRLRLxYHUnm9pFhvVwysaIwmW2s0,3955
44
- fabricatio/models/extra/rule.py,sha256=KQQELVhCLUXhEZ35jU3WGYqKHuCYEAkn0p6pxAE-hOU,2625
45
- fabricatio/models/extra/__init__.py,sha256=XlYnS_2B9nhLhtQkjE7rvvfPmAAtXVdNi9bSDAR-Ge8,54
46
- fabricatio/models/generic.py,sha256=xk2Q_dADxUIGUuaqahCPTnZ4HwBRD67HCs13ZA5_LnE,31364
47
- fabricatio/models/kwargs_types.py,sha256=gIvLSof3XE-B0cGE5d1BrOQB1HO8Pd666_scd-9JaF4,5000
48
- fabricatio/models/role.py,sha256=b8FDRF4VjMMt93Uh5yiAufFbsoH7RcUaaFJAjVmq2l0,2931
49
- fabricatio/models/task.py,sha256=bLYSKjlRAlb4jMYyF12RTnm_8pVXysSmX8CYLrEmbQ8,11096
50
- fabricatio/models/tool.py,sha256=jQ51g4lwTPfsMF1nbreDJtBczbxIHoXcPuLSOqHliq8,12506
51
- fabricatio/models/usages.py,sha256=0bzITf0vug9ZaN6qnjNfFB7T8BAvpXE0bvx0otFYLLA,33356
52
- fabricatio/parser.py,sha256=-RbW2yzfJiu2ARq-lZw4tfgsjY2rIZWtJpoUmaE6gJQ,6637
53
- fabricatio/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
54
- fabricatio/rust.pyi,sha256=ermwopmW2vbR05fQenayq4tbHIf6y0a64SMlp4ftoZA,12640
55
- fabricatio/rust_instances.py,sha256=Byeo8KHW_dJiXujJq7YPGDLBX5bHNDYbBc4sY3uubVY,313
56
- fabricatio/toolboxes/arithmetic.py,sha256=WLqhY-Pikv11Y_0SGajwZx3WhsLNpHKf9drzAqOf_nY,1369
57
- fabricatio/toolboxes/fs.py,sha256=l4L1CVxJmjw9Ld2XUpIlWfV0_Fu_2Og6d3E13I-S4aE,736
58
- fabricatio/toolboxes/__init__.py,sha256=KBJi5OG_pExscdlM7Bnt_UF43j4I3Lv6G71kPVu4KQU,395
59
- fabricatio/utils.py,sha256=IBKfs2Rg3bJnazzvj1-Fz1rMWNKhiuQG5_rZ1nxQeMI,10299
60
- fabricatio/workflows/articles.py,sha256=ObYTFUqLUk_CzdmmnX6S7APfxcGmPFqnFr9pdjU7Z4Y,969
61
- fabricatio/workflows/rag.py,sha256=-YYp2tlE9Vtfgpg6ROpu6QVO8j8yVSPa6yDzlN3qVxs,520
62
- fabricatio/workflows/__init__.py,sha256=5ScFSTA-bvhCesj3U9Mnmi6Law6N1fmh5UKyh58L3u8,51
63
- fabricatio/__init__.py,sha256=Rmvq2VgdS2u68vnOi2i5RbeWbAwrJDbk8D8D883PJWE,1022
64
- fabricatio/rust.cp312-win_amd64.pyd,sha256=hY2p1xhnfqN0T9y9S3oVhE3jjaRdISnpjx7GD07dg-w,4465664
65
- fabricatio-0.2.13.dev3.data/scripts/tdown.exe,sha256=xQabNheXRfFgZNVr_nOZkpbJ_O5RvJXn1nhtR45Vvaw,3359232
66
- fabricatio-0.2.13.dev3.data/scripts/ttm.exe,sha256=69ytRENft3g9IM_KG9NYulGvbeD4lZdp7QfcK2MJCVM,2554880
67
- fabricatio-0.2.13.dev3.dist-info/RECORD,,