lionagi 0.0.305__py3-none-any.whl → 0.0.307__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- lionagi/__init__.py +2 -5
- lionagi/core/__init__.py +7 -4
- lionagi/core/agent/__init__.py +3 -0
- lionagi/core/agent/base_agent.py +46 -0
- lionagi/core/branch/__init__.py +4 -0
- lionagi/core/branch/base/__init__.py +0 -0
- lionagi/core/branch/base_branch.py +100 -78
- lionagi/core/branch/branch.py +22 -34
- lionagi/core/branch/branch_flow_mixin.py +3 -7
- lionagi/core/branch/executable_branch.py +192 -0
- lionagi/core/branch/util.py +77 -162
- lionagi/core/direct/__init__.py +13 -0
- lionagi/core/direct/parallel_predict.py +127 -0
- lionagi/core/direct/parallel_react.py +0 -0
- lionagi/core/direct/parallel_score.py +0 -0
- lionagi/core/direct/parallel_select.py +0 -0
- lionagi/core/direct/parallel_sentiment.py +0 -0
- lionagi/core/direct/predict.py +174 -0
- lionagi/core/direct/react.py +33 -0
- lionagi/core/direct/score.py +163 -0
- lionagi/core/direct/select.py +144 -0
- lionagi/core/direct/sentiment.py +51 -0
- lionagi/core/direct/utils.py +83 -0
- lionagi/core/flow/__init__.py +0 -3
- lionagi/core/flow/monoflow/{mono_react.py → ReAct.py} +52 -9
- lionagi/core/flow/monoflow/__init__.py +9 -0
- lionagi/core/flow/monoflow/{mono_chat.py → chat.py} +11 -11
- lionagi/core/flow/monoflow/{mono_chat_mixin.py → chat_mixin.py} +33 -27
- lionagi/core/flow/monoflow/{mono_followup.py → followup.py} +7 -6
- lionagi/core/flow/polyflow/__init__.py +1 -0
- lionagi/core/flow/polyflow/{polychat.py → chat.py} +15 -3
- lionagi/core/mail/__init__.py +8 -0
- lionagi/core/mail/mail_manager.py +88 -40
- lionagi/core/mail/schema.py +32 -6
- lionagi/core/messages/__init__.py +3 -0
- lionagi/core/messages/schema.py +56 -25
- lionagi/core/prompt/__init__.py +0 -0
- lionagi/core/prompt/prompt_template.py +0 -0
- lionagi/core/schema/__init__.py +7 -5
- lionagi/core/schema/action_node.py +29 -0
- lionagi/core/schema/base_mixin.py +56 -59
- lionagi/core/schema/base_node.py +35 -38
- lionagi/core/schema/condition.py +24 -0
- lionagi/core/schema/data_logger.py +98 -98
- lionagi/core/schema/data_node.py +19 -19
- lionagi/core/schema/prompt_template.py +0 -0
- lionagi/core/schema/structure.py +293 -190
- lionagi/core/session/__init__.py +1 -3
- lionagi/core/session/session.py +196 -214
- lionagi/core/tool/tool_manager.py +95 -103
- lionagi/integrations/__init__.py +1 -3
- lionagi/integrations/bridge/langchain_/documents.py +17 -18
- lionagi/integrations/bridge/langchain_/langchain_bridge.py +14 -14
- lionagi/integrations/bridge/llamaindex_/llama_index_bridge.py +22 -22
- lionagi/integrations/bridge/llamaindex_/node_parser.py +12 -12
- lionagi/integrations/bridge/llamaindex_/reader.py +11 -11
- lionagi/integrations/bridge/llamaindex_/textnode.py +7 -7
- lionagi/integrations/config/openrouter_configs.py +0 -1
- lionagi/integrations/provider/oai.py +26 -26
- lionagi/integrations/provider/services.py +38 -38
- lionagi/libs/__init__.py +34 -1
- lionagi/libs/ln_api.py +211 -221
- lionagi/libs/ln_async.py +53 -60
- lionagi/libs/ln_convert.py +118 -120
- lionagi/libs/ln_dataframe.py +32 -33
- lionagi/libs/ln_func_call.py +334 -342
- lionagi/libs/ln_nested.py +99 -107
- lionagi/libs/ln_parse.py +175 -158
- lionagi/libs/sys_util.py +52 -52
- lionagi/tests/test_core/test_base_branch.py +427 -427
- lionagi/tests/test_core/test_branch.py +292 -292
- lionagi/tests/test_core/test_mail_manager.py +57 -57
- lionagi/tests/test_core/test_session.py +254 -266
- lionagi/tests/test_core/test_session_base_util.py +299 -300
- lionagi/tests/test_core/test_tool_manager.py +70 -74
- lionagi/tests/test_libs/test_nested.py +2 -7
- lionagi/tests/test_libs/test_parse.py +2 -2
- lionagi/version.py +1 -1
- {lionagi-0.0.305.dist-info → lionagi-0.0.307.dist-info}/METADATA +4 -2
- lionagi-0.0.307.dist-info/RECORD +115 -0
- lionagi-0.0.305.dist-info/RECORD +0 -94
- {lionagi-0.0.305.dist-info → lionagi-0.0.307.dist-info}/LICENSE +0 -0
- {lionagi-0.0.305.dist-info → lionagi-0.0.307.dist-info}/WHEEL +0 -0
- {lionagi-0.0.305.dist-info → lionagi-0.0.307.dist-info}/top_level.txt +0 -0
@@ -1,75 +1,75 @@
|
|
1
|
-
from lionagi.core.mail.mail_manager import MailManager
|
2
|
-
from lionagi.core.mail.schema import BaseMail
|
1
|
+
# from lionagi.core.mail.mail_manager import MailManager
|
2
|
+
# from lionagi.core.mail.schema import BaseMail
|
3
3
|
|
4
|
-
import unittest
|
5
|
-
from unittest.mock import patch
|
6
|
-
from collections import deque
|
4
|
+
# import unittest
|
5
|
+
# from unittest.mock import patch
|
6
|
+
# from collections import deque
|
7
7
|
|
8
8
|
|
9
|
-
class MockSource:
|
10
|
-
|
11
|
-
|
12
|
-
|
9
|
+
# class MockSource:
|
10
|
+
# def __init__(self):
|
11
|
+
# self.pending_outs = deque()
|
12
|
+
# self.pending_ins = {}
|
13
13
|
|
14
14
|
|
15
|
-
class TestMailManager(unittest.TestCase):
|
15
|
+
# class TestMailManager(unittest.TestCase):
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
# def setUp(self):
|
18
|
+
# self.sources = {"source1": MockSource(), "source2": MockSource()}
|
19
|
+
# self.manager = MailManager(sources=self.sources)
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
21
|
+
# def test_add_source(self):
|
22
|
+
# """Test adding a new source."""
|
23
|
+
# self.manager.add_source({"new_source": MockSource()})
|
24
|
+
# self.assertIn("new_source", self.manager.sources)
|
25
25
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
26
|
+
# def test_add_source_existing_name(self):
|
27
|
+
# """Test adding a source with an existing name raises ValueError."""
|
28
|
+
# with self.assertRaises(ValueError):
|
29
|
+
# self.manager.add_source({"source1": MockSource()})
|
30
30
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
31
|
+
# def test_delete_source(self):
|
32
|
+
# """Test deleting an existing source."""
|
33
|
+
# self.manager.delete_source("source1")
|
34
|
+
# self.assertNotIn("source1", self.manager.sources)
|
35
35
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
36
|
+
# def test_delete_nonexistent_source(self):
|
37
|
+
# """Test deleting a non-existent source raises ValueError."""
|
38
|
+
# with self.assertRaises(ValueError):
|
39
|
+
# self.manager.delete_source("nonexistent_source")
|
40
40
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
41
|
+
# def test_collect_from_nonexistent_sender(self):
|
42
|
+
# """Test collecting mail from a non-existent sender raises ValueError."""
|
43
|
+
# with self.assertRaises(ValueError):
|
44
|
+
# self.manager.collect("nonexistent_sender")
|
45
45
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
46
|
+
# def test_send_to_nonexistent_recipient(self):
|
47
|
+
# """Test sending mail to a non-existent recipient raises ValueError."""
|
48
|
+
# with self.assertRaises(ValueError):
|
49
|
+
# self.manager.send("nonexistent_recipient")
|
50
50
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
51
|
+
# @patch("lionagi.core.mail.mail_manager.BaseMail")
|
52
|
+
# def test_create_mail(self, mock_base_mail):
|
53
|
+
# """Test creating mail using the static method."""
|
54
|
+
# mail = MailManager.create_mail("sender", "recipient", "messages", "package")
|
55
|
+
# mock_base_mail.assert_called_once_with(
|
56
|
+
# "sender", "recipient", "messages", "package"
|
57
|
+
# )
|
58
58
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
59
|
+
# # def test_collect_and_send_mail(self):
|
60
|
+
# # """Test collecting and sending mail between existing sources."""
|
61
|
+
# # # Setup: Simulate pending outs in source1
|
62
|
+
# # mock_mail = BaseMail("source1", "source2", "messages", "package")
|
63
|
+
# # self.sources["source1"].pending_outs.append(mock_mail)
|
64
64
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
65
|
+
# # # Collect mail from source1
|
66
|
+
# # self.manager.collect("source1")
|
67
|
+
# # # Send mail to source2
|
68
|
+
# # self.manager.send("source2")
|
69
69
|
|
70
|
-
|
71
|
-
|
70
|
+
# # # Verify that source2 received the mail
|
71
|
+
# # self.assertTrue(any(self.sources["source2"].pending_ins))
|
72
72
|
|
73
73
|
|
74
|
-
if __name__ == "__main__":
|
75
|
-
|
74
|
+
# if __name__ == "__main__":
|
75
|
+
# unittest.main()
|