lionagi 0.6.0__tar.gz → 0.7.0__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- lionagi-0.7.0/.github/workflows/docs.yml +34 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/PKG-INFO +4 -4
- {lionagi-0.6.0 → lionagi-0.7.0}/README.md +1 -1
- lionagi-0.7.0/docs/Makefile +20 -0
- lionagi-0.7.0/docs/_static/custom.css +59 -0
- lionagi-0.7.0/docs/_templates/layout.html +34 -0
- lionagi-0.7.0/docs/conf.py +56 -0
- lionagi-0.7.0/docs/index.rst +35 -0
- lionagi-0.7.0/docs/modules/action.rst +339 -0
- lionagi-0.7.0/docs/modules/adapter.rst +241 -0
- lionagi-0.7.0/docs/modules/branch.rst +215 -0
- lionagi-0.7.0/docs/modules/concepts.rst +214 -0
- lionagi-0.7.0/docs/modules/event.rst +38 -0
- lionagi-0.7.0/docs/modules/form.rst +184 -0
- lionagi-0.7.0/docs/modules/graph.rst +238 -0
- lionagi-0.7.0/docs/modules/index.rst +35 -0
- lionagi-0.7.0/docs/modules/instruct.rst +222 -0
- lionagi-0.7.0/docs/modules/lib_file.rst +246 -0
- lionagi-0.7.0/docs/modules/lib_nested.rst +297 -0
- lionagi-0.7.0/docs/modules/lib_package.rst +153 -0
- lionagi-0.7.0/docs/modules/lib_schema.rst +232 -0
- lionagi-0.7.0/docs/modules/lib_validate.rst +239 -0
- lionagi-0.7.0/docs/modules/mail.rst +303 -0
- lionagi-0.7.0/docs/modules/message.rst +295 -0
- lionagi-0.7.0/docs/modules/models.rst +221 -0
- lionagi-0.7.0/docs/modules/operations.rst +111 -0
- lionagi-0.7.0/docs/modules/operative_step.rst +169 -0
- lionagi-0.7.0/docs/modules/pile_progression.rst +324 -0
- lionagi-0.7.0/docs/modules/service.rst +240 -0
- lionagi-0.7.0/docs/modules/session.rst +193 -0
- lionagi-0.7.0/docs/modules/strategies.rst +140 -0
- lionagi-0.7.0/docs/modules/utils.rst +351 -0
- lionagi-0.7.0/docs/operations/core_operations.rst +23 -0
- lionagi-0.7.0/docs/operations/index.rst +13 -0
- lionagi-0.7.0/docs/operations/strategies.rst +37 -0
- lionagi-0.7.0/docs/tutorials/get_started.rst +231 -0
- lionagi-0.7.0/docs/tutorials/get_started_pt2.rst +294 -0
- lionagi-0.7.0/docs/tutorials/get_started_pt3.rst +190 -0
- lionagi-0.7.0/docs/tutorials/index.rst +14 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/__init__.py +2 -0
- lionagi-0.7.0/lionagi/libs/token_transform/__init__.py +0 -0
- lionagi-0.7.0/lionagi/libs/token_transform/llmlingua.py +1 -0
- lionagi-0.7.0/lionagi/libs/token_transform/perplexity.py +439 -0
- lionagi-0.7.0/lionagi/libs/token_transform/synthlang.py +409 -0
- lionagi-0.7.0/lionagi/operations/ReAct/ReAct.py +126 -0
- lionagi-0.7.0/lionagi/operations/ReAct/utils.py +28 -0
- lionagi-0.7.0/lionagi/operations/__init__.py +5 -0
- lionagi-0.7.0/lionagi/operations/_act/act.py +73 -0
- lionagi-0.7.0/lionagi/operations/chat/chat.py +173 -0
- lionagi-0.7.0/lionagi/operations/communicate/__init__.py +0 -0
- lionagi-0.7.0/lionagi/operations/communicate/communicate.py +167 -0
- lionagi-0.7.0/lionagi/operations/instruct/instruct.py +29 -0
- lionagi-0.7.0/lionagi/operations/interpret/interpret.py +40 -0
- lionagi-0.7.0/lionagi/operations/operate/operate.py +189 -0
- lionagi-0.7.0/lionagi/operations/parse/parse.py +125 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/operations/plan/plan.py +3 -3
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/operations/select/select.py +11 -30
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/operations/select/utils.py +13 -2
- lionagi-0.7.0/lionagi/operations/translate/__init__.py +0 -0
- lionagi-0.7.0/lionagi/operations/translate/translate.py +47 -0
- lionagi-0.7.0/lionagi/operations/types.py +29 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/operatives/action/function_calling.py +1 -1
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/operatives/action/manager.py +22 -26
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/operatives/action/tool.py +1 -1
- {lionagi-0.6.0/lionagi/operations → lionagi-0.7.0/lionagi/operatives}/strategies/params.py +18 -2
- lionagi-0.7.0/lionagi/protocols/adapters/__init__.py +0 -0
- lionagi-0.7.0/lionagi/protocols/adapters/adapter.py +95 -0
- lionagi-0.7.0/lionagi/protocols/adapters/json_adapter.py +101 -0
- lionagi-0.7.0/lionagi/protocols/adapters/pandas_/__init__.py +0 -0
- lionagi-0.7.0/lionagi/protocols/adapters/pandas_/csv_adapter.py +50 -0
- lionagi-0.7.0/lionagi/protocols/adapters/pandas_/excel_adapter.py +52 -0
- lionagi-0.7.0/lionagi/protocols/adapters/pandas_/pd_dataframe_adapter.py +31 -0
- lionagi-0.7.0/lionagi/protocols/adapters/pandas_/pd_series_adapter.py +17 -0
- lionagi-0.7.0/lionagi/protocols/adapters/types.py +18 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/protocols/generic/pile.py +22 -1
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/protocols/graph/node.py +17 -1
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/protocols/types.py +3 -3
- lionagi-0.7.0/lionagi/service/__init__.py +1 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/service/endpoints/base.py +1 -1
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/service/endpoints/rate_limited_processor.py +2 -1
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/service/manager.py +1 -1
- lionagi-0.7.0/lionagi/service/providers/__init__.py +3 -0
- lionagi-0.7.0/lionagi/service/providers/anthropic_/__init__.py +3 -0
- lionagi-0.7.0/lionagi/service/providers/groq_/__init__.py +3 -0
- lionagi-0.7.0/lionagi/service/providers/openai_/__init__.py +3 -0
- lionagi-0.7.0/lionagi/service/providers/openrouter_/__init__.py +3 -0
- lionagi-0.7.0/lionagi/service/providers/perplexity_/__init__.py +3 -0
- lionagi-0.6.0/lionagi/service/__init__.py → lionagi-0.7.0/lionagi/service/types.py +6 -2
- lionagi-0.7.0/lionagi/session/__init__.py +3 -0
- lionagi-0.7.0/lionagi/session/branch.py +1456 -0
- lionagi-0.7.0/lionagi/version.py +1 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/pyproject.toml +9 -4
- {lionagi-0.6.0 → lionagi-0.7.0}/uv.lock +305 -4
- lionagi-0.6.0/docs/api_reference/action.md +0 -226
- lionagi-0.6.0/lionagi/libs/compress/models.py +0 -66
- lionagi-0.6.0/lionagi/libs/compress/utils.py +0 -69
- lionagi-0.6.0/lionagi/operations/__init__.py +0 -13
- lionagi-0.6.0/lionagi/operations/select/__init__.py +0 -7
- lionagi-0.6.0/lionagi/operations/select/prompt.py +0 -5
- lionagi-0.6.0/lionagi/operations/types.py +0 -7
- lionagi-0.6.0/lionagi/protocols/_adapter.py +0 -224
- lionagi-0.6.0/lionagi/session/branch.py +0 -1287
- lionagi-0.6.0/lionagi/version.py +0 -1
- {lionagi-0.6.0 → lionagi-0.7.0}/.env.example +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/.github/FUNDING.yml +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/.github/dependabot.yml +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/.github/workflows/ci.yml +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/.github/workflows/codeql.yml +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/.github/workflows/release.yml +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/.gitignore +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/.pre-commit-config.yaml +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/.python-version +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/CODE_OF_CONDUCT.md +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/CONTRIBUTING.md +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/LICENSE +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/dev_tools/count_code_base_lines.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/_class_registry.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/_errors.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/libs/__init__.py +0 -0
- {lionagi-0.6.0/lionagi/libs/compress → lionagi-0.7.0/lionagi/libs/file}/__init__.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/libs/file/chunk.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/libs/file/file_ops.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/libs/file/params.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/libs/file/process.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/libs/file/save.py +0 -0
- {lionagi-0.6.0/lionagi/libs/file → lionagi-0.7.0/lionagi/libs/nested}/__init__.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/libs/nested/flatten.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/libs/nested/nfilter.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/libs/nested/nget.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/libs/nested/ninsert.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/libs/nested/nmerge.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/libs/nested/npop.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/libs/nested/nset.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/libs/nested/unflatten.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/libs/nested/utils.py +0 -0
- {lionagi-0.6.0/lionagi/libs/nested → lionagi-0.7.0/lionagi/libs/package}/__init__.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/libs/package/imports.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/libs/package/management.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/libs/package/params.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/libs/package/system.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/libs/parse.py +0 -0
- {lionagi-0.6.0/lionagi/libs/package → lionagi-0.7.0/lionagi/libs/schema}/__init__.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/libs/schema/as_readable.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/libs/schema/extract_code_block.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/libs/schema/extract_docstring.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/libs/schema/function_to_schema.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/libs/schema/json_schema.py +0 -0
- {lionagi-0.6.0/lionagi/libs/schema → lionagi-0.7.0/lionagi/libs/validate}/__init__.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/libs/validate/common_field_validators.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/libs/validate/fuzzy_match_keys.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/libs/validate/fuzzy_validate_mapping.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/libs/validate/string_similarity.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/libs/validate/validate_boolean.py +0 -0
- {lionagi-0.6.0/lionagi/libs/validate → lionagi-0.7.0/lionagi/operations/ReAct}/__init__.py +0 -0
- {lionagi-0.6.0/lionagi/operations/brainstorm → lionagi-0.7.0/lionagi/operations/_act}/__init__.py +0 -0
- {lionagi-0.6.0/lionagi/operations/strategies → lionagi-0.7.0/lionagi/operations/brainstorm}/__init__.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/operations/brainstorm/brainstorm.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/operations/brainstorm/prompt.py +0 -0
- {lionagi-0.6.0/lionagi/operatives → lionagi-0.7.0/lionagi/operations/chat}/__init__.py +0 -0
- {lionagi-0.6.0/lionagi/operatives/action → lionagi-0.7.0/lionagi/operations/instruct}/__init__.py +0 -0
- {lionagi-0.6.0/lionagi/operatives/forms → lionagi-0.7.0/lionagi/operations/interpret}/__init__.py +0 -0
- {lionagi-0.6.0/lionagi/operatives/instruct → lionagi-0.7.0/lionagi/operations/operate}/__init__.py +0 -0
- {lionagi-0.6.0/lionagi/operatives/models → lionagi-0.7.0/lionagi/operations/parse}/__init__.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/operations/plan/__init__.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/operations/plan/prompt.py +0 -0
- {lionagi-0.6.0/lionagi/protocols → lionagi-0.7.0/lionagi/operations/select}/__init__.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/operations/utils.py +0 -0
- {lionagi-0.6.0/lionagi/protocols/generic → lionagi-0.7.0/lionagi/operatives}/__init__.py +0 -0
- {lionagi-0.6.0/lionagi/protocols/graph → lionagi-0.7.0/lionagi/operatives/action}/__init__.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/operatives/action/request_response_model.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/operatives/action/utils.py +0 -0
- {lionagi-0.6.0/lionagi/protocols/mail → lionagi-0.7.0/lionagi/operatives/forms}/__init__.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/operatives/forms/base.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/operatives/forms/form.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/operatives/forms/report.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/operatives/forms/utils.py +0 -0
- {lionagi-0.6.0/lionagi/protocols/messages → lionagi-0.7.0/lionagi/operatives/instruct}/__init__.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/operatives/instruct/base.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/operatives/instruct/instruct.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/operatives/instruct/instruct_collection.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/operatives/instruct/node.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/operatives/instruct/prompts.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/operatives/instruct/reason.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/operatives/manager.py +0 -0
- {lionagi-0.6.0/lionagi/service/endpoints → lionagi-0.7.0/lionagi/operatives/models}/__init__.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/operatives/models/field_model.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/operatives/models/model_params.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/operatives/models/note.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/operatives/models/operable_model.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/operatives/models/schema_model.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/operatives/operative.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/operatives/step.py +0 -0
- {lionagi-0.6.0/lionagi/service/providers → lionagi-0.7.0/lionagi/operatives/strategies}/__init__.py +0 -0
- {lionagi-0.6.0/lionagi/operations → lionagi-0.7.0/lionagi/operatives}/strategies/base.py +0 -0
- {lionagi-0.6.0/lionagi/operations → lionagi-0.7.0/lionagi/operatives}/strategies/concurrent.py +0 -0
- {lionagi-0.6.0/lionagi/operations → lionagi-0.7.0/lionagi/operatives}/strategies/concurrent_chunk.py +0 -0
- {lionagi-0.6.0/lionagi/operations → lionagi-0.7.0/lionagi/operatives}/strategies/concurrent_sequential_chunk.py +0 -0
- {lionagi-0.6.0/lionagi/operations → lionagi-0.7.0/lionagi/operatives}/strategies/sequential.py +0 -0
- {lionagi-0.6.0/lionagi/operations → lionagi-0.7.0/lionagi/operatives}/strategies/sequential_chunk.py +0 -0
- {lionagi-0.6.0/lionagi/operations → lionagi-0.7.0/lionagi/operatives}/strategies/sequential_concurrent_chunk.py +0 -0
- {lionagi-0.6.0/lionagi/operations → lionagi-0.7.0/lionagi/operatives}/strategies/utils.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/operatives/types.py +0 -0
- {lionagi-0.6.0/lionagi/service/providers/anthropic_ → lionagi-0.7.0/lionagi/protocols}/__init__.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/protocols/_concepts.py +0 -0
- {lionagi-0.6.0/lionagi/service/providers/groq_ → lionagi-0.7.0/lionagi/protocols/generic}/__init__.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/protocols/generic/element.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/protocols/generic/event.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/protocols/generic/log.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/protocols/generic/processor.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/protocols/generic/progression.py +0 -0
- {lionagi-0.6.0/lionagi/service/providers/openai_ → lionagi-0.7.0/lionagi/protocols/graph}/__init__.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/protocols/graph/edge.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/protocols/graph/graph.py +0 -0
- {lionagi-0.6.0/lionagi/service/providers/openrouter_ → lionagi-0.7.0/lionagi/protocols/mail}/__init__.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/protocols/mail/exchange.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/protocols/mail/mail.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/protocols/mail/mailbox.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/protocols/mail/manager.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/protocols/mail/package.py +0 -0
- {lionagi-0.6.0/lionagi/service/providers/perplexity_ → lionagi-0.7.0/lionagi/protocols/messages}/__init__.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/protocols/messages/action_request.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/protocols/messages/action_response.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/protocols/messages/assistant_response.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/protocols/messages/base.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/protocols/messages/instruction.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/protocols/messages/manager.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/protocols/messages/message.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/protocols/messages/system.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/protocols/messages/templates/README.md +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/protocols/messages/templates/action_request.jinja2 +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/protocols/messages/templates/action_response.jinja2 +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/protocols/messages/templates/assistant_response.jinja2 +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/protocols/messages/templates/instruction_message.jinja2 +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/protocols/messages/templates/system_message.jinja2 +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/protocols/messages/templates/tool_schemas.jinja2 +0 -0
- {lionagi-0.6.0/lionagi/session → lionagi-0.7.0/lionagi/service/endpoints}/__init__.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/service/endpoints/chat_completion.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/service/endpoints/match_endpoint.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/service/endpoints/token_calculator.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/service/imodel.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/service/providers/anthropic_/messages.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/service/providers/groq_/chat_completions.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/service/providers/openai_/chat_completions.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/service/providers/openrouter_/chat_completions.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/service/providers/perplexity_/chat_completions.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/session/session.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/settings.py +0 -0
- {lionagi-0.6.0 → lionagi-0.7.0}/lionagi/utils.py +0 -0
@@ -0,0 +1,34 @@
|
|
1
|
+
name: Build and Deploy Docs
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ "main" ]
|
6
|
+
|
7
|
+
jobs:
|
8
|
+
build-deploy:
|
9
|
+
runs-on: ubuntu-latest
|
10
|
+
steps:
|
11
|
+
- name: Check out the repo
|
12
|
+
uses: actions/checkout@v4
|
13
|
+
|
14
|
+
- name: Set up Python
|
15
|
+
uses: actions/setup-python@v5
|
16
|
+
with:
|
17
|
+
python-version: "3.10"
|
18
|
+
|
19
|
+
- name: Install dependencies
|
20
|
+
run: |
|
21
|
+
pip install --upgrade pip
|
22
|
+
pip install sphinx furo # or your theme
|
23
|
+
# plus any other dependencies needed
|
24
|
+
|
25
|
+
- name: Build Sphinx docs
|
26
|
+
run: |
|
27
|
+
cd docs
|
28
|
+
make html
|
29
|
+
|
30
|
+
- name: Deploy to GitHub Pages
|
31
|
+
uses: peaceiris/actions-gh-pages@v4
|
32
|
+
with:
|
33
|
+
github_token: ${{ secrets.GH_TOKEN }}
|
34
|
+
publish_dir: docs/_build/html
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: lionagi
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.7.0
|
4
4
|
Summary: An AGentic Intelligence Operating System.
|
5
5
|
Author-email: HaiyangLi <quantocean.li@gmail.com>
|
6
6
|
License: Apache License
|
@@ -217,13 +217,13 @@ Classifier: Programming Language :: Python :: 3 :: Only
|
|
217
217
|
Classifier: Programming Language :: Python :: 3.11
|
218
218
|
Classifier: Programming Language :: Python :: 3.12
|
219
219
|
Classifier: Programming Language :: Python :: 3.13
|
220
|
-
Requires-Python: >=3.
|
220
|
+
Requires-Python: >=3.10
|
221
221
|
Requires-Dist: aiocache>=0.12.0
|
222
222
|
Requires-Dist: aiohttp>=3.11.0
|
223
223
|
Requires-Dist: jinja2>=3.1.0
|
224
224
|
Requires-Dist: litellm>=1.55.3
|
225
225
|
Requires-Dist: pandas>=2.0.0
|
226
|
-
Requires-Dist: pillow>=
|
226
|
+
Requires-Dist: pillow>=10.0.0
|
227
227
|
Requires-Dist: pydantic>=2.0.0
|
228
228
|
Requires-Dist: python-dotenv>=1.0.1
|
229
229
|
Description-Content-Type: text/markdown
|
@@ -232,7 +232,7 @@ Description-Content-Type: text/markdown
|
|
232
232
|
![PyPI - Downloads](https://img.shields.io/pypi/dm/lionagi?color=blue)
|
233
233
|
![Python Version](https://img.shields.io/badge/python-3.10%2B-blue)
|
234
234
|
|
235
|
-
[Documentation](https://
|
235
|
+
[Documentation](https://lion-agi.github.io/lionagi/) | [Discord](https://discord.gg/aqSJ2v46vu) | [PyPI](https://pypi.org/project/lionagi/) | [Roadmap](https://trello.com/b/3seomsrI/lionagi)
|
236
236
|
|
237
237
|
# LION Framework
|
238
238
|
### Language InterOperable Network - The Future of Controlled AI Operations
|
@@ -2,7 +2,7 @@
|
|
2
2
|
![PyPI - Downloads](https://img.shields.io/pypi/dm/lionagi?color=blue)
|
3
3
|
![Python Version](https://img.shields.io/badge/python-3.10%2B-blue)
|
4
4
|
|
5
|
-
[Documentation](https://
|
5
|
+
[Documentation](https://lion-agi.github.io/lionagi/) | [Discord](https://discord.gg/aqSJ2v46vu) | [PyPI](https://pypi.org/project/lionagi/) | [Roadmap](https://trello.com/b/3seomsrI/lionagi)
|
6
6
|
|
7
7
|
# LION Framework
|
8
8
|
### Language InterOperable Network - The Future of Controlled AI Operations
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# Makefile — On Linux/macOS, run "make html" or "make latexpdf"
|
2
|
+
|
3
|
+
SHELL = /bin/sh
|
4
|
+
|
5
|
+
SPHINXBUILD = sphinx-build
|
6
|
+
SOURCEDIR = .
|
7
|
+
BUILDDIR = _build
|
8
|
+
|
9
|
+
.PHONY: help clean html
|
10
|
+
|
11
|
+
help:
|
12
|
+
@echo "Please use 'make <target>' where <target> is one of:"
|
13
|
+
@echo " html to build the HTML documentation"
|
14
|
+
@echo " clean to remove build artifacts"
|
15
|
+
|
16
|
+
clean:
|
17
|
+
rm -rf $(BUILDDIR)/*
|
18
|
+
|
19
|
+
html:
|
20
|
+
$(SPHINXBUILD) -M html "$(SOURCEDIR)" "$(BUILDDIR)"
|
@@ -0,0 +1,59 @@
|
|
1
|
+
/* Container for the custom link */
|
2
|
+
.my-custom-header {
|
3
|
+
/* If you prefer to separate from theme content: */
|
4
|
+
margin: 0.75rem 1rem 0 1rem;
|
5
|
+
display: flex;
|
6
|
+
justify-content: flex-end; /* Right align */
|
7
|
+
align-items: center;
|
8
|
+
/* Optional border or bottom line: */
|
9
|
+
border-bottom: 1px solid var(--color-border-muted, #ccc);
|
10
|
+
padding-bottom: 0.5rem;
|
11
|
+
}
|
12
|
+
|
13
|
+
.my-custom-header .header-link {
|
14
|
+
display: inline-flex;
|
15
|
+
align-items: center;
|
16
|
+
gap: 0.4rem;
|
17
|
+
text-decoration: none;
|
18
|
+
color: var(--color-text-primary, #222); /* fallback if CSS vars not set */
|
19
|
+
background: var(--color-background-accent, #f5f5f5);
|
20
|
+
padding: 0.4rem 0.75rem;
|
21
|
+
border-radius: 6px;
|
22
|
+
font-weight: 500;
|
23
|
+
transition: background-color 0.2s ease, color 0.2s ease;
|
24
|
+
}
|
25
|
+
|
26
|
+
.my-custom-header .header-link:hover {
|
27
|
+
background: var(--color-background-accent-hover, #e6e6e6);
|
28
|
+
color: var(--color-text-primary-hover, #111);
|
29
|
+
}
|
30
|
+
|
31
|
+
/* The GitHub icon: ensures it scales well with text size */
|
32
|
+
.my-custom-header .gh-icon {
|
33
|
+
width: 1.2em;
|
34
|
+
height: 1.2em;
|
35
|
+
flex-shrink: 0;
|
36
|
+
opacity: 0.8;
|
37
|
+
transition: opacity 0.2s ease;
|
38
|
+
}
|
39
|
+
|
40
|
+
.my-custom-header .header-link:hover .gh-icon {
|
41
|
+
opacity: 1.0;
|
42
|
+
}
|
43
|
+
|
44
|
+
/* Example support for dark mode if your theme doesn't handle it automatically. */
|
45
|
+
@media (prefers-color-scheme: dark) {
|
46
|
+
.my-custom-header .header-link {
|
47
|
+
background: var(--color-background-accent-dark, #333);
|
48
|
+
color: var(--color-text-primary-dark, #eee);
|
49
|
+
}
|
50
|
+
.my-custom-header .header-link:hover {
|
51
|
+
background: var(--color-background-accent-hover-dark, #444);
|
52
|
+
}
|
53
|
+
.my-custom-header .gh-icon {
|
54
|
+
opacity: 0.8;
|
55
|
+
}
|
56
|
+
.my-custom-header .header-link:hover .gh-icon {
|
57
|
+
opacity: 1.0;
|
58
|
+
}
|
59
|
+
}
|
@@ -0,0 +1,34 @@
|
|
1
|
+
{% extends "!layout.html" %}
|
2
|
+
|
3
|
+
{% block header %}
|
4
|
+
<!-- Our custom header container -->
|
5
|
+
<div class="my-custom-header">
|
6
|
+
<!-- A sleek "View on GitHub" link with an icon -->
|
7
|
+
<a class="header-link"
|
8
|
+
href="https://github.com/lion-agi/lionagi"
|
9
|
+
target="_blank"
|
10
|
+
rel="noopener noreferrer"
|
11
|
+
title="View this project on GitHub">
|
12
|
+
<!-- Optional: embed an inline GitHub icon using an SVG -->
|
13
|
+
<svg class="gh-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
|
14
|
+
<path
|
15
|
+
d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303
|
16
|
+
3.438 9.8 8.205 11.387.6.113.82-.258.82-.577
|
17
|
+
0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61
|
18
|
+
-.546-1.387-1.333-1.758-1.333-1.758-1.089-.744.083-.729.083-.729
|
19
|
+
1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.304
|
20
|
+
3.495.998.108-.776.418-1.304.76-1.604-2.665-.3-5.466-1.332-5.466-5.93
|
21
|
+
0-1.31.47-2.381 1.236-3.221-.123-.303-.54-1.523.117-3.176 0 0
|
22
|
+
1.008-.322 3.301 1.23.96-.267 1.98-.399 3-.405 1.02.006
|
23
|
+
2.04.138 3 .405 2.291-1.552 3.299-1.23
|
24
|
+
3.299-1.23 .657 1.653.24 2.873.117 3.176.77.84
|
25
|
+
1.236 1.911 1.236 3.221 0 4.61-2.804 5.625-5.475
|
26
|
+
5.92.43.372.81 1.102.81 2.221 0 1.604-.015
|
27
|
+
2.896-.015 3.286 0 .319.22.694.825.576C20.565
|
28
|
+
22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"/>
|
29
|
+
</svg>
|
30
|
+
<span>View on GitHub</span>
|
31
|
+
</a>
|
32
|
+
</div>
|
33
|
+
{{ super() }}
|
34
|
+
{% endblock %}
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# conf.py — Sphinx configuration for your docs
|
2
|
+
|
3
|
+
import os
|
4
|
+
import sys
|
5
|
+
|
6
|
+
# Insert the path to your main package so autodoc can find it
|
7
|
+
# (Adjust the relative path to match your repo's layout)
|
8
|
+
sys.path.insert(0, os.path.abspath(".."))
|
9
|
+
|
10
|
+
project = "LionAGI"
|
11
|
+
author = "Haiyang Li"
|
12
|
+
copyright = "2025"
|
13
|
+
release = "0.6" # or version from your package
|
14
|
+
|
15
|
+
extensions = [
|
16
|
+
"sphinx.ext.autodoc",
|
17
|
+
"sphinx.ext.napoleon", # Google/NumPy style docstrings
|
18
|
+
"sphinx.ext.todo",
|
19
|
+
"sphinx.ext.viewcode",
|
20
|
+
# "sphinx.ext.autosummary", # optional
|
21
|
+
]
|
22
|
+
|
23
|
+
templates_path = ["_templates"]
|
24
|
+
exclude_patterns = []
|
25
|
+
|
26
|
+
# -- Options for HTML output ----------------------------------------------
|
27
|
+
html_theme = "furo"
|
28
|
+
html_static_path = ["_static"]
|
29
|
+
|
30
|
+
html_theme_options = {
|
31
|
+
"sidebar_hide_name": True,
|
32
|
+
"navigation_with_keys": True,
|
33
|
+
# Hide the “On This Page” panel if you want to rely solely on your local TOC
|
34
|
+
"hide_pages_index": True,
|
35
|
+
"light_css_variables": {
|
36
|
+
"color-brand-primary": "#007ACC",
|
37
|
+
"color-brand-content": "#006699",
|
38
|
+
},
|
39
|
+
"dark_css_variables": {
|
40
|
+
"color-brand-primary": "#4DC1FF",
|
41
|
+
"color-brand-content": "#99C2FF",
|
42
|
+
},
|
43
|
+
}
|
44
|
+
|
45
|
+
# Tells Sphinx to include custom.css after the theme's CSS
|
46
|
+
html_css_files = [
|
47
|
+
"custom.css",
|
48
|
+
]
|
49
|
+
|
50
|
+
# (Optional) a custom title for the entire site:
|
51
|
+
html_title = "LionAGI Documentation"
|
52
|
+
|
53
|
+
|
54
|
+
# -- Custom / Additional config options -----------------------------------
|
55
|
+
# e.g., napoleon_use_param = True
|
56
|
+
# or todo_include_todos = True
|
@@ -0,0 +1,35 @@
|
|
1
|
+
.. _lionagi-docs-index:
|
2
|
+
|
3
|
+
=================================
|
4
|
+
LionAGI — Documentation Home Page
|
5
|
+
=================================
|
6
|
+
|
7
|
+
Welcome to LionAGI's documentation!
|
8
|
+
|
9
|
+
Here you'll find:
|
10
|
+
|
11
|
+
* Core messages system (actions, etc.)
|
12
|
+
* Adapters (tools for conversions)
|
13
|
+
* Operatives (instruct, plans, etc.)
|
14
|
+
* Additional modules references
|
15
|
+
* High-level operations and strategies
|
16
|
+
* And more...
|
17
|
+
|
18
|
+
Contents
|
19
|
+
========
|
20
|
+
|
21
|
+
.. toctree::
|
22
|
+
:maxdepth: 2
|
23
|
+
:caption: Table of Contents:
|
24
|
+
|
25
|
+
tutorials/index
|
26
|
+
modules/index
|
27
|
+
operations/index
|
28
|
+
|
29
|
+
|
30
|
+
Indices and tables
|
31
|
+
==================
|
32
|
+
|
33
|
+
* :ref:`genindex`
|
34
|
+
* :ref:`modindex`
|
35
|
+
* :ref:`search`
|
@@ -0,0 +1,339 @@
|
|
1
|
+
.. _lionagi-action:
|
2
|
+
|
3
|
+
===========================
|
4
|
+
Action
|
5
|
+
===========================
|
6
|
+
|
7
|
+
This module provides a **flexible event-driven framework** for creating and managing
|
8
|
+
**callable “tools”** in LionAGI, validating their inputs/outputs, and invoking them
|
9
|
+
asynchronously with optional pre/post-processing steps. It integrates with the LionAGI
|
10
|
+
**event system** (see :class:`~lionagi.protocols.types.Event`), allowing each function call
|
11
|
+
to be tracked as an event—complete with execution duration, status, and error handling.
|
12
|
+
|
13
|
+
The primary components are:
|
14
|
+
|
15
|
+
- **Tool**: A wrapper for a Python callable function with validation.
|
16
|
+
- **ActionManager**: A registry that orchestrates tools.
|
17
|
+
- **FunctionCalling**: An :class:`~lionagi.protocols.types.Event` that tracks
|
18
|
+
asynchronous function execution.
|
19
|
+
- **ActionRequestModel** / **ActionResponseModel**: Pydantic models for structuring
|
20
|
+
inputs/outputs.
|
21
|
+
|
22
|
+
These classes can be combined with LionAGI's concurrency architecture—such as
|
23
|
+
:class:`~lionagi.protocols.generic.processor.Processor` and
|
24
|
+
:class:`~lionagi.protocols.generic.processor.Executor`—to manage multiple function calls
|
25
|
+
as events in a queue or stored in a :class:`~lionagi.protocols.generic.pile.Pile`
|
26
|
+
(ordered by a :class:`~lionagi.protocols.generic.progression.Progression`).
|
27
|
+
|
28
|
+
|
29
|
+
---------------------------
|
30
|
+
Module Organization & Files
|
31
|
+
---------------------------
|
32
|
+
|
33
|
+
The ``lionagi.action`` package comprises:
|
34
|
+
|
35
|
+
- **function_calling.py**:
|
36
|
+
|
37
|
+
Contains :class:`FunctionCalling`, which is an event class for executing a
|
38
|
+
single tool call asynchronously, handling optional pre/post processing,
|
39
|
+
and storing timing/status in its :attr:`execution`.
|
40
|
+
|
41
|
+
- **manager.py**:
|
42
|
+
|
43
|
+
Implements :class:`ActionManager`, a central registry to:
|
44
|
+
|
45
|
+
- Register tools (functions).
|
46
|
+
- Match incoming requests (function name + arguments) to a registered tool.
|
47
|
+
- Create and run :class:`FunctionCalling` events, returning outcomes or errors.
|
48
|
+
|
49
|
+
- **request_response_model.py**:
|
50
|
+
|
51
|
+
Defines the data schemas for requests/responses:
|
52
|
+
|
53
|
+
- :class:`ActionRequestModel` — capturing the function name and arguments.
|
54
|
+
- :class:`ActionResponseModel` — capturing output after the call.
|
55
|
+
|
56
|
+
- **tool.py**:
|
57
|
+
|
58
|
+
Provides the :class:`Tool` class, wrapping a Python function with optional
|
59
|
+
**preprocessor** / **postprocessor** steps, plus an auto-generated argument schema.
|
60
|
+
|
61
|
+
.. module:: lionagi.action
|
62
|
+
|
63
|
+
|
64
|
+
Tool
|
65
|
+
~~~~
|
66
|
+
.. class:: Tool
|
67
|
+
|
68
|
+
A ``Tool`` wraps a Python callable (function) with metadata and (optionally)
|
69
|
+
preprocessing/postprocessing. It can **strictly validate** the function's parameters,
|
70
|
+
preventing extraneous or missing arguments.
|
71
|
+
|
72
|
+
**Key Attributes**:
|
73
|
+
|
74
|
+
.. py:attribute:: func_callable
|
75
|
+
:type: Callable[..., Any]
|
76
|
+
|
77
|
+
The underlying Python function. This may be sync or async.
|
78
|
+
|
79
|
+
.. py:attribute:: tool_schema
|
80
|
+
:type: dict[str, Any] | None
|
81
|
+
|
82
|
+
An auto-generated JSON schema for the function's parameters (unless provided explicitly).
|
83
|
+
|
84
|
+
.. py:attribute:: preprocessor
|
85
|
+
:type: Callable[[dict[str, Any]], dict[str, Any]] | None
|
86
|
+
|
87
|
+
Optional function that modifies/validates the incoming arguments.
|
88
|
+
|
89
|
+
.. py:attribute:: postprocessor
|
90
|
+
:type: Callable[[Any], Any] | None
|
91
|
+
|
92
|
+
Optional function that modifies/validates the function's output.
|
93
|
+
|
94
|
+
.. py:attribute:: strict_func_call
|
95
|
+
:type: bool
|
96
|
+
|
97
|
+
If ``True``, only the function's exact parameters are allowed during invocation.
|
98
|
+
|
99
|
+
**Properties**:
|
100
|
+
|
101
|
+
.. py:attribute:: function
|
102
|
+
:type: str
|
103
|
+
|
104
|
+
The function's name, inferred from the callable unless overridden.
|
105
|
+
|
106
|
+
.. py:attribute:: required_fields
|
107
|
+
:type: set[str]
|
108
|
+
|
109
|
+
The parameter names that have no default in the function signature.
|
110
|
+
|
111
|
+
.. py:attribute:: minimum_acceptable_fields
|
112
|
+
:type: set[str]
|
113
|
+
|
114
|
+
A less strict subset of required fields, determined by analyzing
|
115
|
+
arguments vs. defaults.
|
116
|
+
|
117
|
+
**Example**::
|
118
|
+
|
119
|
+
from lionagi.action.tool import Tool
|
120
|
+
|
121
|
+
def add(x: int, y: int) -> int:
|
122
|
+
return x + y
|
123
|
+
|
124
|
+
# Wrap 'add' with strict validation
|
125
|
+
add_tool = Tool(
|
126
|
+
func_callable=add,
|
127
|
+
strict_func_call=True
|
128
|
+
)
|
129
|
+
|
130
|
+
|
131
|
+
FunctionCalling
|
132
|
+
~~~~~~~~~~~~~~~
|
133
|
+
.. class:: FunctionCalling
|
134
|
+
:noindex:
|
135
|
+
|
136
|
+
An **event** class representing a single function invocation. It tracks:
|
137
|
+
|
138
|
+
- **Which tool** to call (:attr:`func_tool`).
|
139
|
+
- **Arguments** to pass (:attr:`arguments`).
|
140
|
+
- **Execution** metadata (duration, status, response, error) via
|
141
|
+
:attr:`execution`.
|
142
|
+
|
143
|
+
**Methods**:
|
144
|
+
|
145
|
+
.. method:: invoke() -> None
|
146
|
+
:async:
|
147
|
+
|
148
|
+
1. Optionally run :attr:`func_tool.preprocessor` on :attr:`arguments`.
|
149
|
+
2. Call the function (``await`` if async).
|
150
|
+
3. Optionally run :attr:`func_tool.postprocessor` on the result.
|
151
|
+
4. Set the execution status to COMPLETED or FAILED, plus store
|
152
|
+
the output or error message.
|
153
|
+
|
154
|
+
**Usage Example**::
|
155
|
+
|
156
|
+
from lionagi.action.function_calling import FunctionCalling
|
157
|
+
from lionagi.action.tool import Tool
|
158
|
+
|
159
|
+
def greet(name: str) -> str:
|
160
|
+
return f"Hello, {name}!"
|
161
|
+
|
162
|
+
tool = Tool(greet)
|
163
|
+
call_event = FunctionCalling(func_tool=tool, arguments={"name": "Alice"})
|
164
|
+
|
165
|
+
# In an async context:
|
166
|
+
await call_event.invoke()
|
167
|
+
print(call_event.execution.response) # "Hello, Alice!"
|
168
|
+
print(call_event.status) # COMPLETED
|
169
|
+
|
170
|
+
|
171
|
+
ActionRequestModel
|
172
|
+
~~~~~~~~~~~~~~~~~
|
173
|
+
.. class:: ActionRequestModel
|
174
|
+
:noindex:
|
175
|
+
|
176
|
+
Pydantic model that describes a requested function call. Typically used
|
177
|
+
to parse inbound data that specifies which function to call and what
|
178
|
+
arguments to provide.
|
179
|
+
|
180
|
+
**Fields**:
|
181
|
+
|
182
|
+
.. py:attribute:: function
|
183
|
+
:type: str | None
|
184
|
+
|
185
|
+
The name of the function/tool to invoke. If None, no function is selected.
|
186
|
+
|
187
|
+
.. py:attribute:: arguments
|
188
|
+
:type: dict[str, Any] | None
|
189
|
+
|
190
|
+
The dictionary of arguments for the function call.
|
191
|
+
|
192
|
+
**Class Methods**:
|
193
|
+
|
194
|
+
.. method:: create(content: str) -> list[ActionRequestModel]
|
195
|
+
|
196
|
+
Attempts to parse a JSON string (or similar) into one or more
|
197
|
+
:class:`ActionRequestModel` objects. Returns an empty list on failure.
|
198
|
+
|
199
|
+
|
200
|
+
ActionResponseModel
|
201
|
+
~~~~~~~~~~~~~~~~~~
|
202
|
+
.. class:: ActionResponseModel
|
203
|
+
:noindex:
|
204
|
+
|
205
|
+
Pydantic model describing the **result** of a function call. Includes:
|
206
|
+
|
207
|
+
- :attr:`function`: The function name.
|
208
|
+
- :attr:`arguments`: The passed arguments.
|
209
|
+
- :attr:`output`: The function's return value, if any.
|
210
|
+
|
211
|
+
|
212
|
+
ActionManager
|
213
|
+
~~~~~~~~~~~~~
|
214
|
+
.. class:: ActionManager
|
215
|
+
:noindex:
|
216
|
+
|
217
|
+
The **central registry** for function tools. You can register Python callables
|
218
|
+
(or pre-wrapped :class:`Tool` objects) and invoke them by name with the correct
|
219
|
+
arguments.
|
220
|
+
|
221
|
+
**Core Usage**:
|
222
|
+
|
223
|
+
1) Instantiate :class:`ActionManager`.
|
224
|
+
|
225
|
+
2) Use :meth:`register_tool` or :meth:`register_tools` to add functions.
|
226
|
+
|
227
|
+
3) Call :meth:`invoke` with a dictionary or :class:`ActionRequestModel` specifying
|
228
|
+
``{"function": "...", "arguments": {...}}``.
|
229
|
+
|
230
|
+
Under the hood, :meth:`invoke` creates a :class:`FunctionCalling` event and
|
231
|
+
runs :meth:`FunctionCalling.invoke`. The final or error outcome is contained
|
232
|
+
in the event's execution.
|
233
|
+
|
234
|
+
**Key Methods**:
|
235
|
+
|
236
|
+
.. method:: __init__(*args, **kwargs)
|
237
|
+
|
238
|
+
Collect any tools provided via args/kwargs and register them.
|
239
|
+
|
240
|
+
.. method:: register_tool(tool: FuncTool, update: bool = False) -> None
|
241
|
+
|
242
|
+
Register a single function or :class:`Tool`. If the function name is already
|
243
|
+
taken and ``update=False``, raises ``ValueError``.
|
244
|
+
|
245
|
+
.. method:: register_tools(tools: list[FuncTool] | FuncTool, update: bool = False) -> None
|
246
|
+
|
247
|
+
Register multiple functions or tools at once.
|
248
|
+
|
249
|
+
.. method:: invoke(func_call: ActionRequestModel | dict) -> FunctionCalling | None
|
250
|
+
:async:
|
251
|
+
|
252
|
+
Matches the function name, builds a :class:`FunctionCalling`, invokes it,
|
253
|
+
and returns the event (or logs an error). The event’s :attr:`execution` tracks
|
254
|
+
success/failure.
|
255
|
+
|
256
|
+
**Example**::
|
257
|
+
|
258
|
+
from lionagi.action.manager import ActionManager
|
259
|
+
|
260
|
+
manager = ActionManager()
|
261
|
+
|
262
|
+
def multiply(a: int, b: int) -> int:
|
263
|
+
return a * b
|
264
|
+
|
265
|
+
manager.register_tool(multiply)
|
266
|
+
req = {"function": "multiply", "arguments": {"a": 3, "b": 5}}
|
267
|
+
|
268
|
+
result = await manager.invoke(req)
|
269
|
+
print(result.execution.response) # 15
|
270
|
+
|
271
|
+
|
272
|
+
----------------------------
|
273
|
+
Integration with Event System
|
274
|
+
----------------------------
|
275
|
+
Because **FunctionCalling** can inherit from :class:`~lionagi.protocols.types.Event`, it
|
276
|
+
may be queued or stored in LionAGI's concurrency structures. For instance, you could:
|
277
|
+
|
278
|
+
1. Create a :class:`FunctionCalling` event for each function call you need.
|
279
|
+
2. Add these events to a :class:`~lionagi.protocols.generic.processor.Executor`, which
|
280
|
+
uses a :class:`~lionagi.protocols.generic.processor.Processor` to manage concurrency.
|
281
|
+
3. The events might be stored in a :class:`~lionagi.protocols.generic.pile.Pile` and
|
282
|
+
ordered by a :class:`~lionagi.protocols.generic.progression.Progression`.
|
283
|
+
4. As the Processor runs, it calls :meth:`FunctionCalling.invoke()` for each event,
|
284
|
+
gathering results or errors in the :attr:`execution` field.
|
285
|
+
|
286
|
+
This unifies local function calls under LionAGI’s broader **event-driven** design,
|
287
|
+
ensuring consistent logging, status tracking, and integration with other event types
|
288
|
+
(like advanced scheduling).
|
289
|
+
|
290
|
+
-----------------
|
291
|
+
Additional Examples
|
292
|
+
-----------------
|
293
|
+
|
294
|
+
**Strict Validation**:
|
295
|
+
|
296
|
+
If ``strict_func_call=True`` on a :class:`Tool`, the arguments **must** match the
|
297
|
+
function's signature exactly. Any extra or missing parameters raise a
|
298
|
+
``ValueError``:
|
299
|
+
|
300
|
+
.. code-block:: python
|
301
|
+
|
302
|
+
from lionagi.action.tool import Tool
|
303
|
+
|
304
|
+
def greet(person: str, punctuation: str = "!") -> str:
|
305
|
+
return f"Hello, {person}{punctuation}"
|
306
|
+
|
307
|
+
greet_tool = Tool(
|
308
|
+
func_callable=greet,
|
309
|
+
strict_func_call=True
|
310
|
+
)
|
311
|
+
|
312
|
+
# This fails if 'punctuation' is missing but required, or if you add any unknown keys.
|
313
|
+
|
314
|
+
**Pre/Post Processing**:
|
315
|
+
|
316
|
+
You can attach a preprocessor and postprocessor to the :class:`Tool`:
|
317
|
+
|
318
|
+
.. code-block:: python
|
319
|
+
|
320
|
+
def pre_check(args, **kwargs):
|
321
|
+
if args.get("x", 0) < 0:
|
322
|
+
raise ValueError("x must be >= 0")
|
323
|
+
return args
|
324
|
+
|
325
|
+
def format_result(result, **kwargs):
|
326
|
+
return f"Computed: {result}"
|
327
|
+
|
328
|
+
from lionagi.action.tool import Tool
|
329
|
+
|
330
|
+
def add(x: int, y: int) -> int:
|
331
|
+
return x + y
|
332
|
+
|
333
|
+
add_tool = Tool(
|
334
|
+
func_callable=add,
|
335
|
+
preprocessor=pre_check,
|
336
|
+
postprocessor=format_result
|
337
|
+
)
|
338
|
+
|
339
|
+
# The final result in FunctionCalling.execution.response will be "Computed: <int>"
|