fabricatio 0.2.6.dev3__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.
- fabricatio/__init__.py +60 -0
- fabricatio/_rust.cp39-win_amd64.pyd +0 -0
- fabricatio/_rust.pyi +116 -0
- fabricatio/_rust_instances.py +10 -0
- fabricatio/actions/article.py +81 -0
- fabricatio/actions/output.py +19 -0
- fabricatio/actions/rag.py +25 -0
- fabricatio/capabilities/correct.py +115 -0
- fabricatio/capabilities/propose.py +49 -0
- fabricatio/capabilities/rag.py +369 -0
- fabricatio/capabilities/rating.py +339 -0
- fabricatio/capabilities/review.py +278 -0
- fabricatio/capabilities/task.py +113 -0
- fabricatio/config.py +400 -0
- fabricatio/core.py +181 -0
- fabricatio/decorators.py +179 -0
- fabricatio/fs/__init__.py +29 -0
- fabricatio/fs/curd.py +149 -0
- fabricatio/fs/readers.py +46 -0
- fabricatio/journal.py +21 -0
- fabricatio/models/action.py +158 -0
- fabricatio/models/events.py +120 -0
- fabricatio/models/extra.py +171 -0
- fabricatio/models/generic.py +406 -0
- fabricatio/models/kwargs_types.py +158 -0
- fabricatio/models/role.py +48 -0
- fabricatio/models/task.py +299 -0
- fabricatio/models/tool.py +189 -0
- fabricatio/models/usages.py +682 -0
- fabricatio/models/utils.py +167 -0
- fabricatio/parser.py +149 -0
- fabricatio/py.typed +0 -0
- fabricatio/toolboxes/__init__.py +15 -0
- fabricatio/toolboxes/arithmetic.py +62 -0
- fabricatio/toolboxes/fs.py +31 -0
- fabricatio/workflows/articles.py +15 -0
- fabricatio/workflows/rag.py +11 -0
- fabricatio-0.2.6.dev3.data/scripts/tdown.exe +0 -0
- fabricatio-0.2.6.dev3.dist-info/METADATA +432 -0
- fabricatio-0.2.6.dev3.dist-info/RECORD +42 -0
- fabricatio-0.2.6.dev3.dist-info/WHEEL +4 -0
- fabricatio-0.2.6.dev3.dist-info/licenses/LICENSE +21 -0
fabricatio/__init__.py
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
"""Fabricatio is a Python library for building llm app using event-based agent structure."""
|
2
|
+
|
3
|
+
from importlib.util import find_spec
|
4
|
+
|
5
|
+
from fabricatio._rust import BibManager
|
6
|
+
from fabricatio._rust_instances import TEMPLATE_MANAGER
|
7
|
+
from fabricatio.actions.article import ExtractArticleEssence, GenerateArticleProposal, GenerateOutline
|
8
|
+
from fabricatio.actions.output import DumpFinalizedOutput
|
9
|
+
from fabricatio.core import env
|
10
|
+
from fabricatio.fs import MAGIKA, safe_json_read, safe_text_read
|
11
|
+
from fabricatio.journal import logger
|
12
|
+
from fabricatio.models.action import Action, WorkFlow
|
13
|
+
from fabricatio.models.events import Event
|
14
|
+
from fabricatio.models.extra import ArticleEssence
|
15
|
+
from fabricatio.models.role import Role
|
16
|
+
from fabricatio.models.task import Task
|
17
|
+
from fabricatio.models.tool import ToolBox
|
18
|
+
from fabricatio.models.utils import Message, Messages
|
19
|
+
from fabricatio.parser import Capture, GenericCapture, JsonCapture, PythonCapture
|
20
|
+
from fabricatio.toolboxes import arithmetic_toolbox, basic_toolboxes, fs_toolbox
|
21
|
+
from fabricatio.workflows.articles import WriteOutlineWorkFlow
|
22
|
+
|
23
|
+
__all__ = [
|
24
|
+
"MAGIKA",
|
25
|
+
"TEMPLATE_MANAGER",
|
26
|
+
"Action",
|
27
|
+
"ArticleEssence",
|
28
|
+
"BibManager",
|
29
|
+
"Capture",
|
30
|
+
"DumpFinalizedOutput",
|
31
|
+
"Event",
|
32
|
+
"ExtractArticleEssence",
|
33
|
+
"GenerateArticleProposal",
|
34
|
+
"GenerateOutline",
|
35
|
+
"GenericCapture",
|
36
|
+
"JsonCapture",
|
37
|
+
"Message",
|
38
|
+
"Messages",
|
39
|
+
"PythonCapture",
|
40
|
+
"Role",
|
41
|
+
"Task",
|
42
|
+
"ToolBox",
|
43
|
+
"WorkFlow",
|
44
|
+
"WriteOutlineWorkFlow",
|
45
|
+
"arithmetic_toolbox",
|
46
|
+
"basic_toolboxes",
|
47
|
+
"env",
|
48
|
+
"fs_toolbox",
|
49
|
+
"logger",
|
50
|
+
"safe_json_read",
|
51
|
+
"safe_text_read",
|
52
|
+
]
|
53
|
+
|
54
|
+
|
55
|
+
if find_spec("pymilvus"):
|
56
|
+
from fabricatio.actions.rag import InjectToDB
|
57
|
+
from fabricatio.capabilities.rag import RAG
|
58
|
+
from fabricatio.workflows.rag import StoreArticle
|
59
|
+
|
60
|
+
__all__ += ["RAG", "InjectToDB", "StoreArticle"]
|
Binary file
|
fabricatio/_rust.pyi
ADDED
@@ -0,0 +1,116 @@
|
|
1
|
+
from pathlib import Path
|
2
|
+
from typing import Any, Dict, List, Optional
|
3
|
+
|
4
|
+
|
5
|
+
class TemplateManager:
|
6
|
+
"""Template rendering engine using Handlebars templates.
|
7
|
+
|
8
|
+
This manager handles template discovery, loading, and rendering
|
9
|
+
through a wrapper around the handlebars-rust engine.
|
10
|
+
|
11
|
+
See: https://crates.io/crates/handlebars
|
12
|
+
"""
|
13
|
+
|
14
|
+
def __init__(
|
15
|
+
self, template_dirs: List[Path], suffix: Optional[str] = None, active_loading: Optional[bool] = None
|
16
|
+
) -> None:
|
17
|
+
"""Initialize the template manager.
|
18
|
+
|
19
|
+
Args:
|
20
|
+
template_dirs: List of directories containing template files
|
21
|
+
suffix: File extension for templates (defaults to 'hbs')
|
22
|
+
active_loading: Whether to enable dev mode for reloading templates on change
|
23
|
+
"""
|
24
|
+
|
25
|
+
@property
|
26
|
+
def template_count(self) -> int:
|
27
|
+
"""Returns the number of currently loaded templates."""
|
28
|
+
|
29
|
+
def get_template_source(self, name: str) -> Optional[str]:
|
30
|
+
"""Get the filesystem path for a template.
|
31
|
+
|
32
|
+
Args:
|
33
|
+
name: Template name (without extension)
|
34
|
+
|
35
|
+
Returns:
|
36
|
+
Path to the template file if found, None otherwise
|
37
|
+
"""
|
38
|
+
|
39
|
+
def discover_templates(self) -> None:
|
40
|
+
"""Scan template directories and load available templates.
|
41
|
+
|
42
|
+
This refreshes the template cache, finding any new or modified templates.
|
43
|
+
"""
|
44
|
+
|
45
|
+
def render_template(self, name: str, data: Dict[str, Any]) -> str:
|
46
|
+
"""Render a template with context data.
|
47
|
+
|
48
|
+
Args:
|
49
|
+
name: Template name (without extension)
|
50
|
+
data: Context dictionary to provide variables to the template
|
51
|
+
|
52
|
+
Returns:
|
53
|
+
Rendered template content as string
|
54
|
+
|
55
|
+
Raises:
|
56
|
+
RuntimeError: If template rendering fails
|
57
|
+
"""
|
58
|
+
|
59
|
+
|
60
|
+
def blake3_hash(content: bytes) -> str:
|
61
|
+
"""Calculate the BLAKE3 cryptographic hash of data.
|
62
|
+
|
63
|
+
Args:
|
64
|
+
content: Bytes to be hashed
|
65
|
+
|
66
|
+
Returns:
|
67
|
+
Hex-encoded BLAKE3 hash string
|
68
|
+
"""
|
69
|
+
|
70
|
+
|
71
|
+
class BibManager:
|
72
|
+
"""BibTeX bibliography manager for parsing and querying citation data."""
|
73
|
+
|
74
|
+
def __init__(self, path: str) -> None:
|
75
|
+
"""Initialize the bibliography manager.
|
76
|
+
|
77
|
+
Args:
|
78
|
+
path: Path to BibTeX (.bib) file to load
|
79
|
+
|
80
|
+
Raises:
|
81
|
+
RuntimeError: If file cannot be read or parsed
|
82
|
+
"""
|
83
|
+
|
84
|
+
def get_cite_key(self, title: str) -> Optional[str]:
|
85
|
+
"""Find citation key by exact title match.
|
86
|
+
|
87
|
+
Args:
|
88
|
+
title: Full title to search for (case-insensitive)
|
89
|
+
|
90
|
+
Returns:
|
91
|
+
Citation key if exact match found, None otherwise
|
92
|
+
"""
|
93
|
+
|
94
|
+
def get_cite_key_fuzzy(self, query: str) -> Optional[str]:
|
95
|
+
"""Find best matching citation using fuzzy text search.
|
96
|
+
|
97
|
+
Args:
|
98
|
+
query: Search term to find in bibliography entries
|
99
|
+
|
100
|
+
Returns:
|
101
|
+
Citation key of best matching entry, or None if no good match
|
102
|
+
|
103
|
+
Notes:
|
104
|
+
Uses nucleo_matcher for high-quality fuzzy text searching
|
105
|
+
See: https://crates.io/crates/nucleo-matcher
|
106
|
+
"""
|
107
|
+
|
108
|
+
def list_titles(self, is_verbatim: Optional[bool] = False) -> List[str]:
|
109
|
+
"""List all titles in the bibliography.
|
110
|
+
|
111
|
+
Args:
|
112
|
+
is_verbatim: Whether to return verbatim titles (without formatting)
|
113
|
+
|
114
|
+
Returns:
|
115
|
+
List of all titles in the bibliography
|
116
|
+
"""
|
@@ -0,0 +1,10 @@
|
|
1
|
+
"""Some necessary instances."""
|
2
|
+
|
3
|
+
from fabricatio._rust import TemplateManager
|
4
|
+
from fabricatio.config import configs
|
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
|
+
)
|
@@ -0,0 +1,81 @@
|
|
1
|
+
"""Actions for transmitting tasks to targets."""
|
2
|
+
|
3
|
+
from os import PathLike
|
4
|
+
from pathlib import Path
|
5
|
+
from typing import Callable, List, Optional
|
6
|
+
|
7
|
+
from fabricatio.fs import safe_text_read
|
8
|
+
from fabricatio.journal import logger
|
9
|
+
from fabricatio.models.action import Action
|
10
|
+
from fabricatio.models.extra import ArticleEssence, ArticleOutline, ArticleProposal
|
11
|
+
from fabricatio.models.task import Task
|
12
|
+
|
13
|
+
|
14
|
+
class ExtractArticleEssence(Action):
|
15
|
+
"""Extract the essence of article(s) in text format from the paths specified in the task dependencies.
|
16
|
+
|
17
|
+
Notes:
|
18
|
+
This action is designed to extract vital information from articles with Markdown format, which is pure text, and
|
19
|
+
which is converted from pdf files using `magic-pdf` from the `MinerU` project, see https://github.com/opendatalab/MinerU
|
20
|
+
"""
|
21
|
+
|
22
|
+
output_key: str = "article_essence"
|
23
|
+
"""The key of the output data."""
|
24
|
+
|
25
|
+
async def _execute[P: PathLike | str](
|
26
|
+
self,
|
27
|
+
task_input: Task,
|
28
|
+
reader: Callable[[P], str] = lambda p: Path(p).read_text(encoding="utf-8"),
|
29
|
+
**_,
|
30
|
+
) -> Optional[List[ArticleEssence]]:
|
31
|
+
if not task_input.dependencies:
|
32
|
+
logger.info(err := "Task not approved, since no dependencies are provided.")
|
33
|
+
raise RuntimeError(err)
|
34
|
+
|
35
|
+
# trim the references
|
36
|
+
contents = ["References".join(c.split("References")[:-1]) for c in map(reader, task_input.dependencies)]
|
37
|
+
return await self.propose(
|
38
|
+
ArticleEssence,
|
39
|
+
contents,
|
40
|
+
system_message=f"# your personal briefing: \n{self.briefing}",
|
41
|
+
)
|
42
|
+
|
43
|
+
|
44
|
+
class GenerateArticleProposal(Action):
|
45
|
+
"""Generate an outline for the article based on the extracted essence."""
|
46
|
+
|
47
|
+
output_key: str = "article_proposal"
|
48
|
+
"""The key of the output data."""
|
49
|
+
|
50
|
+
async def _execute(
|
51
|
+
self,
|
52
|
+
task_input: Task,
|
53
|
+
**_,
|
54
|
+
) -> Optional[ArticleProposal]:
|
55
|
+
input_path = await self.awhich_pathstr(
|
56
|
+
f"{task_input.briefing}\nExtract the path of file, which contains the article briefing that I need to read."
|
57
|
+
)
|
58
|
+
|
59
|
+
return await self.propose(
|
60
|
+
ArticleProposal,
|
61
|
+
safe_text_read(input_path),
|
62
|
+
system_message=f"# your personal briefing: \n{self.briefing}",
|
63
|
+
)
|
64
|
+
|
65
|
+
|
66
|
+
class GenerateOutline(Action):
|
67
|
+
"""Generate the article based on the outline."""
|
68
|
+
|
69
|
+
output_key: str = "article"
|
70
|
+
"""The key of the output data."""
|
71
|
+
|
72
|
+
async def _execute(
|
73
|
+
self,
|
74
|
+
article_proposal: ArticleProposal,
|
75
|
+
**_,
|
76
|
+
) -> Optional[ArticleOutline]:
|
77
|
+
return await self.propose(
|
78
|
+
ArticleOutline,
|
79
|
+
article_proposal.display(),
|
80
|
+
system_message=f"# your personal briefing: \n{self.briefing}",
|
81
|
+
)
|
@@ -0,0 +1,19 @@
|
|
1
|
+
"""Dump the finalized output to a file."""
|
2
|
+
|
3
|
+
from fabricatio.models.action import Action
|
4
|
+
from fabricatio.models.generic import FinalizedDumpAble
|
5
|
+
from fabricatio.models.task import Task
|
6
|
+
|
7
|
+
|
8
|
+
class DumpFinalizedOutput(Action):
|
9
|
+
"""Dump the finalized output to a file."""
|
10
|
+
|
11
|
+
output_key: str = "dump_path"
|
12
|
+
|
13
|
+
async def _execute(self, task_input: Task, to_dump: FinalizedDumpAble, **_) -> str:
|
14
|
+
dump_path = await self.awhich_pathstr(
|
15
|
+
f"{task_input.briefing}\n\nExtract a single path of the file, to which I will dump the data."
|
16
|
+
)
|
17
|
+
|
18
|
+
to_dump.finalized_dump_to(dump_path)
|
19
|
+
return dump_path
|
@@ -0,0 +1,25 @@
|
|
1
|
+
"""Inject data into the database."""
|
2
|
+
|
3
|
+
from typing import List, Optional
|
4
|
+
|
5
|
+
from fabricatio.capabilities.rag import RAG
|
6
|
+
from fabricatio.models.action import Action
|
7
|
+
from fabricatio.models.generic import PrepareVectorization
|
8
|
+
|
9
|
+
|
10
|
+
class InjectToDB(Action, RAG):
|
11
|
+
"""Inject data into the database."""
|
12
|
+
|
13
|
+
output_key: str = "collection_name"
|
14
|
+
|
15
|
+
async def _execute[T: PrepareVectorization](
|
16
|
+
self, to_inject: T | List[T], collection_name: Optional[str] = "my_collection", **_
|
17
|
+
) -> Optional[str]:
|
18
|
+
if not isinstance(to_inject, list):
|
19
|
+
to_inject = [to_inject]
|
20
|
+
|
21
|
+
await self.view(collection_name, create=True).consume_string(
|
22
|
+
[t.prepare_vectorization(self.embedding_max_sequence_length) for t in to_inject],
|
23
|
+
)
|
24
|
+
|
25
|
+
return collection_name
|
@@ -0,0 +1,115 @@
|
|
1
|
+
"""Correct capability module providing advanced review and validation functionality.
|
2
|
+
|
3
|
+
This module implements the Correct capability, which extends the Review functionality
|
4
|
+
to provide mechanisms for reviewing, validating, and correcting various objects and tasks
|
5
|
+
based on predefined criteria and templates.
|
6
|
+
"""
|
7
|
+
|
8
|
+
from typing import Optional, Unpack, cast
|
9
|
+
|
10
|
+
from fabricatio._rust_instances import TEMPLATE_MANAGER
|
11
|
+
from fabricatio.capabilities.review import Review, ReviewResult
|
12
|
+
from fabricatio.config import configs
|
13
|
+
from fabricatio.models.generic import Display, ProposedAble, WithBriefing
|
14
|
+
from fabricatio.models.kwargs_types import CorrectKwargs, ReviewKwargs
|
15
|
+
from fabricatio.models.task import Task
|
16
|
+
|
17
|
+
|
18
|
+
class Correct(Review):
|
19
|
+
"""Correct capability for reviewing, validating, and improving objects.
|
20
|
+
|
21
|
+
This class enhances the Review capability with specialized functionality for
|
22
|
+
correcting and improving objects based on review feedback. It can process
|
23
|
+
various inputs including tasks, strings, and generic objects that implement
|
24
|
+
the required interfaces, applying corrections based on templated review processes.
|
25
|
+
"""
|
26
|
+
|
27
|
+
async def correct_obj[M: ProposedAble](
|
28
|
+
self,
|
29
|
+
obj: M,
|
30
|
+
reference: str = "",
|
31
|
+
supervisor_check: bool = True,
|
32
|
+
**kwargs: Unpack[ReviewKwargs[ReviewResult[str]]],
|
33
|
+
) -> Optional[M]:
|
34
|
+
"""Review and correct an object based on defined criteria and templates.
|
35
|
+
|
36
|
+
This method first conducts a review of the given object, then uses the review results
|
37
|
+
to generate a corrected version of the object using appropriate templates.
|
38
|
+
|
39
|
+
Args:
|
40
|
+
obj (M): The object to be reviewed and corrected. Must implement ProposedAble.
|
41
|
+
reference (str): A reference or contextual information for the object.
|
42
|
+
supervisor_check (bool, optional): Whether to perform a supervisor check on the review results. Defaults to True.
|
43
|
+
**kwargs: Review configuration parameters including criteria and review options.
|
44
|
+
|
45
|
+
Returns:
|
46
|
+
Optional[M]: A corrected version of the input object, or None if correction fails.
|
47
|
+
|
48
|
+
Raises:
|
49
|
+
TypeError: If the provided object doesn't implement Display or WithBriefing interfaces.
|
50
|
+
"""
|
51
|
+
if not isinstance(obj, (Display, WithBriefing)):
|
52
|
+
raise TypeError(f"Expected Display or WithBriefing, got {type(obj)}")
|
53
|
+
|
54
|
+
review_res = await self.review_obj(obj, **kwargs)
|
55
|
+
if supervisor_check:
|
56
|
+
await review_res.supervisor_check()
|
57
|
+
if "default" in kwargs:
|
58
|
+
cast(ReviewKwargs[None], kwargs)["default"] = None
|
59
|
+
return await self.propose(
|
60
|
+
obj.__class__,
|
61
|
+
TEMPLATE_MANAGER.render_template(
|
62
|
+
configs.templates.correct_template,
|
63
|
+
{
|
64
|
+
"content": f"{(reference + '\n\nAbove is referencing material') if reference else ''}{obj.display() if isinstance(obj, Display) else obj.briefing}",
|
65
|
+
"review": review_res.display(),
|
66
|
+
},
|
67
|
+
),
|
68
|
+
**kwargs,
|
69
|
+
)
|
70
|
+
|
71
|
+
async def correct_string(
|
72
|
+
self, input_text: str, supervisor_check: bool = True, **kwargs: Unpack[ReviewKwargs[ReviewResult[str]]]
|
73
|
+
) -> Optional[str]:
|
74
|
+
"""Review and correct a string based on defined criteria and templates.
|
75
|
+
|
76
|
+
This method applies the review process to the input text and generates
|
77
|
+
a corrected version based on the review results.
|
78
|
+
|
79
|
+
Args:
|
80
|
+
input_text (str): The text content to be reviewed and corrected.
|
81
|
+
supervisor_check (bool, optional): Whether to perform a supervisor check on the review results. Defaults to True.
|
82
|
+
**kwargs: Review configuration parameters including criteria and review options.
|
83
|
+
|
84
|
+
Returns:
|
85
|
+
Optional[str]: The corrected text content, or None if correction fails.
|
86
|
+
"""
|
87
|
+
review_res = await self.review_string(input_text, **kwargs)
|
88
|
+
if supervisor_check:
|
89
|
+
await review_res.supervisor_check()
|
90
|
+
|
91
|
+
if "default" in kwargs:
|
92
|
+
cast(ReviewKwargs[None], kwargs)["default"] = None
|
93
|
+
return await self.ageneric_string(
|
94
|
+
TEMPLATE_MANAGER.render_template(
|
95
|
+
configs.templates.correct_template, {"content": input_text, "review": review_res.display()}
|
96
|
+
),
|
97
|
+
**kwargs,
|
98
|
+
)
|
99
|
+
|
100
|
+
async def correct_task[T](
|
101
|
+
self, task: Task[T], **kwargs: Unpack[CorrectKwargs[ReviewResult[str]]]
|
102
|
+
) -> Optional[Task[T]]:
|
103
|
+
"""Review and correct a task object based on defined criteria.
|
104
|
+
|
105
|
+
This is a specialized version of correct_obj specifically for Task objects,
|
106
|
+
applying the same review and correction process to task definitions.
|
107
|
+
|
108
|
+
Args:
|
109
|
+
task (Task[T]): The task to be reviewed and corrected.
|
110
|
+
**kwargs: Review configuration parameters including criteria and review options.
|
111
|
+
|
112
|
+
Returns:
|
113
|
+
Optional[Task[T]]: The corrected task, or None if correction fails.
|
114
|
+
"""
|
115
|
+
return await self.correct_obj(task, **kwargs)
|
@@ -0,0 +1,49 @@
|
|
1
|
+
"""A module for the task capabilities of the Fabricatio library."""
|
2
|
+
|
3
|
+
from typing import List, Optional, Type, Unpack, overload
|
4
|
+
|
5
|
+
from fabricatio.models.generic import ProposedAble
|
6
|
+
from fabricatio.models.kwargs_types import ValidateKwargs
|
7
|
+
from fabricatio.models.usages import LLMUsage
|
8
|
+
|
9
|
+
|
10
|
+
class Propose(LLMUsage):
|
11
|
+
"""A class that proposes an Obj based on a prompt."""
|
12
|
+
|
13
|
+
@overload
|
14
|
+
async def propose[M: ProposedAble](
|
15
|
+
self,
|
16
|
+
cls: Type[M],
|
17
|
+
prompt: List[str],
|
18
|
+
**kwargs: Unpack[ValidateKwargs[M]],
|
19
|
+
) -> Optional[List[M]]: ...
|
20
|
+
|
21
|
+
@overload
|
22
|
+
async def propose[M: ProposedAble](
|
23
|
+
self,
|
24
|
+
cls: Type[M],
|
25
|
+
prompt: str,
|
26
|
+
**kwargs: Unpack[ValidateKwargs[M]],
|
27
|
+
) -> Optional[M]: ...
|
28
|
+
|
29
|
+
async def propose[M: ProposedAble](
|
30
|
+
self,
|
31
|
+
cls: Type[M],
|
32
|
+
prompt: List[str] | str,
|
33
|
+
**kwargs: Unpack[ValidateKwargs[M]],
|
34
|
+
) -> Optional[List[M] | M]:
|
35
|
+
"""Asynchronously proposes a task based on a given prompt and parameters.
|
36
|
+
|
37
|
+
Parameters:
|
38
|
+
cls: The class type of the task to be proposed.
|
39
|
+
prompt: The prompt text for proposing a task, which is a string that must be provided.
|
40
|
+
**kwargs: The keyword arguments for the LLM (Large Language Model) usage.
|
41
|
+
|
42
|
+
Returns:
|
43
|
+
A Task object based on the proposal result.
|
44
|
+
"""
|
45
|
+
return await self.aask_validate(
|
46
|
+
question=cls.create_json_prompt(prompt),
|
47
|
+
validator=cls.instantiate_from_string,
|
48
|
+
**kwargs,
|
49
|
+
)
|