lionagi 0.2.0__tar.gz → 0.2.1__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {lionagi-0.2.0 → lionagi-0.2.1}/PKG-INFO +2 -2
- {lionagi-0.2.0 → lionagi-0.2.1}/README.md +1 -1
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/report/form.py +1 -1
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/session/directive_mixin.py +1 -1
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/unit/template/plan.py +1 -1
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/work/work.py +4 -2
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/work/work_function.py +10 -1
- lionagi-0.2.1/lionagi/core/work/work_queue.py +103 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/work/worker.py +78 -15
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/work/worklog.py +5 -9
- lionagi-0.2.1/lionagi/version.py +1 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi.egg-info/PKG-INFO +2 -2
- lionagi-0.2.0/lionagi/core/work/work_queue.py +0 -81
- lionagi-0.2.0/lionagi/version.py +0 -1
- {lionagi-0.2.0 → lionagi-0.2.1}/LICENSE +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/README.rst +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/__init__.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/__init__.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/_setting/__init__.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/_setting/_setting.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/action/__init__.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/action/function_calling.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/action/manual.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/action/node.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/action/tool.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/action/tool_manager.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/agent/__init__.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/agent/base_agent.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/agent/eval/__init__.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/agent/eval/evaluator.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/agent/eval/vote.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/agent/learn/__init__.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/agent/learn/learner.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/agent/plan/__init__.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/agent/plan/plan.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/agent/plan/unit_template.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/collections/__init__.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/collections/_logger.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/collections/abc/__init__.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/collections/abc/component.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/collections/abc/concepts.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/collections/abc/exceptions.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/collections/abc/util.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/collections/exchange.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/collections/flow.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/collections/model.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/collections/pile.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/collections/progression.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/collections/util.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/director/__init__.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/director/direct.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/director/director.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/engine/__init__.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/engine/branch_engine.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/engine/instruction_map_engine.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/engine/sandbox_.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/engine/script_engine.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/executor/__init__.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/executor/base_executor.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/executor/graph_executor.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/executor/neo4j_executor.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/generic/__init__.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/generic/edge.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/generic/edge_condition.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/generic/graph.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/generic/hyperedge.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/generic/node.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/generic/tree.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/generic/tree_node.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/mail/__init__.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/mail/mail.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/mail/mail_manager.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/mail/package.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/mail/start_mail.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/message/__init__.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/message/action_request.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/message/action_response.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/message/assistant_response.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/message/instruction.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/message/message.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/message/system.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/message/util.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/report/__init__.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/report/base.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/report/report.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/report/util.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/rule/__init__.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/rule/_default.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/rule/action.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/rule/base.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/rule/boolean.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/rule/choice.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/rule/mapping.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/rule/number.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/rule/rulebook.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/rule/string.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/rule/util.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/session/__init__.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/session/branch.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/session/session.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/structure/__init__.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/structure/chain.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/structure/forest.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/structure/graph.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/structure/tree.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/unit/__init__.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/unit/parallel_unit.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/unit/template/__init__.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/unit/template/action.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/unit/template/base.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/unit/template/predict.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/unit/template/score.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/unit/template/select.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/unit/unit.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/unit/unit_form.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/unit/unit_mixin.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/unit/util.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/validator/__init__.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/validator/validator.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/core/work/__init__.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/experimental/__init__.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/experimental/compressor/__init__.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/experimental/compressor/base.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/experimental/compressor/llm_compressor.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/experimental/compressor/llm_summarizer.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/experimental/compressor/util.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/experimental/directive/__init__.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/experimental/directive/parser/__init__.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/experimental/directive/parser/base_parser.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/experimental/directive/template/__init__.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/experimental/directive/template/base_template.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/experimental/directive/template/schema.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/experimental/directive/tokenizer.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/experimental/evaluator/__init__.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/experimental/evaluator/ast_evaluator.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/experimental/evaluator/base_evaluator.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/experimental/knowledge/__init__.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/experimental/knowledge/base.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/experimental/knowledge/graph.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/experimental/memory/__init__.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/experimental/strategies/__init__.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/experimental/strategies/base.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/integrations/__init__.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/integrations/bridge/__init__.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/integrations/bridge/autogen_/__init__.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/integrations/bridge/autogen_/autogen_.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/integrations/bridge/langchain_/__init__.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/integrations/bridge/langchain_/documents.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/integrations/bridge/langchain_/langchain_bridge.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/integrations/bridge/llamaindex_/__init__.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/integrations/bridge/llamaindex_/index.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/integrations/bridge/llamaindex_/llama_index_bridge.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/integrations/bridge/llamaindex_/llama_pack.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/integrations/bridge/llamaindex_/node_parser.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/integrations/bridge/llamaindex_/reader.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/integrations/bridge/llamaindex_/textnode.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/integrations/bridge/pydantic_/__init__.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/integrations/bridge/pydantic_/pydantic_bridge.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/integrations/bridge/transformers_/__init__.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/integrations/bridge/transformers_/install_.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/integrations/chunker/__init__.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/integrations/chunker/chunk.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/integrations/config/__init__.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/integrations/config/mlx_configs.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/integrations/config/oai_configs.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/integrations/config/ollama_configs.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/integrations/config/openrouter_configs.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/integrations/loader/__init__.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/integrations/loader/load.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/integrations/loader/load_util.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/integrations/provider/__init__.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/integrations/provider/_mapping.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/integrations/provider/litellm.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/integrations/provider/mistralai.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/integrations/provider/mlx_service.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/integrations/provider/oai.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/integrations/provider/ollama.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/integrations/provider/openrouter.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/integrations/provider/services.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/integrations/provider/transformers.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/integrations/storage/__init__.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/integrations/storage/neo4j.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/integrations/storage/storage_util.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/integrations/storage/structure_excel.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/integrations/storage/to_csv.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/integrations/storage/to_excel.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/libs/__init__.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/libs/ln_api.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/libs/ln_async.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/libs/ln_context.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/libs/ln_convert.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/libs/ln_dataframe.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/libs/ln_func_call.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/libs/ln_image.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/libs/ln_knowledge_graph.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/libs/ln_nested.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/libs/ln_parse.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/libs/ln_queue.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/libs/ln_tokenize.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/libs/ln_validate.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/libs/special_tokens.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/libs/sys_util.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/lions/__init__.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/lions/coder/__init__.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/lions/coder/add_feature.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/lions/coder/base_prompts.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/lions/coder/code_form.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/lions/coder/coder.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/lions/coder/util.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/lions/researcher/__init__.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/lions/researcher/data_source/__init__.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/lions/researcher/data_source/finhub_.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/lions/researcher/data_source/google_.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/lions/researcher/data_source/wiki_.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/lions/researcher/data_source/yfinance_.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/tests/__init__.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/tests/integrations/__init__.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/tests/libs/__init__.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/tests/libs/test_api.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/tests/libs/test_convert.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/tests/libs/test_field_validators.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/tests/libs/test_func_call.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/tests/libs/test_nested.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/tests/libs/test_parse.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/tests/libs/test_queue.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/tests/libs/test_sys_util.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/tests/test_core/__init__.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/tests/test_core/collections/__init__.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/tests/test_core/collections/test_component.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/tests/test_core/collections/test_exchange.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/tests/test_core/collections/test_flow.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/tests/test_core/collections/test_pile.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/tests/test_core/collections/test_progression.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/tests/test_core/generic/__init__.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/tests/test_core/generic/test_edge.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/tests/test_core/generic/test_graph.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/tests/test_core/generic/test_node.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/tests/test_core/generic/test_tree_node.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/tests/test_core/test_branch.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/tests/test_core/test_form.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/tests/test_core/test_report.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi/tests/test_core/test_validator.py +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi.egg-info/SOURCES.txt +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi.egg-info/dependency_links.txt +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi.egg-info/requires.txt +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/lionagi.egg-info/top_level.txt +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/pyproject.toml +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/setup.cfg +0 -0
- {lionagi-0.2.0 → lionagi-0.2.1}/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.1
|
4
4
|
Summary: Towards automated general intelligence.
|
5
5
|
Author: HaiyangLi
|
6
6
|
Author-email: Haiyang Li <ocean@lionagi.ai>
|
@@ -232,7 +232,7 @@ Requires-Dist: pandas>=2.1.0
|
|
232
232
|
# Language InterOperable Network - LION
|
233
233
|
|
234
234
|
```
|
235
|
-
lionagi version 0.2.
|
235
|
+
lionagi version 0.2.1
|
236
236
|
```
|
237
237
|
|
238
238
|
**Powerful Intelligent Workflow Automation**
|
@@ -177,7 +177,7 @@ class Form(BaseForm):
|
|
177
177
|
f"""
|
178
178
|
## input: {i}:
|
179
179
|
- description: {getattr(self._all_fields[i], "description", "N/A")}
|
180
|
-
- value: {str(
|
180
|
+
- value: {str(getattr(self, self.input_fields[idx]))}
|
181
181
|
"""
|
182
182
|
for idx, i in enumerate(self.input_fields)
|
183
183
|
)
|
@@ -27,7 +27,7 @@ class DirectiveMixin:
|
|
27
27
|
|
28
28
|
async def chat(
|
29
29
|
self,
|
30
|
-
instruction, # additional instruction
|
30
|
+
instruction=None, # additional instruction
|
31
31
|
context=None, # context to perform the instruction on
|
32
32
|
system=None, # optionally swap system message
|
33
33
|
sender=None, # sender of the instruction, default "user"
|
@@ -37,7 +37,7 @@ class PlanTemplate(BaseUnitForm):
|
|
37
37
|
description="the generated step by step plan, return as a dictionary following {step_n: {plan: ..., reason: ...}} format",
|
38
38
|
)
|
39
39
|
|
40
|
-
|
40
|
+
assignment: str = "task -> plan"
|
41
41
|
|
42
42
|
@property
|
43
43
|
def answer(self):
|
@@ -17,6 +17,7 @@ limitations under the License.
|
|
17
17
|
from enum import Enum
|
18
18
|
import asyncio
|
19
19
|
from typing import Any
|
20
|
+
from collections.abc import Coroutine
|
20
21
|
|
21
22
|
from lionagi.libs import SysUtil
|
22
23
|
from lionagi.core.collections.abc import Component
|
@@ -39,7 +40,7 @@ class Work(Component):
|
|
39
40
|
status (WorkStatus): The current status of the work.
|
40
41
|
result (Any): The result of the work, if completed.
|
41
42
|
error (Any): Any error encountered during the work.
|
42
|
-
async_task (
|
43
|
+
async_task (Coroutine | None): The asynchronous task associated with the work.
|
43
44
|
completion_timestamp (str | None): The timestamp when the work was completed.
|
44
45
|
duration (float | None): The duration of the work.
|
45
46
|
"""
|
@@ -47,7 +48,8 @@ class Work(Component):
|
|
47
48
|
status: WorkStatus = WorkStatus.PENDING
|
48
49
|
result: Any = None
|
49
50
|
error: Any = None
|
50
|
-
async_task:
|
51
|
+
async_task: Coroutine | None = None
|
52
|
+
async_task_name: str | None = None
|
51
53
|
completion_timestamp: str | None = None
|
52
54
|
duration: float | None = None
|
53
55
|
|
@@ -13,10 +13,14 @@ 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
|
+
import logging
|
16
17
|
|
17
18
|
from lionagi.libs.ln_func_call import rcall
|
19
|
+
from lionagi.libs.ln_parse import ParseUtil
|
18
20
|
from lionagi.core.work.worklog import WorkLog
|
19
21
|
|
22
|
+
from lionagi.core.report.form import Form
|
23
|
+
|
20
24
|
|
21
25
|
class WorkFunction:
|
22
26
|
"""
|
@@ -86,7 +90,12 @@ class WorkFunction:
|
|
86
90
|
|
87
91
|
async def forward(self):
|
88
92
|
"""
|
89
|
-
|
93
|
+
Forward the work log to work queue.
|
90
94
|
"""
|
91
95
|
await self.worklog.forward()
|
96
|
+
|
97
|
+
async def process(self):
|
98
|
+
"""
|
99
|
+
Process the first capacity_size works in the work queue.
|
100
|
+
"""
|
92
101
|
await self.worklog.queue.process()
|
@@ -0,0 +1,103 @@
|
|
1
|
+
"""
|
2
|
+
Copyright 2024 HaiyangLi
|
3
|
+
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
you may not use this file except in compliance with the License.
|
6
|
+
You may obtain a copy of the License at
|
7
|
+
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
See the License for the specific language governing permissions and
|
14
|
+
limitations under the License.
|
15
|
+
"""
|
16
|
+
|
17
|
+
import asyncio
|
18
|
+
from lionagi.core.work.work import WorkStatus
|
19
|
+
|
20
|
+
|
21
|
+
class WorkQueue:
|
22
|
+
"""
|
23
|
+
A class representing a queue for managing work.
|
24
|
+
|
25
|
+
Attributes:
|
26
|
+
capacity (int): The maximum number of tasks the queue can handle.
|
27
|
+
queue (asyncio.Queue): The queue holding the tasks.
|
28
|
+
_stop_event (asyncio.Event): Event to signal stopping `execute` of the queue.
|
29
|
+
available_capacity (int): The remaining number of tasks the queue can handle.
|
30
|
+
execution_mode (bool): If `execute` is running.
|
31
|
+
"""
|
32
|
+
|
33
|
+
def __init__(self, capacity=5):
|
34
|
+
if capacity < 0:
|
35
|
+
raise ValueError("initial capacity must be >= 0")
|
36
|
+
self.capacity = capacity
|
37
|
+
self.queue = asyncio.Queue()
|
38
|
+
self._stop_event = asyncio.Event()
|
39
|
+
self.available_capacity = capacity
|
40
|
+
self.execution_mode = False
|
41
|
+
|
42
|
+
async def enqueue(self, work) -> None:
|
43
|
+
"""Enqueue a work item."""
|
44
|
+
await self.queue.put(work)
|
45
|
+
|
46
|
+
async def dequeue(self):
|
47
|
+
"""Dequeue a work item."""
|
48
|
+
return await self.queue.get()
|
49
|
+
|
50
|
+
async def join(self) -> None:
|
51
|
+
"""Block until all items in the queue have been processed."""
|
52
|
+
await self.queue.join()
|
53
|
+
|
54
|
+
async def stop(self) -> None:
|
55
|
+
"""Signal the queue to stop processing."""
|
56
|
+
self._stop_event.set()
|
57
|
+
|
58
|
+
@property
|
59
|
+
def stopped(self) -> bool:
|
60
|
+
"""Return whether the queue has been stopped."""
|
61
|
+
return self._stop_event.is_set()
|
62
|
+
|
63
|
+
# async def process(self):
|
64
|
+
# async def _parse_work(work):
|
65
|
+
# async with self.semaphore:
|
66
|
+
# await work.perform()
|
67
|
+
#
|
68
|
+
# tasks = set()
|
69
|
+
# while self.queue.qsize() > 0:
|
70
|
+
# next = await self.dequeue()
|
71
|
+
# next.status = WorkStatus.IN_PROGRESS
|
72
|
+
# task = asyncio.create_task(_parse_work(next))
|
73
|
+
# tasks.add(task)
|
74
|
+
#
|
75
|
+
# await asyncio.wait(tasks)
|
76
|
+
|
77
|
+
async def process(self) -> None:
|
78
|
+
"""Process the work items in the queue."""
|
79
|
+
tasks = set()
|
80
|
+
while self.available_capacity > 0 and self.queue.qsize() > 0:
|
81
|
+
next = await self.dequeue()
|
82
|
+
next.status = WorkStatus.IN_PROGRESS
|
83
|
+
task = asyncio.create_task(next.perform())
|
84
|
+
tasks.add(task)
|
85
|
+
self.available_capacity -= 1
|
86
|
+
|
87
|
+
if tasks:
|
88
|
+
await asyncio.wait(tasks)
|
89
|
+
self.available_capacity = self.capacity
|
90
|
+
|
91
|
+
async def execute(self, refresh_time=1):
|
92
|
+
"""
|
93
|
+
Continuously executes the process method at a specified refresh interval.
|
94
|
+
|
95
|
+
Args:
|
96
|
+
refresh_time (int, optional): The time in seconds to wait between
|
97
|
+
successive calls to `process`. Defaults to 1.
|
98
|
+
"""
|
99
|
+
self.execution_mode = True
|
100
|
+
while not self.stopped:
|
101
|
+
await self.process()
|
102
|
+
await asyncio.sleep(refresh_time)
|
103
|
+
self.execution_mode = False
|
@@ -16,11 +16,15 @@ limitations under the License.
|
|
16
16
|
|
17
17
|
from abc import ABC
|
18
18
|
from functools import wraps
|
19
|
+
from typing import Callable
|
19
20
|
import asyncio
|
21
|
+
import inspect
|
20
22
|
from lionagi import logging as _logging
|
21
23
|
from lionagi.libs.ln_func_call import pcall
|
22
24
|
from lionagi.core.work.work_function import WorkFunction
|
23
25
|
from lionagi.core.work.work import Work
|
26
|
+
from lionagi.core.report.form import Form
|
27
|
+
from lionagi.core.collections.abc import get_lion_id
|
24
28
|
|
25
29
|
|
26
30
|
class Worker(ABC):
|
@@ -30,19 +34,23 @@ class Worker(ABC):
|
|
30
34
|
Attributes:
|
31
35
|
name (str): The name of the worker.
|
32
36
|
work_functions (dict[str, WorkFunction]): Dictionary mapping assignments to WorkFunction objects.
|
37
|
+
forms (dict[str, Form]): Dictionary mapping form identifier to Form objects.
|
38
|
+
default_form (str|None): The default form to be used by the worker.
|
33
39
|
"""
|
34
40
|
|
35
41
|
name: str = "Worker"
|
36
42
|
work_functions: dict[str, WorkFunction] = {}
|
37
43
|
|
38
|
-
def __init__(self) -> None:
|
39
|
-
self.stopped = False
|
44
|
+
def __init__(self, forms=None, default_form=None) -> None:
|
45
|
+
# self.stopped = False
|
46
|
+
self.forms: dict[str, Form] = forms or {}
|
47
|
+
self.default_form = default_form
|
40
48
|
|
41
49
|
async def stop(self):
|
42
50
|
"""
|
43
51
|
Stops the worker and all associated work functions.
|
44
52
|
"""
|
45
|
-
self.stopped = True
|
53
|
+
# self.stopped = True
|
46
54
|
_logging.info(f"Stopping worker {self.name}")
|
47
55
|
non_stopped_ = []
|
48
56
|
|
@@ -69,16 +77,31 @@ class Worker(ABC):
|
|
69
77
|
and not self.stopped
|
70
78
|
)
|
71
79
|
|
72
|
-
async def
|
80
|
+
async def change_default_form(self, form_key):
|
73
81
|
"""
|
74
|
-
|
82
|
+
Changes the default form to the specified form key.
|
75
83
|
|
76
84
|
Args:
|
77
|
-
|
85
|
+
form_key (str): The key of the form to set as the default.
|
86
|
+
|
87
|
+
Raises:
|
88
|
+
ValueError: If the form key does not exist in the forms dictionary.
|
89
|
+
|
78
90
|
"""
|
79
|
-
|
80
|
-
|
81
|
-
|
91
|
+
if form_key not in self.forms.keys():
|
92
|
+
raise ValueError(f"Unable to change default form. Key {form_key} does not exist.")
|
93
|
+
self.default_form = self.forms[form_key]
|
94
|
+
|
95
|
+
# async def process(self, refresh_time=1):
|
96
|
+
# """
|
97
|
+
# Processes all work functions periodically.
|
98
|
+
#
|
99
|
+
# Args:
|
100
|
+
# refresh_time (int): Time interval between each process cycle.
|
101
|
+
# """
|
102
|
+
# while await self.is_progressable():
|
103
|
+
# await pcall([i.process(refresh_time) for i in self.work_functions.values()])
|
104
|
+
# await asyncio.sleep(refresh_time)
|
82
105
|
|
83
106
|
# TODO: Implement process method
|
84
107
|
|
@@ -96,6 +119,7 @@ class Worker(ABC):
|
|
96
119
|
*args,
|
97
120
|
func=None,
|
98
121
|
assignment=None,
|
122
|
+
form_param_key=None,
|
99
123
|
capacity=None,
|
100
124
|
retry_kwargs=None,
|
101
125
|
guidance=None,
|
@@ -107,6 +131,10 @@ class Worker(ABC):
|
|
107
131
|
Args:
|
108
132
|
func (Callable): The function to be executed.
|
109
133
|
assignment (str): The assignment description.
|
134
|
+
form_param_key (str): The key to identify the form parameter in
|
135
|
+
the function's signature. This parameter is used to locate and fill
|
136
|
+
the appropriate form according to the assignment. Raises an error
|
137
|
+
if the form parameter key is not found in the function's signature.
|
110
138
|
capacity (int): Capacity for the work log.
|
111
139
|
retry_kwargs (dict): Retry arguments for the function.
|
112
140
|
guidance (str): Guidance or documentation for the function.
|
@@ -119,23 +147,53 @@ class Worker(ABC):
|
|
119
147
|
assignment=assignment,
|
120
148
|
function=func,
|
121
149
|
retry_kwargs=retry_kwargs or {},
|
122
|
-
guidance=guidance
|
150
|
+
guidance=guidance,
|
123
151
|
capacity=capacity,
|
124
152
|
)
|
125
153
|
|
126
154
|
work_func: WorkFunction = self.work_functions[func.__name__]
|
127
|
-
|
128
|
-
|
155
|
+
|
156
|
+
# locate form that should be filled according to the assignment
|
157
|
+
if form_param_key:
|
158
|
+
func_signature = inspect.signature(func)
|
159
|
+
if form_param_key not in func_signature.parameters:
|
160
|
+
raise KeyError(f"Failed to locate form. \"{form_param_key}\" is not defined in the function.")
|
161
|
+
if "self" in func_signature.parameters:
|
162
|
+
bound_args = func_signature.bind(None, *args, **kwargs)
|
163
|
+
else:
|
164
|
+
bound_args = func_signature.bind(*args, **kwargs)
|
165
|
+
bound_args.apply_defaults()
|
166
|
+
arguments = bound_args.arguments
|
167
|
+
|
168
|
+
form_key = arguments.get(form_param_key)
|
169
|
+
try:
|
170
|
+
form_key = get_lion_id(form_key)
|
171
|
+
except:
|
172
|
+
pass
|
173
|
+
form = self.forms.get(form_key) or self.default_form
|
174
|
+
|
175
|
+
if form:
|
176
|
+
subform = form.__class__(assignment=work_func.assignment, task=work_func.guidance)
|
177
|
+
for k in subform.input_fields:
|
178
|
+
v = getattr(form, k, None)
|
179
|
+
setattr(subform, k, v)
|
180
|
+
subform.origin = form
|
181
|
+
kwargs = {"form": subform} | kwargs
|
182
|
+
else:
|
183
|
+
raise ValueError(f"Cannot locate form in Worker's forms and default_form is not available.")
|
184
|
+
|
185
|
+
task = work_func.perform(self, *args, **kwargs)
|
186
|
+
work = Work(async_task=task, async_task_name=work_func.name)
|
129
187
|
await work_func.worklog.append(work)
|
130
|
-
return
|
188
|
+
return work
|
131
189
|
|
132
190
|
|
133
191
|
def work(
|
134
192
|
assignment=None,
|
193
|
+
form_param_key=None,
|
135
194
|
capacity=10,
|
136
195
|
guidance=None,
|
137
196
|
retry_kwargs=None,
|
138
|
-
refresh_time=1,
|
139
197
|
timeout=10,
|
140
198
|
):
|
141
199
|
"""
|
@@ -143,10 +201,13 @@ def work(
|
|
143
201
|
|
144
202
|
Args:
|
145
203
|
assignment (str): The assignment description of the work function.
|
204
|
+
form_param_key (str): The key to identify the form parameter in
|
205
|
+
the function's signature. This parameter is used to locate and fill
|
206
|
+
the appropriate form according to the assignment. Raises an error
|
207
|
+
if the form parameter key is not found in the function's signature.
|
146
208
|
capacity (int): Capacity for the work log.
|
147
209
|
guidance (str): Guidance or documentation for the work function.
|
148
210
|
retry_kwargs (dict): Retry arguments for the work function.
|
149
|
-
refresh_time (int): Time interval between each process cycle.
|
150
211
|
timeout (int): Timeout for the work function.
|
151
212
|
"""
|
152
213
|
|
@@ -157,6 +218,7 @@ def work(
|
|
157
218
|
*args,
|
158
219
|
func=func,
|
159
220
|
assignment=assignment,
|
221
|
+
form_param_key=form_param_key,
|
160
222
|
capacity=capacity,
|
161
223
|
retry_kwargs=retry_kwargs,
|
162
224
|
guidance=guidance,
|
@@ -168,6 +230,7 @@ def work(
|
|
168
230
|
*args,
|
169
231
|
func=func,
|
170
232
|
assignment=assignment,
|
233
|
+
form_param_key=form_param_key,
|
171
234
|
capacity=capacity,
|
172
235
|
retry_kwargs=retry_kwargs,
|
173
236
|
guidance=guidance,
|
@@ -56,15 +56,11 @@ class WorkLog(Progressable):
|
|
56
56
|
|
57
57
|
async def forward(self):
|
58
58
|
"""
|
59
|
-
Forwards pending work items to the queue
|
60
|
-
"""
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
while len(self.pending) > 0 and self.queue.available_capacity:
|
65
|
-
work: Work = self.pile[self.pending.popleft()]
|
66
|
-
work.status = WorkStatus.IN_PROGRESS
|
67
|
-
await self.queue.enqueue(work)
|
59
|
+
Forwards pending work items to the queue.
|
60
|
+
"""
|
61
|
+
while len(self.pending) > 0:
|
62
|
+
work: Work = self.pile[self.pending.popleft()]
|
63
|
+
await self.queue.enqueue(work)
|
68
64
|
|
69
65
|
async def stop(self):
|
70
66
|
"""
|
@@ -0,0 +1 @@
|
|
1
|
+
__version__ = "0.2.1"
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: lionagi
|
3
|
-
Version: 0.2.
|
3
|
+
Version: 0.2.1
|
4
4
|
Summary: Towards automated general intelligence.
|
5
5
|
Author: HaiyangLi
|
6
6
|
Author-email: Haiyang Li <ocean@lionagi.ai>
|
@@ -232,7 +232,7 @@ Requires-Dist: pandas>=2.1.0
|
|
232
232
|
# Language InterOperable Network - LION
|
233
233
|
|
234
234
|
```
|
235
|
-
lionagi version 0.2.
|
235
|
+
lionagi version 0.2.1
|
236
236
|
```
|
237
237
|
|
238
238
|
**Powerful Intelligent Workflow Automation**
|
@@ -1,81 +0,0 @@
|
|
1
|
-
"""
|
2
|
-
Copyright 2024 HaiyangLi
|
3
|
-
|
4
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
-
you may not use this file except in compliance with the License.
|
6
|
-
You may obtain a copy of the License at
|
7
|
-
|
8
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
9
|
-
|
10
|
-
Unless required by applicable law or agreed to in writing, software
|
11
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
-
See the License for the specific language governing permissions and
|
14
|
-
limitations under the License.
|
15
|
-
"""
|
16
|
-
|
17
|
-
import asyncio
|
18
|
-
|
19
|
-
|
20
|
-
class WorkQueue:
|
21
|
-
"""
|
22
|
-
A class representing a queue for managing work.
|
23
|
-
|
24
|
-
Attributes:
|
25
|
-
capacity (int): The maximum number of tasks the queue can handle.
|
26
|
-
queue (asyncio.Queue): The queue holding the tasks.
|
27
|
-
_stop_event (asyncio.Event): Event to signal stopping of the queue.
|
28
|
-
semaphore (asyncio.Semaphore): Semaphore to control access based on capacity.
|
29
|
-
"""
|
30
|
-
|
31
|
-
def __init__(self, capacity=5):
|
32
|
-
|
33
|
-
self.queue = asyncio.Queue()
|
34
|
-
self._stop_event = asyncio.Event()
|
35
|
-
self.capacity = capacity
|
36
|
-
self.semaphore = asyncio.Semaphore(capacity)
|
37
|
-
|
38
|
-
async def enqueue(self, work) -> None:
|
39
|
-
"""Enqueue a work item."""
|
40
|
-
await self.queue.put(work)
|
41
|
-
|
42
|
-
async def dequeue(self):
|
43
|
-
"""Dequeue a work item."""
|
44
|
-
return await self.queue.get()
|
45
|
-
|
46
|
-
async def join(self) -> None:
|
47
|
-
"""Block until all items in the queue have been processed."""
|
48
|
-
await self.queue.join()
|
49
|
-
|
50
|
-
async def stop(self) -> None:
|
51
|
-
"""Signal the queue to stop processing."""
|
52
|
-
self._stop_event.set()
|
53
|
-
|
54
|
-
@property
|
55
|
-
def available_capacity(self):
|
56
|
-
"""Return the available capacity of the queue."""
|
57
|
-
available = self.capacity - self.queue.qsize()
|
58
|
-
return available if available > 0 else None
|
59
|
-
|
60
|
-
@property
|
61
|
-
def stopped(self) -> bool:
|
62
|
-
"""Return whether the queue has been stopped."""
|
63
|
-
return self._stop_event.is_set()
|
64
|
-
|
65
|
-
async def process(self) -> None:
|
66
|
-
"""Process the work items in the queue."""
|
67
|
-
tasks = set()
|
68
|
-
while self.queue.qsize() > 0 and not self.stopped:
|
69
|
-
if not self.available_capacity and tasks:
|
70
|
-
_, done = await asyncio.wait(tasks, return_when=asyncio.FIRST_COMPLETED)
|
71
|
-
tasks.difference_update(done)
|
72
|
-
|
73
|
-
async with self.semaphore:
|
74
|
-
next = await self.dequeue()
|
75
|
-
if next is None:
|
76
|
-
break
|
77
|
-
task = asyncio.create_task(next.perform())
|
78
|
-
tasks.add(task)
|
79
|
-
|
80
|
-
if tasks:
|
81
|
-
await asyncio.wait(tasks)
|
lionagi-0.2.0/lionagi/version.py
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
__version__ = "0.2.0"
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|