lionagi 0.0.315__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 +13 -1
- lionagi/core/direct/cot.py +123 -1
- lionagi/core/direct/plan.py +164 -0
- lionagi/core/direct/predict.py +13 -9
- lionagi/core/direct/react.py +12 -8
- lionagi/core/direct/score.py +4 -4
- lionagi/core/direct/select.py +4 -4
- lionagi/core/direct/utils.py +23 -0
- 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.315.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.315.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.315.dist-info → lionagi-0.1.0.dist-info}/LICENSE +0 -0
- {lionagi-0.0.315.dist-info → lionagi-0.1.0.dist-info}/WHEEL +0 -0
- {lionagi-0.0.315.dist-info → lionagi-0.1.0.dist-info}/top_level.txt +0 -0
@@ -1,67 +0,0 @@
|
|
1
|
-
from lionagi.libs import convert
|
2
|
-
from lionagi.core.schema.base_node import BaseComponent
|
3
|
-
from pydantic import BaseModel, Field
|
4
|
-
|
5
|
-
|
6
|
-
class PromptTemplate(BaseComponent):
|
7
|
-
signature: str = Field("null", description="signature indicating inputs, outputs")
|
8
|
-
|
9
|
-
def __init__(
|
10
|
-
self,
|
11
|
-
name_: str = "default_prompt_template",
|
12
|
-
version_: str | float | int = None,
|
13
|
-
description_: dict | str | None = None,
|
14
|
-
**kwargs,
|
15
|
-
):
|
16
|
-
super().__init__(**kwargs)
|
17
|
-
self.metadata["prompt_name"] = name_
|
18
|
-
self.metadata["version"] = version_
|
19
|
-
self.metadata["description"] = description_ or ""
|
20
|
-
|
21
|
-
@property
|
22
|
-
def prompt_fields(self):
|
23
|
-
return [
|
24
|
-
_field
|
25
|
-
for _field in self.property_keys
|
26
|
-
if _field
|
27
|
-
not in ["id_", "timestamp", "metadata", "prompt_fields", "signature"]
|
28
|
-
]
|
29
|
-
|
30
|
-
@staticmethod
|
31
|
-
def _get_input_output_fields(str_):
|
32
|
-
_inputs, _outputs = str_.split("->")
|
33
|
-
|
34
|
-
_inputs = [convert.strip_lower(i) for i in _inputs.split(",")]
|
35
|
-
_outputs = [convert.strip_lower(o) for o in _outputs.split(",")]
|
36
|
-
|
37
|
-
return _inputs, _outputs
|
38
|
-
|
39
|
-
@property
|
40
|
-
def input_fields(self):
|
41
|
-
_inputs, _ = self._get_input_output_fields(self.signature)
|
42
|
-
return _inputs
|
43
|
-
|
44
|
-
@property
|
45
|
-
def output_fields(self):
|
46
|
-
_, _outputs = self._get_input_output_fields(self.signature)
|
47
|
-
return _outputs
|
48
|
-
|
49
|
-
def validate_field(self): ...
|
50
|
-
|
51
|
-
def fix_field(self): ...
|
52
|
-
|
53
|
-
def _to_instruction(self): ...
|
54
|
-
|
55
|
-
|
56
|
-
class Weather(PromptTemplate):
|
57
|
-
sunny: bool = Field(
|
58
|
-
True, description="true if the weather is sunny outside else false"
|
59
|
-
)
|
60
|
-
rainy: bool = Field(False, description="true if it is raining outside else false")
|
61
|
-
play1: bool = Field(True, description="conduct play1")
|
62
|
-
play2: bool = Field(False, description="conduct play2")
|
63
|
-
signature: str = Field("sunny, rainy -> play1, play2")
|
64
|
-
|
65
|
-
|
66
|
-
a = Weather(name_="Weather", version_=1.0)
|
67
|
-
a.output_field # ['play1', 'play2']
|