lionagi 0.9.12__tar.gz → 0.9.14__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.9.12 → lionagi-0.9.14}/PKG-INFO +2 -1
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/libs/file/chunk.py +3 -3
- lionagi-0.9.14/lionagi/libs/token_transform/base.py +52 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/libs/token_transform/perplexity.py +41 -29
- lionagi-0.9.14/lionagi/libs/token_transform/symbolic_compress_context.py +138 -0
- lionagi-0.9.14/lionagi/libs/token_transform/synthlang.py +9 -0
- lionagi-0.9.14/lionagi/libs/token_transform/synthlang_/base.py +130 -0
- lionagi-0.9.14/lionagi/libs/token_transform/synthlang_/resources/frameworks/abstract_algebra.toml +11 -0
- lionagi-0.9.14/lionagi/libs/token_transform/synthlang_/resources/frameworks/category_theory.toml +11 -0
- lionagi-0.9.14/lionagi/libs/token_transform/synthlang_/resources/frameworks/complex_analysis.toml +11 -0
- lionagi-0.9.14/lionagi/libs/token_transform/synthlang_/resources/frameworks/framework_options.json +52 -0
- lionagi-0.9.14/lionagi/libs/token_transform/synthlang_/resources/frameworks/group_theory.toml +11 -0
- lionagi-0.9.14/lionagi/libs/token_transform/synthlang_/resources/frameworks/math_logic.toml +11 -0
- lionagi-0.9.14/lionagi/libs/token_transform/synthlang_/resources/frameworks/reflective_patterns.toml +11 -0
- lionagi-0.9.14/lionagi/libs/token_transform/synthlang_/resources/frameworks/set_theory.toml +11 -0
- lionagi-0.9.14/lionagi/libs/token_transform/synthlang_/resources/frameworks/topology_fundamentals.toml +11 -0
- lionagi-0.9.14/lionagi/libs/token_transform/synthlang_/resources/mapping/rust_chinese_mapping.toml +37 -0
- lionagi-0.9.14/lionagi/libs/token_transform/synthlang_/resources/utility/base_synthlang_system_prompt.toml +11 -0
- lionagi-0.9.14/lionagi/libs/token_transform/synthlang_/translate_to_synthlang.py +136 -0
- lionagi-0.9.14/lionagi/libs/token_transform/types.py +15 -0
- lionagi-0.9.14/lionagi/protocols/adapters/toml_adapter.py +204 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/protocols/adapters/types.py +3 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/protocols/generic/element.py +9 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/protocols/graph/node.py +3 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/service/endpoints/token_calculator.py +8 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/service/imodel.py +14 -13
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/session/branch.py +6 -6
- lionagi-0.9.14/lionagi/tools/base.py +78 -0
- lionagi-0.9.14/lionagi/version.py +1 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/pyproject.toml +2 -1
- {lionagi-0.9.12 → lionagi-0.9.14}/uv.lock +1219 -1032
- lionagi-0.9.12/lionagi/libs/token_transform/synthlang.py +0 -415
- lionagi-0.9.12/lionagi/tools/base.py +0 -16
- lionagi-0.9.12/lionagi/version.py +0 -1
- {lionagi-0.9.12 → lionagi-0.9.14}/.env.example +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/.github/FUNDING.yml +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/.github/dependabot.yml +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/.github/workflows/ci.yml +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/.github/workflows/codeql.yml +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/.github/workflows/docs.yml +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/.github/workflows/release.yml +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/.gitignore +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/.pre-commit-config.yaml +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/CODE_OF_CONDUCT.md +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/CONTRIBUTING.md +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/LICENSE +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/README.md +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/cookbooks/ch01_get_started.md +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/cookbooks/ch02_concepts.md +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/dev_tools/count_code_base_lines.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/docs/Makefile +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/docs/_static/custom.css +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/docs/_templates/layout.html +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/docs/conf.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/docs/index.rst +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/docs/modules/action.rst +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/docs/modules/adapter.rst +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/docs/modules/branch.rst +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/docs/modules/branch_operations.rst +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/docs/modules/concepts.rst +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/docs/modules/element_id.rst +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/docs/modules/event.rst +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/docs/modules/form.rst +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/docs/modules/graph.rst +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/docs/modules/index.rst +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/docs/modules/instruct.rst +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/docs/modules/lib_file.rst +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/docs/modules/lib_nested.rst +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/docs/modules/lib_package.rst +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/docs/modules/lib_schema.rst +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/docs/modules/lib_validate.rst +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/docs/modules/log.rst +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/docs/modules/mail.rst +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/docs/modules/message.rst +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/docs/modules/models.rst +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/docs/modules/operative_step.rst +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/docs/modules/pile.rst +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/docs/modules/processor.rst +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/docs/modules/progression.rst +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/docs/modules/service.rst +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/docs/modules/session.rst +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/docs/modules/utils.rst +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/docs/tutorials/get_started.rst +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/docs/tutorials/get_started_pt2.rst +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/docs/tutorials/get_started_pt3.rst +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/docs/tutorials/index.rst +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/__init__.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/_class_registry.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/_errors.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/_types.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/libs/__init__.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/libs/file/__init__.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/libs/file/file_ops.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/libs/file/params.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/libs/file/process.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/libs/file/save.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/libs/nested/__init__.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/libs/nested/flatten.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/libs/nested/nfilter.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/libs/nested/nget.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/libs/nested/ninsert.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/libs/nested/nmerge.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/libs/nested/npop.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/libs/nested/nset.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/libs/nested/unflatten.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/libs/nested/utils.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/libs/package/__init__.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/libs/package/imports.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/libs/package/management.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/libs/package/params.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/libs/package/system.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/libs/parse.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/libs/schema/__init__.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/libs/schema/as_readable.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/libs/schema/extract_code_block.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/libs/schema/extract_docstring.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/libs/schema/function_to_schema.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/libs/schema/json_schema.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/libs/token_transform/__init__.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/libs/token_transform/llmlingua.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/libs/validate/__init__.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/libs/validate/common_field_validators.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/libs/validate/fuzzy_match_keys.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/libs/validate/fuzzy_validate_mapping.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/libs/validate/string_similarity.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/libs/validate/validate_boolean.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/operations/ReAct/ReAct.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/operations/ReAct/__init__.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/operations/ReAct/utils.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/operations/__init__.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/operations/_act/__init__.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/operations/_act/act.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/operations/brainstorm/__init__.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/operations/brainstorm/brainstorm.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/operations/brainstorm/prompt.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/operations/chat/__init__.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/operations/chat/chat.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/operations/communicate/__init__.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/operations/communicate/communicate.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/operations/instruct/__init__.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/operations/instruct/instruct.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/operations/interpret/__init__.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/operations/interpret/interpret.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/operations/manager.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/operations/operate/__init__.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/operations/operate/operate.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/operations/parse/__init__.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/operations/parse/parse.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/operations/plan/__init__.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/operations/plan/plan.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/operations/plan/prompt.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/operations/select/__init__.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/operations/select/select.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/operations/select/utils.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/operations/translate/__init__.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/operations/translate/translate.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/operations/types.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/operations/utils.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/operatives/__init__.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/operatives/action/__init__.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/operatives/action/function_calling.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/operatives/action/manager.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/operatives/action/request_response_model.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/operatives/action/tool.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/operatives/action/utils.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/operatives/forms/__init__.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/operatives/forms/base.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/operatives/forms/flow.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/operatives/forms/form.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/operatives/forms/report.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/operatives/instruct/__init__.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/operatives/instruct/base.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/operatives/instruct/instruct.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/operatives/instruct/instruct_collection.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/operatives/instruct/node.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/operatives/instruct/prompts.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/operatives/instruct/reason.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/operatives/manager.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/operatives/models/__init__.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/operatives/models/field_model.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/operatives/models/model_params.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/operatives/models/note.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/operatives/models/operable_model.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/operatives/models/schema_model.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/operatives/operative.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/operatives/step.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/operatives/strategies/__init__.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/operatives/strategies/base.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/operatives/strategies/concurrent.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/operatives/strategies/concurrent_chunk.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/operatives/strategies/concurrent_sequential_chunk.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/operatives/strategies/params.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/operatives/strategies/sequential.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/operatives/strategies/sequential_chunk.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/operatives/strategies/sequential_concurrent_chunk.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/operatives/strategies/utils.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/operatives/types.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/protocols/__init__.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/protocols/_concepts.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/protocols/adapters/__init__.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/protocols/adapters/adapter.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/protocols/adapters/json_adapter.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/protocols/adapters/pandas_/__init__.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/protocols/adapters/pandas_/csv_adapter.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/protocols/adapters/pandas_/excel_adapter.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/protocols/adapters/pandas_/pd_dataframe_adapter.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/protocols/adapters/pandas_/pd_series_adapter.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/protocols/generic/__init__.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/protocols/generic/event.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/protocols/generic/log.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/protocols/generic/pile.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/protocols/generic/processor.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/protocols/generic/progression.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/protocols/graph/__init__.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/protocols/graph/edge.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/protocols/graph/graph.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/protocols/mail/__init__.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/protocols/mail/exchange.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/protocols/mail/mail.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/protocols/mail/mailbox.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/protocols/mail/manager.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/protocols/mail/package.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/protocols/messages/__init__.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/protocols/messages/action_request.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/protocols/messages/action_response.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/protocols/messages/assistant_response.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/protocols/messages/base.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/protocols/messages/instruction.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/protocols/messages/manager.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/protocols/messages/message.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/protocols/messages/system.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/protocols/messages/templates/README.md +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/protocols/messages/templates/action_request.jinja2 +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/protocols/messages/templates/action_response.jinja2 +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/protocols/messages/templates/assistant_response.jinja2 +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/protocols/messages/templates/instruction_message.jinja2 +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/protocols/messages/templates/system_message.jinja2 +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/protocols/messages/templates/tool_schemas.jinja2 +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/protocols/types.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/service/__init__.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/service/endpoints/__init__.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/service/endpoints/base.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/service/endpoints/chat_completion.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/service/endpoints/match_endpoint.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/service/endpoints/rate_limited_processor.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/service/manager.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/service/providers/__init__.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/service/providers/anthropic_/__init__.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/service/providers/anthropic_/messages.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/service/providers/exa_/__init__.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/service/providers/exa_/models.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/service/providers/exa_/search.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/service/providers/exa_/types.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/service/providers/groq_/__init__.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/service/providers/groq_/chat_completions.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/service/providers/ollama_/__init__.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/service/providers/ollama_/chat_completions.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/service/providers/openai_/__init__.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/service/providers/openai_/chat_completions.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/service/providers/openai_/spec.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/service/providers/openrouter_/__init__.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/service/providers/openrouter_/chat_completions.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/service/providers/perplexity_/__init__.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/service/providers/perplexity_/chat_completions.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/service/providers/perplexity_/models.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/service/providers/types.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/service/types.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/session/__init__.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/session/prompts.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/session/session.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/settings.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/tools/__init__.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/tools/browser/__init__.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/tools/browser/providers/__init__.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/tools/browser/providers/browser_use_.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/tools/code/__init__.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/tools/code/coder.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/tools/code/manager.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/tools/code/providers/__init__.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/tools/code/providers/aider_.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/tools/code/providers/e2b_.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/tools/code/sandbox.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/tools/file/__init__.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/tools/file/manager.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/tools/file/providers/__init__.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/tools/file/providers/docling_.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/tools/file/reader.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/tools/file/writer.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/tools/query/__init__.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/tools/types.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/lionagi/utils.py +0 -0
- {lionagi-0.9.12 → lionagi-0.9.14}/prompts/doc_style.md +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: lionagi
|
3
|
-
Version: 0.9.
|
3
|
+
Version: 0.9.14
|
4
4
|
Summary: An Intelligence Operating System.
|
5
5
|
Author-email: HaiyangLi <quantocean.li@gmail.com>
|
6
6
|
License: Apache License
|
@@ -227,6 +227,7 @@ 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
|
Requires-Dist: tiktoken>=0.8.0
|
230
|
+
Requires-Dist: toml>=0.9.0
|
230
231
|
Provides-Extra: llms
|
231
232
|
Requires-Dist: litellm>=1.59.5; extra == 'llms'
|
232
233
|
Provides-Extra: ollama
|
@@ -216,7 +216,7 @@ def chunk_content(
|
|
216
216
|
chunk_size: int = 1024,
|
217
217
|
overlap: float = 0,
|
218
218
|
threshold: int = 256,
|
219
|
-
metadata: dict[str, Any] =
|
219
|
+
metadata: dict[str, Any] = None,
|
220
220
|
return_tokens: bool = False,
|
221
221
|
as_node: bool = False,
|
222
222
|
**kwargs: Any,
|
@@ -268,7 +268,7 @@ def chunk_content(
|
|
268
268
|
"chunk_id": i + 1,
|
269
269
|
"total_chunks": len(chunks),
|
270
270
|
"chunk_size": len(chunk),
|
271
|
-
**metadata,
|
271
|
+
**(metadata or {}),
|
272
272
|
},
|
273
273
|
)
|
274
274
|
for i, chunk in enumerate(chunks)
|
@@ -280,7 +280,7 @@ def chunk_content(
|
|
280
280
|
"chunk_id": i + 1,
|
281
281
|
"total_chunks": len(chunks),
|
282
282
|
"chunk_size": len(chunk),
|
283
|
-
**metadata,
|
283
|
+
**(metadata or {}),
|
284
284
|
}
|
285
285
|
for i, chunk in enumerate(chunks)
|
286
286
|
]
|
@@ -0,0 +1,52 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
from enum import Enum
|
4
|
+
from pathlib import Path
|
5
|
+
|
6
|
+
from pydantic import Field
|
7
|
+
|
8
|
+
from lionagi.tools.base import Resource, ResourceCategory
|
9
|
+
|
10
|
+
here = Path(__file__).parent.resolve()
|
11
|
+
MAPPING_PATH = "synthlang_/resources/mapping"
|
12
|
+
|
13
|
+
|
14
|
+
class TokenMappingTemplate(str, Enum):
|
15
|
+
RUST_CHINESE = "rust_chinese"
|
16
|
+
|
17
|
+
@property
|
18
|
+
def fp(self) -> Path:
|
19
|
+
return here / MAPPING_PATH / f"{self.value}_mapping.toml"
|
20
|
+
|
21
|
+
|
22
|
+
class TokenMapping(Resource):
|
23
|
+
category: ResourceCategory = Field(
|
24
|
+
default=ResourceCategory.UTILITY, frozen=True
|
25
|
+
)
|
26
|
+
content: dict
|
27
|
+
|
28
|
+
@classmethod
|
29
|
+
def load_from_template(
|
30
|
+
cls, template: TokenMappingTemplate | str
|
31
|
+
) -> TokenMapping:
|
32
|
+
if isinstance(template, str):
|
33
|
+
template = template.lower().strip()
|
34
|
+
template = (
|
35
|
+
template.replace(".toml", "")
|
36
|
+
.replace(" ", "_")
|
37
|
+
.replace("-", "_")
|
38
|
+
.strip()
|
39
|
+
)
|
40
|
+
if template.endswith("_mapping"):
|
41
|
+
template = template[:-8]
|
42
|
+
if "/" in template:
|
43
|
+
template = template.split("/")[-1]
|
44
|
+
template = TokenMappingTemplate(template)
|
45
|
+
|
46
|
+
if isinstance(template, TokenMappingTemplate):
|
47
|
+
template = template.fp
|
48
|
+
return cls.adapt_from(template, ".toml", many=False)
|
49
|
+
|
50
|
+
raise ValueError(
|
51
|
+
f"Invalid template: {template}. Must be a TokenMappingTemplate or a valid path."
|
52
|
+
)
|
@@ -101,7 +101,7 @@ async def compute_perplexity(
|
|
101
101
|
chat_model: iModel,
|
102
102
|
initial_context: str = None,
|
103
103
|
tokens: list[str] = None,
|
104
|
-
|
104
|
+
system: str = None,
|
105
105
|
n_samples: int = 1,
|
106
106
|
use_residue: bool = True,
|
107
107
|
**kwargs,
|
@@ -142,9 +142,9 @@ async def compute_perplexity(
|
|
142
142
|
api_calls = []
|
143
143
|
for sample_txt in sampless:
|
144
144
|
messages = []
|
145
|
-
if
|
145
|
+
if system:
|
146
146
|
if not chat_model.sequential_exchange:
|
147
|
-
messages.append({"role": "system", "content":
|
147
|
+
messages.append({"role": "system", "content": system})
|
148
148
|
messages.append({"role": "user", "content": sample_txt})
|
149
149
|
else:
|
150
150
|
messages.append({"role": "user", "content": sample_txt})
|
@@ -171,10 +171,10 @@ class LLMCompressor:
|
|
171
171
|
def __init__(
|
172
172
|
self,
|
173
173
|
chat_model: iModel,
|
174
|
-
|
174
|
+
system=None,
|
175
175
|
tokenizer=None,
|
176
176
|
splitter=None,
|
177
|
-
|
177
|
+
compression_ratio=0.2,
|
178
178
|
n_samples=5,
|
179
179
|
chunk_size=64,
|
180
180
|
max_tokens_per_sample=80,
|
@@ -193,10 +193,8 @@ class LLMCompressor:
|
|
193
193
|
self.chat_model = chat_model
|
194
194
|
self.tokenizer = tokenizer
|
195
195
|
self.splitter = splitter
|
196
|
-
self.
|
197
|
-
|
198
|
-
)
|
199
|
-
self.target_ratio = target_ratio
|
196
|
+
self.system = system or "Concisely summarize content for storage:"
|
197
|
+
self.compression_ratio = compression_ratio
|
200
198
|
self.n_samples = n_samples
|
201
199
|
self.chunk_size = chunk_size
|
202
200
|
self.max_tokens_per_sample = max_tokens_per_sample
|
@@ -281,7 +279,7 @@ class LLMCompressor:
|
|
281
279
|
initial_context=initial_text,
|
282
280
|
tokens=item_toks,
|
283
281
|
n_samples=n_samples or self.n_samples,
|
284
|
-
|
282
|
+
system=self.system,
|
285
283
|
use_residue=use_residue,
|
286
284
|
**kwargs,
|
287
285
|
)
|
@@ -347,6 +345,7 @@ class LLMCompressor:
|
|
347
345
|
# Tokenize once to get total length
|
348
346
|
all_tokens = self.tokenize(text)
|
349
347
|
original_len = len(all_tokens)
|
348
|
+
ttl_chars = len(text)
|
350
349
|
|
351
350
|
# Split text
|
352
351
|
items = self.split(text, **split_kwargs)
|
@@ -363,26 +362,26 @@ class LLMCompressor:
|
|
363
362
|
# Select
|
364
363
|
selected = self.select_by_pplex(
|
365
364
|
ranked_items=ranked,
|
366
|
-
target_compression_ratio=compression_ratio
|
365
|
+
target_compression_ratio=compression_ratio
|
366
|
+
or self.compression_ratio,
|
367
367
|
original_length=original_len,
|
368
368
|
min_pplx=min_pplx or self.min_pplx,
|
369
369
|
)
|
370
370
|
|
371
|
-
if self.verbose:
|
372
|
-
compressed_len = sum(
|
373
|
-
len(to_list(self.tokenize(x), dropna=True, flatten=True))
|
374
|
-
for x in selected
|
375
|
-
)
|
376
|
-
ratio = compressed_len / original_len if original_len else 1
|
377
|
-
print(
|
378
|
-
f"Original tokens: {original_len}\n"
|
379
|
-
f"Selected tokens: {compressed_len}\n"
|
380
|
-
f"Compression ratio: {ratio:.3f}\n"
|
381
|
-
f"Time: {timer() - start:.3f}s\n"
|
382
|
-
)
|
383
|
-
|
384
371
|
# Join final
|
385
372
|
out_str = " ".join(selected)
|
373
|
+
|
374
|
+
if self.verbose:
|
375
|
+
compressed_chars = len(out_str)
|
376
|
+
ratio = compressed_chars / ttl_chars if original_len else 1
|
377
|
+
msg = "------------------------------------------\n"
|
378
|
+
msg += f"Compression Method: Perplexity\n"
|
379
|
+
msg += f"Compressed Characters number: {compressed_chars}\n"
|
380
|
+
msg += f"Character Compression Ratio: {ratio:.1%}\n"
|
381
|
+
msg += f"Compression Time: {timer() - start:.3f}s\n"
|
382
|
+
msg += f"Compression Model: {self.chat_model.model_name}\n"
|
383
|
+
print(msg)
|
384
|
+
|
386
385
|
return out_str.strip()
|
387
386
|
|
388
387
|
def select_by_pplex(
|
@@ -419,21 +418,34 @@ class LLMCompressor:
|
|
419
418
|
async def compress_text(
|
420
419
|
text: str,
|
421
420
|
chat_model: iModel,
|
422
|
-
|
423
|
-
|
421
|
+
system: str = None,
|
422
|
+
compression_ratio: float = 0.2,
|
424
423
|
n_samples: int = 5,
|
425
424
|
max_tokens_per_sample=80,
|
426
425
|
verbose=True,
|
426
|
+
initial_text=None,
|
427
|
+
cumulative=False,
|
428
|
+
split_kwargs=None,
|
429
|
+
min_pplx=None,
|
430
|
+
**kwargs,
|
427
431
|
) -> str:
|
428
432
|
"""
|
429
433
|
Convenience function that instantiates LLMCompressor and compresses text.
|
430
434
|
"""
|
431
435
|
compressor = LLMCompressor(
|
432
436
|
chat_model=chat_model,
|
433
|
-
|
434
|
-
|
437
|
+
system=system,
|
438
|
+
compression_ratio=compression_ratio,
|
435
439
|
n_samples=n_samples,
|
436
440
|
max_tokens_per_sample=max_tokens_per_sample,
|
437
441
|
verbose=verbose,
|
438
442
|
)
|
439
|
-
return await compressor.compress(
|
443
|
+
return await compressor.compress(
|
444
|
+
text,
|
445
|
+
compression_ratio=compression_ratio,
|
446
|
+
initial_text=initial_text,
|
447
|
+
cumulative=cumulative,
|
448
|
+
split_kwargs=split_kwargs,
|
449
|
+
min_pplx=min_pplx,
|
450
|
+
**kwargs,
|
451
|
+
)
|
@@ -0,0 +1,138 @@
|
|
1
|
+
from collections.abc import Callable
|
2
|
+
from pathlib import Path
|
3
|
+
from typing import Literal
|
4
|
+
|
5
|
+
from lionagi.service.imodel import iModel
|
6
|
+
from lionagi.session.branch import Branch
|
7
|
+
from lionagi.utils import alcall
|
8
|
+
|
9
|
+
from .base import TokenMapping, TokenMappingTemplate
|
10
|
+
from .synthlang_.base import SynthlangFramework, SynthlangTemplate
|
11
|
+
|
12
|
+
FRAMEWORK_OPTIONS = SynthlangFramework.load_framework_options()
|
13
|
+
FRAMEWORK_CHOICES = Literal["math", "optim", "custom_algebra"]
|
14
|
+
|
15
|
+
|
16
|
+
async def symbolic_compress_context(
|
17
|
+
*,
|
18
|
+
text: str = None,
|
19
|
+
url_or_path: str | Path = None,
|
20
|
+
chunk_by="tokens",
|
21
|
+
chunk_size: int = 1000,
|
22
|
+
chunk_tokenizer: Callable = str.split,
|
23
|
+
threshold=50,
|
24
|
+
output_path: Path | str = None,
|
25
|
+
overlap=0.05,
|
26
|
+
system: str = None,
|
27
|
+
chat_model: iModel = None,
|
28
|
+
use_lion_system_message: bool = True,
|
29
|
+
max_concurrent=10,
|
30
|
+
throttle_period=1,
|
31
|
+
framework: Literal["synthlang"] = "synthlang",
|
32
|
+
framework_template: (
|
33
|
+
SynthlangTemplate | SynthlangFramework
|
34
|
+
) = SynthlangTemplate.REFLECTIVE_PATTERNS,
|
35
|
+
framework_options: list[FRAMEWORK_CHOICES] = None,
|
36
|
+
compress: bool = False,
|
37
|
+
compress_model: iModel = None,
|
38
|
+
compression_ratio: float = 0.2,
|
39
|
+
compress_initial_text=None,
|
40
|
+
compress_cumulative=False,
|
41
|
+
compress_split_kwargs=None,
|
42
|
+
compress_min_pplx=None,
|
43
|
+
encode_token_map: TokenMappingTemplate | dict | TokenMapping = None,
|
44
|
+
num_encodings: int = 3,
|
45
|
+
encode_output: bool = False,
|
46
|
+
num_output_encodings: int = None,
|
47
|
+
verbose: bool = True,
|
48
|
+
branch: Branch = None,
|
49
|
+
additional_text: str = "",
|
50
|
+
**kwargs,
|
51
|
+
):
|
52
|
+
if framework != "synthlang":
|
53
|
+
raise ValueError(f"Unsupported framework: {framework}")
|
54
|
+
|
55
|
+
if not text and not url_or_path:
|
56
|
+
raise ValueError("Either text or url_or_path must be provided.")
|
57
|
+
|
58
|
+
if text and url_or_path:
|
59
|
+
raise ValueError("Only one of text or url_or_path should be provided.")
|
60
|
+
|
61
|
+
from .synthlang_.translate_to_synthlang import translate_to_synthlang
|
62
|
+
|
63
|
+
async def _inner(text: str):
|
64
|
+
b_ = None
|
65
|
+
if branch:
|
66
|
+
b_ = await branch.aclone()
|
67
|
+
else:
|
68
|
+
b_ = Branch(
|
69
|
+
system=system,
|
70
|
+
use_lion_system_message=use_lion_system_message,
|
71
|
+
chat_model=chat_model,
|
72
|
+
)
|
73
|
+
|
74
|
+
return await translate_to_synthlang(
|
75
|
+
text,
|
76
|
+
branch=b_,
|
77
|
+
framework_template=framework_template,
|
78
|
+
framework_options=framework_options,
|
79
|
+
compress=compress,
|
80
|
+
compress_model=compress_model,
|
81
|
+
compression_ratio=compression_ratio,
|
82
|
+
compress_kwargs={
|
83
|
+
"initial_text": compress_initial_text,
|
84
|
+
"cumulative": compress_cumulative,
|
85
|
+
"split_kwargs": compress_split_kwargs,
|
86
|
+
"min_pplx": compress_min_pplx,
|
87
|
+
},
|
88
|
+
encode_token_map=encode_token_map,
|
89
|
+
num_encodings=num_encodings,
|
90
|
+
encode_output=encode_output,
|
91
|
+
num_output_encodings=num_output_encodings,
|
92
|
+
verbose=verbose,
|
93
|
+
additional_text=additional_text,
|
94
|
+
**kwargs,
|
95
|
+
)
|
96
|
+
|
97
|
+
from lionagi.libs.file.process import chunk, chunk_content
|
98
|
+
|
99
|
+
texts = []
|
100
|
+
if url_or_path:
|
101
|
+
chunks = chunk(
|
102
|
+
url_or_path=url_or_path,
|
103
|
+
chunk_by=chunk_by,
|
104
|
+
chunk_size=chunk_size,
|
105
|
+
overlap=overlap,
|
106
|
+
threshold=threshold,
|
107
|
+
)
|
108
|
+
texts = [i.content for i in chunks if i.content]
|
109
|
+
|
110
|
+
elif text:
|
111
|
+
texts = chunk_content(
|
112
|
+
text=text,
|
113
|
+
chunk_by=chunk_by,
|
114
|
+
chunk_size=chunk_size,
|
115
|
+
overlap=overlap,
|
116
|
+
threshold=threshold,
|
117
|
+
tokenizer=chunk_tokenizer,
|
118
|
+
)
|
119
|
+
|
120
|
+
results = await alcall(
|
121
|
+
texts,
|
122
|
+
_inner,
|
123
|
+
max_concurrent=max_concurrent,
|
124
|
+
retry_default=None,
|
125
|
+
throttle_period=throttle_period,
|
126
|
+
flatten=True,
|
127
|
+
dropna=True,
|
128
|
+
)
|
129
|
+
text = "\n".join(results)
|
130
|
+
|
131
|
+
if output_path:
|
132
|
+
fp = Path(output_path)
|
133
|
+
fp.write_text(text)
|
134
|
+
if verbose:
|
135
|
+
print(f"Results of {len(text)} characters saved to: {fp}")
|
136
|
+
|
137
|
+
return fp
|
138
|
+
return text
|
@@ -0,0 +1,130 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
from enum import Enum
|
4
|
+
from pathlib import Path
|
5
|
+
from typing import Literal
|
6
|
+
|
7
|
+
from pydantic import Field
|
8
|
+
|
9
|
+
from lionagi.tools.base import Prompt, Resource, ResourceCategory
|
10
|
+
|
11
|
+
here = Path(__file__).parent.resolve()
|
12
|
+
|
13
|
+
FRAMEWORK_PATH = "resources/frameworks"
|
14
|
+
FRAMEWORK_CHOICES = Literal["math", "optim", "custom_algebra"]
|
15
|
+
|
16
|
+
|
17
|
+
__all__ = (
|
18
|
+
"SynthlangFramework",
|
19
|
+
"SynthlangTemplate",
|
20
|
+
)
|
21
|
+
|
22
|
+
|
23
|
+
class SynthlangFramework(Resource):
|
24
|
+
|
25
|
+
category: ResourceCategory = Field(
|
26
|
+
default=ResourceCategory.FRAMEWORK, frozen=True
|
27
|
+
)
|
28
|
+
|
29
|
+
@classmethod
|
30
|
+
def load_framework_options(cls) -> dict:
|
31
|
+
import json
|
32
|
+
|
33
|
+
fp = here / FRAMEWORK_PATH / "framework_options.json"
|
34
|
+
with open(fp, "r", encoding="utf-8") as f:
|
35
|
+
return json.load(f)
|
36
|
+
|
37
|
+
@classmethod
|
38
|
+
def load_from_template(
|
39
|
+
cls, template: SynthlangTemplate | str
|
40
|
+
) -> SynthlangFramework:
|
41
|
+
return SynthlangTemplate.load(template)
|
42
|
+
|
43
|
+
@classmethod
|
44
|
+
def load_base_system_prompt(cls) -> Prompt:
|
45
|
+
fp = here / "resources/utility" / "base_synthlang_system_prompt.toml"
|
46
|
+
return SynthlangFramework.adapt_from(fp, ".toml", many=False)
|
47
|
+
|
48
|
+
@classmethod
|
49
|
+
def build_framework_text(
|
50
|
+
cls, framework_options: list[FRAMEWORK_CHOICES] = None
|
51
|
+
) -> str:
|
52
|
+
FRAMEWORK_OPTIONS = cls.load_framework_options()
|
53
|
+
lines = []
|
54
|
+
if not framework_options:
|
55
|
+
framework_options = FRAMEWORK_OPTIONS["options"].keys()
|
56
|
+
|
57
|
+
for fw_key in framework_options:
|
58
|
+
fw = FRAMEWORK_OPTIONS.get(fw_key, None)
|
59
|
+
if fw:
|
60
|
+
print(fw)
|
61
|
+
lines.append(f"{fw['name']}: {fw['description']}")
|
62
|
+
lines.append("Glyphs:")
|
63
|
+
for g in fw["glyphs"]:
|
64
|
+
lines.append(
|
65
|
+
f" {g['symbol']} -> {g['name']} ({g['description']})"
|
66
|
+
)
|
67
|
+
lines.append("")
|
68
|
+
return "\n".join(lines).strip()
|
69
|
+
|
70
|
+
def create_system_prompt(
|
71
|
+
self,
|
72
|
+
framework_options: list[FRAMEWORK_CHOICES] = None,
|
73
|
+
additional_text: str = "",
|
74
|
+
) -> str:
|
75
|
+
|
76
|
+
framework_options_text = self.build_framework_text(framework_options)
|
77
|
+
base_prompt = self.load_base_system_prompt()
|
78
|
+
template_details = (
|
79
|
+
f"Title: {self.meta_obj.title}\n"
|
80
|
+
f"Domain: {str(self.meta_obj.domain)}\n"
|
81
|
+
f"Category: {str(self.category)}\n"
|
82
|
+
f"Overview: {self.meta_obj.overview}\n"
|
83
|
+
"Excerpt:\n"
|
84
|
+
f"{self.content}\n"
|
85
|
+
)
|
86
|
+
prompt = (
|
87
|
+
f"{base_prompt.content}\n\n"
|
88
|
+
"[Active Frameworks]\n"
|
89
|
+
f"{framework_options_text}\n\n"
|
90
|
+
"[Template]\n"
|
91
|
+
f"{template_details}\n"
|
92
|
+
)
|
93
|
+
if additional_text.strip():
|
94
|
+
prompt += f"\n[Additional]\n{additional_text.strip()}\n"
|
95
|
+
|
96
|
+
return prompt.strip()
|
97
|
+
|
98
|
+
|
99
|
+
class SynthlangTemplate(str, Enum):
|
100
|
+
ABSTRACT_ALGEBRA = "abstract_algebra"
|
101
|
+
CATEGORY_THEORY = "category_theory"
|
102
|
+
COMPLEX_ANALYSIS = "complex_analysis"
|
103
|
+
GROUP_THEORY = "group_theory"
|
104
|
+
MATH_LOGIC = "math_logic"
|
105
|
+
REFLECTIVE_PATTERNS = "reflective_patterns"
|
106
|
+
SET_THEORY = "set_theory"
|
107
|
+
TOPOLOGY_FUNDAMENTALS = "topology_fundamentals"
|
108
|
+
|
109
|
+
@property
|
110
|
+
def fp(self) -> Path:
|
111
|
+
return here / FRAMEWORK_PATH / f"{self.value}.toml"
|
112
|
+
|
113
|
+
@classmethod
|
114
|
+
def list_templates(cls) -> list[str]:
|
115
|
+
return [template.value for template in cls]
|
116
|
+
|
117
|
+
@classmethod
|
118
|
+
def load(cls, framework: str) -> SynthlangFramework:
|
119
|
+
framework = str(framework).strip().lower()
|
120
|
+
framework = framework.replace(" ", "_").replace("-", "_")
|
121
|
+
if ".toml" in framework:
|
122
|
+
framework = framework.replace(".toml", "").strip()
|
123
|
+
if "synthlangtemplate." in framework:
|
124
|
+
framework = framework.replace("synthlangtemplate.", "").strip()
|
125
|
+
try:
|
126
|
+
framework = cls(framework)
|
127
|
+
except ValueError:
|
128
|
+
raise ValueError(f"Invalid synthlang framework name: {framework}")
|
129
|
+
|
130
|
+
return SynthlangFramework.adapt_from(framework.fp, ".toml", many=False)
|
lionagi-0.9.14/lionagi/libs/token_transform/synthlang_/resources/frameworks/abstract_algebra.toml
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
id = "11968433-1402-4783-b167-25afbe0a6c4f"
|
2
|
+
created_at = 1740606622.114634
|
3
|
+
content = "\n## Group Actions\n`G × X → X`\n\n### Reflective Pattern\n↹ transformations•symmetries•invariants\n⊕ identify => patterns\n⊕ analyze => operations\n⊕ preserve => structure\nΣ systematic•approach + invariant•properties\n\n### Example Prompt\n\"What patterns remain constant as we apply different transformations to our approach?\"\n\n## Ring Structure\n`(R, +, ×)`\n\n### Reflective Pattern\n↹ operations•interactions•composition\n⊕ combine => methods\n⊕ distribute => resources\n⊕ verify => closure\nΣ integrated•framework + operational•rules\n"
|
4
|
+
category = "framework"
|
5
|
+
|
6
|
+
[metadata]
|
7
|
+
title = "Abstract Algebra Reflective Symbolic Compression"
|
8
|
+
domain = "Symbolic Compression"
|
9
|
+
version = "1.0"
|
10
|
+
overview = "A resource for learning and exploring abstract algebra concepts."
|
11
|
+
lion_class = "lionagi.libs.token_transform.synthlang_.base.SynthlangFramework"
|
lionagi-0.9.14/lionagi/libs/token_transform/synthlang_/resources/frameworks/category_theory.toml
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
id = "b8588217-3da0-4809-8a8e-1bc9489a718a"
|
2
|
+
created_at = 1740606718.863813
|
3
|
+
content = "\n# Category Theory Reflective Prompts\n\n## Functors\n`F: C → D`\n\n### Reflective Pattern\n↹ domain•codomain•mapping\n⊕ preserve => structure\n⊕ transform => concepts\n⊕ maintain => relationships\nΣ transformed•insight + preserved•properties\n\n### Example Prompt\n\"How can we translate this solution from one context to another while preserving its essential properties?\"\n\n## Natural Transformations\n`η: F ⇒ G`\n\n### Reflective Pattern\n↹ approaches•methods•transitions\n⊕ compare => strategies\n⊕ identify => transformations\n⊕ validate => coherence\nΣ systematic•evolution + consistency•check\n"
|
4
|
+
category = "framework"
|
5
|
+
|
6
|
+
[metadata]
|
7
|
+
title = "Category Theory Concepts Symbolic Compression"
|
8
|
+
domain = "Symbolic Compression"
|
9
|
+
version = "1.0"
|
10
|
+
overview = "Abstract mathematical framework dealing with mathematical structures and relationships between them."
|
11
|
+
lion_class = "lionagi.libs.token_transform.synthlang_.base.SynthlangFramework"
|
lionagi-0.9.14/lionagi/libs/token_transform/synthlang_/resources/frameworks/complex_analysis.toml
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
id = "f7ea039c-829b-453c-a562-85e8e66df2b0"
|
2
|
+
created_at = 1740602435.49488
|
3
|
+
content = "\n# Complex Analysis Reflective Prompts\n\n## Residue Theorem\n`∮_C f(z)dz = 2πi ∑Res(f,ak)`\n\n### Reflective Pattern\n↹ local•global•interactions\n⊕ analyze => singularities\n⊕ integrate => effects\n⊕ synthesize => global•view\nΣ comprehensive•understanding + local•insights\n\n### Example Prompt\n\"How do local decisions and singular points in our approach contribute to the overall solution?\"\n\n## Analytic Continuation\n`f(z)` extends uniquely\n\n### Reflective Pattern\n↹ partial•solution•constraints\n⊕ extend => domain\n⊕ preserve => consistency\n⊕ validate => uniqueness\nΣ complete•solution + coherence•check\n"
|
4
|
+
category = "framework"
|
5
|
+
|
6
|
+
[metadata]
|
7
|
+
title = "Complex Analysis Foundations"
|
8
|
+
domain = "Symbolic Compression"
|
9
|
+
version = "1.0"
|
10
|
+
overview = "Advanced study of complex functions, including integration and residue theory."
|
11
|
+
lion_class = "lionagi.libs.token_transform.synthlang_.base.SynthlangFramework"
|
lionagi-0.9.14/lionagi/libs/token_transform/synthlang_/resources/frameworks/framework_options.json
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
{
|
2
|
+
"options": {
|
3
|
+
"math": {
|
4
|
+
"name": "Mathematical Framework",
|
5
|
+
"description": "Offers a suite of math glyphs and notation rules.",
|
6
|
+
"glyphs": [
|
7
|
+
{
|
8
|
+
"symbol": "\u21b9",
|
9
|
+
"name": "Focus/Filter",
|
10
|
+
"description": "Used for focusing instructions"
|
11
|
+
},
|
12
|
+
{
|
13
|
+
"symbol": "\u03a3",
|
14
|
+
"name": "Summarize",
|
15
|
+
"description": "Condense large sets of data"
|
16
|
+
},
|
17
|
+
{
|
18
|
+
"symbol": "\u2295",
|
19
|
+
"name": "Combine/Merge",
|
20
|
+
"description": "Merge multiple data sources"
|
21
|
+
},
|
22
|
+
{
|
23
|
+
"symbol": "\u2022",
|
24
|
+
"name": "Group Operation",
|
25
|
+
"description": "Binary operation in group theory"
|
26
|
+
}
|
27
|
+
]
|
28
|
+
},
|
29
|
+
"optim": {
|
30
|
+
"name": "Optimization Framework",
|
31
|
+
"description": "Compression and optimization for code/math expressions.",
|
32
|
+
"glyphs": [
|
33
|
+
{
|
34
|
+
"symbol": "IF",
|
35
|
+
"name": "Conditional Operator",
|
36
|
+
"description": "Represents branching logic"
|
37
|
+
}
|
38
|
+
]
|
39
|
+
},
|
40
|
+
"custom_algebra": {
|
41
|
+
"name": "Custom Algebraic Framework",
|
42
|
+
"description": "Extra rules for ring, group, field expansions.",
|
43
|
+
"glyphs": [
|
44
|
+
{
|
45
|
+
"symbol": "\u221e",
|
46
|
+
"name": "Infinite Operator",
|
47
|
+
"description": "Represents unbounded algebraic ops"
|
48
|
+
}
|
49
|
+
]
|
50
|
+
}
|
51
|
+
}
|
52
|
+
}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
id = "c077186b-30cd-42d9-88ae-563859a00db3"
|
2
|
+
created_at = 1740602288.669331
|
3
|
+
content = "# Structures\nLet G be a group with operation •\nLet H be a subgroup of G\nLet N be a normal subgroup of G\n\n# Properties\nP(x): \"x is a homomorphism\"\nQ(x): \"x preserves group structure\"\nR(x): \"x maps to kernel\"\n\n# Objectives\n1. Prove fundamental homomorphism theorem\n2. Show group action properties\n3. Analyze quotient groups\n"
|
4
|
+
category = "framework"
|
5
|
+
|
6
|
+
[metadata]
|
7
|
+
title = "Group Theory Analysis"
|
8
|
+
domain = "Symbolic Compression"
|
9
|
+
version = "1.0"
|
10
|
+
overview = "Investigation of algebraic structures using group theory and ring theory."
|
11
|
+
lion_class = "lionagi.libs.token_transform.synthlang_.base.SynthlangFramework"
|
@@ -0,0 +1,11 @@
|
|
1
|
+
id = "bc244d9c-3fcc-4e7c-9a13-d0e208904c22"
|
2
|
+
created_at = 1740602490.430191
|
3
|
+
content = "\n# Sets and Axioms\nLet A be the set of all logical propositions.\nLet T be the subset of A that are tautologies.\nLet C be the subset of A that are contradictions.\n\n# Predicates\nP(x): \"x is a well-formed formula\"\nQ(x): \"x is satisfiable\"\nR(x): \"x is valid\"\n\n# Objectives\n1. Prove completeness theorem using predicate calculus\n2. Demonstrate soundness of the system\n3. Show relationship between syntax and semantics\n\n# Complex Integration\n∮ f(z)dz = 2πi∑Res(f,ak)\nLet f(z) = ∑(n=0 to ∞) an(z-z₀)ⁿ\nRes(f,a) = 1/(2πi)∮ f(z)dz\nw = f(z) preserves angles\n∂u/∂x = ∂v/∂y\n∂u/∂y = -∂v/∂x\n"
|
4
|
+
category = "framework"
|
5
|
+
|
6
|
+
[metadata]
|
7
|
+
title = "Mathematical Logic Foundations"
|
8
|
+
domain = "Symbolic Compression"
|
9
|
+
version = "1.0"
|
10
|
+
overview = "Exploration of fundamental mathematical logic concepts using set theory and predicate calculus."
|
11
|
+
lion_class = "lionagi.libs.token_transform.synthlang_.base.SynthlangFramework"
|
lionagi-0.9.14/lionagi/libs/token_transform/synthlang_/resources/frameworks/reflective_patterns.toml
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
id = "8d77ef3c-50a5-45c1-a1e4-1719e4de5337"
|
2
|
+
created_at = 1740602200.381864
|
3
|
+
content = "\n\n## Pattern Structure\n- Input (↹): Context and constraints\n- Process (⊕): Transformation steps\n- Output (Σ): Results and insights\n\n## Mathematical Frameworks\n# Abstract Algebra Reflective Prompts\n\n## Group Actions\n`G × X → X`\n\n### Reflective Pattern\n↹ transformations•symmetries•invariants\n⊕ identify => patterns\n⊕ analyze => operations\n⊕ preserve => structure\nΣ systematic•approach + invariant•properties\n\n### Example Prompt\n\"What patterns remain constant as we apply different transformations to our approach?\"\n\n## Ring Structure\n`(R, +, ×)`\n\n### Reflective Pattern\n↹ operations•interactions•composition\n⊕ combine => methods\n⊕ distribute => resources\n⊕ verify => closure\nΣ integrated•framework + operational•rules\n# Category Theory Reflective Prompts\n\n## Functors\n`F: C → D`\n\n### Reflective Pattern\n↹ domain•codomain•mapping\n⊕ preserve => structure\n⊕ transform => concepts\n⊕ maintain => relationships\nΣ transformed•insight + preserved•properties\n\n### Example Prompt\n\"How can we translate this solution from one context to another while preserving its essential properties?\"\n\n## Natural Transformations\n`η: F ⇒ G`\n\n### Reflective Pattern\n↹ approaches•methods•transitions\n⊕ compare => strategies\n⊕ identify => transformations\n⊕ validate => coherence\nΣ systematic•evolution + consistency•check\n# Complex Analysis Reflective Prompts\n\n## Residue Theorem\n`∮_C f(z)dz = 2πi ∑Res(f,ak)`\n\n### Reflective Pattern\n↹ local•global•interactions\n⊕ analyze => singularities\n⊕ integrate => effects\n⊕ synthesize => global•view\nΣ comprehensive•understanding + local•insights\n\n### Example Prompt\n\"How do local decisions and singular points in our approach contribute to the overall solution?\"\n\n## Analytic Continuation\n`f(z)` extends uniquely\n\n### Reflective Pattern\n↹ partial•solution•constraints\n⊕ extend => domain\n⊕ preserve => consistency\n⊕ validate => uniqueness\nΣ complete•solution + coherence•check\n# Set Theory Reflective Prompts\n\n## Union and Intersection\n`A ∪ B` and `A ∩ B`\n\n### Reflective Pattern\n↹ problem•domains•constraints\n⊕ identify => common•elements\n⊕ analyze => unique•aspects\n⊕ synthesize => unified•solution\nΣ integrated•approach + shared•insights\n\n### Example Prompt\n\"Consider two different approaches to solving this problem. How might we combine their strengths (union) while identifying their common successful elements (intersection)?\"\n\n## Power Set\n`P(A) = {x | x ⊆ A}`\n\n### Reflective Pattern\n↹ solution•space•constraints\n⊕ enumerate => possibilities\n⊕ analyze => subsets\n⊕ evaluate => combinations\nΣ comprehensive•analysis + feasibility•matrix\n\n### Example Prompt\n\"What are all possible combinations of approaches we could take? How do these subsets of solutions interact with each other?\"\n\n## Complement\n`A' = {x ∈ U | x ∉ A}`\n\n### Reflective Pattern\n↹ current•approach•limitations\n⊕ identify => gaps\n⊕ explore => alternatives\n⊕ analyze => completeness\nΣ holistic•perspective + blind•spots\n# Topology Reflective Prompts\n\n## Continuity\n`f: X → Y` is continuous\n\n### Reflective Pattern\n↹ transitions•changes•preservation\n⊕ identify => connections\n⊕ maintain => continuity\n⊕ analyze => boundaries\nΣ smooth•transition + preserved•properties\n\n### Example Prompt\n\"How can we ensure our solution remains robust under small perturbations or changes in conditions?\"\n\n## Homeomorphism\n`f: X → Y` is bijective and bicontinuous\n\n### Reflective Pattern\n↹ transformations•equivalences•preservation\n⊕ map => structure\n⊕ preserve => properties\n⊕ verify => reversibility\nΣ equivalent•perspective + structural•insight\n\n## Application Guidelines\n\n### Pattern Selection\n1. Identify the type of reflection needed:\n - Structure preservation (Category Theory)\n - Completeness analysis (Set Theory)\n - Transformation analysis (Abstract Algebra)\n - Continuity and connection (Topology)\n - Local-global relationships (Complex Analysis)\n\n### Pattern Application\n1. Context Definition\n - Clearly specify the domain\n - Identify constraints\n - Define objectives\n\n2. Process Execution\n - Follow transformation steps\n - Maintain mathematical properties\n - Verify consistency\n\n3. Output Analysis\n - Validate results\n - Check coherence\n - Ensure completeness\n\n### Best Practices\n1. Property Preservation\n - Maintain essential structure\n - Preserve important relationships\n - Ensure consistency\n\n2. Transformation Clarity\n - Clear mapping definitions\n - Well-defined steps\n - Verifiable results\n\n3. Completeness\n - Cover all cases\n - Address edge conditions\n - Validate assumptions\n\n## Next Steps\n1. Pattern Refinement\n - Collect usage feedback\n - Refine transformations\n - Expand examples\n\n2. Framework Extension\n - Add new patterns\n - Develop combinations\n - Create variations\n\n3. Application Development\n - Create specific instances\n - Document case studies\n - Build pattern library\n"
|
4
|
+
category = "framework"
|
5
|
+
|
6
|
+
[metadata]
|
7
|
+
title = "Mathematical Reflective Patterns Analysis"
|
8
|
+
domain = "Symbolic Compression"
|
9
|
+
version = "1.0"
|
10
|
+
overview = "reflective patterns derived from fundamental mathematical concepts. Each pattern provides a structured approach to problem-solving and reflection."
|
11
|
+
lion_class = "lionagi.libs.token_transform.synthlang_.base.SynthlangFramework"
|
@@ -0,0 +1,11 @@
|
|
1
|
+
id = "518a9d70-ebb7-4f6c-aa7a-e6c8238a6671"
|
2
|
+
created_at = 1740602563.169808
|
3
|
+
content = "\n## Union and Intersection\n`A ∪ B` and `A ∩ B`\n\n### Reflective Pattern\n↹ problem•domains•constraints\n⊕ identify => common•elements\n⊕ analyze => unique•aspects\n⊕ synthesize => unified•solution\nΣ integrated•approach + shared•insights\n\n### Example Prompt\n\"Consider two different approaches to solving this problem. How might we combine their strengths (union) while identifying their common successful elements (intersection)?\"\n\n## Power Set\n`P(A) = {x | x ⊆ A}`\n\n### Reflective Pattern\n↹ solution•space•constraints\n⊕ enumerate => possibilities\n⊕ analyze => subsets\n⊕ evaluate => combinations\nΣ comprehensive•analysis + feasibility•matrix\n\n### Example Prompt\n\"What are all possible combinations of approaches we could take? How do these subsets of solutions interact with each other?\"\n\n## Complement\n`A' = {x ∈ U | x ∉ A}`\n\n### Reflective Pattern\n↹ current•approach•limitations\n⊕ identify => gaps\n⊕ explore => alternatives\n⊕ analyze => completeness\nΣ holistic•perspective + blind•spots\n"
|
4
|
+
category = "framework"
|
5
|
+
|
6
|
+
[metadata]
|
7
|
+
title = "Set Theory Reflective Analysis"
|
8
|
+
domain = "Symbolic Compression"
|
9
|
+
version = "1.0"
|
10
|
+
overview = "Exploration of fundamental set theory concepts and operations."
|
11
|
+
lion_class = "lionagi.libs.token_transform.synthlang_.base.SynthlangFramework"
|