lionagi 0.0.316__py3-none-any.whl → 0.1.0__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- lionagi/core/__init__.py +19 -8
- lionagi/core/agent/__init__.py +0 -3
- lionagi/core/agent/base_agent.py +26 -30
- lionagi/core/branch/__init__.py +0 -4
- lionagi/core/branch/{base_branch.py → base.py} +13 -14
- lionagi/core/branch/branch.py +22 -20
- lionagi/core/branch/executable_branch.py +0 -347
- lionagi/core/branch/{branch_flow_mixin.py → flow_mixin.py} +6 -6
- lionagi/core/branch/util.py +1 -1
- lionagi/core/direct/__init__.py +10 -1
- lionagi/core/direct/cot.py +61 -26
- lionagi/core/direct/plan.py +10 -8
- lionagi/core/direct/predict.py +5 -5
- lionagi/core/direct/react.py +8 -8
- lionagi/core/direct/score.py +4 -4
- lionagi/core/direct/select.py +4 -4
- lionagi/core/direct/utils.py +7 -4
- lionagi/core/direct/vote.py +2 -2
- lionagi/core/execute/base_executor.py +50 -0
- lionagi/core/execute/branch_executor.py +233 -0
- lionagi/core/execute/instruction_map_executor.py +131 -0
- lionagi/core/execute/structure_executor.py +218 -0
- lionagi/core/flow/monoflow/ReAct.py +4 -4
- lionagi/core/flow/monoflow/chat.py +6 -6
- lionagi/core/flow/monoflow/chat_mixin.py +24 -34
- lionagi/core/flow/monoflow/followup.py +4 -4
- lionagi/core/flow/polyflow/__init__.py +1 -1
- lionagi/core/flow/polyflow/chat.py +15 -12
- lionagi/core/{prompt/action_template.py → form/action_form.py} +2 -2
- lionagi/core/{prompt → form}/field_validator.py +40 -31
- lionagi/core/form/form.py +302 -0
- lionagi/core/form/mixin.py +214 -0
- lionagi/core/{prompt/scored_template.py → form/scored_form.py} +2 -2
- lionagi/core/generic/__init__.py +37 -0
- lionagi/core/generic/action.py +26 -0
- lionagi/core/generic/component.py +457 -0
- lionagi/core/generic/condition.py +44 -0
- lionagi/core/generic/data_logger.py +305 -0
- lionagi/core/generic/edge.py +110 -0
- lionagi/core/generic/mail.py +90 -0
- lionagi/core/generic/mailbox.py +36 -0
- lionagi/core/generic/node.py +285 -0
- lionagi/core/generic/relation.py +70 -0
- lionagi/core/generic/signal.py +22 -0
- lionagi/core/generic/structure.py +362 -0
- lionagi/core/generic/transfer.py +20 -0
- lionagi/core/generic/work.py +40 -0
- lionagi/core/graph/graph.py +126 -0
- lionagi/core/graph/tree.py +190 -0
- lionagi/core/mail/__init__.py +0 -8
- lionagi/core/mail/mail_manager.py +12 -10
- lionagi/core/mail/schema.py +9 -2
- lionagi/core/messages/__init__.py +0 -3
- lionagi/core/messages/schema.py +17 -225
- lionagi/core/session/__init__.py +0 -3
- lionagi/core/session/session.py +25 -23
- lionagi/core/tool/__init__.py +3 -1
- lionagi/core/tool/tool.py +28 -0
- lionagi/core/tool/tool_manager.py +75 -75
- lionagi/integrations/chunker/chunk.py +7 -7
- lionagi/integrations/config/oai_configs.py +4 -4
- lionagi/integrations/loader/load.py +6 -6
- lionagi/integrations/loader/load_util.py +8 -8
- lionagi/libs/ln_api.py +3 -3
- lionagi/libs/ln_parse.py +43 -6
- lionagi/libs/ln_validate.py +288 -0
- lionagi/libs/sys_util.py +28 -6
- lionagi/tests/libs/test_async.py +0 -0
- lionagi/tests/libs/test_field_validators.py +353 -0
- lionagi/tests/test_core/test_base_branch.py +0 -1
- lionagi/tests/test_core/test_branch.py +3 -0
- lionagi/tests/test_core/test_session_base_util.py +1 -0
- lionagi/version.py +1 -1
- {lionagi-0.0.316.dist-info → lionagi-0.1.0.dist-info}/METADATA +1 -1
- lionagi-0.1.0.dist-info/RECORD +136 -0
- lionagi/core/prompt/prompt_template.py +0 -312
- lionagi/core/schema/__init__.py +0 -22
- lionagi/core/schema/action_node.py +0 -29
- lionagi/core/schema/base_mixin.py +0 -296
- lionagi/core/schema/base_node.py +0 -199
- lionagi/core/schema/condition.py +0 -24
- lionagi/core/schema/data_logger.py +0 -354
- lionagi/core/schema/data_node.py +0 -93
- lionagi/core/schema/prompt_template.py +0 -67
- lionagi/core/schema/structure.py +0 -912
- lionagi/core/tool/manual.py +0 -1
- lionagi-0.0.316.dist-info/RECORD +0 -121
- /lionagi/core/{branch/base → execute}/__init__.py +0 -0
- /lionagi/core/flow/{base/baseflow.py → baseflow.py} +0 -0
- /lionagi/core/flow/{base/__init__.py → mono_chat_mixin.py} +0 -0
- /lionagi/core/{prompt → form}/__init__.py +0 -0
- /lionagi/{tests/test_integrations → core/graph}/__init__.py +0 -0
- /lionagi/tests/{test_libs → integrations}/__init__.py +0 -0
- /lionagi/tests/{test_libs/test_async.py → libs/__init__.py} +0 -0
- /lionagi/tests/{test_libs → libs}/test_api.py +0 -0
- /lionagi/tests/{test_libs → libs}/test_convert.py +0 -0
- /lionagi/tests/{test_libs → libs}/test_func_call.py +0 -0
- /lionagi/tests/{test_libs → libs}/test_nested.py +0 -0
- /lionagi/tests/{test_libs → libs}/test_parse.py +0 -0
- /lionagi/tests/{test_libs → libs}/test_sys_util.py +0 -0
- {lionagi-0.0.316.dist-info → lionagi-0.1.0.dist-info}/LICENSE +0 -0
- {lionagi-0.0.316.dist-info → lionagi-0.1.0.dist-info}/WHEEL +0 -0
- {lionagi-0.0.316.dist-info → lionagi-0.1.0.dist-info}/top_level.txt +0 -0
@@ -1,9 +1,9 @@
|
|
1
1
|
from abc import ABC
|
2
2
|
from typing import Any, Optional, Union, TypeVar
|
3
3
|
|
4
|
-
from
|
5
|
-
from
|
6
|
-
from
|
4
|
+
from lionagi.core.tool import Tool, TOOL_TYPE
|
5
|
+
from lionagi.core.messages.schema import Instruction, System
|
6
|
+
from lionagi.core.flow.monoflow import MonoChat, MonoFollowup, MonoReAct
|
7
7
|
|
8
8
|
T = TypeVar("T", bound=Tool)
|
9
9
|
|
@@ -20,7 +20,7 @@ class BranchFlowMixin(ABC):
|
|
20
20
|
out: bool = True,
|
21
21
|
invoke: bool = True,
|
22
22
|
output_fields=None,
|
23
|
-
|
23
|
+
form=None,
|
24
24
|
**kwargs,
|
25
25
|
) -> Any:
|
26
26
|
flow = MonoChat(self)
|
@@ -33,7 +33,7 @@ class BranchFlowMixin(ABC):
|
|
33
33
|
out=out,
|
34
34
|
invoke=invoke,
|
35
35
|
output_fields=output_fields,
|
36
|
-
|
36
|
+
form=form,
|
37
37
|
**kwargs,
|
38
38
|
)
|
39
39
|
|
@@ -93,4 +93,4 @@ class BranchFlowMixin(ABC):
|
|
93
93
|
output_prompt=output_prompt,
|
94
94
|
out=out,
|
95
95
|
**kwargs,
|
96
|
-
)
|
96
|
+
)
|
lionagi/core/branch/util.py
CHANGED
lionagi/core/direct/__init__.py
CHANGED
@@ -7,4 +7,13 @@ from .plan import plan
|
|
7
7
|
from .cot import chain_of_thoughts, chain_of_react
|
8
8
|
|
9
9
|
|
10
|
-
__all__ = [
|
10
|
+
__all__ = [
|
11
|
+
"predict",
|
12
|
+
"select",
|
13
|
+
"score",
|
14
|
+
"vote",
|
15
|
+
"react",
|
16
|
+
"plan",
|
17
|
+
"chain_of_thoughts",
|
18
|
+
"chain_of_react",
|
19
|
+
]
|
lionagi/core/direct/cot.py
CHANGED
@@ -1,10 +1,8 @@
|
|
1
|
-
from typing import Callable
|
2
1
|
from lionagi.libs import convert
|
3
|
-
|
4
|
-
from
|
5
|
-
from .
|
6
|
-
from .
|
7
|
-
from .react import react
|
2
|
+
|
3
|
+
from lionagi.core.direct.predict import predict
|
4
|
+
from lionagi.core.direct.plan import plan
|
5
|
+
from lionagi.core.direct.react import react
|
8
6
|
|
9
7
|
from .utils import _process_tools
|
10
8
|
|
@@ -18,37 +16,56 @@ async def chain_of_thoughts(
|
|
18
16
|
num_steps=3,
|
19
17
|
directive_kwargs={},
|
20
18
|
return_branch=False,
|
21
|
-
**kwargs
|
19
|
+
**kwargs,
|
22
20
|
):
|
23
|
-
|
21
|
+
|
24
22
|
out_, outs, answer, reasons, confidence_score = "", [], "", [], 0
|
25
23
|
if branch is not None:
|
26
|
-
out_ = await plan(
|
24
|
+
out_ = await plan(
|
25
|
+
sentence,
|
26
|
+
branch=branch,
|
27
|
+
instruction=instruction,
|
28
|
+
num_steps=num_steps,
|
29
|
+
**kwargs,
|
30
|
+
)
|
27
31
|
else:
|
28
|
-
out_, branch = await plan(
|
29
|
-
|
32
|
+
out_, branch = await plan(
|
33
|
+
sentence,
|
34
|
+
instruction=instruction,
|
35
|
+
branch=branch,
|
36
|
+
num_steps=num_steps,
|
37
|
+
return_branch=True,
|
38
|
+
**kwargs,
|
39
|
+
)
|
40
|
+
|
30
41
|
for i in range(len(out_.plan)):
|
31
|
-
_out = await predict(
|
42
|
+
_out = await predict(
|
43
|
+
branch=branch,
|
44
|
+
instruction=out_.plan[f"step_{i+1}"],
|
45
|
+
reason=reason,
|
46
|
+
confidence_score=confidence_score,
|
47
|
+
**directive_kwargs,
|
48
|
+
)
|
32
49
|
answer += _out.answer
|
33
50
|
if reason:
|
34
51
|
reasons.append(_out.reason)
|
35
52
|
if confidence_score:
|
36
53
|
confidence_score += _out.confidence_score
|
37
54
|
outs.append(_out)
|
38
|
-
|
55
|
+
|
39
56
|
setattr(out_, "chain_output", outs)
|
40
57
|
setattr(out_, "chain_answer", answer)
|
41
|
-
|
58
|
+
|
42
59
|
if reason:
|
43
60
|
setattr(out_, "chain_reasons", reasons)
|
44
61
|
if confidence_score:
|
45
|
-
setattr(out_, "chain_confidence_score", confidence_score/len(outs))
|
46
|
-
|
62
|
+
setattr(out_, "chain_confidence_score", confidence_score / len(outs))
|
63
|
+
|
47
64
|
if return_branch:
|
48
65
|
return out_, branch
|
49
|
-
|
66
|
+
|
50
67
|
return out_
|
51
|
-
|
68
|
+
|
52
69
|
|
53
70
|
async def chain_of_react(
|
54
71
|
sentence=None,
|
@@ -59,24 +76,42 @@ async def chain_of_react(
|
|
59
76
|
directive_system=None,
|
60
77
|
directive_kwargs={},
|
61
78
|
return_branch=False,
|
62
|
-
**kwargs
|
79
|
+
**kwargs,
|
63
80
|
):
|
64
81
|
out_, outs, reasons, actions, action_responses = "", [], [], [], []
|
65
82
|
if branch is not None:
|
66
|
-
out_ = await plan(
|
83
|
+
out_ = await plan(
|
84
|
+
sentence,
|
85
|
+
branch=branch,
|
86
|
+
instruction=instruction,
|
87
|
+
num_steps=num_steps,
|
88
|
+
**kwargs,
|
89
|
+
)
|
67
90
|
else:
|
68
|
-
out_, branch = await plan(
|
69
|
-
|
91
|
+
out_, branch = await plan(
|
92
|
+
sentence,
|
93
|
+
instruction=instruction,
|
94
|
+
branch=branch,
|
95
|
+
num_steps=num_steps,
|
96
|
+
return_branch=True,
|
97
|
+
**kwargs,
|
98
|
+
)
|
99
|
+
|
70
100
|
_process_tools(tools, branch)
|
71
|
-
|
101
|
+
|
72
102
|
for i in range(len(out_.plan)):
|
73
|
-
_out = await react(
|
103
|
+
_out = await react(
|
104
|
+
branch=branch,
|
105
|
+
system=directive_system,
|
106
|
+
instruction=out_.plan[f"step_{i+1}"],
|
107
|
+
**directive_kwargs,
|
108
|
+
)
|
74
109
|
outs.append(_out)
|
75
110
|
reasons.append(_out.reason)
|
76
111
|
actions.append(_out.actions)
|
77
112
|
if _out.action_needed:
|
78
113
|
action_responses.append(_out.action_response)
|
79
|
-
|
114
|
+
|
80
115
|
setattr(out_, "chain_output", convert.to_list(outs))
|
81
116
|
setattr(out_, "chain_reason", convert.to_list(reasons))
|
82
117
|
setattr(out_, "chain_actions", convert.to_list(actions))
|
@@ -84,5 +119,5 @@ async def chain_of_react(
|
|
84
119
|
|
85
120
|
if return_branch:
|
86
121
|
return out_, branch
|
87
|
-
|
122
|
+
|
88
123
|
return out_
|
lionagi/core/direct/plan.py
CHANGED
@@ -2,18 +2,20 @@
|
|
2
2
|
|
3
3
|
from lionagi.libs import func_call, ParseUtil
|
4
4
|
from lionagi.integrations.bridge.pydantic_.pydantic_bridge import Field
|
5
|
-
from
|
6
|
-
from
|
5
|
+
from lionagi.core.form.scored_form import ScoredForm
|
6
|
+
from lionagi.core.branch.branch import Branch
|
7
7
|
|
8
8
|
|
9
|
-
class PlanTemplate(
|
9
|
+
class PlanTemplate(ScoredForm):
|
10
10
|
template_name: str = "default_plan"
|
11
11
|
sentence: str | list | dict = Field(
|
12
12
|
default_factory=str,
|
13
13
|
description="the given sentence(s) or context to generate a plan for",
|
14
14
|
)
|
15
|
-
plan: dict | str= Field(
|
16
|
-
default_factory=dict,
|
15
|
+
plan: dict | str = Field(
|
16
|
+
default_factory=dict,
|
17
|
+
description="the generated step by step plan, return as a dictionary following {step_n: {plan: ..., reason: ...}} format",
|
18
|
+
)
|
17
19
|
signature: str = "sentence -> plan"
|
18
20
|
|
19
21
|
def __init__(
|
@@ -89,7 +91,7 @@ async def _plan(
|
|
89
91
|
|
90
92
|
await func_call.rcall(
|
91
93
|
branch.chat,
|
92
|
-
|
94
|
+
form=_template,
|
93
95
|
retries=retries,
|
94
96
|
delay=delay,
|
95
97
|
backoff_factor=backoff_factor,
|
@@ -97,7 +99,7 @@ async def _plan(
|
|
97
99
|
timeout=timeout,
|
98
100
|
**kwargs,
|
99
101
|
)
|
100
|
-
|
102
|
+
|
101
103
|
_template.plan = ParseUtil.fuzzy_parse_json(_template.plan)
|
102
104
|
|
103
105
|
return (_template, branch) if return_branch else _template
|
@@ -159,4 +161,4 @@ async def plan(
|
|
159
161
|
return await _inner()
|
160
162
|
|
161
163
|
elif num_instances > 1:
|
162
|
-
return await func_call.alcall(range(num_instances), _inner)
|
164
|
+
return await func_call.alcall(range(num_instances), _inner)
|
lionagi/core/direct/predict.py
CHANGED
@@ -9,11 +9,11 @@ confidence score, and reason for the prediction.
|
|
9
9
|
from lionagi.libs import func_call
|
10
10
|
from lionagi.integrations.bridge.pydantic_.pydantic_bridge import Field
|
11
11
|
|
12
|
-
from
|
13
|
-
from
|
12
|
+
from lionagi.core.form.scored_form import ScoredForm
|
13
|
+
from lionagi.core.branch.branch import Branch
|
14
14
|
|
15
15
|
|
16
|
-
class PredictTemplate(
|
16
|
+
class PredictTemplate(ScoredForm):
|
17
17
|
"""
|
18
18
|
A class for predicting the next sentence(s) based on a given sentence.
|
19
19
|
|
@@ -68,7 +68,7 @@ class PredictTemplate(ScoredTemplate):
|
|
68
68
|
"""
|
69
69
|
super().__init__(**kwargs)
|
70
70
|
|
71
|
-
self.sentence = sentence or
|
71
|
+
self.sentence = sentence or ""
|
72
72
|
self.num_sentences = num_sentences
|
73
73
|
self.task = f"follow instruction to predict the next {self.num_sentences} sentence(s). Instruction: {instruction}."
|
74
74
|
|
@@ -154,7 +154,7 @@ async def predict(
|
|
154
154
|
|
155
155
|
await func_call.rcall(
|
156
156
|
branch.chat,
|
157
|
-
|
157
|
+
form=predict_template,
|
158
158
|
retries=retries,
|
159
159
|
delay=delay,
|
160
160
|
backoff_factor=backoff_factor,
|
lionagi/core/direct/react.py
CHANGED
@@ -1,14 +1,14 @@
|
|
1
|
-
from lionagi.libs import func_call,
|
1
|
+
from lionagi.libs import func_call, AsyncUtil
|
2
2
|
|
3
3
|
from lionagi.integrations.bridge.pydantic_.pydantic_bridge import Field
|
4
|
-
from
|
5
|
-
from
|
6
|
-
from .utils import _process_tools
|
4
|
+
from lionagi.core.form.action_form import ActionForm
|
5
|
+
from lionagi.core.branch.branch import Branch
|
6
|
+
from lionagi.core.direct.utils import _process_tools
|
7
7
|
|
8
8
|
|
9
|
-
class ReactTemplate(
|
9
|
+
class ReactTemplate(ActionForm):
|
10
10
|
template_name: str = "default_react"
|
11
|
-
sentence: str | list | dict | None= Field(
|
11
|
+
sentence: str | list | dict | None = Field(
|
12
12
|
default_factory=str,
|
13
13
|
description="the given sentence(s) to reason and take actions on",
|
14
14
|
)
|
@@ -61,7 +61,7 @@ async def _react(
|
|
61
61
|
|
62
62
|
if branch and tools:
|
63
63
|
_process_tools(tools, branch)
|
64
|
-
|
64
|
+
|
65
65
|
branch = branch or Branch(
|
66
66
|
name=branch_name,
|
67
67
|
system=system,
|
@@ -83,7 +83,7 @@ async def _react(
|
|
83
83
|
|
84
84
|
await func_call.rcall(
|
85
85
|
branch.chat,
|
86
|
-
|
86
|
+
form=_template,
|
87
87
|
retries=retries,
|
88
88
|
delay=delay,
|
89
89
|
backoff_factor=backoff_factor,
|
lionagi/core/direct/score.py
CHANGED
@@ -12,11 +12,11 @@ ScoreTemplate class and a language model.
|
|
12
12
|
from pydantic import Field
|
13
13
|
import numpy as np
|
14
14
|
from lionagi.libs import func_call, convert
|
15
|
-
from
|
16
|
-
from
|
15
|
+
from lionagi.core.form.scored_form import ScoredForm
|
16
|
+
from lionagi.core.branch.branch import Branch
|
17
17
|
|
18
18
|
|
19
|
-
class ScoreTemplate(
|
19
|
+
class ScoreTemplate(ScoredForm):
|
20
20
|
"""
|
21
21
|
A class for scoring a given context using a language model.
|
22
22
|
|
@@ -169,7 +169,7 @@ async def _score(
|
|
169
169
|
|
170
170
|
await func_call.rcall(
|
171
171
|
branch.chat,
|
172
|
-
|
172
|
+
form=_template,
|
173
173
|
retries=retries,
|
174
174
|
delay=delay,
|
175
175
|
backoff_factor=backoff_factor,
|
lionagi/core/direct/select.py
CHANGED
@@ -13,11 +13,11 @@ from enum import Enum
|
|
13
13
|
from pydantic import Field
|
14
14
|
|
15
15
|
from lionagi.libs import func_call, StringMatch
|
16
|
-
from
|
17
|
-
from
|
16
|
+
from lionagi.core.form.scored_form import ScoredForm
|
17
|
+
from lionagi.core.branch.branch import Branch
|
18
18
|
|
19
19
|
|
20
|
-
class SelectTemplate(
|
20
|
+
class SelectTemplate(ScoredForm):
|
21
21
|
"""
|
22
22
|
A class for selecting an item from given choices based on a given context.
|
23
23
|
|
@@ -153,7 +153,7 @@ async def select(
|
|
153
153
|
|
154
154
|
await func_call.rcall(
|
155
155
|
branch.chat,
|
156
|
-
|
156
|
+
form=_template,
|
157
157
|
retries=retries,
|
158
158
|
delay=delay,
|
159
159
|
backoff_factor=backoff_factor,
|
lionagi/core/direct/utils.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
from typing import Callable
|
2
|
-
from
|
3
|
-
|
2
|
+
from lionagi.core.tool import func_to_tool, Tool
|
3
|
+
|
4
4
|
# import contextlib
|
5
5
|
# from lionagi.libs import ParseUtil, StringMatch, convert, func_call
|
6
6
|
|
@@ -99,9 +99,12 @@ def _process_tools(tool_obj, branch):
|
|
99
99
|
|
100
100
|
|
101
101
|
def _process_tool(tool_obj, branch):
|
102
|
-
if
|
102
|
+
if (
|
103
|
+
isinstance(tool_obj, Tool)
|
104
|
+
and tool_obj.schema_["function"]["name"] not in branch.tool_manager.registry
|
105
|
+
):
|
103
106
|
branch.register_tools(tool_obj)
|
104
107
|
if isinstance(tool_obj, Callable):
|
105
108
|
tool = func_to_tool(tool_obj)[0]
|
106
109
|
if tool.schema_["function"]["name"] not in branch.tool_manager.registry:
|
107
|
-
branch.register_tools(tool)
|
110
|
+
branch.register_tools(tool)
|
lionagi/core/direct/vote.py
CHANGED
@@ -8,8 +8,8 @@ number of generations, number of outputs to return, number of scorers, score ran
|
|
8
8
|
|
9
9
|
from lionagi.libs import func_call
|
10
10
|
import numpy as np
|
11
|
-
from .predict import predict
|
12
|
-
from .score import score
|
11
|
+
from lionagi.core.direct.predict import predict
|
12
|
+
from lionagi.core.direct.score import score
|
13
13
|
|
14
14
|
|
15
15
|
async def vote(
|
@@ -0,0 +1,50 @@
|
|
1
|
+
from collections import deque
|
2
|
+
from abc import ABC, abstractmethod
|
3
|
+
from typing import Any
|
4
|
+
|
5
|
+
from pydantic import Field
|
6
|
+
|
7
|
+
from lionagi.core.generic import BaseComponent
|
8
|
+
from lionagi.core.mail.schema import BaseMail
|
9
|
+
|
10
|
+
|
11
|
+
class BaseExecutor(BaseComponent, ABC):
|
12
|
+
pending_ins: dict = Field(
|
13
|
+
default_factory=dict, description="The pending incoming mails."
|
14
|
+
)
|
15
|
+
pending_outs: deque = Field(
|
16
|
+
default_factory=deque, description="The pending outgoing mails."
|
17
|
+
)
|
18
|
+
execute_stop: bool = Field(
|
19
|
+
False, description="A flag indicating whether to stop execution."
|
20
|
+
)
|
21
|
+
context: dict | str | None = Field(
|
22
|
+
None, description="The context buffer for the next instruction."
|
23
|
+
)
|
24
|
+
execution_responses: list = Field(
|
25
|
+
default_factory=list, description="The list of responses."
|
26
|
+
)
|
27
|
+
context_log: list = Field(default_factory=list, description="The context log.")
|
28
|
+
verbose: bool = Field(
|
29
|
+
True, description="A flag indicating whether to provide verbose output."
|
30
|
+
)
|
31
|
+
execute_stop: bool = Field(
|
32
|
+
False, description="A flag indicating whether to stop execution."
|
33
|
+
)
|
34
|
+
|
35
|
+
def send(self, recipient_id: str, category: str, package: Any) -> None:
|
36
|
+
"""
|
37
|
+
Sends a mail to a recipient.
|
38
|
+
|
39
|
+
Args:
|
40
|
+
recipient_id (str): The ID of the recipient.
|
41
|
+
category (str): The category of the mail.
|
42
|
+
package (Any): The package to send in the mail.
|
43
|
+
"""
|
44
|
+
mail = BaseMail(
|
45
|
+
sender_id=self.id_,
|
46
|
+
recipient_id=recipient_id,
|
47
|
+
category=category,
|
48
|
+
package=package,
|
49
|
+
)
|
50
|
+
self.pending_outs.append(mail)
|