lionagi 0.2.7__py3-none-any.whl → 0.2.9__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- lionagi/__init__.py +11 -25
- lionagi/core/action/README.md +20 -0
- lionagi/core/action/__init__.py +1 -2
- lionagi/core/action/function_calling.py +2 -27
- lionagi/core/action/node.py +1 -16
- lionagi/core/action/tool.py +4 -17
- lionagi/core/action/tool_manager.py +8 -31
- lionagi/core/agent/README.md +1 -0
- lionagi/core/agent/base_agent.py +3 -27
- lionagi/core/agent/eval/README.md +1 -0
- lionagi/core/collections/README.md +23 -0
- lionagi/core/collections/__init__.py +2 -3
- lionagi/core/collections/_logger.py +0 -17
- lionagi/core/collections/abc/README.md +63 -0
- lionagi/core/collections/abc/__init__.py +18 -18
- lionagi/core/collections/abc/component.py +5 -21
- lionagi/core/collections/abc/concepts.py +1 -17
- lionagi/core/collections/abc/exceptions.py +0 -16
- lionagi/core/collections/exchange.py +1 -16
- lionagi/core/collections/flow.py +5 -25
- lionagi/core/collections/model.py +6 -21
- lionagi/core/collections/pile.py +317 -35
- lionagi/core/collections/progression.py +4 -17
- lionagi/core/collections/util.py +2 -2
- lionagi/core/director/README.md +1 -0
- lionagi/core/director/direct.py +1 -17
- lionagi/core/engine/branch_engine.py +6 -6
- lionagi/core/engine/instruction_map_engine.py +4 -4
- lionagi/core/engine/script_engine.py +2 -16
- lionagi/core/executor/base_executor.py +1 -1
- lionagi/core/executor/graph_executor.py +6 -9
- lionagi/core/executor/neo4j_executor.py +7 -9
- lionagi/core/generic/README.md +0 -0
- lionagi/core/generic/__init__.py +1 -2
- lionagi/core/generic/edge.py +7 -3
- lionagi/core/generic/edge_condition.py +3 -2
- lionagi/core/generic/graph.py +5 -6
- lionagi/core/generic/node.py +4 -4
- lionagi/core/generic/tree.py +2 -1
- lionagi/core/generic/tree_node.py +2 -0
- lionagi/core/mail/__init__.py +0 -1
- lionagi/core/mail/mail.py +2 -1
- lionagi/core/mail/mail_manager.py +8 -6
- lionagi/core/mail/package.py +2 -0
- lionagi/core/mail/start_mail.py +2 -2
- lionagi/core/message/__init__.py +4 -5
- lionagi/core/message/action_request.py +5 -31
- lionagi/core/message/action_response.py +3 -23
- lionagi/core/message/assistant_response.py +2 -17
- lionagi/core/message/instruction.py +2 -48
- lionagi/core/message/message.py +2 -17
- lionagi/core/message/system.py +2 -17
- lionagi/core/message/util.py +7 -26
- lionagi/core/report/base.py +4 -26
- lionagi/core/report/form.py +6 -28
- lionagi/core/report/report.py +3 -26
- lionagi/core/report/util.py +2 -17
- lionagi/core/rule/_default.py +3 -2
- lionagi/core/rule/action.py +4 -19
- lionagi/core/rule/base.py +4 -19
- lionagi/core/rule/boolean.py +2 -2
- lionagi/core/rule/choice.py +3 -2
- lionagi/core/rule/mapping.py +7 -21
- lionagi/core/rule/number.py +3 -1
- lionagi/core/rule/rulebook.py +2 -70
- lionagi/core/rule/string.py +2 -13
- lionagi/core/rule/util.py +0 -35
- lionagi/core/session/branch.py +11 -27
- lionagi/core/session/directive_mixin.py +1 -16
- lionagi/core/session/session.py +8 -24
- lionagi/core/unit/__init__.py +1 -2
- lionagi/core/unit/parallel_unit.py +4 -21
- lionagi/core/unit/template/action.py +0 -16
- lionagi/core/unit/template/base.py +0 -16
- lionagi/core/unit/template/plan.py +1 -16
- lionagi/core/unit/template/predict.py +0 -16
- lionagi/core/unit/template/score.py +1 -17
- lionagi/core/unit/template/select.py +1 -16
- lionagi/core/unit/unit.py +6 -21
- lionagi/core/unit/unit_form.py +6 -19
- lionagi/core/unit/unit_mixin.py +11 -29
- lionagi/core/unit/util.py +1 -0
- lionagi/core/validator/validator.py +8 -22
- lionagi/core/work/work.py +2 -19
- lionagi/core/work/work_edge.py +3 -3
- lionagi/core/work/work_function.py +1 -18
- lionagi/core/work/work_function_node.py +0 -5
- lionagi/core/work/work_queue.py +1 -16
- lionagi/core/work/work_task.py +4 -4
- lionagi/core/work/worker.py +5 -20
- lionagi/core/work/worker_engine.py +5 -5
- lionagi/core/work/worklog.py +1 -17
- lionagi/experimental/compressor/base.py +1 -0
- lionagi/experimental/compressor/llm_compressor.py +7 -4
- lionagi/experimental/directive/README.md +1 -0
- lionagi/experimental/directive/parser/base_parser.py +2 -17
- lionagi/experimental/directive/parser/base_syntax.txt +200 -0
- lionagi/experimental/directive/template/base_template.py +1 -17
- lionagi/experimental/directive/tokenizer.py +0 -16
- lionagi/experimental/evaluator/README.md +1 -0
- lionagi/experimental/evaluator/ast_evaluator.py +0 -16
- lionagi/experimental/evaluator/base_evaluator.py +1 -17
- lionagi/experimental/knowledge/base.py +1 -1
- lionagi/integrations/bridge/__init__.py +1 -1
- lionagi/integrations/bridge/langchain_/documents.py +1 -1
- lionagi/integrations/bridge/llamaindex_/node_parser.py +2 -1
- lionagi/integrations/bridge/llamaindex_/textnode.py +2 -1
- lionagi/integrations/bridge/pydantic_/pydantic_bridge.py +1 -1
- lionagi/integrations/bridge/transformers_/install_.py +1 -0
- lionagi/integrations/chunker/chunk.py +5 -6
- lionagi/integrations/loader/load.py +3 -3
- lionagi/integrations/loader/load_util.py +2 -2
- lionagi/integrations/provider/__init__.py +0 -1
- lionagi/integrations/provider/_mapping.py +6 -5
- lionagi/integrations/provider/mlx_service.py +4 -3
- lionagi/integrations/provider/oai.py +1 -17
- lionagi/integrations/provider/ollama.py +1 -1
- lionagi/integrations/provider/openrouter.py +1 -0
- lionagi/integrations/provider/transformers.py +2 -2
- lionagi/integrations/storage/neo4j.py +1 -1
- lionagi/integrations/storage/storage_util.py +3 -4
- lionagi/integrations/storage/structure_excel.py +5 -4
- lionagi/integrations/storage/to_csv.py +3 -2
- lionagi/integrations/storage/to_excel.py +2 -2
- lionagi/libs/__init__.py +15 -19
- lionagi/libs/ln_api.py +9 -26
- lionagi/libs/ln_async.py +3 -2
- lionagi/libs/ln_convert.py +1 -18
- lionagi/libs/ln_func_call.py +3 -20
- lionagi/libs/ln_image.py +4 -1
- lionagi/libs/ln_knowledge_graph.py +5 -2
- lionagi/libs/ln_nested.py +2 -18
- lionagi/libs/ln_parse.py +4 -19
- lionagi/libs/ln_queue.py +2 -17
- lionagi/libs/ln_tokenize.py +3 -1
- lionagi/libs/ln_validate.py +2 -18
- lionagi/libs/sys_util.py +0 -16
- lionagi/lions/coder/code_form.py +3 -1
- lionagi/lions/coder/coder.py +1 -1
- lionagi/lions/coder/util.py +3 -2
- lionagi/lions/researcher/data_source/finhub_.py +1 -0
- lionagi/lions/researcher/data_source/google_.py +2 -2
- lionagi/lions/researcher/data_source/wiki_.py +1 -1
- lionagi/tests/libs/test_api.py +2 -1
- lionagi/tests/libs/test_convert.py +2 -1
- lionagi/tests/libs/test_field_validators.py +9 -8
- lionagi/tests/libs/test_func_call.py +2 -2
- lionagi/tests/libs/test_nested.py +1 -0
- lionagi/tests/libs/test_queue.py +1 -0
- lionagi/tests/libs/test_sys_util.py +4 -4
- lionagi/tests/test_core/collections/test_component.py +6 -4
- lionagi/tests/test_core/collections/test_exchange.py +2 -1
- lionagi/tests/test_core/collections/test_flow.py +2 -1
- lionagi/tests/test_core/collections/test_pile.py +3 -2
- lionagi/tests/test_core/collections/test_progression.py +3 -2
- lionagi/tests/test_core/generic/test_edge.py +4 -2
- lionagi/tests/test_core/generic/test_graph.py +3 -2
- lionagi/tests/test_core/generic/test_node.py +2 -1
- lionagi/tests/test_core/generic/test_tree_node.py +2 -1
- lionagi/tests/test_core/mail/test_mail.py +2 -1
- lionagi/tests/test_core/test_branch.py +3 -2
- lionagi/tests/test_core/test_form.py +1 -0
- lionagi/tests/test_core/test_report.py +1 -0
- lionagi/tests/test_core/test_validator.py +4 -3
- lionagi/version.py +1 -1
- lionagi-0.2.9.dist-info/METADATA +68 -0
- lionagi-0.2.9.dist-info/RECORD +267 -0
- {lionagi-0.2.7.dist-info → lionagi-0.2.9.dist-info}/WHEEL +1 -2
- lionagi-0.2.7.dist-info/METADATA +0 -277
- lionagi-0.2.7.dist-info/RECORD +0 -258
- lionagi-0.2.7.dist-info/top_level.txt +0 -1
- {lionagi-0.2.7.dist-info → lionagi-0.2.9.dist-info}/LICENSE +0 -0
lionagi/lions/coder/coder.py
CHANGED
@@ -6,7 +6,7 @@ from lionagi.core import Session
|
|
6
6
|
from lionagi.libs import ParseUtil
|
7
7
|
|
8
8
|
from .base_prompts import CODER_PROMPTS
|
9
|
-
from .util import install_missing_dependencies,
|
9
|
+
from .util import install_missing_dependencies, save_code_file, set_up_interpreter
|
10
10
|
|
11
11
|
|
12
12
|
class Coder:
|
lionagi/lions/coder/util.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
from typing import Any
|
2
1
|
from pathlib import Path
|
2
|
+
from typing import Any
|
3
3
|
|
4
4
|
E2B_key_scheme = "E2B_API_KEY"
|
5
5
|
|
@@ -15,9 +15,10 @@ def set_up_interpreter(interpreter_provider="e2b", key_scheme=E2B_key_scheme):
|
|
15
15
|
|
16
16
|
SysUtil.check_import("e2b_code_interpreter")
|
17
17
|
|
18
|
-
from e2b_code_interpreter import CodeInterpreter # type: ignore
|
19
18
|
from os import getenv
|
20
19
|
|
20
|
+
from e2b_code_interpreter import CodeInterpreter # type: ignore
|
21
|
+
|
21
22
|
return CodeInterpreter(api_key=getenv(key_scheme))
|
22
23
|
|
23
24
|
else:
|
@@ -68,11 +68,11 @@ class GoogleSearch:
|
|
68
68
|
)
|
69
69
|
|
70
70
|
from llama_index.agent import OpenAIAgent
|
71
|
+
from llama_index.llms.openai import OpenAI
|
72
|
+
from llama_index.tools.google import GoogleSearchToolSpec
|
71
73
|
from llama_index.tools.tool_spec.load_and_search.base import (
|
72
74
|
LoadAndSearchToolSpec,
|
73
75
|
)
|
74
|
-
from llama_index.tools.google import GoogleSearchToolSpec
|
75
|
-
from llama_index.llms.openai import OpenAI
|
76
76
|
|
77
77
|
llm = OpenAI(model="gpt-4-turbo", temperature=0.1)
|
78
78
|
|
@@ -26,9 +26,9 @@ class WikipediaSearch:
|
|
26
26
|
pip_name="llama-index-tools-wikipedia",
|
27
27
|
)
|
28
28
|
|
29
|
-
from llama_index.tools.wikipedia import WikipediaToolSpec
|
30
29
|
from llama_index.agent.openai import OpenAIAgent
|
31
30
|
from llama_index.llms.openai import OpenAI
|
31
|
+
from llama_index.tools.wikipedia import WikipediaToolSpec
|
32
32
|
|
33
33
|
llm = OpenAI(model="gpt-4-turbo", temperature=0.1)
|
34
34
|
|
lionagi/tests/libs/test_api.py
CHANGED
@@ -1,17 +1,18 @@
|
|
1
1
|
import unittest
|
2
2
|
from unittest.mock import patch
|
3
|
+
|
3
4
|
from lionagi.libs.ln_validate import (
|
4
|
-
check_dict_field,
|
5
|
-
check_action_field,
|
6
|
-
check_number_field,
|
7
|
-
check_bool_field,
|
8
|
-
check_str_field,
|
9
|
-
check_enum_field,
|
10
5
|
_fix_action_field,
|
11
|
-
_fix_number_field,
|
12
6
|
_fix_bool_field,
|
13
|
-
_fix_str_field,
|
14
7
|
_fix_enum_field,
|
8
|
+
_fix_number_field,
|
9
|
+
_fix_str_field,
|
10
|
+
check_action_field,
|
11
|
+
check_bool_field,
|
12
|
+
check_dict_field,
|
13
|
+
check_enum_field,
|
14
|
+
check_number_field,
|
15
|
+
check_str_field,
|
15
16
|
)
|
16
17
|
|
17
18
|
|
lionagi/tests/libs/test_queue.py
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
import unittest
|
2
|
-
from datetime import datetime, timezone
|
3
|
-
from unittest.mock import patch, MagicMock
|
4
1
|
import shutil
|
2
|
+
import sys
|
5
3
|
import tempfile
|
6
4
|
import time
|
7
|
-
import
|
5
|
+
import unittest
|
6
|
+
from datetime import datetime, timezone
|
8
7
|
from pathlib import Path
|
8
|
+
from unittest.mock import MagicMock, patch
|
9
9
|
|
10
10
|
from lionagi.libs.sys_util import SysUtil
|
11
11
|
|
@@ -1,12 +1,14 @@
|
|
1
|
+
import json
|
1
2
|
import unittest
|
3
|
+
from datetime import datetime
|
4
|
+
|
5
|
+
import pandas as pd
|
6
|
+
|
2
7
|
from lionagi.core.collections.abc.component import (
|
3
8
|
Component,
|
4
|
-
LionValueError,
|
5
9
|
LionTypeError,
|
10
|
+
LionValueError,
|
6
11
|
)
|
7
|
-
import pandas as pd
|
8
|
-
from datetime import datetime
|
9
|
-
import json
|
10
12
|
|
11
13
|
|
12
14
|
class TestComponent(unittest.TestCase):
|
@@ -1,7 +1,8 @@
|
|
1
1
|
import unittest
|
2
|
-
|
3
|
-
from lionagi.core.collections import Progression
|
2
|
+
|
4
3
|
from lionagi import Node
|
4
|
+
from lionagi.core.collections import Progression
|
5
|
+
from lionagi.core.collections.abc import ItemNotFoundError
|
5
6
|
|
6
7
|
|
7
8
|
class TestProgression(unittest.TestCase):
|
@@ -1,9 +1,11 @@
|
|
1
1
|
import unittest
|
2
2
|
from unittest.mock import AsyncMock, patch
|
3
|
+
|
3
4
|
from pydantic import ValidationError
|
4
|
-
|
5
|
-
from lionagi.core.
|
5
|
+
|
6
|
+
from lionagi.core.collections.abc import Component, Condition, LionIDable, get_lion_id
|
6
7
|
from lionagi.core.generic.edge import Edge
|
8
|
+
from lionagi.core.generic.edge_condition import EdgeCondition
|
7
9
|
|
8
10
|
|
9
11
|
class TestEdge(unittest.TestCase):
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import unittest
|
2
|
-
|
3
|
-
from lionagi.core.
|
2
|
+
|
3
|
+
from lionagi.core.collections.abc import ItemNotFoundError, LionTypeError
|
4
|
+
from lionagi.core.generic import Edge, Graph, Node
|
4
5
|
from lionagi.libs.ln_convert import to_list
|
5
6
|
|
6
7
|
|
@@ -1,9 +1,10 @@
|
|
1
1
|
import unittest
|
2
2
|
from unittest.mock import MagicMock, patch
|
3
|
+
|
3
4
|
import lionagi as li
|
4
|
-
from lionagi.core.message import System, Instruction, AssistantResponse, ActionResponse
|
5
|
-
from lionagi.core.collections import Pile, Progression, Exchange
|
6
5
|
from lionagi.core.action.tool_manager import ToolManager
|
6
|
+
from lionagi.core.collections import Exchange, Pile, Progression
|
7
|
+
from lionagi.core.message import ActionResponse, AssistantResponse, Instruction, System
|
7
8
|
|
8
9
|
|
9
10
|
class TestBranch(unittest.TestCase):
|
@@ -1,14 +1,15 @@
|
|
1
1
|
import unittest
|
2
|
-
from typing import Dict, List
|
2
|
+
from typing import Any, Dict, List
|
3
|
+
|
4
|
+
from lionagi.core.collections.abc import FieldError
|
3
5
|
from lionagi.core.report.form import Form
|
4
6
|
from lionagi.core.report.report import Report
|
5
|
-
from lionagi.core.collections.abc import FieldError
|
6
7
|
from lionagi.core.rule.base import Rule
|
7
8
|
from lionagi.core.rule.rulebook import RuleBook
|
8
9
|
from lionagi.core.validator.validator import (
|
9
|
-
Validator,
|
10
10
|
_DEFAULT_RULEORDER,
|
11
11
|
_DEFAULT_RULES,
|
12
|
+
Validator,
|
12
13
|
)
|
13
14
|
|
14
15
|
|
lionagi/version.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
__version__ = "0.2.
|
1
|
+
__version__ = "0.2.9"
|
@@ -0,0 +1,68 @@
|
|
1
|
+
Metadata-Version: 2.1
|
2
|
+
Name: lionagi
|
3
|
+
Version: 0.2.9
|
4
|
+
Summary: Towards automated general intelligence.
|
5
|
+
Author: HaiyangLi
|
6
|
+
Author-email: quantocean.li@gmail.com
|
7
|
+
Requires-Python: >=3.10,<4.0
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
9
|
+
Classifier: Programming Language :: Python :: 3.10
|
10
|
+
Classifier: Programming Language :: Python :: 3.11
|
11
|
+
Classifier: Programming Language :: Python :: 3.12
|
12
|
+
Requires-Dist: aiocache (>=0.12.3,<0.13.0)
|
13
|
+
Requires-Dist: ipython (>=8.27.0,<9.0.0)
|
14
|
+
Requires-Dist: lion-openai (>=0.1.4,<0.2.0)
|
15
|
+
Requires-Dist: lionfuncs (==1.0.1)
|
16
|
+
Requires-Dist: pandas (>=2.2.3,<3.0.0)
|
17
|
+
Requires-Dist: python-dotenv (>=1.0.1,<2.0.0)
|
18
|
+
Description-Content-Type: text/markdown
|
19
|
+
|
20
|
+
![PyPI - Version](https://img.shields.io/pypi/v/lionagi?labelColor=233476aa&color=231fc935) ![PyPI - Downloads](https://img.shields.io/pypi/dm/lionagi?color=blue)
|
21
|
+
|
22
|
+
|
23
|
+
[PyPI](https://pypi.org/project/lionagi/) | [Documentation](https://ocean-lion.com/Welcome) | [Discord](https://discord.gg/aqSJ2v46vu) | [Roadmap](https://trello.com/b/3seomsrI/lionagi)
|
24
|
+
|
25
|
+
|
26
|
+
# Language InterOperable Network - LION
|
27
|
+
### an AGentic Intelligence Operating System
|
28
|
+
|
29
|
+
```
|
30
|
+
pip install lionagi==0.2.8
|
31
|
+
```
|
32
|
+
|
33
|
+
**Powerful Intelligent Workflow Automation**
|
34
|
+
|
35
|
+
lionagi is an intelligent agentic workflow automation framework. It introduces advanced ML models into any existing workflows and data infrastructure.
|
36
|
+
|
37
|
+
|
38
|
+
### Why Automating Workflows?
|
39
|
+
|
40
|
+
Intelligent AI models such as [Large Language Model (LLM)](https://en.wikipedia.org/wiki/Large_language_model), introduced new possibilities of human-computer interaction. LLMs is drawing a lot of attention worldwide due to its “one model fits all”, and incredible performance. One way of using LLM is to use as search engine, however, this usage is complicated by the fact that LLMs [hallucinate](https://arxiv.org/abs/2311.05232).
|
41
|
+
|
42
|
+
What goes inside of a LLM is more akin to a [black-box](https://pauldeepakraj-r.medium.com/demystifying-the-black-box-a-deep-dive-into-llm-interpretability-971524966fdf), lacking interpretability, meaning we don’t know how it reaches certain answer or conclusion, thus we cannot fully trust/rely the output from such a system. Another approach of using LLM is to treat them as [intelligent agent](https://arxiv.org/html/2401.03428v1), that are equipped with various tools and data sources. A workflow conducted by such an intelligent agent have clear steps, and we can specify, observe, evaluate and optimize the logic for each decision that the `agent` made to perform actions. This approach, though we still cannot pinpoint how LLM output what it outputs, but the flow itself is **explainable**.
|
43
|
+
|
44
|
+
|
45
|
+
|
46
|
+
### Community
|
47
|
+
|
48
|
+
We encourage contributions to LionAGI and invite you to enrich its features and capabilities. Engage with us and other community members [Join Our Discord](https://discord.gg/aqSJ2v46vu)
|
49
|
+
|
50
|
+
### Citation
|
51
|
+
|
52
|
+
When referencing LionAGI in your projects or research, please cite:
|
53
|
+
|
54
|
+
```bibtex
|
55
|
+
@software{Li_LionAGI_2023,
|
56
|
+
author = {Haiyang Li},
|
57
|
+
month = {12},
|
58
|
+
year = {2023},
|
59
|
+
title = {LionAGI: Towards Automated General Intelligence},
|
60
|
+
url = {https://github.com/lion-agi/lionagi},
|
61
|
+
}
|
62
|
+
```
|
63
|
+
|
64
|
+
|
65
|
+
### Requirements
|
66
|
+
Python 3.10 or higher.
|
67
|
+
|
68
|
+
|