lionagi 0.2.4__tar.gz → 0.2.5__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {lionagi-0.2.4 → lionagi-0.2.5}/PKG-INFO +2 -2
- {lionagi-0.2.4 → lionagi-0.2.5}/README.md +1 -1
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/engine/branch_engine.py +4 -1
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/generic/graph.py +4 -2
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/generic/node.py +2 -2
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/session/directive_mixin.py +2 -2
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/unit/unit_mixin.py +1 -1
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/work/work_edge.py +8 -6
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/work/work_function.py +13 -6
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/work/work_function_node.py +19 -8
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/work/work_queue.py +4 -4
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/work/work_task.py +14 -24
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/work/worker.py +66 -39
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/work/worker_engine.py +38 -13
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/config/oai_configs.py +1 -1
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/provider/litellm.py +3 -4
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/libs/ln_parse.py +2 -2
- lionagi-0.2.5/lionagi/tests/api/aws/conftest.py +25 -0
- lionagi-0.2.5/lionagi/tests/api/aws/test_aws_s3.py +6 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/test_core/generic/test_structure.py +2 -2
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/test_core/graph/test_graph.py +1 -1
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/test_core/graph/test_tree.py +1 -1
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/test_core/mail/test_mail.py +4 -5
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/test_core/test_structure/test_base_structure.py +1 -1
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/test_core/test_structure/test_graph.py +1 -1
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/test_core/test_structure/test_tree.py +1 -1
- lionagi-0.2.5/lionagi/version.py +1 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi.egg-info/PKG-INFO +2 -2
- lionagi-0.2.4/lionagi/tests/api/aws/conftest.py +0 -28
- lionagi-0.2.4/lionagi/tests/api/aws/test_aws_s3.py +0 -7
- lionagi-0.2.4/lionagi/version.py +0 -1
- {lionagi-0.2.4 → lionagi-0.2.5}/LICENSE +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/README.rst +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/__init__.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/__init__.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/_setting/__init__.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/_setting/_setting.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/action/__init__.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/action/function_calling.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/action/manual.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/action/node.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/action/tool.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/action/tool_manager.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/agent/__init__.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/agent/base_agent.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/agent/eval/__init__.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/agent/eval/evaluator.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/agent/eval/vote.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/agent/learn/__init__.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/agent/learn/learner.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/agent/plan/__init__.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/agent/plan/plan.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/agent/plan/unit_template.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/collections/__init__.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/collections/_logger.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/collections/abc/__init__.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/collections/abc/component.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/collections/abc/concepts.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/collections/abc/exceptions.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/collections/abc/util.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/collections/exchange.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/collections/flow.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/collections/model.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/collections/pile.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/collections/progression.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/collections/util.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/director/__init__.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/director/direct.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/director/director.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/engine/__init__.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/engine/instruction_map_engine.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/engine/sandbox_.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/engine/script_engine.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/executor/__init__.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/executor/base_executor.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/executor/graph_executor.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/executor/neo4j_executor.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/generic/__init__.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/generic/edge.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/generic/edge_condition.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/generic/hyperedge.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/generic/tree.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/generic/tree_node.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/mail/__init__.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/mail/mail.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/mail/mail_manager.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/mail/package.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/mail/start_mail.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/message/__init__.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/message/action_request.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/message/action_response.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/message/assistant_response.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/message/instruction.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/message/message.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/message/system.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/message/util.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/report/__init__.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/report/base.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/report/form.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/report/report.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/report/util.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/rule/__init__.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/rule/_default.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/rule/action.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/rule/base.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/rule/boolean.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/rule/choice.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/rule/mapping.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/rule/number.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/rule/rulebook.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/rule/string.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/rule/util.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/session/__init__.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/session/branch.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/session/session.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/structure/__init__.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/structure/chain.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/structure/forest.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/structure/graph.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/structure/tree.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/unit/__init__.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/unit/parallel_unit.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/unit/template/__init__.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/unit/template/action.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/unit/template/base.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/unit/template/plan.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/unit/template/predict.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/unit/template/score.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/unit/template/select.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/unit/unit.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/unit/unit_form.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/unit/util.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/validator/__init__.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/validator/validator.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/work/__init__.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/work/work.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/core/work/worklog.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/experimental/__init__.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/experimental/compressor/__init__.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/experimental/compressor/base.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/experimental/compressor/llm_compressor.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/experimental/compressor/llm_summarizer.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/experimental/compressor/util.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/experimental/directive/__init__.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/experimental/directive/parser/__init__.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/experimental/directive/parser/base_parser.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/experimental/directive/template/__init__.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/experimental/directive/template/base_template.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/experimental/directive/template/schema.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/experimental/directive/tokenizer.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/experimental/evaluator/__init__.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/experimental/evaluator/ast_evaluator.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/experimental/evaluator/base_evaluator.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/experimental/knowledge/__init__.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/experimental/knowledge/base.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/experimental/knowledge/graph.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/experimental/memory/__init__.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/experimental/strategies/__init__.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/experimental/strategies/base.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/__init__.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/bridge/__init__.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/bridge/autogen_/__init__.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/bridge/autogen_/autogen_.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/bridge/langchain_/__init__.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/bridge/langchain_/documents.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/bridge/langchain_/langchain_bridge.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/bridge/llamaindex_/__init__.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/bridge/llamaindex_/index.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/bridge/llamaindex_/llama_index_bridge.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/bridge/llamaindex_/llama_pack.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/bridge/llamaindex_/node_parser.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/bridge/llamaindex_/reader.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/bridge/llamaindex_/textnode.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/bridge/pydantic_/__init__.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/bridge/pydantic_/pydantic_bridge.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/bridge/transformers_/__init__.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/bridge/transformers_/install_.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/chunker/__init__.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/chunker/chunk.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/config/__init__.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/config/mlx_configs.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/config/ollama_configs.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/config/openrouter_configs.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/loader/__init__.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/loader/load.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/loader/load_util.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/provider/__init__.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/provider/_mapping.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/provider/mistralai.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/provider/mlx_service.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/provider/oai.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/provider/ollama.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/provider/openrouter.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/provider/services.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/provider/transformers.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/storage/__init__.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/storage/neo4j.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/storage/storage_util.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/storage/structure_excel.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/storage/to_csv.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/integrations/storage/to_excel.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/libs/__init__.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/libs/ln_api.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/libs/ln_async.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/libs/ln_context.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/libs/ln_convert.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/libs/ln_dataframe.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/libs/ln_func_call.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/libs/ln_image.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/libs/ln_knowledge_graph.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/libs/ln_nested.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/libs/ln_queue.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/libs/ln_tokenize.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/libs/ln_validate.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/libs/special_tokens.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/libs/sys_util.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/lions/__init__.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/lions/coder/__init__.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/lions/coder/add_feature.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/lions/coder/base_prompts.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/lions/coder/code_form.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/lions/coder/coder.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/lions/coder/util.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/lions/researcher/__init__.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/lions/researcher/data_source/__init__.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/lions/researcher/data_source/finhub_.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/lions/researcher/data_source/google_.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/lions/researcher/data_source/wiki_.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/lions/researcher/data_source/yfinance_.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/__init__.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/api/__init__.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/api/aws/__init__.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/integrations/__init__.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/libs/__init__.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/libs/test_api.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/libs/test_convert.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/libs/test_field_validators.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/libs/test_func_call.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/libs/test_nested.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/libs/test_parse.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/libs/test_queue.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/libs/test_sys_util.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/test_core/__init__.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/test_core/collections/__init__.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/test_core/collections/test_component.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/test_core/collections/test_exchange.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/test_core/collections/test_flow.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/test_core/collections/test_pile.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/test_core/collections/test_progression.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/test_core/generic/__init__.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/test_core/generic/test_edge.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/test_core/generic/test_graph.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/test_core/generic/test_node.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/test_core/generic/test_tree_node.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/test_core/graph/__init__.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/test_core/mail/__init__.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/test_core/test_branch.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/test_core/test_form.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/test_core/test_report.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/test_core/test_structure/__init__.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi/tests/test_core/test_validator.py +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi.egg-info/SOURCES.txt +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi.egg-info/dependency_links.txt +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi.egg-info/requires.txt +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/lionagi.egg-info/top_level.txt +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/pyproject.toml +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/setup.cfg +0 -0
- {lionagi-0.2.4 → lionagi-0.2.5}/setup.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: lionagi
|
3
|
-
Version: 0.2.
|
3
|
+
Version: 0.2.5
|
4
4
|
Summary: Towards automated general intelligence.
|
5
5
|
Author: HaiyangLi
|
6
6
|
Author-email: Haiyang Li <ocean@lionagi.ai>
|
@@ -237,7 +237,7 @@ Requires-Dist: boto3>=1.34.131
|
|
237
237
|
### an AGentic Intelligence Operating System
|
238
238
|
|
239
239
|
```
|
240
|
-
pip install lionagi==0.2.
|
240
|
+
pip install lionagi==0.2.5
|
241
241
|
```
|
242
242
|
|
243
243
|
**Powerful Intelligent Workflow Automation**
|
@@ -57,7 +57,10 @@ class BranchExecutor(Branch, BaseExecutor):
|
|
57
57
|
await self._process_condition(mail)
|
58
58
|
elif mail.category == "end":
|
59
59
|
self._process_end(mail)
|
60
|
-
if
|
60
|
+
if (
|
61
|
+
key in self.mailbox.pending_ins
|
62
|
+
and self.mailbox.pending_ins.get(key, Pile()).size() == 0
|
63
|
+
):
|
61
64
|
self.mailbox.pending_ins.pop(key)
|
62
65
|
|
63
66
|
async def execute(self, refresh_time=1) -> None:
|
@@ -202,7 +202,9 @@ class Graph(Node):
|
|
202
202
|
|
203
203
|
return g
|
204
204
|
|
205
|
-
def display(
|
205
|
+
def display(
|
206
|
+
self, node_label="class_name", edge_label="label", draw_kwargs={}, **kwargs
|
207
|
+
):
|
206
208
|
"""Display the graph using NetworkX and Matplotlib."""
|
207
209
|
from lionagi.libs import SysUtil
|
208
210
|
|
@@ -224,7 +226,7 @@ class Graph(Node):
|
|
224
226
|
node_color="orange",
|
225
227
|
alpha=0.9,
|
226
228
|
labels=nx.get_node_attributes(g, node_label),
|
227
|
-
**draw_kwargs
|
229
|
+
**draw_kwargs,
|
228
230
|
)
|
229
231
|
|
230
232
|
labels = nx.get_edge_attributes(g, edge_label)
|
@@ -124,7 +124,7 @@ class Node(Component, Relatable):
|
|
124
124
|
label: str | None = None,
|
125
125
|
bundle: bool = False,
|
126
126
|
edge_class: Callable = Edge,
|
127
|
-
**kwargs
|
127
|
+
**kwargs,
|
128
128
|
) -> None:
|
129
129
|
"""
|
130
130
|
Establish directed relationship from this node to another.
|
@@ -150,7 +150,7 @@ class Node(Component, Relatable):
|
|
150
150
|
condition=condition,
|
151
151
|
bundle=bundle,
|
152
152
|
label=label,
|
153
|
-
**kwargs
|
153
|
+
**kwargs,
|
154
154
|
)
|
155
155
|
|
156
156
|
self.relations[direction].include(edge)
|
@@ -248,7 +248,7 @@ class DirectiveMixin:
|
|
248
248
|
form.action_response.update(_dict)
|
249
249
|
|
250
250
|
return form
|
251
|
-
|
251
|
+
|
252
252
|
form = await _directive.direct(
|
253
253
|
instruction=instruction,
|
254
254
|
context=context,
|
@@ -283,5 +283,5 @@ class DirectiveMixin:
|
|
283
283
|
if not hasattr(form, "action_response"):
|
284
284
|
form.append_to_request("action_response", {})
|
285
285
|
form.action_response.update(_dict)
|
286
|
-
|
286
|
+
|
287
287
|
return form
|
@@ -21,19 +21,19 @@ class WorkEdge(Edge, Progressable):
|
|
21
21
|
other than "from_work" and "from_result".
|
22
22
|
associated_worker (Worker): The worker to which this WorkEdge belongs.
|
23
23
|
"""
|
24
|
+
|
24
25
|
convert_function: Callable = Field(
|
25
26
|
...,
|
26
|
-
description="Function to transform the result of the previous work into parameters for the next work."
|
27
|
+
description="Function to transform the result of the previous work into parameters for the next work.",
|
27
28
|
)
|
28
29
|
|
29
30
|
convert_function_kwargs: dict = Field(
|
30
31
|
{},
|
31
|
-
description=
|
32
|
+
description='parameters for the worklink function other than "from_work" and "from_result"',
|
32
33
|
)
|
33
34
|
|
34
35
|
associated_worker: Worker = Field(
|
35
|
-
...,
|
36
|
-
description="The worker to which this WorkEdge belongs."
|
36
|
+
..., description="The worker to which this WorkEdge belongs."
|
37
37
|
)
|
38
38
|
|
39
39
|
@field_validator("convert_function", mode="before")
|
@@ -81,8 +81,10 @@ class WorkEdge(Edge, Progressable):
|
|
81
81
|
StopIteration: If the task has no available steps left to proceed.
|
82
82
|
"""
|
83
83
|
if task.available_steps == 0:
|
84
|
-
task.status_note = (
|
85
|
-
|
84
|
+
task.status_note = (
|
85
|
+
"Task stopped proceeding further as all available steps have been used up, "
|
86
|
+
"but the task has not yet reached completion."
|
87
|
+
)
|
86
88
|
return
|
87
89
|
func_signature = inspect.signature(self.convert_function)
|
88
90
|
kwargs = self.convert_function_kwargs.copy()
|
@@ -13,6 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
13
|
See the License for the specific language governing permissions and
|
14
14
|
limitations under the License.
|
15
15
|
"""
|
16
|
+
|
16
17
|
import asyncio
|
17
18
|
import logging
|
18
19
|
|
@@ -33,7 +34,13 @@ class WorkFunction:
|
|
33
34
|
"""
|
34
35
|
|
35
36
|
def __init__(
|
36
|
-
self,
|
37
|
+
self,
|
38
|
+
assignment,
|
39
|
+
function,
|
40
|
+
retry_kwargs=None,
|
41
|
+
guidance=None,
|
42
|
+
capacity=10,
|
43
|
+
refresh_time=1,
|
37
44
|
):
|
38
45
|
"""
|
39
46
|
Initializes a WorkFunction instance.
|
@@ -69,11 +76,11 @@ class WorkFunction:
|
|
69
76
|
@property
|
70
77
|
def execution_mode(self):
|
71
78
|
"""
|
72
|
-
|
79
|
+
Gets the execution mode of the work function's queue.
|
73
80
|
|
74
|
-
|
75
|
-
|
76
|
-
|
81
|
+
Returns:
|
82
|
+
bool: The execution mode of the work function's queue.
|
83
|
+
"""
|
77
84
|
return self.worklog.queue.execution_mode
|
78
85
|
|
79
86
|
def is_progressable(self):
|
@@ -121,4 +128,4 @@ class WorkFunction:
|
|
121
128
|
"""
|
122
129
|
Stops the execution of the work function's queue.
|
123
130
|
"""
|
124
|
-
await self.worklog.stop()
|
131
|
+
await self.worklog.stop()
|
@@ -21,7 +21,16 @@ class WorkFunctionNode(WorkFunction, Node):
|
|
21
21
|
refresh_time (int): The time interval to refresh the work log queue.
|
22
22
|
"""
|
23
23
|
|
24
|
-
def __init__(
|
24
|
+
def __init__(
|
25
|
+
self,
|
26
|
+
assignment,
|
27
|
+
function,
|
28
|
+
retry_kwargs=None,
|
29
|
+
guidance=None,
|
30
|
+
capacity=10,
|
31
|
+
refresh_time=1,
|
32
|
+
**kwargs,
|
33
|
+
):
|
25
34
|
"""
|
26
35
|
Initializes a WorkFunctionNode instance.
|
27
36
|
|
@@ -35,10 +44,12 @@ class WorkFunctionNode(WorkFunction, Node):
|
|
35
44
|
**kwargs: Additional keyword arguments for the Node initialization.
|
36
45
|
"""
|
37
46
|
Node.__init__(self, **kwargs)
|
38
|
-
WorkFunction.__init__(
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
47
|
+
WorkFunction.__init__(
|
48
|
+
self,
|
49
|
+
assignment=assignment,
|
50
|
+
function=function,
|
51
|
+
retry_kwargs=retry_kwargs,
|
52
|
+
guidance=guidance,
|
53
|
+
capacity=capacity,
|
54
|
+
refresh_time=refresh_time,
|
55
|
+
)
|
@@ -90,11 +90,11 @@ class WorkQueue:
|
|
90
90
|
|
91
91
|
async def execute(self):
|
92
92
|
"""
|
93
|
-
|
93
|
+
Continuously executes the process method at a specified refresh interval.
|
94
94
|
|
95
|
-
|
96
|
-
|
97
|
-
|
95
|
+
Args:
|
96
|
+
refresh_time (int, optional): The time in seconds to wait between
|
97
|
+
successive calls to `process`. Defaults to 1.
|
98
98
|
"""
|
99
99
|
self.execution_mode = True
|
100
100
|
self._stop_event.clear()
|
@@ -20,39 +20,24 @@ class WorkTask(Component):
|
|
20
20
|
current_work (Work | None): The current work in progress.
|
21
21
|
post_processing (Callable | None): The post-processing function to be executed after the entire task is successfully completed.
|
22
22
|
"""
|
23
|
-
|
24
|
-
|
25
|
-
description="Name of the task"
|
26
|
-
)
|
23
|
+
|
24
|
+
name: str | None = Field(None, description="Name of the task")
|
27
25
|
|
28
26
|
status: WorkStatus = Field(
|
29
|
-
WorkStatus.PENDING,
|
30
|
-
description="The current status of the task"
|
27
|
+
WorkStatus.PENDING, description="The current status of the task"
|
31
28
|
)
|
32
29
|
|
33
|
-
status_note: str = Field(
|
34
|
-
None,
|
35
|
-
description="Note for tasks current status"
|
36
|
-
)
|
30
|
+
status_note: str = Field(None, description="Note for tasks current status")
|
37
31
|
|
38
|
-
work_history: list[Work] = Field(
|
39
|
-
[],
|
40
|
-
description="List of works processed"
|
41
|
-
)
|
32
|
+
work_history: list[Work] = Field([], description="List of works processed")
|
42
33
|
|
43
|
-
max_steps: int | None = Field(
|
44
|
-
10,
|
45
|
-
description="Maximum number of works allowed"
|
46
|
-
)
|
34
|
+
max_steps: int | None = Field(10, description="Maximum number of works allowed")
|
47
35
|
|
48
|
-
current_work: Work | None = Field(
|
49
|
-
None,
|
50
|
-
description="The current work in progress"
|
51
|
-
)
|
36
|
+
current_work: Work | None = Field(None, description="The current work in progress")
|
52
37
|
|
53
38
|
post_processing: Callable | None = Field(
|
54
39
|
None,
|
55
|
-
description="The post-processing function to be executed after the entire task has been successfully completed."
|
40
|
+
description="The post-processing function to be executed after the entire task has been successfully completed.",
|
56
41
|
)
|
57
42
|
|
58
43
|
@field_validator("max_steps", mode="before")
|
@@ -108,7 +93,12 @@ class WorkTask(Component):
|
|
108
93
|
Returns:
|
109
94
|
WorkTask: A new instance of WorkTask with the same attributes.
|
110
95
|
"""
|
111
|
-
new_worktask = WorkTask(
|
96
|
+
new_worktask = WorkTask(
|
97
|
+
name=self.name,
|
98
|
+
status=self.status,
|
99
|
+
max_steps=self.max_steps,
|
100
|
+
current_work=self.current_work,
|
101
|
+
)
|
112
102
|
for work in self.work_history:
|
113
103
|
new_worktask.work_history.append(work)
|
114
104
|
return new_worktask
|
@@ -93,7 +93,9 @@ class Worker(ABC):
|
|
93
93
|
|
94
94
|
"""
|
95
95
|
if form_key not in self.forms.keys():
|
96
|
-
raise ValueError(
|
96
|
+
raise ValueError(
|
97
|
+
f"Unable to change default form. Key {form_key} does not exist."
|
98
|
+
)
|
97
99
|
self.default_form = self.forms[form_key]
|
98
100
|
|
99
101
|
def _get_decorated_functions(self, decorator_attr, name_only=True):
|
@@ -108,7 +110,9 @@ class Worker(ABC):
|
|
108
110
|
list: List of decorated function names or tuples containing function details.
|
109
111
|
"""
|
110
112
|
decorated_functions = []
|
111
|
-
for name, func in inspect.getmembers(
|
113
|
+
for name, func in inspect.getmembers(
|
114
|
+
self.__class__, predicate=inspect.isfunction
|
115
|
+
):
|
112
116
|
if hasattr(func, decorator_attr):
|
113
117
|
if name_only:
|
114
118
|
decorated_functions.append(name)
|
@@ -121,11 +125,18 @@ class Worker(ABC):
|
|
121
125
|
"""
|
122
126
|
Validates worklink functions to ensure they have the required parameters.
|
123
127
|
"""
|
124
|
-
worklink_decorated_function = self._get_decorated_functions(
|
128
|
+
worklink_decorated_function = self._get_decorated_functions(
|
129
|
+
decorator_attr="_worklink_decorator_params", name_only=False
|
130
|
+
)
|
125
131
|
for func_name, func, _ in worklink_decorated_function:
|
126
132
|
func_signature = inspect.signature(func)
|
127
|
-
if
|
128
|
-
|
133
|
+
if (
|
134
|
+
"from_work" not in func_signature.parameters
|
135
|
+
and "from_result" not in func_signature.parameters
|
136
|
+
):
|
137
|
+
raise ValueError(
|
138
|
+
f'Either "from_work" or "from_result" must be a parameter in function {func_name}'
|
139
|
+
)
|
129
140
|
|
130
141
|
def construct_all_work_functions(self):
|
131
142
|
"""
|
@@ -133,7 +144,9 @@ class Worker(ABC):
|
|
133
144
|
"""
|
134
145
|
if getattr(self, "work_functions", None) is None:
|
135
146
|
self.work_functions = {}
|
136
|
-
work_decorated_function = self._get_decorated_functions(
|
147
|
+
work_decorated_function = self._get_decorated_functions(
|
148
|
+
decorator_attr="_work_decorator_params", name_only=False
|
149
|
+
)
|
137
150
|
for func_name, func, dec_params in work_decorated_function:
|
138
151
|
if func_name not in self.work_functions:
|
139
152
|
self.work_functions[func_name] = WorkFunction(**dec_params)
|
@@ -174,7 +187,7 @@ class Worker(ABC):
|
|
174
187
|
retry_kwargs=retry_kwargs or {},
|
175
188
|
guidance=guidance or function.__doc__,
|
176
189
|
capacity=capacity,
|
177
|
-
refresh_time=refresh_time
|
190
|
+
refresh_time=refresh_time,
|
178
191
|
)
|
179
192
|
|
180
193
|
work_func: WorkFunction = self.work_functions[function.__name__]
|
@@ -183,7 +196,9 @@ class Worker(ABC):
|
|
183
196
|
if form_param_key:
|
184
197
|
func_signature = inspect.signature(function)
|
185
198
|
if form_param_key not in func_signature.parameters:
|
186
|
-
raise KeyError(
|
199
|
+
raise KeyError(
|
200
|
+
f'Failed to locate form. "{form_param_key}" is not defined in the function.'
|
201
|
+
)
|
187
202
|
if "self" in func_signature.parameters:
|
188
203
|
bound_args = func_signature.bind(None, *args, **kwargs)
|
189
204
|
else:
|
@@ -199,14 +214,18 @@ class Worker(ABC):
|
|
199
214
|
form = self.forms.get(form_key) or self.default_form
|
200
215
|
|
201
216
|
if form:
|
202
|
-
subform = form.__class__(
|
217
|
+
subform = form.__class__(
|
218
|
+
assignment=work_func.assignment, task=work_func.guidance
|
219
|
+
)
|
203
220
|
for k in subform.input_fields:
|
204
221
|
v = getattr(form, k, None)
|
205
222
|
setattr(subform, k, v)
|
206
223
|
subform.origin = form
|
207
224
|
kwargs = {"form": subform} | kwargs
|
208
225
|
else:
|
209
|
-
raise ValueError(
|
226
|
+
raise ValueError(
|
227
|
+
f"Cannot locate form in Worker's forms and default_form is not available."
|
228
|
+
)
|
210
229
|
|
211
230
|
task = work_func.perform(self, *args, **kwargs)
|
212
231
|
work = Work(async_task=task, async_task_name=work_func.name)
|
@@ -221,7 +240,7 @@ def work(
|
|
221
240
|
guidance=None,
|
222
241
|
retry_kwargs=None,
|
223
242
|
timeout=10,
|
224
|
-
refresh_time=1
|
243
|
+
refresh_time=1,
|
225
244
|
):
|
226
245
|
"""
|
227
246
|
Decorator to mark a method as a work function.
|
@@ -271,23 +290,22 @@ def work(
|
|
271
290
|
refresh_time=refresh_time,
|
272
291
|
**kwargs,
|
273
292
|
)
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
293
|
+
|
294
|
+
wrapper._work_decorator_params = {
|
295
|
+
"assignment": assignment,
|
296
|
+
"function": func,
|
297
|
+
"retry_kwargs": retry_kwargs,
|
298
|
+
"guidance": guidance,
|
299
|
+
"capacity": capacity,
|
300
|
+
"refresh_time": refresh_time,
|
301
|
+
}
|
280
302
|
|
281
303
|
return wrapper
|
282
304
|
|
283
305
|
return decorator
|
284
306
|
|
285
307
|
|
286
|
-
def worklink(
|
287
|
-
from_: str,
|
288
|
-
to_: str,
|
289
|
-
auto_schedule: bool = True
|
290
|
-
):
|
308
|
+
def worklink(from_: str, to_: str, auto_schedule: bool = True):
|
291
309
|
"""
|
292
310
|
Decorator to create a link between two work functions.
|
293
311
|
|
@@ -299,26 +317,31 @@ def worklink(
|
|
299
317
|
Returns:
|
300
318
|
Callable: The decorated function.
|
301
319
|
"""
|
320
|
+
|
302
321
|
def decorator(func):
|
303
322
|
@wraps(func)
|
304
323
|
async def wrapper(
|
305
|
-
self: Worker,
|
306
|
-
*args,
|
307
|
-
func=func,
|
308
|
-
from_=from_,
|
309
|
-
to_=to_,
|
310
|
-
**kwargs
|
324
|
+
self: Worker, *args, func=func, from_=from_, to_=to_, **kwargs
|
311
325
|
):
|
312
326
|
if not inspect.iscoroutinefunction(func):
|
313
327
|
raise TypeError(f"{func.__name__} must be an asynchronous function")
|
314
328
|
|
315
|
-
work_funcs = self._get_decorated_functions(
|
329
|
+
work_funcs = self._get_decorated_functions(
|
330
|
+
decorator_attr="_work_decorator_params"
|
331
|
+
)
|
316
332
|
if from_ not in work_funcs or to_ not in work_funcs:
|
317
|
-
raise ValueError(
|
333
|
+
raise ValueError(
|
334
|
+
"Invalid link. 'from_' and 'to_' must be the name of work decorated functions."
|
335
|
+
)
|
318
336
|
|
319
337
|
func_signature = inspect.signature(func)
|
320
|
-
if
|
321
|
-
|
338
|
+
if (
|
339
|
+
"from_work" not in func_signature.parameters
|
340
|
+
and "from_result" not in func_signature.parameters
|
341
|
+
):
|
342
|
+
raise ValueError(
|
343
|
+
f'Either "from_work" or "from_result" must be a parameter in function {func.__name__}'
|
344
|
+
)
|
322
345
|
|
323
346
|
if "self" in func_signature.parameters:
|
324
347
|
bound_args = func_signature.bind(None, *args, **kwargs)
|
@@ -331,10 +354,14 @@ def worklink(
|
|
331
354
|
|
332
355
|
if from_work := arguments.get("from_work"):
|
333
356
|
if not isinstance(from_work, Work):
|
334
|
-
raise ValueError(
|
357
|
+
raise ValueError(
|
358
|
+
"Invalid type for from_work. Only work objects are accepted."
|
359
|
+
)
|
335
360
|
if from_work.async_task_name != from_:
|
336
|
-
raise ValueError(
|
337
|
-
|
361
|
+
raise ValueError(
|
362
|
+
f"Invalid work object in from_work. "
|
363
|
+
f'async_task_name "{from_work.async_task_name}" does not match from_ "{from_}"'
|
364
|
+
)
|
338
365
|
|
339
366
|
next_params = await func(self, *args, **kwargs)
|
340
367
|
to_work_func = getattr(self, to_)
|
@@ -347,7 +374,9 @@ def worklink(
|
|
347
374
|
if wrapper.auto_schedule:
|
348
375
|
return await to_work_func(**next_params)
|
349
376
|
elif isinstance(next_params, tuple) and len(next_params) == 2:
|
350
|
-
if isinstance(next_params[0], list) and isinstance(
|
377
|
+
if isinstance(next_params[0], list) and isinstance(
|
378
|
+
next_params[1], dict
|
379
|
+
):
|
351
380
|
if wrapper.auto_schedule:
|
352
381
|
return await to_work_func(*next_params[0], **next_params[1])
|
353
382
|
else:
|
@@ -358,9 +387,7 @@ def worklink(
|
|
358
387
|
return next_params
|
359
388
|
|
360
389
|
wrapper.auto_schedule = auto_schedule
|
361
|
-
wrapper._worklink_decorator_params = {"func": func,
|
362
|
-
"from_": from_,
|
363
|
-
"to_": to_}
|
390
|
+
wrapper._worklink_decorator_params = {"func": func, "from_": from_, "to_": to_}
|
364
391
|
|
365
392
|
return wrapper
|
366
393
|
|
@@ -41,7 +41,15 @@ class WorkerEngine:
|
|
41
41
|
self.refresh_time = refresh_time
|
42
42
|
self._stop_event = asyncio.Event()
|
43
43
|
|
44
|
-
async def add_task(
|
44
|
+
async def add_task(
|
45
|
+
self,
|
46
|
+
*args,
|
47
|
+
task_function: str,
|
48
|
+
task_name=None,
|
49
|
+
task_max_steps=10,
|
50
|
+
task_post_processing=None,
|
51
|
+
**kwargs,
|
52
|
+
):
|
45
53
|
"""
|
46
54
|
Adds a new task to the task queue.
|
47
55
|
|
@@ -56,7 +64,11 @@ class WorkerEngine:
|
|
56
64
|
Returns:
|
57
65
|
WorkTask: The newly created task.
|
58
66
|
"""
|
59
|
-
task = WorkTask(
|
67
|
+
task = WorkTask(
|
68
|
+
name=task_name,
|
69
|
+
max_steps=task_max_steps,
|
70
|
+
post_processing=task_post_processing,
|
71
|
+
)
|
60
72
|
self.tasks.append(task)
|
61
73
|
function = getattr(self.worker, task_function)
|
62
74
|
work = await function(*args, **kwargs)
|
@@ -66,7 +78,7 @@ class WorkerEngine:
|
|
66
78
|
|
67
79
|
async def activate_work_queues(self):
|
68
80
|
"""
|
69
|
-
|
81
|
+
Activates the work queues for all work functions.
|
70
82
|
"""
|
71
83
|
for work_function in self.worker.work_functions.values():
|
72
84
|
if not work_function.worklog.queue.execution_mode:
|
@@ -141,11 +153,12 @@ class WorkerEngine:
|
|
141
153
|
Executes tasks continuously until stopped.
|
142
154
|
"""
|
143
155
|
self._stop_event.clear()
|
144
|
-
|
156
|
+
|
145
157
|
async def execute_lasting_inner():
|
146
158
|
while not self.stopped:
|
147
159
|
await self.execute(stop_queue=False)
|
148
160
|
await asyncio.sleep(self.refresh_time)
|
161
|
+
|
149
162
|
asyncio.create_task(execute_lasting_inner())
|
150
163
|
|
151
164
|
def _construct_work_functions(self):
|
@@ -154,26 +167,38 @@ class WorkerEngine:
|
|
154
167
|
"""
|
155
168
|
if getattr(self.worker, "work_functions", None) is None:
|
156
169
|
self.worker.work_functions = {}
|
157
|
-
work_decorated_function = self.worker._get_decorated_functions(
|
158
|
-
|
170
|
+
work_decorated_function = self.worker._get_decorated_functions(
|
171
|
+
decorator_attr="_work_decorator_params", name_only=False
|
172
|
+
)
|
159
173
|
for func_name, func, dec_params in work_decorated_function:
|
160
174
|
if func_name not in self.worker.work_functions:
|
161
175
|
self.worker.work_functions[func_name] = WorkFunctionNode(**dec_params)
|
162
176
|
self.worker_graph.add_node(self.worker.work_functions[func_name])
|
163
177
|
else:
|
164
|
-
if not isinstance(
|
165
|
-
|
166
|
-
|
167
|
-
|
178
|
+
if not isinstance(
|
179
|
+
self.worker.work_functions[func_name], WorkFunctionNode
|
180
|
+
):
|
181
|
+
raise TypeError(
|
182
|
+
f"WorkFunction {func_name} already exists but is not a WorkFunctionNode. "
|
183
|
+
f"If you would like to use it in WorkerEngine, please convert it to a "
|
184
|
+
f"WorkFunctionNode, or initiate a new worker, or pop it from work_function dict"
|
185
|
+
)
|
168
186
|
|
169
187
|
def _construct_workedges(self):
|
170
188
|
"""
|
171
189
|
Constructs work edges for the worker graph.
|
172
190
|
"""
|
173
|
-
worklink_decorated_function = self.worker._get_decorated_functions(
|
174
|
-
|
191
|
+
worklink_decorated_function = self.worker._get_decorated_functions(
|
192
|
+
decorator_attr="_worklink_decorator_params", name_only=False
|
193
|
+
)
|
175
194
|
|
176
195
|
for func_name, func, dec_params in worklink_decorated_function:
|
177
196
|
head = self.worker.work_functions[dec_params["from_"]]
|
178
197
|
tail = self.worker.work_functions[dec_params["to_"]]
|
179
|
-
self.worker_graph.add_edge(
|
198
|
+
self.worker_graph.add_edge(
|
199
|
+
head=head,
|
200
|
+
tail=tail,
|
201
|
+
convert_function=func,
|
202
|
+
associated_worker=self.worker,
|
203
|
+
edge_class=WorkEdge,
|
204
|
+
)
|
@@ -27,8 +27,9 @@ class LiteLLMService(BaseService):
|
|
27
27
|
SysUtil.check_import("litellm")
|
28
28
|
|
29
29
|
import litellm
|
30
|
+
|
30
31
|
litellm.drop_params = True
|
31
|
-
|
32
|
+
|
32
33
|
self.acompletion = litellm.acompletion
|
33
34
|
self.model = model
|
34
35
|
self.kwargs = kwargs
|
@@ -45,9 +46,7 @@ class LiteLLMService(BaseService):
|
|
45
46
|
kwargs["model"] = self.model or kwargs.get("model")
|
46
47
|
|
47
48
|
try:
|
48
|
-
completion = await self.acompletion(
|
49
|
-
messages=messages, **kwargs
|
50
|
-
)
|
49
|
+
completion = await self.acompletion(messages=messages, **kwargs)
|
51
50
|
return payload, completion.model_dump()
|
52
51
|
except Exception as e:
|
53
52
|
self.status_tracker.num_tasks_failed += 1
|