fabricatio 0.2.6.dev5__cp39-cp39-win_amd64.whl → 0.2.6.dev7__cp39-cp39-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.
Binary file
@@ -93,10 +93,11 @@ class CorrectProposal(Action):
93
93
  f"{task_input.briefing}\nExtract the path of file, which contains the article briefing that I need to read."
94
94
  )
95
95
 
96
- rprint(article_proposal.display())
97
96
  ret = None
98
97
  while await confirm("Do you want to correct the Proposal?").ask_async():
99
- topic = await text("What is the topic of the proposal?").ask_async()
98
+ rprint(article_proposal.display())
99
+ while not (topic := await text("What is the topic of the proposal reviewing?").ask_async()):
100
+ ...
100
101
  ret = await self.correct_obj(
101
102
  article_proposal,
102
103
  safe_text_read(input_path),
@@ -115,11 +116,13 @@ class CorrectOutline(Action):
115
116
  self,
116
117
  article_outline: ArticleOutline,
117
118
  article_proposal: ArticleProposal,
119
+
118
120
  **_,
119
121
  ) -> Optional[str]:
120
- rprint(article_outline.finalized_dump())
121
122
  ret = None
122
123
  while await confirm("Do you want to correct the outline?").ask_async():
123
- topic = await text("What is the topic of the outline?").ask_async()
124
+ rprint(article_outline.finalized_dump())
125
+ while not (topic := await text("What is the topic of the outline reviewing?").ask_async()):
126
+ ...
124
127
  ret = await self.correct_obj(article_outline, article_proposal.display(), topic=topic)
125
128
  return ret or article_outline
@@ -15,13 +15,13 @@ from fabricatio.config import configs
15
15
  from fabricatio.journal import logger
16
16
  from fabricatio.models.kwargs_types import (
17
17
  ChooseKwargs,
18
- CollectionSimpleConfigKwargs,
18
+ CollectionConfigKwargs,
19
19
  EmbeddingKwargs,
20
20
  FetchKwargs,
21
21
  LLMKwargs,
22
22
  )
23
23
  from fabricatio.models.usages import EmbeddingUsage
24
- from fabricatio.models.utils import MilvusData
24
+ from fabricatio.models.utils import MilvusData, ok
25
25
  from more_itertools.recipes import flatten, unique
26
26
  from pydantic import Field, PrivateAttr
27
27
 
@@ -60,7 +60,7 @@ class RAG(EmbeddingUsage):
60
60
  ) -> Self:
61
61
  """Initialize the Milvus client."""
62
62
  self._client = create_client(
63
- uri=milvus_uri or (self.milvus_uri or configs.rag.milvus_uri).unicode_string(),
63
+ uri=milvus_uri or ok(self.milvus_uri or configs.rag.milvus_uri).unicode_string(),
64
64
  token=milvus_token
65
65
  or (token.get_secret_value() if (token := (self.milvus_token or configs.rag.milvus_token)) else ""),
66
66
  timeout=milvus_timeout or self.milvus_timeout,
@@ -102,14 +102,14 @@ class RAG(EmbeddingUsage):
102
102
  ]
103
103
 
104
104
  def view(
105
- self, collection_name: Optional[str], create: bool = False, **kwargs: Unpack[CollectionSimpleConfigKwargs]
105
+ self, collection_name: Optional[str], create: bool = False, **kwargs: Unpack[CollectionConfigKwargs]
106
106
  ) -> Self:
107
107
  """View the specified collection.
108
108
 
109
109
  Args:
110
110
  collection_name (str): The name of the collection.
111
111
  create (bool): Whether to create the collection if it does not exist.
112
- **kwargs (Unpack[CollectionSimpleConfigKwargs]): Additional keyword arguments for collection configuration.
112
+ **kwargs (Unpack[CollectionConfigKwargs]): Additional keyword arguments for collection configuration.
113
113
  """
114
114
  if create and collection_name and self.client.has_collection(collection_name):
115
115
  kwargs["dimension"] = kwargs.get("dimension") or self.milvus_dimensions or configs.rag.milvus_dimensions
@@ -315,7 +315,7 @@ class RAG(EmbeddingUsage):
315
315
  **kwargs,
316
316
  )
317
317
 
318
- async def arefined_query(self, question: List[str] | str, **kwargs: Unpack[ChooseKwargs]) -> List[str]:
318
+ async def arefined_query(self, question: List[str] | str, **kwargs: Unpack[ChooseKwargs]) -> Optional[List[str]]:
319
319
  """Refines the given question using a template.
320
320
 
321
321
  Args:
fabricatio/config.py CHANGED
@@ -66,7 +66,7 @@ class LLMConfig(BaseModel):
66
66
  temperature: Optional[NonNegativeFloat] = Field(default=1.0)
67
67
  """The temperature of the LLM model. Controls randomness in generation. Set to 1.0 as per request."""
68
68
 
69
- stop_sign: Optional[str | List[str]] = Field(default="")
69
+ stop_sign: Optional[str | List[str]] = Field(default=None)
70
70
  """The stop sign of the LLM model. No default stop sign specified."""
71
71
 
72
72
  top_p: Optional[NonNegativeFloat] = Field(default=0.35)
@@ -78,7 +78,7 @@ class LLMConfig(BaseModel):
78
78
  stream: Optional[bool] = Field(default=False)
79
79
  """Whether to stream the LLM model's response. Default is False."""
80
80
 
81
- max_tokens: Optional[PositiveInt] = Field(default=8192)
81
+ max_tokens: Optional[PositiveInt] = Field(default=None)
82
82
  """The maximum number of tokens to generate. Set to 8192 as per request."""
83
83
 
84
84
  rpm: Optional[PositiveInt] = Field(default=100)
@@ -148,13 +148,13 @@ class DebugConfig(BaseModel):
148
148
  log_level: Literal["DEBUG", "INFO", "SUCCESS", "WARNING", "ERROR", "CRITICAL"] = Field(default="INFO")
149
149
  """The log level of the application."""
150
150
 
151
- log_file: FilePath = Field(default=Path(rf"{ROAMING_DIR}\fabricatio.log"))
151
+ log_file: FilePath = Field(default=Path(rf"{ROAMING_DIR}\fabricatio.log"), frozen=True)
152
152
  """The log file of the application."""
153
153
 
154
- rotation: int = Field(default=1)
154
+ rotation: int = Field(default=1, frozen=True)
155
155
  """The rotation of the log file. in weeks."""
156
156
 
157
- retention: int = Field(default=2)
157
+ retention: int = Field(default=2, frozen=True)
158
158
  """The retention of the log file. in weeks."""
159
159
 
160
160
  streaming_visible: bool = Field(default=False)
@@ -10,7 +10,6 @@ from asyncio import Queue, create_task
10
10
  from typing import Any, Dict, Self, Tuple, Type, Union, final
11
11
 
12
12
  from fabricatio.capabilities.correct import Correct
13
- from fabricatio.capabilities.covalidate import CoValidate
14
13
  from fabricatio.capabilities.task import HandleTask, ProposeTask
15
14
  from fabricatio.journal import logger
16
15
  from fabricatio.models.generic import WithBriefing
@@ -19,7 +18,7 @@ from fabricatio.models.usages import ToolBoxUsage
19
18
  from pydantic import Field, PrivateAttr
20
19
 
21
20
 
22
- class Action(HandleTask, ProposeTask, Correct, CoValidate):
21
+ class Action(HandleTask, ProposeTask, Correct):
23
22
  """Class that represents an action to be executed in a workflow.
24
23
 
25
24
  Actions are the atomic units of work in a workflow. Each action performs