langbot-plugin 0.4.3__tar.gz → 0.4.5__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.
- langbot_plugin-0.4.5/.github/workflows/test.yml +79 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/PKG-INFO +1 -1
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/pyproject.toml +1 -1
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/api/entities/builtin/provider/message.py +67 -1
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/api/proxies/langbot_api.py +125 -14
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/box/__init__.py +1 -1
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/box/backend.py +106 -85
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/box/e2b_backend.py +120 -81
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/box/models.py +72 -68
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/box/nsjail_backend.py +148 -128
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/box/security.py +22 -18
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/box/skill_store.py +283 -180
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/cli/__init__.py +6 -8
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/cli/i18n.py +2 -2
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/cli/run/handler.py +11 -3
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/cli/run/hotreload.py +8 -4
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/entities/io/actions/enums.py +2 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/entities/io/errors.py +3 -1
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/runtime/helper/pkgmgr.py +4 -1
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/runtime/io/controllers/stdio/client.py +3 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/runtime/io/controllers/ws/client.py +3 -1
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/runtime/io/handlers/control.py +21 -4
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/runtime/io/handlers/plugin.py +23 -6
- langbot_plugin-0.4.5/src/langbot_plugin/runtime/plugin/logbuffer.py +121 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/runtime/plugin/mgr.py +27 -4
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/tests/api/definition/components/test_components.py +12 -5
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/tests/api/entities/builtin/test_rag_models.py +8 -5
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/tests/api/entities/test_context.py +3 -1
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/tests/api/proxies/test_langbot_api.py +46 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/tests/api/proxies/test_query_based_api.py +6 -2
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/tests/box/test_backend.py +226 -208
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/tests/box/test_backend_selection.py +60 -52
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/tests/box/test_client.py +189 -191
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/tests/box/test_e2b_backend.py +164 -135
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/tests/box/test_nsjail_backend.py +207 -188
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/tests/box/test_runtime.py +187 -183
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/tests/box/test_server.py +7 -22
- langbot_plugin-0.4.5/tests/box/test_skill_store.py +952 -0
- langbot_plugin-0.4.5/tests/cli/run/test_controller.py +519 -0
- langbot_plugin-0.4.5/tests/cli/run/test_hotreload.py +180 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/tests/cli/run/test_runtime_handler.py +309 -4
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/tests/cli/test_buildplugin.py +1 -3
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/tests/cli/test_initplugin.py +8 -2
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/tests/cli/test_login.py +1 -3
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/tests/cli/test_logout_publish.py +18 -4
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/tests/cli/test_renderer.py +24 -13
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/tests/cli/test_runplugin.py +6 -6
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/tests/entities/io/test_protocol.py +3 -1
- langbot_plugin-0.4.5/tests/packaging/test_installed_cli_blackbox.py +350 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/tests/runtime/helper/test_marketplace.py +3 -1
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/tests/runtime/helper/test_pkgmgr.py +11 -3
- langbot_plugin-0.4.5/tests/runtime/io/handlers/test_control_handler.py +904 -0
- langbot_plugin-0.4.5/tests/runtime/io/handlers/test_plugin_handler.py +756 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/tests/runtime/io/test_handler.py +4 -4
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/tests/runtime/plugin/test_manager.py +323 -6
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/tests/runtime/test_app.py +1 -3
- langbot_plugin-0.4.5/tests/test_plugin_logbuffer.py +72 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/tests/utils/test_discovery.py +7 -6
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/tests/utils/test_importutil.py +3 -1
- langbot_plugin-0.4.3/.github/workflows/test.yml +0 -46
- langbot_plugin-0.4.3/tests/box/test_skill_store.py +0 -914
- langbot_plugin-0.4.3/tests/cli/run/test_controller.py +0 -172
- langbot_plugin-0.4.3/tests/runtime/io/handlers/test_control_handler.py +0 -452
- langbot_plugin-0.4.3/tests/runtime/io/handlers/test_plugin_handler.py +0 -317
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/.github/workflows/cla.yml +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/.github/workflows/publish-pypi.yaml +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/.gitignore +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/.python-version +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/AGENTS.md +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/CLAUDE.md +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/CONTRIBUTING.md +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/LICENSE +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/README.md +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/data/.env.example +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/docs/Message.md +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/docs/PluginPages.md +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/docs/communication/apis/lb2rt.md +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/docs/communication/runtime_plugin.md +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/docs/dependency-management.md +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/docs/langbot-plugin-social.png +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/__init__.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/api/__init__.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/api/definition/__init__.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/api/definition/abstract/__init__.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/api/definition/abstract/platform/__init__.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/api/definition/abstract/platform/adapter.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/api/definition/abstract/platform/event_logger.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/api/definition/components/__init__.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/api/definition/components/base.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/api/definition/components/command/__init__.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/api/definition/components/command/command.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/api/definition/components/common/__init__.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/api/definition/components/common/event_listener.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/api/definition/components/knowledge_engine/__init__.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/api/definition/components/knowledge_engine/engine.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/api/definition/components/manifest.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/api/definition/components/page/__init__.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/api/definition/components/parser/__init__.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/api/definition/components/parser/parser.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/api/definition/components/tool/__init__.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/api/definition/components/tool/tool.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/api/definition/plugin.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/api/entities/__init__.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/api/entities/builtin/__init__.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/api/entities/builtin/command/__init__.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/api/entities/builtin/command/context.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/api/entities/builtin/command/errors.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/api/entities/builtin/pipeline/__init__.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/api/entities/builtin/pipeline/query.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/api/entities/builtin/platform/__init__.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/api/entities/builtin/platform/entities.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/api/entities/builtin/platform/events.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/api/entities/builtin/platform/logger.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/api/entities/builtin/platform/message.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/api/entities/builtin/provider/__init__.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/api/entities/builtin/provider/prompt.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/api/entities/builtin/provider/session.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/api/entities/builtin/rag/__init__.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/api/entities/builtin/rag/context.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/api/entities/builtin/rag/enums.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/api/entities/builtin/rag/errors.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/api/entities/builtin/rag/models.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/api/entities/builtin/resource/__init__.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/api/entities/builtin/resource/tool.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/api/entities/context.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/api/entities/events.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/api/proxies/__init__.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/api/proxies/base.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/api/proxies/event_context.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/api/proxies/execute_context.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/api/proxies/query_based_api.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/assets/__init__.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/assets/langbot-page-sdk.js +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/assets/templates/.env.example.example +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/assets/templates/.github/workflows/release.yml.example +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/assets/templates/.gitignore.example +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/assets/templates/.vscode/launch.json.example +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/assets/templates/README.md.example +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/assets/templates/__init__.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/assets/templates/assets/icon.svg.example +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/assets/templates/components/__init__.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/assets/templates/components/commands/__init__.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/assets/templates/components/commands/{cmd_name}.py.example +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/assets/templates/components/commands/{cmd_name}.yaml.example +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/assets/templates/components/event_listener/__init__.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/assets/templates/components/event_listener/default.py.example +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/assets/templates/components/event_listener/default.yaml.example +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/assets/templates/components/knowledge_engine/__init__.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/assets/templates/components/knowledge_engine/{knowledge_engine_name}.py.example +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/assets/templates/components/knowledge_engine/{knowledge_engine_name}.yaml.example +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/assets/templates/components/pages/{page_name}.html.example +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/assets/templates/components/pages/{page_name}.yaml.example +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/assets/templates/components/parser/__init__.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/assets/templates/components/parser/{parser_name}.py.example +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/assets/templates/components/parser/{parser_name}.yaml.example +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/assets/templates/components/tools/__init__.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/assets/templates/components/tools/{tool_name}.py.example +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/assets/templates/components/tools/{tool_name}.yaml.example +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/assets/templates/main.py.example +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/assets/templates/manifest.yaml.example +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/assets/templates/readme/README_zh_Hans.md.example +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/assets/templates/requirements.txt.example +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/box/actions.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/box/client.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/box/errors.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/box/runtime.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/box/server.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/cli/__main__.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/cli/commands/__init__.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/cli/commands/buildplugin.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/cli/commands/gencomponent.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/cli/commands/initplugin.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/cli/commands/login.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/cli/commands/logout.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/cli/commands/publish.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/cli/commands/runplugin.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/cli/gen/__init__.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/cli/gen/renderer.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/cli/locales/__init__.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/cli/locales/en_US.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/cli/locales/es_ES.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/cli/locales/ja_JP.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/cli/locales/th_TH.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/cli/locales/vi_VN.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/cli/locales/zh_Hans.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/cli/locales/zh_Hant.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/cli/run/__init__.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/cli/run/controller.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/cli/utils/__init__.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/cli/utils/cloudsv.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/cli/utils/form.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/cli/utils/page_components.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/entities/__init__.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/entities/io/__init__.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/entities/io/actions/__init__.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/entities/io/req.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/entities/io/resp.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/entities/marketplace.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/runtime/LICENSE +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/runtime/README.md +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/runtime/__init__.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/runtime/app.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/runtime/context.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/runtime/helper/__init__.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/runtime/helper/marketplace.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/runtime/io/__init__.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/runtime/io/connection.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/runtime/io/connections/__init__.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/runtime/io/connections/stdio.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/runtime/io/connections/ws.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/runtime/io/controller.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/runtime/io/controllers/__init__.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/runtime/io/controllers/stdio/__init__.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/runtime/io/controllers/stdio/server.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/runtime/io/controllers/ws/__init__.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/runtime/io/controllers/ws/server.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/runtime/io/handler.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/runtime/io/handlers/__init__.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/runtime/plugin/__init__.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/runtime/plugin/container.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/runtime/settings.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/utils/__init__.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/utils/discover/__init__.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/utils/discover/engine.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/utils/importutil.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/utils/log.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/utils/platform.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/src/langbot_plugin/version.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/tests/__init__.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/tests/api/definition/test_manifest.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/tests/api/entities/builtin/test_command_context.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/tests/api/entities/builtin/test_platform_logger.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/tests/api/entities/builtin/test_provider_message.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/tests/api/entities/test_events.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/tests/api/proxies/test_base.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/tests/box/__init__.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/tests/cli/test_gencomponent.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/tests/cli/test_i18n_form.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/tests/cli/test_page_components.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/tests/entities/io/test_dependency_errors.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/tests/helpers/__init__.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/tests/helpers/protocol.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/tests/runtime/io/handlers/test_import_contracts.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/tests/runtime/io/test_connections.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/tests/runtime/io/test_controllers.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/tests/runtime/plugin/test_container.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/tests/test_log.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/tests/test_message.py +0 -0
- {langbot_plugin-0.4.3 → langbot_plugin-0.4.5}/tests/utils/test_platform.py +0 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
name: Tests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
- test-build
|
|
8
|
+
pull_request:
|
|
9
|
+
|
|
10
|
+
permissions:
|
|
11
|
+
contents: read
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
unit-tests:
|
|
15
|
+
name: Unit Tests
|
|
16
|
+
runs-on: ubuntu-latest
|
|
17
|
+
strategy:
|
|
18
|
+
fail-fast: false
|
|
19
|
+
matrix:
|
|
20
|
+
python-version: ["3.10", "3.11", "3.12"]
|
|
21
|
+
steps:
|
|
22
|
+
- uses: actions/checkout@v4
|
|
23
|
+
with:
|
|
24
|
+
persist-credentials: false
|
|
25
|
+
- name: Install uv
|
|
26
|
+
uses: astral-sh/setup-uv@v6
|
|
27
|
+
- name: Set up Python
|
|
28
|
+
run: uv python install ${{ matrix.python-version }}
|
|
29
|
+
- name: Run tests with coverage
|
|
30
|
+
run: |
|
|
31
|
+
uv run --python ${{ matrix.python-version }} pytest \
|
|
32
|
+
--ignore=tests/packaging \
|
|
33
|
+
--cov=langbot_plugin \
|
|
34
|
+
--cov-report=term-missing \
|
|
35
|
+
--cov-fail-under=84
|
|
36
|
+
|
|
37
|
+
test-lint:
|
|
38
|
+
name: Lint and Format
|
|
39
|
+
runs-on: ubuntu-latest
|
|
40
|
+
steps:
|
|
41
|
+
- uses: actions/checkout@v4
|
|
42
|
+
with:
|
|
43
|
+
persist-credentials: false
|
|
44
|
+
- name: Install uv
|
|
45
|
+
uses: astral-sh/setup-uv@v6
|
|
46
|
+
- name: Ruff check
|
|
47
|
+
run: uv run ruff check src tests --output-format=concise
|
|
48
|
+
- name: Ruff format check
|
|
49
|
+
run: uv run ruff format --check src tests
|
|
50
|
+
|
|
51
|
+
package-smoke:
|
|
52
|
+
name: Package Smoke
|
|
53
|
+
runs-on: ubuntu-latest
|
|
54
|
+
steps:
|
|
55
|
+
- uses: actions/checkout@v4
|
|
56
|
+
with:
|
|
57
|
+
persist-credentials: false
|
|
58
|
+
- name: Install uv
|
|
59
|
+
uses: astral-sh/setup-uv@v6
|
|
60
|
+
- name: Set up Python
|
|
61
|
+
run: uv python install 3.12
|
|
62
|
+
- name: Installed wheel CLI smoke
|
|
63
|
+
run: uv run --python 3.12 pytest -q tests/packaging
|
|
64
|
+
|
|
65
|
+
scoped-type-check:
|
|
66
|
+
name: Scoped Type Check
|
|
67
|
+
runs-on: ubuntu-latest
|
|
68
|
+
steps:
|
|
69
|
+
- uses: actions/checkout@v4
|
|
70
|
+
with:
|
|
71
|
+
persist-credentials: false
|
|
72
|
+
- name: Install uv
|
|
73
|
+
uses: astral-sh/setup-uv@v6
|
|
74
|
+
- name: Mypy stable protocol modules
|
|
75
|
+
run: |
|
|
76
|
+
uv run mypy \
|
|
77
|
+
src/langbot_plugin/entities/io \
|
|
78
|
+
src/langbot_plugin/runtime/plugin/logbuffer.py \
|
|
79
|
+
src/langbot_plugin/utils/platform.py
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: langbot-plugin
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.5
|
|
4
4
|
Summary: This package contains the SDK, CLI for building plugins for LangBot, plus the runtime for hosting LangBot plugins
|
|
5
5
|
Project-URL: Homepage, https://langbot.app
|
|
6
6
|
Project-URL: Repository, https://github.com/langbot-app/langbot-plugin-sdk
|
|
@@ -13,12 +13,23 @@ class FunctionCall(pydantic.BaseModel):
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
class ToolCall(pydantic.BaseModel):
|
|
16
|
+
"""Tool call from LLM.
|
|
17
|
+
|
|
18
|
+
The `provider_specific_fields` dict carries provider-specific metadata
|
|
19
|
+
that must be round-tripped between requests and responses. For example,
|
|
20
|
+
Gemini models require `thought_signature` in function call parts for
|
|
21
|
+
tool calls to work correctly.
|
|
22
|
+
"""
|
|
23
|
+
|
|
16
24
|
id: str
|
|
17
25
|
|
|
18
26
|
type: str
|
|
19
27
|
|
|
20
28
|
function: FunctionCall
|
|
21
29
|
|
|
30
|
+
provider_specific_fields: typing.Optional[dict[str, typing.Any]] = None
|
|
31
|
+
"""Provider-specific fields (e.g., Gemini thought_signature) to round-trip."""
|
|
32
|
+
|
|
22
33
|
|
|
23
34
|
class ImageURLContentObject(pydantic.BaseModel):
|
|
24
35
|
url: str
|
|
@@ -79,7 +90,13 @@ class ContentElement(pydantic.BaseModel):
|
|
|
79
90
|
|
|
80
91
|
|
|
81
92
|
class Message(pydantic.BaseModel):
|
|
82
|
-
"""Message for AI
|
|
93
|
+
"""Message for AI.
|
|
94
|
+
|
|
95
|
+
The `provider_specific_fields` dict carries provider-specific metadata
|
|
96
|
+
that must be round-tripped between requests and responses. For example,
|
|
97
|
+
Gemini models require `thought_signatures` to be preserved across
|
|
98
|
+
conversation turns for tool calls to work correctly.
|
|
99
|
+
"""
|
|
83
100
|
|
|
84
101
|
role: str # user, system, assistant, tool, command, plugin
|
|
85
102
|
"""Role of the message"""
|
|
@@ -95,6 +112,12 @@ class Message(pydantic.BaseModel):
|
|
|
95
112
|
|
|
96
113
|
tool_call_id: typing.Optional[str] = None
|
|
97
114
|
|
|
115
|
+
resp_message_id: typing.Optional[str] = None
|
|
116
|
+
"""Response message ID for tracking"""
|
|
117
|
+
|
|
118
|
+
provider_specific_fields: typing.Optional[dict[str, typing.Any]] = None
|
|
119
|
+
"""Provider-specific fields (e.g., Gemini thought_signatures) to round-trip."""
|
|
120
|
+
|
|
98
121
|
def readable_str(self) -> str:
|
|
99
122
|
if self.content is not None:
|
|
100
123
|
return (
|
|
@@ -188,6 +211,9 @@ class MessageChunk(pydantic.BaseModel):
|
|
|
188
211
|
msg_sequence: int = 0
|
|
189
212
|
"""消息迭代次数"""
|
|
190
213
|
|
|
214
|
+
provider_specific_fields: typing.Optional[dict[str, typing.Any]] = None
|
|
215
|
+
"""Provider-specific fields (e.g., Gemini thought_signatures) to round-trip."""
|
|
216
|
+
|
|
191
217
|
def readable_str(self) -> str:
|
|
192
218
|
if self.content is not None:
|
|
193
219
|
return (
|
|
@@ -262,3 +288,43 @@ class ToolCallChunk(pydantic.BaseModel):
|
|
|
262
288
|
|
|
263
289
|
function: FunctionCall
|
|
264
290
|
"""函数调用"""
|
|
291
|
+
|
|
292
|
+
provider_specific_fields: typing.Optional[dict[str, typing.Any]] = None
|
|
293
|
+
"""Provider-specific fields (e.g., Gemini thought_signature) to round-trip."""
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
class LLMTokenUsage(pydantic.BaseModel):
|
|
297
|
+
"""Token usage returned by an LLM provider.
|
|
298
|
+
|
|
299
|
+
The standard OpenAI-compatible counters are normalized when available.
|
|
300
|
+
Provider-specific fields such as prompt/completion token details or cache
|
|
301
|
+
counters are preserved as extra fields.
|
|
302
|
+
"""
|
|
303
|
+
|
|
304
|
+
prompt_tokens: int | None = None
|
|
305
|
+
completion_tokens: int | None = None
|
|
306
|
+
total_tokens: int | None = None
|
|
307
|
+
|
|
308
|
+
model_config = pydantic.ConfigDict(extra="allow")
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
class LLMInvokeResult(pydantic.BaseModel):
|
|
312
|
+
"""Non-streaming LLM invoke result with optional provider usage."""
|
|
313
|
+
|
|
314
|
+
message: Message
|
|
315
|
+
usage: LLMTokenUsage | None = None
|
|
316
|
+
|
|
317
|
+
model_config = pydantic.ConfigDict(extra="forbid")
|
|
318
|
+
|
|
319
|
+
|
|
320
|
+
class LLMStreamEvent(pydantic.BaseModel):
|
|
321
|
+
"""Streaming LLM event.
|
|
322
|
+
|
|
323
|
+
Most events carry a message chunk. A final provider usage event may carry
|
|
324
|
+
usage without a chunk when the upstream API reports usage after completion.
|
|
325
|
+
"""
|
|
326
|
+
|
|
327
|
+
chunk: MessageChunk | None = None
|
|
328
|
+
usage: LLMTokenUsage | None = None
|
|
329
|
+
|
|
330
|
+
model_config = pydantic.ConfigDict(extra="forbid")
|
|
@@ -84,22 +84,96 @@ class LangBotAPIProxy:
|
|
|
84
84
|
timeout: float | None = None,
|
|
85
85
|
) -> provider_message.Message:
|
|
86
86
|
"""Invoke an LLM model"""
|
|
87
|
+
result = await self.invoke_llm_with_usage(
|
|
88
|
+
llm_model_uuid=llm_model_uuid,
|
|
89
|
+
messages=messages,
|
|
90
|
+
funcs=funcs,
|
|
91
|
+
extra_args=extra_args,
|
|
92
|
+
timeout=timeout,
|
|
93
|
+
)
|
|
94
|
+
return result.message
|
|
95
|
+
|
|
96
|
+
async def invoke_llm_with_usage(
|
|
97
|
+
self,
|
|
98
|
+
llm_model_uuid: str,
|
|
99
|
+
messages: list[provider_message.Message],
|
|
100
|
+
funcs: list[resource_tool.LLMTool] = [],
|
|
101
|
+
extra_args: dict[str, Any] = {},
|
|
102
|
+
timeout: float | None = None,
|
|
103
|
+
) -> provider_message.LLMInvokeResult:
|
|
104
|
+
"""Invoke an LLM model and return the message plus optional provider usage."""
|
|
87
105
|
effective_timeout = timeout if timeout is not None else 120.0
|
|
88
|
-
resp = (
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
)
|
|
100
|
-
)["message"]
|
|
106
|
+
resp = await self.plugin_runtime_handler.call_action(
|
|
107
|
+
PluginToRuntimeAction.INVOKE_LLM,
|
|
108
|
+
{
|
|
109
|
+
"llm_model_uuid": llm_model_uuid,
|
|
110
|
+
"messages": [m.model_dump() for m in messages],
|
|
111
|
+
"funcs": [f.model_dump() for f in funcs],
|
|
112
|
+
"extra_args": extra_args,
|
|
113
|
+
"timeout": effective_timeout,
|
|
114
|
+
},
|
|
115
|
+
timeout=effective_timeout,
|
|
116
|
+
)
|
|
101
117
|
|
|
102
|
-
return provider_message.
|
|
118
|
+
return provider_message.LLMInvokeResult.model_validate(
|
|
119
|
+
{
|
|
120
|
+
"message": resp["message"],
|
|
121
|
+
"usage": resp.get("usage") if isinstance(resp, dict) else None,
|
|
122
|
+
}
|
|
123
|
+
)
|
|
124
|
+
|
|
125
|
+
async def invoke_llm_stream(
|
|
126
|
+
self,
|
|
127
|
+
llm_model_uuid: str,
|
|
128
|
+
messages: list[provider_message.Message],
|
|
129
|
+
funcs: list[resource_tool.LLMTool] = [],
|
|
130
|
+
extra_args: dict[str, Any] = {},
|
|
131
|
+
):
|
|
132
|
+
"""Invoke an LLM model with streaming response
|
|
133
|
+
|
|
134
|
+
Args:
|
|
135
|
+
llm_model_uuid: The UUID of the LLM model to use
|
|
136
|
+
messages: List of conversation messages
|
|
137
|
+
funcs: List of tools available to the LLM
|
|
138
|
+
extra_args: Extra arguments for the LLM provider
|
|
139
|
+
|
|
140
|
+
Yields:
|
|
141
|
+
MessageChunk: Streamed message chunks from the LLM
|
|
142
|
+
"""
|
|
143
|
+
async for event in self.invoke_llm_stream_events(
|
|
144
|
+
llm_model_uuid=llm_model_uuid,
|
|
145
|
+
messages=messages,
|
|
146
|
+
funcs=funcs,
|
|
147
|
+
extra_args=extra_args,
|
|
148
|
+
):
|
|
149
|
+
if event.chunk is not None:
|
|
150
|
+
yield event.chunk
|
|
151
|
+
|
|
152
|
+
async def invoke_llm_stream_events(
|
|
153
|
+
self,
|
|
154
|
+
llm_model_uuid: str,
|
|
155
|
+
messages: list[provider_message.Message],
|
|
156
|
+
funcs: list[resource_tool.LLMTool] = [],
|
|
157
|
+
extra_args: dict[str, Any] = {},
|
|
158
|
+
):
|
|
159
|
+
"""Invoke an LLM model and yield chunks plus optional final usage events."""
|
|
160
|
+
async for chunk_data in self.plugin_runtime_handler.call_action_generator(
|
|
161
|
+
PluginToRuntimeAction.INVOKE_LLM_STREAM,
|
|
162
|
+
{
|
|
163
|
+
"llm_model_uuid": llm_model_uuid,
|
|
164
|
+
"messages": [m.model_dump() for m in messages],
|
|
165
|
+
"funcs": [f.model_dump() for f in funcs],
|
|
166
|
+
"extra_args": extra_args,
|
|
167
|
+
},
|
|
168
|
+
):
|
|
169
|
+
event_data: dict[str, Any] = {}
|
|
170
|
+
if isinstance(chunk_data, dict) and "chunk" in chunk_data:
|
|
171
|
+
event_data["chunk"] = chunk_data["chunk"]
|
|
172
|
+
if isinstance(chunk_data, dict) and "usage" in chunk_data:
|
|
173
|
+
event_data["usage"] = chunk_data["usage"]
|
|
174
|
+
if not event_data:
|
|
175
|
+
event_data["chunk"] = chunk_data["chunk"]
|
|
176
|
+
yield provider_message.LLMStreamEvent.model_validate(event_data)
|
|
103
177
|
|
|
104
178
|
async def set_plugin_storage(self, key: str, value: bytes) -> None:
|
|
105
179
|
"""Set a plugin storage value"""
|
|
@@ -284,6 +358,43 @@ class LangBotAPIProxy:
|
|
|
284
358
|
)
|
|
285
359
|
)["vectors"]
|
|
286
360
|
|
|
361
|
+
async def invoke_rerank(
|
|
362
|
+
self,
|
|
363
|
+
rerank_model_uuid: str,
|
|
364
|
+
query: str,
|
|
365
|
+
documents: list[str],
|
|
366
|
+
top_k: int | None = None,
|
|
367
|
+
extra_args: dict[str, Any] | None = None,
|
|
368
|
+
timeout: float = 60.0,
|
|
369
|
+
) -> list[dict[str, Any]]:
|
|
370
|
+
"""Rerank documents using Host's rerank model.
|
|
371
|
+
|
|
372
|
+
Args:
|
|
373
|
+
rerank_model_uuid: The UUID of the rerank model to use.
|
|
374
|
+
query: Query text used to score document relevance.
|
|
375
|
+
documents: Candidate document texts to rerank.
|
|
376
|
+
top_k: Optional number of scored results to return.
|
|
377
|
+
extra_args: Optional provider-specific arguments.
|
|
378
|
+
timeout: Request timeout in seconds.
|
|
379
|
+
|
|
380
|
+
Returns:
|
|
381
|
+
List of score dicts, usually containing ``index`` and
|
|
382
|
+
``relevance_score``.
|
|
383
|
+
"""
|
|
384
|
+
return (
|
|
385
|
+
await self.plugin_runtime_handler.call_action(
|
|
386
|
+
PluginToRuntimeAction.INVOKE_RERANK,
|
|
387
|
+
{
|
|
388
|
+
"rerank_model_uuid": rerank_model_uuid,
|
|
389
|
+
"query": query,
|
|
390
|
+
"documents": documents,
|
|
391
|
+
"top_k": top_k,
|
|
392
|
+
"extra_args": extra_args or {},
|
|
393
|
+
},
|
|
394
|
+
timeout=timeout,
|
|
395
|
+
)
|
|
396
|
+
)["results"]
|
|
397
|
+
|
|
287
398
|
async def vector_upsert(
|
|
288
399
|
self,
|
|
289
400
|
collection_id: str,
|