lionagi 0.8.5__tar.gz → 0.8.7__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {lionagi-0.8.5 → lionagi-0.8.7}/PKG-INFO +73 -246
- lionagi-0.8.7/README.md +145 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/__init__.py +6 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/operations/ReAct/ReAct.py +40 -12
- lionagi-0.8.7/lionagi/operations/ReAct/utils.py +92 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/operations/_act/act.py +8 -0
- lionagi-0.8.7/lionagi/operations/interpret/interpret.py +74 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/operations/operate/operate.py +7 -1
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/session/branch.py +54 -6
- lionagi-0.8.7/lionagi/tools/__init__.py +0 -0
- lionagi-0.8.7/lionagi/tools/base.py +12 -0
- lionagi-0.8.7/lionagi/tools/reader.py +244 -0
- lionagi-0.8.7/lionagi/tools/types.py +3 -0
- lionagi-0.8.7/lionagi/version.py +1 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/pyproject.toml +5 -1
- {lionagi-0.8.5 → lionagi-0.8.7}/uv.lock +1462 -237
- lionagi-0.8.5/README.md +0 -318
- lionagi-0.8.5/lionagi/operations/ReAct/utils.py +0 -28
- lionagi-0.8.5/lionagi/operations/interpret/interpret.py +0 -43
- lionagi-0.8.5/lionagi/version.py +0 -1
- {lionagi-0.8.5 → lionagi-0.8.7}/.env.example +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/.github/FUNDING.yml +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/.github/dependabot.yml +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/.github/workflows/ci.yml +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/.github/workflows/codeql.yml +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/.github/workflows/docs.yml +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/.github/workflows/release.yml +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/.gitignore +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/.pre-commit-config.yaml +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/CODE_OF_CONDUCT.md +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/CONTRIBUTING.md +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/LICENSE +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/cookbooks/ch01_get_started.md +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/cookbooks/ch02_concepts.md +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/dev_tools/count_code_base_lines.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/docs/Makefile +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/docs/_static/custom.css +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/docs/_templates/layout.html +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/docs/conf.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/docs/index.rst +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/docs/modules/action.rst +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/docs/modules/adapter.rst +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/docs/modules/branch.rst +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/docs/modules/branch_operations.rst +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/docs/modules/concepts.rst +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/docs/modules/element_id.rst +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/docs/modules/event.rst +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/docs/modules/form.rst +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/docs/modules/graph.rst +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/docs/modules/index.rst +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/docs/modules/instruct.rst +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/docs/modules/lib_file.rst +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/docs/modules/lib_nested.rst +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/docs/modules/lib_package.rst +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/docs/modules/lib_schema.rst +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/docs/modules/lib_validate.rst +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/docs/modules/log.rst +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/docs/modules/mail.rst +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/docs/modules/message.rst +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/docs/modules/models.rst +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/docs/modules/operative_step.rst +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/docs/modules/pile.rst +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/docs/modules/processor.rst +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/docs/modules/progression.rst +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/docs/modules/service.rst +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/docs/modules/session.rst +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/docs/modules/utils.rst +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/docs/tutorials/get_started.rst +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/docs/tutorials/get_started_pt2.rst +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/docs/tutorials/get_started_pt3.rst +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/docs/tutorials/index.rst +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/_class_registry.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/_errors.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/_types.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/libs/__init__.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/libs/file/__init__.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/libs/file/chunk.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/libs/file/file_ops.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/libs/file/params.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/libs/file/process.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/libs/file/save.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/libs/nested/__init__.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/libs/nested/flatten.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/libs/nested/nfilter.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/libs/nested/nget.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/libs/nested/ninsert.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/libs/nested/nmerge.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/libs/nested/npop.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/libs/nested/nset.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/libs/nested/unflatten.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/libs/nested/utils.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/libs/package/__init__.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/libs/package/imports.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/libs/package/management.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/libs/package/params.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/libs/package/system.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/libs/parse.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/libs/schema/__init__.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/libs/schema/as_readable.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/libs/schema/extract_code_block.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/libs/schema/extract_docstring.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/libs/schema/function_to_schema.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/libs/schema/json_schema.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/libs/token_transform/__init__.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/libs/token_transform/llmlingua.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/libs/token_transform/perplexity.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/libs/token_transform/synthlang.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/libs/validate/__init__.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/libs/validate/common_field_validators.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/libs/validate/fuzzy_match_keys.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/libs/validate/fuzzy_validate_mapping.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/libs/validate/string_similarity.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/libs/validate/validate_boolean.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/operations/ReAct/__init__.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/operations/__init__.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/operations/_act/__init__.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/operations/brainstorm/__init__.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/operations/brainstorm/brainstorm.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/operations/brainstorm/prompt.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/operations/chat/__init__.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/operations/chat/chat.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/operations/communicate/__init__.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/operations/communicate/communicate.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/operations/instruct/__init__.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/operations/instruct/instruct.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/operations/interpret/__init__.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/operations/manager.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/operations/operate/__init__.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/operations/parse/__init__.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/operations/parse/parse.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/operations/plan/__init__.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/operations/plan/plan.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/operations/plan/prompt.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/operations/select/__init__.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/operations/select/select.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/operations/select/utils.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/operations/translate/__init__.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/operations/translate/translate.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/operations/types.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/operations/utils.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/operatives/__init__.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/operatives/action/__init__.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/operatives/action/function_calling.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/operatives/action/manager.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/operatives/action/request_response_model.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/operatives/action/tool.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/operatives/action/utils.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/operatives/forms/__init__.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/operatives/forms/base.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/operatives/forms/flow.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/operatives/forms/form.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/operatives/forms/report.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/operatives/instruct/__init__.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/operatives/instruct/base.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/operatives/instruct/instruct.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/operatives/instruct/instruct_collection.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/operatives/instruct/node.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/operatives/instruct/prompts.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/operatives/instruct/reason.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/operatives/manager.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/operatives/models/__init__.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/operatives/models/field_model.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/operatives/models/model_params.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/operatives/models/note.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/operatives/models/operable_model.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/operatives/models/schema_model.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/operatives/operative.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/operatives/step.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/operatives/strategies/__init__.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/operatives/strategies/base.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/operatives/strategies/concurrent.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/operatives/strategies/concurrent_chunk.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/operatives/strategies/concurrent_sequential_chunk.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/operatives/strategies/params.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/operatives/strategies/sequential.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/operatives/strategies/sequential_chunk.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/operatives/strategies/sequential_concurrent_chunk.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/operatives/strategies/utils.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/operatives/types.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/protocols/__init__.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/protocols/_concepts.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/protocols/adapters/__init__.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/protocols/adapters/adapter.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/protocols/adapters/json_adapter.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/protocols/adapters/pandas_/__init__.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/protocols/adapters/pandas_/csv_adapter.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/protocols/adapters/pandas_/excel_adapter.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/protocols/adapters/pandas_/pd_dataframe_adapter.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/protocols/adapters/pandas_/pd_series_adapter.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/protocols/adapters/types.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/protocols/generic/__init__.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/protocols/generic/element.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/protocols/generic/event.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/protocols/generic/log.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/protocols/generic/pile.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/protocols/generic/processor.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/protocols/generic/progression.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/protocols/graph/__init__.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/protocols/graph/edge.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/protocols/graph/graph.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/protocols/graph/node.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/protocols/mail/__init__.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/protocols/mail/exchange.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/protocols/mail/mail.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/protocols/mail/mailbox.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/protocols/mail/manager.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/protocols/mail/package.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/protocols/messages/__init__.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/protocols/messages/action_request.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/protocols/messages/action_response.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/protocols/messages/assistant_response.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/protocols/messages/base.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/protocols/messages/instruction.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/protocols/messages/manager.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/protocols/messages/message.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/protocols/messages/system.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/protocols/messages/templates/README.md +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/protocols/messages/templates/action_request.jinja2 +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/protocols/messages/templates/action_response.jinja2 +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/protocols/messages/templates/assistant_response.jinja2 +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/protocols/messages/templates/instruction_message.jinja2 +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/protocols/messages/templates/system_message.jinja2 +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/protocols/messages/templates/tool_schemas.jinja2 +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/protocols/types.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/service/__init__.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/service/endpoints/__init__.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/service/endpoints/base.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/service/endpoints/chat_completion.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/service/endpoints/match_endpoint.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/service/endpoints/rate_limited_processor.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/service/endpoints/token_calculator.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/service/imodel.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/service/manager.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/service/providers/__init__.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/service/providers/anthropic_/__init__.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/service/providers/anthropic_/messages.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/service/providers/exa_/__init__.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/service/providers/exa_/models.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/service/providers/exa_/search.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/service/providers/exa_/types.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/service/providers/groq_/__init__.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/service/providers/groq_/chat_completions.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/service/providers/openai_/__init__.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/service/providers/openai_/chat_completions.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/service/providers/openrouter_/__init__.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/service/providers/openrouter_/chat_completions.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/service/providers/perplexity_/__init__.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/service/providers/perplexity_/chat_completions.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/service/providers/perplexity_/models.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/service/providers/types.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/service/types.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/session/__init__.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/session/session.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/settings.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/lionagi/utils.py +0 -0
- {lionagi-0.8.5 → lionagi-0.8.7}/prompts/doc_style.md +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: lionagi
|
3
|
-
Version: 0.8.
|
3
|
+
Version: 0.8.7
|
4
4
|
Summary: An Intelligence Operating System.
|
5
5
|
Author-email: HaiyangLi <quantocean.li@gmail.com>
|
6
6
|
License: Apache License
|
@@ -235,310 +235,134 @@ Description-Content-Type: text/markdown
|
|
235
235
|
|
236
236
|
[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)
|
237
237
|
|
238
|
-
# LION
|
239
|
-
### Language InterOperable Network - The Future of Controlled AI Operations
|
238
|
+
# LION - Language InterOperable Network
|
240
239
|
|
241
|
-
|
240
|
+
## An Intelligence Operating System
|
242
241
|
|
243
|
-
|
242
|
+
LionAGI is a robust framework for orchestrating multi-step AI operations with precise control. Bring together multiple models, advanced ReAct reasoning, tool integrations, and custom validations in a single coherent pipeline.
|
244
243
|
|
245
|
-
|
246
|
-
|
247
|
-
LION is designed to be:
|
248
|
-
- 🔒 **Controlled**: Built-in safety mechanisms and verification
|
249
|
-
- 🎯 **Precise**: Exact control over AI behaviors
|
250
|
-
- 🔧 **Flexible**: Build any workflow you need
|
251
|
-
- 🚀 **Efficient**: Minimal dependencies, maximum performance
|
244
|
+
## Why LionAGI?
|
252
245
|
|
246
|
+
- **Structured**: LLM interactions are validated and typed (via Pydantic).
|
247
|
+
- **Expandable**: Integrate multiple providers (OpenAI, Anthropic, Perplexity, custom) with minimal friction.
|
248
|
+
- **Controlled**: Built-in safety checks, concurrency strategies, and advanced multi-step flows—like ReAct with verbose outputs.
|
249
|
+
- **Transparent**: Real-time logging, message introspection, and easy debugging of tool usage.
|
253
250
|
|
254
251
|
|
255
252
|
## Installation
|
256
253
|
|
257
|
-
|
258
|
-
|
259
|
-
```bash
|
260
|
-
uv pip install lionagi
|
254
|
+
```
|
255
|
+
pip install lionagi
|
261
256
|
```
|
262
257
|
|
263
258
|
Dependencies:
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
259
|
+
• litellm
|
260
|
+
• jinja2
|
261
|
+
• pandas
|
262
|
+
• pillow
|
263
|
+
• python-dotenv
|
270
264
|
|
271
265
|
## Quick Start
|
272
|
-
|
273
266
|
```python
|
274
|
-
from lionagi import
|
267
|
+
from lionagi import Branch, iModel
|
275
268
|
|
276
|
-
#
|
277
|
-
gpt4o = iModel(provider="openai",
|
269
|
+
# Pick a model
|
270
|
+
gpt4o = iModel(provider="openai", model="gpt-4o")
|
278
271
|
|
272
|
+
# Create a Branch (conversation context)
|
279
273
|
hunter = Branch(
|
280
|
-
system="you are a hilarious dragon hunter who responds in 10 words rhymes",
|
281
|
-
|
274
|
+
system="you are a hilarious dragon hunter who responds in 10 words rhymes.",
|
275
|
+
chat_model=gpt4o,
|
282
276
|
)
|
283
277
|
|
284
|
-
#
|
285
|
-
|
278
|
+
# Communicate asynchronously
|
279
|
+
response = await hunter.communicate("I am a dragon")
|
280
|
+
print(response)
|
286
281
|
```
|
287
282
|
|
288
283
|
```
|
289
284
|
You claim to be a dragon, oh what a braggin'!
|
290
285
|
```
|
286
|
+
### Structured Responses
|
291
287
|
|
292
|
-
|
293
|
-
|
294
|
-
### 1. Model Agnostic Structured Output
|
295
|
-
|
296
|
-
LION provides a unified interface for interacting with any AI model, regardless of the underlying architecture. This allows you to easily switch between models without changing your code.
|
288
|
+
Use Pydantic to keep outputs structured:
|
297
289
|
|
298
290
|
```python
|
299
291
|
from pydantic import BaseModel
|
300
292
|
|
301
293
|
class Joke(BaseModel):
|
302
|
-
|
294
|
+
joke: str
|
303
295
|
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
max_tokens=100, # max_tokens is required for anthropic models
|
296
|
+
res = await hunter.communicate(
|
297
|
+
"Tell me a short dragon joke",
|
298
|
+
response_format=Joke
|
308
299
|
)
|
309
|
-
|
310
|
-
response = await hunter.communicate(
|
311
|
-
instruction="I am a dragon",
|
312
|
-
response_format=Joke, # structured output in given pydantic model
|
313
|
-
clear_messages=True, # refresh the conversation
|
314
|
-
imodel=sonnet, # use sonnet model, which doesn't support structured output
|
315
|
-
)
|
316
|
-
|
317
300
|
print(type(response))
|
318
301
|
print(response.joke)
|
319
302
|
```
|
320
|
-
|
321
303
|
```
|
322
304
|
<class '__main__.Joke'>
|
323
|
-
|
305
|
+
With fiery claws, dragons hide their laughter flaws!
|
324
306
|
```
|
325
307
|
|
308
|
+
### ReAct and Tools
|
326
309
|
|
327
|
-
|
310
|
+
LionAGI supports advanced multi-step reasoning with ReAct. Tools let the LLM invoke external actions:
|
328
311
|
|
329
312
|
```python
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
imodel=pplx_small, # use perplexity model
|
313
|
+
from lionagi.tools.types import ReaderTool
|
314
|
+
|
315
|
+
branch = Branch(chat_model=gpt4o, tools=ReaderTool)
|
316
|
+
result = await branch.ReAct(
|
317
|
+
instruct={
|
318
|
+
"instruction": "Summarize my PDF and compare with relevant papers.",
|
319
|
+
"context": {"paper_file_path": "/path/to/paper.pdf"},
|
320
|
+
},
|
321
|
+
extension_allowed=True, # allow multi-round expansions
|
322
|
+
max_extensions=5,
|
323
|
+
verbose=True, # see step-by-step chain-of-thought
|
342
324
|
)
|
343
|
-
|
344
|
-
print(b)
|
345
|
-
```
|
346
|
-
|
347
|
-
```
|
348
|
-
A well-behaved dragon is one that's calm and bright,
|
349
|
-
No stress or fear, just a peaceful night.
|
350
|
-
It's active, not lethargic, with a happy face,
|
351
|
-
And behaviors like digging, not a frantic pace.
|
352
|
-
It's social, friendly, and never a fright,
|
353
|
-
Just a gentle soul, shining with delight
|
354
|
-
```
|
355
|
-
|
356
|
-
```python
|
357
|
-
hunter.msgs.last_response.model_response
|
358
|
-
```
|
359
|
-
|
360
|
-
```
|
361
|
-
{'id': '1be10f4c-0936-4050-ab48-91bd86ab11a5',
|
362
|
-
'model': 'llama-3.1-sonar-small-128k-online',
|
363
|
-
'object': 'chat.completion',
|
364
|
-
'created': 1734369700,
|
365
|
-
'choices': [{'index': 0,
|
366
|
-
'message': {'role': 'assistant',
|
367
|
-
'content': "A well-behaved dragon is one that's calm and bright,\nNo stress or fear, just a peaceful night.\nIt's active, not lethargic, with a happy face,\nAnd behaviors like digging, not a frantic pace.\nIt's social, friendly, and never a fright,\nJust a gentle soul, shining with delight"},
|
368
|
-
'finish_reason': 'stop',
|
369
|
-
'delta': {'role': 'assistant', 'content': ''}}],
|
370
|
-
'usage': {'prompt_tokens': 40, 'completion_tokens': 69, 'total_tokens': 109},
|
371
|
-
'citations': [{'url': 'https://dragonsdiet.com/blogs/dragon-care/15-bearded-dragon-behaviors-and-what-they-could-mean'},
|
372
|
-
{'url': 'https://masterbraeokk.tripod.com/dragons/behavior.html'},
|
373
|
-
{'url': 'https://files.eric.ed.gov/fulltext/ED247607.pdf'},
|
374
|
-
{'url': 'https://www.travelchinaguide.com/intro/social_customs/zodiac/dragon/five-elements.htm'},
|
375
|
-
{'url': 'https://www.travelchinaguide.com/intro/social_customs/zodiac/dragon/'}]}
|
325
|
+
print(result)
|
376
326
|
```
|
377
327
|
|
328
|
+
The LLM can now open the PDF, read in slices, fetch references, and produce a final structured summary.
|
378
329
|
|
379
|
-
###
|
380
|
-
|
330
|
+
### Observability & Debugging
|
331
|
+
- Inspect messages:
|
381
332
|
```python
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
class Reason(BaseModel):
|
386
|
-
reason: str
|
387
|
-
confidence_score: float
|
388
|
-
|
389
|
-
class Thought(BaseModel):
|
390
|
-
thought: str
|
391
|
-
|
392
|
-
class Analysis(BaseModel):
|
393
|
-
thought: list[Thought] = Field(
|
394
|
-
default_factory=list,
|
395
|
-
description="concise Chain of thoughts from you, 3 step, each in 8 words"
|
396
|
-
)
|
397
|
-
analysis: str = Field(
|
398
|
-
...,
|
399
|
-
description="Final analysis of the dragon's psyche in 20 words",
|
400
|
-
)
|
401
|
-
reason: list[Reason] = Field(
|
402
|
-
default_factory=list,
|
403
|
-
description="Concise Reasoning behind the analysis, 3 support, each in 8 words"
|
404
|
-
)
|
405
|
-
|
406
|
-
context1 = "I am a dragon, I think therefore I am, I suffer from shiny objects syndrome"
|
407
|
-
context2 = "I like food and poetry, I use uv sometimes, it's cool but I am not familiar with pip"
|
408
|
-
|
409
|
-
async def analyze(context) -> Analysis:
|
410
|
-
psychologist = Branch(
|
411
|
-
system="you are a renowned dragon psychologist",
|
412
|
-
imodel=gpt4o,
|
413
|
-
)
|
414
|
-
return await psychologist.communicate(
|
415
|
-
instruction="analyze the dragon's psyche using chain of thoughts",
|
416
|
-
guidance="think step by step, reason with logic",
|
417
|
-
context=context,
|
418
|
-
response_format=Analysis,
|
419
|
-
)
|
420
|
-
|
333
|
+
df = branch.to_df()
|
334
|
+
print(df.tail())
|
421
335
|
```
|
336
|
+
- Action logs show each tool call, arguments, and outcomes.
|
337
|
+
- Verbose ReAct provides chain-of-thought analysis (helpful for debugging multi-step flows).
|
422
338
|
|
423
|
-
|
424
|
-
result1 = await analyze(context1)
|
425
|
-
|
426
|
-
print("\nThoughts:")
|
427
|
-
for i in result1.thought:
|
428
|
-
print(i.thought)
|
429
|
-
|
430
|
-
print("\nAnalysis:")
|
431
|
-
print(result1.analysis)
|
432
|
-
|
433
|
-
print("\nReasoning:")
|
434
|
-
for i in result1.reason:
|
435
|
-
print(i.reason)
|
436
|
-
```
|
437
|
-
|
438
|
-
```
|
439
|
-
|
440
|
-
Thoughts:
|
441
|
-
Dragons are attracted to shiny objects naturally.
|
442
|
-
This suggests a strong affinity for hoarding.
|
443
|
-
Reflects the dragon's inherent desire for possession.
|
444
|
-
|
445
|
-
Analysis:
|
446
|
-
The dragon demonstrates a compulsive hoarding behavior linked to attraction for shiny objects.
|
447
|
-
|
448
|
-
Reasoning:
|
449
|
-
Shiny objects trigger instinctual hoarding behavior.
|
450
|
-
Possession indicates a symbol of power and security.
|
451
|
-
Hoarding is reinforced by evolutionary survival mechanisms.
|
452
|
-
```
|
339
|
+
### Example: Multi-Model Orchestration
|
453
340
|
|
454
341
|
```python
|
455
|
-
|
342
|
+
from lionagi import Branch, iModel
|
456
343
|
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
344
|
+
gpt4o = iModel(provider="openai", model="gpt-4o")
|
345
|
+
sonnet = iModel(
|
346
|
+
provider="anthropic",
|
347
|
+
model="claude-3-5-sonnet-20241022",
|
348
|
+
max_tokens=1000, # max_tokens is required for anthropic models
|
349
|
+
)
|
463
350
|
|
464
|
-
|
465
|
-
|
466
|
-
|
351
|
+
branch = Branch(chat_model=gpt4o)
|
352
|
+
# Switch mid-flow
|
353
|
+
analysis = await branch.communicate("Analyze these stats", imodel=sonnet)
|
467
354
|
```
|
468
355
|
|
469
|
-
|
470
|
-
Thoughts:
|
471
|
-
Dragon enjoys both food and poetry regularly.
|
472
|
-
Dragon uses uv light with frequent interest.
|
473
|
-
Dragon is unfamiliar and not comfortable with pip.
|
474
|
-
|
475
|
-
Analysis:
|
476
|
-
The dragon is curious and exploratory, yet selectively cautious about unfamiliar methodologies.
|
477
|
-
|
478
|
-
Reasoning:
|
479
|
-
Preference for food and poetry suggests curiosity.
|
480
|
-
Frequent uv light use indicates exploratory nature.
|
481
|
-
Discomfort with pip usage shows selective caution.
|
482
|
-
```
|
356
|
+
Seamlessly route to different models in the same workflow.
|
483
357
|
|
358
|
+
## Community & Contributing
|
484
359
|
|
360
|
+
We welcome issues, ideas, and pull requests:
|
361
|
+
- Discord: Join to chat or get help
|
362
|
+
- Issues / PRs: GitHub
|
485
363
|
|
486
|
-
|
487
|
-
|
488
|
-
Below is an example of what you can build with LION. Note that these are sample implementations - LION provides the building blocks, you create the workflows that fit your needs.
|
489
|
-
|
490
|
-
```mermaid
|
491
|
-
sequenceDiagram
|
492
|
-
autonumber
|
493
|
-
participant Client
|
494
|
-
participant Orchestrator
|
495
|
-
participant ResearchAgent
|
496
|
-
participant AnalysisAgent
|
497
|
-
participant ValidationAgent
|
498
|
-
participant Tools
|
499
|
-
|
500
|
-
Client->>+Orchestrator: Submit Complex Task
|
501
|
-
Note over Orchestrator: Task Analysis & Planning
|
502
|
-
|
503
|
-
%% Research Phase
|
504
|
-
Orchestrator->>+ResearchAgent: Delegate Research
|
505
|
-
activate ResearchAgent
|
506
|
-
ResearchAgent->>Tools: Access Data Sources
|
507
|
-
Tools-->>ResearchAgent: Raw Data
|
508
|
-
ResearchAgent-->>-Orchestrator: Research Results
|
509
|
-
deactivate ResearchAgent
|
510
|
-
|
511
|
-
%% Analysis Phase
|
512
|
-
Orchestrator->>+AnalysisAgent: Process Data
|
513
|
-
activate AnalysisAgent
|
514
|
-
AnalysisAgent->>Tools: Apply Models
|
515
|
-
Tools-->>AnalysisAgent: Analysis Results
|
516
|
-
AnalysisAgent-->>-Orchestrator: Processed Insights
|
517
|
-
deactivate AnalysisAgent
|
518
|
-
|
519
|
-
%% Validation Phase
|
520
|
-
Orchestrator->>+ValidationAgent: Verify Results
|
521
|
-
activate ValidationAgent
|
522
|
-
ValidationAgent->>Tools: Apply Safety Checks
|
523
|
-
Tools-->>ValidationAgent: Validation Status
|
524
|
-
ValidationAgent-->>-Orchestrator: Verified Results
|
525
|
-
deactivate ValidationAgent
|
526
|
-
|
527
|
-
Orchestrator-->>-Client: Return Validated Output
|
364
|
+
### Citation
|
528
365
|
```
|
529
|
-
|
530
|
-
|
531
|
-
## 🤝 Contributing
|
532
|
-
|
533
|
-
Join our [Discord community](https://discord.gg/aqSJ2v46vu) to:
|
534
|
-
- Share ideas
|
535
|
-
- Report issues
|
536
|
-
- Contribute code
|
537
|
-
- Learn from others
|
538
|
-
|
539
|
-
## 📚 Citation
|
540
|
-
|
541
|
-
```bibtex
|
542
366
|
@software{Li_LionAGI_2023,
|
543
367
|
author = {Haiyang Li},
|
544
368
|
month = {12},
|
@@ -547,3 +371,6 @@ Join our [Discord community](https://discord.gg/aqSJ2v46vu) to:
|
|
547
371
|
url = {https://github.com/lion-agi/lionagi},
|
548
372
|
}
|
549
373
|
```
|
374
|
+
|
375
|
+
**🦁 LionAGI**
|
376
|
+
> Because real AI orchestration demands more than a single prompt. Try it out and discover the next evolution in structured, multi-model, safe AI.
|
lionagi-0.8.7/README.md
ADDED
@@ -0,0 +1,145 @@
|
|
1
|
+

|
2
|
+

|
3
|
+

|
4
|
+
|
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
|
+
|
7
|
+
# LION - Language InterOperable Network
|
8
|
+
|
9
|
+
## An Intelligence Operating System
|
10
|
+
|
11
|
+
LionAGI is a robust framework for orchestrating multi-step AI operations with precise control. Bring together multiple models, advanced ReAct reasoning, tool integrations, and custom validations in a single coherent pipeline.
|
12
|
+
|
13
|
+
## Why LionAGI?
|
14
|
+
|
15
|
+
- **Structured**: LLM interactions are validated and typed (via Pydantic).
|
16
|
+
- **Expandable**: Integrate multiple providers (OpenAI, Anthropic, Perplexity, custom) with minimal friction.
|
17
|
+
- **Controlled**: Built-in safety checks, concurrency strategies, and advanced multi-step flows—like ReAct with verbose outputs.
|
18
|
+
- **Transparent**: Real-time logging, message introspection, and easy debugging of tool usage.
|
19
|
+
|
20
|
+
|
21
|
+
## Installation
|
22
|
+
|
23
|
+
```
|
24
|
+
pip install lionagi
|
25
|
+
```
|
26
|
+
|
27
|
+
Dependencies:
|
28
|
+
• litellm
|
29
|
+
• jinja2
|
30
|
+
• pandas
|
31
|
+
• pillow
|
32
|
+
• python-dotenv
|
33
|
+
|
34
|
+
## Quick Start
|
35
|
+
```python
|
36
|
+
from lionagi import Branch, iModel
|
37
|
+
|
38
|
+
# Pick a model
|
39
|
+
gpt4o = iModel(provider="openai", model="gpt-4o")
|
40
|
+
|
41
|
+
# Create a Branch (conversation context)
|
42
|
+
hunter = Branch(
|
43
|
+
system="you are a hilarious dragon hunter who responds in 10 words rhymes.",
|
44
|
+
chat_model=gpt4o,
|
45
|
+
)
|
46
|
+
|
47
|
+
# Communicate asynchronously
|
48
|
+
response = await hunter.communicate("I am a dragon")
|
49
|
+
print(response)
|
50
|
+
```
|
51
|
+
|
52
|
+
```
|
53
|
+
You claim to be a dragon, oh what a braggin'!
|
54
|
+
```
|
55
|
+
### Structured Responses
|
56
|
+
|
57
|
+
Use Pydantic to keep outputs structured:
|
58
|
+
|
59
|
+
```python
|
60
|
+
from pydantic import BaseModel
|
61
|
+
|
62
|
+
class Joke(BaseModel):
|
63
|
+
joke: str
|
64
|
+
|
65
|
+
res = await hunter.communicate(
|
66
|
+
"Tell me a short dragon joke",
|
67
|
+
response_format=Joke
|
68
|
+
)
|
69
|
+
print(type(response))
|
70
|
+
print(response.joke)
|
71
|
+
```
|
72
|
+
```
|
73
|
+
<class '__main__.Joke'>
|
74
|
+
With fiery claws, dragons hide their laughter flaws!
|
75
|
+
```
|
76
|
+
|
77
|
+
### ReAct and Tools
|
78
|
+
|
79
|
+
LionAGI supports advanced multi-step reasoning with ReAct. Tools let the LLM invoke external actions:
|
80
|
+
|
81
|
+
```python
|
82
|
+
from lionagi.tools.types import ReaderTool
|
83
|
+
|
84
|
+
branch = Branch(chat_model=gpt4o, tools=ReaderTool)
|
85
|
+
result = await branch.ReAct(
|
86
|
+
instruct={
|
87
|
+
"instruction": "Summarize my PDF and compare with relevant papers.",
|
88
|
+
"context": {"paper_file_path": "/path/to/paper.pdf"},
|
89
|
+
},
|
90
|
+
extension_allowed=True, # allow multi-round expansions
|
91
|
+
max_extensions=5,
|
92
|
+
verbose=True, # see step-by-step chain-of-thought
|
93
|
+
)
|
94
|
+
print(result)
|
95
|
+
```
|
96
|
+
|
97
|
+
The LLM can now open the PDF, read in slices, fetch references, and produce a final structured summary.
|
98
|
+
|
99
|
+
### Observability & Debugging
|
100
|
+
- Inspect messages:
|
101
|
+
```python
|
102
|
+
df = branch.to_df()
|
103
|
+
print(df.tail())
|
104
|
+
```
|
105
|
+
- Action logs show each tool call, arguments, and outcomes.
|
106
|
+
- Verbose ReAct provides chain-of-thought analysis (helpful for debugging multi-step flows).
|
107
|
+
|
108
|
+
### Example: Multi-Model Orchestration
|
109
|
+
|
110
|
+
```python
|
111
|
+
from lionagi import Branch, iModel
|
112
|
+
|
113
|
+
gpt4o = iModel(provider="openai", model="gpt-4o")
|
114
|
+
sonnet = iModel(
|
115
|
+
provider="anthropic",
|
116
|
+
model="claude-3-5-sonnet-20241022",
|
117
|
+
max_tokens=1000, # max_tokens is required for anthropic models
|
118
|
+
)
|
119
|
+
|
120
|
+
branch = Branch(chat_model=gpt4o)
|
121
|
+
# Switch mid-flow
|
122
|
+
analysis = await branch.communicate("Analyze these stats", imodel=sonnet)
|
123
|
+
```
|
124
|
+
|
125
|
+
Seamlessly route to different models in the same workflow.
|
126
|
+
|
127
|
+
## Community & Contributing
|
128
|
+
|
129
|
+
We welcome issues, ideas, and pull requests:
|
130
|
+
- Discord: Join to chat or get help
|
131
|
+
- Issues / PRs: GitHub
|
132
|
+
|
133
|
+
### Citation
|
134
|
+
```
|
135
|
+
@software{Li_LionAGI_2023,
|
136
|
+
author = {Haiyang Li},
|
137
|
+
month = {12},
|
138
|
+
year = {2023},
|
139
|
+
title = {LionAGI: Towards Automated General Intelligence},
|
140
|
+
url = {https://github.com/lion-agi/lionagi},
|
141
|
+
}
|
142
|
+
```
|
143
|
+
|
144
|
+
**🦁 LionAGI**
|
145
|
+
> Because real AI orchestration demands more than a single prompt. Try it out and discover the next evolution in structured, multi-model, safe AI.
|
@@ -2,6 +2,8 @@
|
|
2
2
|
#
|
3
3
|
# SPDX-License-Identifier: Apache-2.0
|
4
4
|
|
5
|
+
import logging
|
6
|
+
|
5
7
|
from pydantic import BaseModel, Field
|
6
8
|
|
7
9
|
from . import _types as types
|
@@ -13,6 +15,9 @@ from .version import __version__
|
|
13
15
|
|
14
16
|
LiteiModel = iModel
|
15
17
|
|
18
|
+
logger = logging.getLogger(__name__)
|
19
|
+
logger.setLevel(logging.INFO)
|
20
|
+
|
16
21
|
__all__ = (
|
17
22
|
"Session",
|
18
23
|
"Branch",
|
@@ -24,4 +29,5 @@ __all__ = (
|
|
24
29
|
"__version__",
|
25
30
|
"BaseModel",
|
26
31
|
"Field",
|
32
|
+
"logger",
|
27
33
|
)
|
@@ -28,11 +28,12 @@ async def ReAct(
|
|
28
28
|
tools: Any = None,
|
29
29
|
tool_schemas: Any = None,
|
30
30
|
response_format: type[BaseModel] | BaseModel = None,
|
31
|
-
extension_allowed: bool =
|
32
|
-
max_extensions: int | None =
|
31
|
+
extension_allowed: bool = True,
|
32
|
+
max_extensions: int | None = 3,
|
33
33
|
response_kwargs: dict | None = None,
|
34
34
|
return_analysis: bool = False,
|
35
35
|
analysis_model: iModel | None = None,
|
36
|
+
verbose_analysis: bool = False,
|
36
37
|
**kwargs,
|
37
38
|
):
|
38
39
|
# If no tools or tool schemas are provided, default to "all tools"
|
@@ -53,6 +54,8 @@ async def ReAct(
|
|
53
54
|
sample_writing=interpret_sample,
|
54
55
|
**(interpret_kwargs or {}),
|
55
56
|
)
|
57
|
+
if verbose_analysis:
|
58
|
+
print(f"Interpreted instruction: {instruction_str}")
|
56
59
|
|
57
60
|
# Convert Instruct to dict if necessary
|
58
61
|
instruct_dict = (
|
@@ -60,10 +63,13 @@ async def ReAct(
|
|
60
63
|
if isinstance(instruct, Instruct)
|
61
64
|
else dict(instruct)
|
62
65
|
)
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
66
|
+
|
67
|
+
# Overwrite "instruction" with the interpreted prompt (if any) plus a note about expansions
|
68
|
+
max_ext_info = f"\nIf needed, you can do up to {max_extensions or 0 if extension_allowed else 0} expansions."
|
69
|
+
instruct_dict["instruction"] = (
|
70
|
+
instruction_str
|
71
|
+
or (instruct_dict.get("instruction") or "") # in case it's missing
|
72
|
+
) + max_ext_info
|
67
73
|
|
68
74
|
# Prepare a copy of user-provided kwargs for the first operate call
|
69
75
|
kwargs_for_operate = copy(kwargs)
|
@@ -81,13 +87,23 @@ async def ReAct(
|
|
81
87
|
)
|
82
88
|
analyses = [analysis]
|
83
89
|
|
90
|
+
# If verbose, show round #1 analysis
|
91
|
+
if verbose_analysis:
|
92
|
+
print(
|
93
|
+
f"ReAct Round #1 Analysis:\n {analysis.model_dump_json(indent=2)}",
|
94
|
+
)
|
95
|
+
|
84
96
|
# Validate and clamp max_extensions if needed
|
85
|
-
if max_extensions and max_extensions >
|
86
|
-
logging.warning(
|
87
|
-
|
97
|
+
if max_extensions and max_extensions > 100:
|
98
|
+
logging.warning(
|
99
|
+
"max_extensions should not exceed 100; defaulting to 100."
|
100
|
+
)
|
101
|
+
max_extensions = 100
|
88
102
|
|
89
103
|
# Step 2: Possibly loop through expansions if extension_needed
|
90
104
|
extensions = max_extensions
|
105
|
+
round_count = 1
|
106
|
+
|
91
107
|
while (
|
92
108
|
extension_allowed
|
93
109
|
and analysis.extension_needed
|
@@ -103,16 +119,28 @@ async def ReAct(
|
|
103
119
|
extensions=extensions
|
104
120
|
)
|
105
121
|
|
122
|
+
operate_kwargs = copy(kwargs)
|
123
|
+
operate_kwargs["actions"] = True
|
124
|
+
operate_kwargs["reason"] = True
|
125
|
+
operate_kwargs["response_format"] = ReActAnalysis
|
126
|
+
operate_kwargs["action_strategy"] = analysis.action_strategy
|
127
|
+
if analysis.action_batch_size:
|
128
|
+
operate_kwargs["action_batch_size"] = analysis.action_batch_size
|
129
|
+
|
106
130
|
analysis = await branch.operate(
|
107
131
|
instruction=new_instruction,
|
108
|
-
response_format=ReActAnalysis,
|
109
132
|
tools=tools,
|
110
133
|
tool_schemas=tool_schemas,
|
111
|
-
|
112
|
-
actions=True,
|
134
|
+
**operate_kwargs,
|
113
135
|
)
|
114
136
|
analyses.append(analysis)
|
137
|
+
round_count += 1
|
115
138
|
|
139
|
+
# If verbose, show round analysis
|
140
|
+
if verbose_analysis:
|
141
|
+
print(
|
142
|
+
f"ReAct Round #{round_count} Analysis:\n {analysis.model_dump_json(indent=2)}",
|
143
|
+
)
|
116
144
|
if extensions:
|
117
145
|
extensions -= 1
|
118
146
|
|