rasa-pro 3.22.0.dev4__py3-none-any.whl → 3.22.0.dev5__py3-none-any.whl
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.
- rasa/api/_class_resolution.py +207 -0
- rasa/api/brokers/_factory.py +38 -60
- rasa/api/channels/_factory.py +25 -53
- rasa/api/channels/v1/voice_stream/voice_channel.py +33 -54
- rasa/api/knowledge/_factory.py +33 -36
- rasa/api/locks/_factory.py +20 -38
- rasa/api/timers/_factory.py +27 -47
- rasa/api/tracker/_factory.py +28 -56
- rasa/api/voice/_deepgram_endpoint.py +29 -0
- rasa/api/voice/asr/_builtins.py +21 -0
- rasa/api/voice/asr/_factory.py +8 -12
- rasa/api/voice/asr/v1/__init__.py +10 -3
- rasa/api/voice/asr/v1/assemblyai.py +283 -0
- rasa/api/voice/asr/v1/azure/engine.py +0 -4
- rasa/api/voice/asr/v1/base.py +229 -25
- rasa/api/voice/asr/v1/deepgram/base.py +0 -5
- rasa/api/voice/asr/v1/deepgram/flux.py +2 -1
- rasa/api/voice/asr/v1/deepgram/nova.py +13 -1
- rasa/api/voice/asr/v1/elevenlabs.py +6 -55
- rasa/api/voice/asr/v1/gradium.py +290 -0
- rasa/api/voice/asr/v1/inworld.py +201 -0
- rasa/api/voice/asr/v1/speechmatics.py +10 -0
- rasa/api/voice/reconnect/__init__.py +6 -0
- rasa/api/voice/reconnect/_constants.py +25 -0
- rasa/api/voice/reconnect/_errors.py +10 -0
- rasa/api/voice/reconnect/_retry.py +192 -0
- rasa/api/voice/reconnect/v1/__init__.py +15 -0
- rasa/api/voice/reconnect/v1/config.py +39 -0
- rasa/api/voice/reconnect/v1/errors.py +5 -0
- rasa/api/voice/tts/_builtins.py +21 -0
- rasa/api/voice/tts/_factory.py +8 -12
- rasa/api/voice/tts/v1/__init__.py +10 -3
- rasa/api/voice/tts/v1/assemblyai.py +333 -0
- rasa/api/voice/tts/v1/azure.py +0 -4
- rasa/api/voice/tts/v1/base.py +148 -3
- rasa/api/voice/tts/v1/cartesia.py +24 -21
- rasa/api/voice/tts/v1/deepgram.py +28 -25
- rasa/api/voice/tts/v1/deepgram_flux.py +16 -17
- rasa/api/voice/tts/v1/elevenlabs.py +0 -3
- rasa/api/voice/tts/v1/gradium.py +271 -0
- rasa/api/voice/tts/v1/inworld.py +434 -0
- rasa/api/voice/tts/v1/rime.py +24 -19
- rasa/builder/agent_id.py +189 -0
- rasa/builder/behavior_editing.py +6 -31
- rasa/builder/branches.py +59 -1
- rasa/builder/config.py +0 -2
- rasa/builder/constants.py +3 -0
- rasa/builder/copilot/file_operations.py +48 -4
- rasa/builder/copilot/mcp_server/schema/scenario_schema.yml +2 -0
- rasa/builder/copilot/mcp_server/tools/event_ledger.py +1 -0
- rasa/builder/copilot/mcp_server/tools/scenario.py +1 -0
- rasa/builder/copilot/modes/AGENTS.md +1 -1
- rasa/builder/copilot/modes/eval/AGENTS.md +9 -5
- rasa/builder/copilot/modes/eval/actions.py +72 -39
- rasa/builder/copilot/modes/eval/capability.py +132 -9
- rasa/builder/copilot/modes/eval/cards.py +28 -2
- rasa/builder/copilot/modes/eval/job.py +21 -1
- rasa/builder/copilot/modes/eval/models.py +1 -0
- rasa/builder/copilot/modes/plan/actions.py +1 -0
- rasa/builder/copilot/modes/plan/build_job.py +3 -1
- rasa/builder/copilot/pydantic_ai/agent.py +14 -3
- rasa/builder/copilot/pydantic_ai/hooks.py +4 -0
- rasa/builder/copilot/pydantic_ai/prompt_loader.py +4 -2
- rasa/builder/copilot/pydantic_ai/run_context.py +10 -5
- rasa/builder/copilot/pydantic_ai/types.py +2 -0
- rasa/builder/copilot/skills/mantle/building-skills/SKILL.md +2 -2
- rasa/builder/copilot/skills/mantle/building-skills/references/control-levers.md +1 -1
- rasa/builder/copilot/skills/mantle/building-skills/references/ordered-blocks.md +4 -2
- rasa/builder/copilot/skills/mantle/building-skills/references/responses.md +2 -2
- rasa/builder/copilot/skills/mantle/configuring-agent/SKILL.md +2 -2
- rasa/builder/copilot/skills/mantle/configuring-agent/references/agent-yml.md +5 -8
- rasa/builder/copilot/skills/mantle/configuring-agent/references/integrations-yml.md +3 -2
- rasa/builder/copilot/skills/mantle/configuring-agent/references/knowledge-and-hooks.md +5 -5
- rasa/builder/copilot/skills/mantle/migrating-from-calm/SKILL.md +1 -1
- rasa/builder/copilot/skills/mantle/simulating-evaluating/SKILL.md +22 -12
- rasa/builder/copilot/skills/mantle/testing-debugging/SKILL.md +4 -4
- rasa/builder/copilot/skills/mantle/testing-debugging/references/validation-failures.md +4 -2
- rasa/builder/copilot/subagents/builder/agent.py +17 -8
- rasa/builder/copilot/subagents/evaluator/agent.py +53 -12
- rasa/builder/document_retrieval/local/data/docs_vectors.parquet +0 -0
- rasa/builder/document_retrieval/local/data/mantle_docs_vectors.parquet +0 -0
- rasa/builder/eval_scenarios.py +1 -0
- rasa/builder/exceptions.py +7 -0
- rasa/builder/job_runner.py +51 -9
- rasa/builder/jobs.py +12 -2
- rasa/builder/models.py +20 -0
- rasa/builder/project_generator/project_generator.py +19 -5
- rasa/builder/service.py +78 -4
- rasa/builder/shared/tracker_context.py +12 -3
- rasa/cli/project_templates/mantle/AGENTS.md +1 -1
- rasa/cli/project_templates/mantle/skills/view_transactions/memory.yml +1 -1
- rasa/cli/tools/skills_data/mantle/mantle-building-skills/SKILL.md +10 -8
- rasa/cli/tools/skills_data/mantle/mantle-configuring-agent/SKILL.md +17 -13
- rasa/cli/tools/skills_data/mantle/mantle-docs/SKILL.md +1 -1
- rasa/cli/tools/skills_data/mantle/mantle-migrating-from-calm/SKILL.md +1 -1
- rasa/cli/tools/skills_data/mantle/mantle-simulating-evaluating/SKILL.md +8 -5
- rasa/cli/tools/skills_data/mantle/mantle-testing-debugging/SKILL.md +9 -2
- rasa/core/actions/action.py +2 -1
- rasa/core/agent.py +11 -22
- rasa/core/channels/inspector/dist/assets/{abnfDiagram-VCTEODGH-9bb4b1b7.js → abnfDiagram-VCTEODGH-4dad96d5.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{arc-c3810888.js → arc-3e6f53b9.js} +1 -1
- rasa/core/channels/inspector/dist/assets/architecture-7GRP2DOG-699b1092.js +1 -0
- rasa/core/channels/inspector/dist/assets/{architectureDiagram-5GKGNRK7-871eab48.js → architectureDiagram-5GKGNRK7-196dd756.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{blockDiagram-I7D4REHJ-db15b3c9.js → blockDiagram-I7D4REHJ-dde191ce.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{c4Diagram-7LVT6UL2-d576670d.js → c4Diagram-7LVT6UL2-323f6330.js} +1 -1
- rasa/core/channels/inspector/dist/assets/channel-da9956d7.js +1 -0
- rasa/core/channels/inspector/dist/assets/{chunk-2Q5K7J3B-03b49407.js → chunk-2Q5K7J3B-442e95da.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{chunk-5VM5RSS4-21ebf9e7.js → chunk-5VM5RSS4-4b8f18bf.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{chunk-F27PBJKO-8c71eab7.js → chunk-F27PBJKO-0d13dc9c.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{chunk-IMKFNOWR-31c44837.js → chunk-IMKFNOWR-582c5eb2.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{chunk-JWPE2WC7-84ef11d7.js → chunk-JWPE2WC7-4eff958f.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{chunk-POPQ4Y6H-6567ef4e.js → chunk-POPQ4Y6H-e26f4239.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{chunk-SHT3W25Y-6c21498e.js → chunk-SHT3W25Y-b08c37cd.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{chunk-SVP7TREG-73f752ea.js → chunk-SVP7TREG-d321f270.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{chunk-TICWLB2K-00498b4c.js → chunk-TICWLB2K-1b2cbe3c.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{chunk-XXDRQBXY-344b78e6.js → chunk-XXDRQBXY-a9c5e0e5.js} +1 -1
- rasa/core/channels/inspector/dist/assets/classDiagram-ZZMXUADV-00200122.js +1 -0
- rasa/core/channels/inspector/dist/assets/classDiagram-v2-VYDZK3BY-00200122.js +1 -0
- rasa/core/channels/inspector/dist/assets/{cose-bilkent-JH36ORCC-e6dd637c.js → cose-bilkent-JH36ORCC-46815318.js} +1 -1
- rasa/core/channels/inspector/dist/assets/cynefin-OW5HDTMX-eda39f47.js +1 -0
- rasa/core/channels/inspector/dist/assets/{cynefinDiagram-5FMLGOSQ-8c24409a.js → cynefinDiagram-5FMLGOSQ-54c1624b.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{dagre-GXQ25YYZ-e453a665.js → dagre-GXQ25YYZ-b008a027.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{diagram-S7CK7UJ4-6a283b1b.js → diagram-S7CK7UJ4-ae89395e.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{diagram-UQ7AKVKN-554ef82f.js → diagram-UQ7AKVKN-999ae09e.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{diagram-VSXAHHWV-3be73563.js → diagram-VSXAHHWV-97c7889e.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{diagram-VX7I27RA-a2331b4f.js → diagram-VX7I27RA-823e67b2.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{diagram-Z3DM3KII-8f19966a.js → diagram-Z3DM3KII-e2703905.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{ebnfDiagram-PWID7BFC-776e52fe.js → ebnfDiagram-PWID7BFC-90957809.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{erDiagram-RLTQ6QDP-41e1a7a7.js → erDiagram-RLTQ6QDP-ab7d586b.js} +1 -1
- rasa/core/channels/inspector/dist/assets/eventmodeling-NTZA5JFV-5ba493ba.js +1 -0
- rasa/core/channels/inspector/dist/assets/flowDiagram-HODETNUW-878d9a43.js +1 -0
- rasa/core/channels/inspector/dist/assets/{ganttDiagram-EL5Y4UJY-53724fff.js → ganttDiagram-EL5Y4UJY-d51cb341.js} +1 -1
- rasa/core/channels/inspector/dist/assets/gitGraph-4MIJSDKK-a1e2f707.js +1 -0
- rasa/core/channels/inspector/dist/assets/{gitGraphDiagram-WWUBYQGX-1b7a87aa.js → gitGraphDiagram-WWUBYQGX-00e4986d.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{index-274d8869.js → index-f0843d4a.js} +214 -214
- rasa/core/channels/inspector/dist/assets/info-A6RAGUB7-899546b8.js +1 -0
- rasa/core/channels/inspector/dist/assets/{infoDiagram-27XIBGKW-3b7adc8a.js → infoDiagram-27XIBGKW-9b4914f1.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{ishikawaDiagram-5VMMS53U-6ceb54a2.js → ishikawaDiagram-5VMMS53U-60c66367.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{journeyDiagram-3NMN7TZE-b5ab0205.js → journeyDiagram-3NMN7TZE-5b85e88f.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{kanban-definition-UXKFOSKX-6ff5197e.js → kanban-definition-UXKFOSKX-49b30c4d.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{layout-06fc0ce8.js → layout-9f5b710a.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{linear-5063258f.js → linear-514ea504.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{mermaid-parser.core-cef7e732.js → mermaid-parser.core-30107f2c.js} +2 -2
- rasa/core/channels/inspector/dist/assets/{mindmap-definition-YA3MSWOX-78933baa.js → mindmap-definition-YA3MSWOX-3327eb70.js} +1 -1
- rasa/core/channels/inspector/dist/assets/packet-AYTQ26CC-20d1be69.js +1 -0
- rasa/core/channels/inspector/dist/assets/{pegDiagram-XKGWAZYB-b288834e.js → pegDiagram-XKGWAZYB-fc962248.js} +1 -1
- rasa/core/channels/inspector/dist/assets/pie-WAS4IAKB-1294e5e5.js +1 -0
- rasa/core/channels/inspector/dist/assets/{pieDiagram-E7YTZNPT-2c04e795.js → pieDiagram-E7YTZNPT-a28a6852.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{quadrantDiagram-AXDQQJYC-2ee4a399.js → quadrantDiagram-AXDQQJYC-aac7cd2a.js} +1 -1
- rasa/core/channels/inspector/dist/assets/radar-RG4KPBEZ-09727d46.js +1 -0
- rasa/core/channels/inspector/dist/assets/railroad-74A4TZTK-477c7b05.js +1 -0
- rasa/core/channels/inspector/dist/assets/railroad-abnf-HS5TGJTU-ab8e102e.js +1 -0
- rasa/core/channels/inspector/dist/assets/railroad-ebnf-LZEXJU2U-13acb37b.js +1 -0
- rasa/core/channels/inspector/dist/assets/railroad-peg-WCYAUIDC-49de1c2b.js +1 -0
- rasa/core/channels/inspector/dist/assets/{railroadDiagram-O6MQD6OU-9bfe3600.js → railroadDiagram-O6MQD6OU-23af80ec.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{requirementDiagram-BXWQKSXE-115ef51e.js → requirementDiagram-BXWQKSXE-3cfea867.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{sankeyDiagram-P5KCCOFB-23c7a678.js → sankeyDiagram-P5KCCOFB-da6ddca7.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{sequenceDiagram-WJ2MYXX4-08014e4a.js → sequenceDiagram-WJ2MYXX4-58a120cd.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{sizeCapture-INFHLROL-d66ec26a.js → sizeCapture-INFHLROL-e13c1480.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{stateDiagram-D77RDMKH-0542b581.js → stateDiagram-D77RDMKH-bf9decb0.js} +1 -1
- rasa/core/channels/inspector/dist/assets/stateDiagram-v2-MP3YSRHH-6b114887.js +1 -0
- rasa/core/channels/inspector/dist/assets/{swimlanes-42K2YHIH-7324252c.js → swimlanes-42K2YHIH-9f742571.js} +1 -1
- rasa/core/channels/inspector/dist/assets/swimlanesDiagram-VR7AAH4N-c58e1722.js +8 -0
- rasa/core/channels/inspector/dist/assets/{timeline-definition-24CTP7MA-fda150ab.js → timeline-definition-24CTP7MA-452c1abe.js} +1 -1
- rasa/core/channels/inspector/dist/assets/treeView-Q6P3EWNA-eea32e07.js +1 -0
- rasa/core/channels/inspector/dist/assets/treemap-WGGIJYW6-5e10075c.js +1 -0
- rasa/core/channels/inspector/dist/assets/{vennDiagram-4TSXK5OY-f6996200.js → vennDiagram-4TSXK5OY-9570c84f.js} +1 -1
- rasa/core/channels/inspector/dist/assets/wardley-WFR3VGLG-6370adc9.js +1 -0
- rasa/core/channels/inspector/dist/assets/{wardleyDiagram-VM6X3IG4-1076f51b.js → wardleyDiagram-VM6X3IG4-bd06177f.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{xychartDiagram-S5SC5T6Z-08b5eb79.js → xychartDiagram-S5SC5T6Z-9864c80f.js} +1 -1
- rasa/core/channels/inspector/dist/index.html +1 -1
- rasa/core/channels/inspector/package.json +6 -6
- rasa/core/channels/inspector/yarn.lock +25 -25
- rasa/core/channels/inspector-nextgen/dist/assets/{index-B9poI8Mv.js → index-D9aqZG2L.js} +53 -53
- rasa/core/channels/inspector-nextgen/dist/index.html +1 -1
- rasa/core/channels/inspector-nextgen/e2e/agents/mantle/skills/builtin_session_start/skill.md +1 -1
- rasa/core/channels/inspector-nextgen/e2e/agents/mantle/skills/card_replace/skill.md +15 -15
- rasa/core/channels/inspector-nextgen/e2e/agents/mantle/skills/report_fraudulent_transaction/skill.md +4 -4
- rasa/core/channels/inspector-nextgen/e2e/agents/mantle/skills/travel_notice/skill.md +4 -4
- rasa/core/channels/inspector-nextgen/src/Icon/LangfuseIcon.tsx +19 -0
- rasa/core/channels/inspector-nextgen/src/Icon/index.ts +2 -0
- rasa/core/channels/inspector-nextgen/src/store/selectors.test.ts +1 -1
- rasa/core/channels/inspector-nextgen/src/try-assistant/ChatHeader.test.tsx +10 -0
- rasa/core/channels/inspector-nextgen/src/try-assistant/ChatHeader.tsx +1 -1
- rasa/core/channels/inspector-nextgen/src/try-assistant/LangfuseSessionButton.test.tsx +11 -4
- rasa/core/channels/inspector-nextgen/src/try-assistant/LangfuseSessionButton.tsx +3 -3
- rasa/core/channels/inspector-nextgen/src/try-assistant/MiddlePane.test.tsx +1 -1
- rasa/core/channels/inspector-nextgen/src/try-assistant/SkillSection/SkillSection.test.tsx +1 -1
- rasa/core/channels/inspector-nextgen/src/utils/broker-event.test.ts +5 -2
- rasa/core/channels/inspector-nextgen/src/utils/skill-flow-import.test.ts +9 -6
- rasa/core/channels/inspector-nextgen/src/utils/skill-flow-import.ts +2 -2
- rasa/core/channels/inspector.py +9 -0
- rasa/core/channels/rest.py +20 -9
- rasa/core/channels/voice_stream/call_recording/recording.py +164 -42
- rasa/core/channels/voice_stream/tts/utterance_audio.py +66 -0
- rasa/core/channels/voice_stream/util.py +13 -1
- rasa/core/channels/voice_stream/websockets.py +3 -2
- rasa/core/config/channel_loading.py +5 -3
- rasa/core/voice/event_composition/composer/composer.py +0 -3
- rasa/core/voice/event_composition/handlers/barge_in/barge_in_handler.py +1 -17
- rasa/core/voice/event_composition/handlers/playback_tracking_handler.py +0 -91
- rasa/core/voice/event_composition/handlers/transcript_merge_handler.py +1 -9
- rasa/core/voice/interruptions.py +0 -12
- rasa/events/v1/broker_event_mapper.py +126 -5
- rasa/events/v1/broker_event_pb2.py +62 -54
- rasa/mantle/README-INTERNAL.md +16 -10
- rasa/mantle/a2a/cancel.py +2 -5
- rasa/mantle/builtin_skills/__init__.py +12 -15
- rasa/mantle/builtin_skills/builtin_customer_satisfaction/responses.yml +1 -1
- rasa/mantle/builtin_skills/builtin_customer_satisfaction/skill.md +1 -1
- rasa/mantle/builtin_skills/builtin_silence_timeout/skill.md +1 -1
- rasa/mantle/builtin_skills/builtin_silence_timeout_hangup/skill.md +2 -2
- rasa/mantle/builtin_skills/builtin_unsupported_request_handler/skill.md +2 -2
- rasa/mantle/builtin_skills/default_responses.yml +1 -1
- rasa/mantle/config/agent_spec.py +1 -1
- rasa/mantle/config/authoring_documents.py +4 -13
- rasa/mantle/config/builtin_tool_constraints.py +49 -16
- rasa/mantle/config/channels.py +56 -15
- rasa/mantle/config/integration_factory.py +102 -0
- rasa/mantle/config/integrations_file.py +38 -1
- rasa/mantle/config/validation.py +4 -3
- rasa/mantle/content/response_references.py +3 -3
- rasa/mantle/content/responses.py +32 -2
- rasa/mantle/content/validation.py +30 -5
- rasa/mantle/hooks/__init__.py +6 -6
- rasa/mantle/hooks/constants.py +3 -3
- rasa/mantle/hooks/decorators.py +2 -2
- rasa/mantle/hooks/defaults.py +188 -0
- rasa/mantle/hooks/loader.py +21 -0
- rasa/mantle/hooks/outgoing_message.py +90 -0
- rasa/mantle/hooks/payloads.py +1 -1
- rasa/mantle/hooks/points.py +5 -5
- rasa/mantle/hooks/registry.py +45 -1
- rasa/mantle/hooks/runner.py +7 -1
- rasa/mantle/inspector.py +24 -34
- rasa/mantle/llm/tool_schemas.py +259 -231
- rasa/mantle/memory/coercion.py +2 -2
- rasa/mantle/memory/discovery/catalog.py +2 -3
- rasa/mantle/memory/discovery/extractor.py +3 -3
- rasa/mantle/memory/field.py +7 -6
- rasa/mantle/memory/manager.py +29 -53
- rasa/mantle/memory/schema.py +3 -3
- rasa/mantle/memory/validation.py +2 -2
- rasa/mantle/model_archive/snapshot.py +2 -2
- rasa/mantle/model_archive/training_telemetry.py +7 -7
- rasa/mantle/orchestration/ask_before_filling.py +380 -0
- rasa/mantle/orchestration/cancel_events.py +5 -13
- rasa/mantle/orchestration/contracts.py +7 -6
- rasa/mantle/orchestration/correction/discovery.py +129 -52
- rasa/mantle/orchestration/correction/executor.py +486 -98
- rasa/mantle/orchestration/correction/models.py +11 -9
- rasa/mantle/orchestration/correction/replay.py +3 -16
- rasa/mantle/orchestration/dispatch_result.py +101 -0
- rasa/mantle/orchestration/hooks/__init__.py +10 -10
- rasa/mantle/orchestration/hooks/{outgoing_text.py → outgoing_message.py} +11 -11
- rasa/mantle/orchestration/hybrid_link.py +5 -8
- rasa/mantle/orchestration/memory_utils.py +5 -7
- rasa/mantle/orchestration/memory_validation_tools.py +6 -4
- rasa/mantle/orchestration/orchestrator.py +163 -32
- rasa/mantle/orchestration/pending_hold.py +5 -5
- rasa/mantle/orchestration/responses.py +4 -4
- rasa/mantle/orchestration/set_memory/__init__.py +1 -0
- rasa/mantle/orchestration/set_memory/argument_names.py +70 -0
- rasa/mantle/orchestration/set_memory/dispatcher.py +533 -0
- rasa/mantle/orchestration/set_memory/outcomes.py +98 -0
- rasa/mantle/orchestration/set_memory/revision.py +211 -0
- rasa/mantle/orchestration/set_memory/revision_applier.py +208 -0
- rasa/mantle/orchestration/set_memory_button.py +1 -4
- rasa/mantle/orchestration/settable_write.py +5 -12
- rasa/mantle/orchestration/skill_completion/gate.py +6 -4
- rasa/mantle/orchestration/skill_digression.py +18 -42
- rasa/mantle/orchestration/skill_executor.py +966 -1183
- rasa/mantle/orchestration/skill_utils.py +325 -37
- rasa/mantle/orchestration/stated_fields.py +70 -32
- rasa/mantle/orchestration/tool_execution/constraints.py +145 -14
- rasa/mantle/orchestration/tool_execution/invoker.py +9 -13
- rasa/mantle/orchestration/turn_context.py +19 -19
- rasa/mantle/orchestration/verbatim_triggers.py +11 -13
- rasa/mantle/processor.py +99 -37
- rasa/mantle/prompts/builtin_history.py +35 -0
- rasa/mantle/prompts/constructor.py +49 -21
- rasa/mantle/prompts/memory_lines.py +11 -0
- rasa/mantle/prompts/messages.py +198 -33
- rasa/mantle/prompts/renderer.py +5 -4
- rasa/mantle/prompts/state.py +42 -170
- rasa/mantle/prompts/system_prompt.py +55 -41
- rasa/mantle/prompts/templates/active_skill.jinja2 +0 -20
- rasa/mantle/prompts/templates/lifecycle_tools.jinja2 +9 -107
- rasa/mantle/prompts/templates/routing_catalog.jinja2 +2 -4
- rasa/mantle/prompts/templates/scope_handling.jinja2 +6 -14
- rasa/mantle/prompts/templates/skipped_collect_notice.jinja2 +1 -1
- rasa/mantle/skills/catalog.py +15 -0
- rasa/mantle/skills/conditions.py +4 -4
- rasa/mantle/skills/markdown_skill_compiler.py +6 -6
- rasa/mantle/skills/stack_frame_helpers.py +21 -13
- rasa/mantle/skills/steps.py +42 -41
- rasa/mantle/skills/validation.py +94 -68
- rasa/mantle/state/provenance.py +1 -1
- rasa/mantle/state/repair_metadata.py +11 -11
- rasa/mantle/state/session_continuation.py +77 -0
- rasa/mantle/state/tracker_handle.py +68 -40
- rasa/mantle/tools/decorator.py +23 -18
- rasa/mantle/tools/loader.py +22 -20
- rasa/mantle/tools/mcp_meta.py +1 -1
- rasa/mantle/tools/result.py +1 -1
- rasa/mantle/tools/validation.py +31 -5
- rasa/mantle/validation.py +3 -3
- rasa/mantle/validation_finding.py +1 -1
- rasa/model_manager/config.py +18 -0
- rasa/model_manager/runner_service.py +84 -0
- rasa/privacy/mantle_anonymization.py +17 -7
- rasa/shared/constants.py +6 -0
- rasa/shared/core/constants.py +15 -1
- rasa/shared/core/events.py +107 -6
- rasa/shared/core/trackers.py +9 -6
- rasa/shared/utils/schemas/events.py +9 -1
- rasa/tracing/voice/__init__.py +8 -4
- rasa/tracing/voice/recorders/asr/connection.py +8 -6
- rasa/tracing/voice/recorders/asr/span_attributes.py +34 -17
- rasa/tracing/voice/recorders/connection.py +10 -5
- rasa/tracing/voice/recorders/reconnect.py +165 -0
- rasa/tracing/voice/recorders/tts/connection.py +6 -6
- rasa/tracing/voice/recorders/tts/span_attributes.py +6 -0
- rasa/tracing/voice/shared/semconv.py +23 -18
- rasa/version.py +1 -1
- {rasa_pro-3.22.0.dev4.dist-info → rasa_pro-3.22.0.dev5.dist-info}/METADATA +6 -4
- {rasa_pro-3.22.0.dev4.dist-info → rasa_pro-3.22.0.dev5.dist-info}/RECORD +330 -302
- rasa/api/endpoints/__init__.py +0 -7
- rasa/api/endpoints/v1/__init__.py +0 -14
- rasa/core/channels/inspector/dist/assets/architecture-7GRP2DOG-c3261b6f.js +0 -1
- rasa/core/channels/inspector/dist/assets/channel-6a478806.js +0 -1
- rasa/core/channels/inspector/dist/assets/classDiagram-ZZMXUADV-aa376894.js +0 -1
- rasa/core/channels/inspector/dist/assets/classDiagram-v2-VYDZK3BY-aa376894.js +0 -1
- rasa/core/channels/inspector/dist/assets/cynefin-OW5HDTMX-1d4764f4.js +0 -1
- rasa/core/channels/inspector/dist/assets/eventmodeling-NTZA5JFV-4198fc99.js +0 -1
- rasa/core/channels/inspector/dist/assets/flowDiagram-HODETNUW-39aa8123.js +0 -1
- rasa/core/channels/inspector/dist/assets/gitGraph-4MIJSDKK-3c8a2697.js +0 -1
- rasa/core/channels/inspector/dist/assets/info-A6RAGUB7-b357205e.js +0 -1
- rasa/core/channels/inspector/dist/assets/packet-AYTQ26CC-a0566fcd.js +0 -1
- rasa/core/channels/inspector/dist/assets/pie-WAS4IAKB-2c914674.js +0 -1
- rasa/core/channels/inspector/dist/assets/radar-RG4KPBEZ-250e6275.js +0 -1
- rasa/core/channels/inspector/dist/assets/railroad-74A4TZTK-2e6a515c.js +0 -1
- rasa/core/channels/inspector/dist/assets/railroad-abnf-HS5TGJTU-d87728ed.js +0 -1
- rasa/core/channels/inspector/dist/assets/railroad-ebnf-LZEXJU2U-80278ef8.js +0 -1
- rasa/core/channels/inspector/dist/assets/railroad-peg-WCYAUIDC-0976b887.js +0 -1
- rasa/core/channels/inspector/dist/assets/stateDiagram-v2-MP3YSRHH-868b26bc.js +0 -1
- rasa/core/channels/inspector/dist/assets/swimlanesDiagram-VR7AAH4N-56dce0e5.js +0 -8
- rasa/core/channels/inspector/dist/assets/treeView-Q6P3EWNA-865c6aae.js +0 -1
- rasa/core/channels/inspector/dist/assets/treemap-WGGIJYW6-25956d6c.js +0 -1
- rasa/core/channels/inspector/dist/assets/wardley-WFR3VGLG-99c5646c.js +0 -1
- rasa/mantle/hooks/outgoing_text.py +0 -82
- rasa/tracing/voice/recorders/call_recording.py +0 -118
- {rasa_pro-3.22.0.dev4.dist-info → rasa_pro-3.22.0.dev5.dist-info}/WHEEL +0 -0
- {rasa_pro-3.22.0.dev4.dist-info → rasa_pro-3.22.0.dev5.dist-info}/entry_points.txt +0 -0
- {rasa_pro-3.22.0.dev4.dist-info → rasa_pro-3.22.0.dev5.dist-info}/licenses/NOTICE +0 -0
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
"""Shared class resolution for Mantle ``rasa.api.<stage>._factory`` modules.
|
|
2
|
+
|
|
3
|
+
Every stage factory turns an ``integrations.yml`` type into a class: a builtin
|
|
4
|
+
short name, or a ``module.path.ClassName`` import path that is then checked
|
|
5
|
+
against the published contract. The lookup, the import, and the contract
|
|
6
|
+
checks several stages repeat live here so they cannot drift. Which methods a
|
|
7
|
+
stage requires and how an instance is constructed stay in the stage factory.
|
|
8
|
+
|
|
9
|
+
This module resolves classes only. The Mantle agent-load entrypoint that calls
|
|
10
|
+
the stage factories is ``rasa.mantle.config.integration_factory``.
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
from __future__ import annotations
|
|
14
|
+
|
|
15
|
+
import importlib
|
|
16
|
+
from collections.abc import Callable, Iterable, Mapping
|
|
17
|
+
from dataclasses import dataclass
|
|
18
|
+
from typing import Any
|
|
19
|
+
|
|
20
|
+
from rasa.api.versioning import (
|
|
21
|
+
AmbiguousApiVersionError,
|
|
22
|
+
ResolvedApiVersion,
|
|
23
|
+
UnknownApiVersionError,
|
|
24
|
+
current_version,
|
|
25
|
+
resolve_version,
|
|
26
|
+
)
|
|
27
|
+
from rasa.shared.exceptions import RasaException
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
@dataclass(frozen=True)
|
|
31
|
+
class ResolveErrors:
|
|
32
|
+
"""Exception types raised for each way an import path can fail to resolve.
|
|
33
|
+
|
|
34
|
+
Stages raise ``RasaException`` throughout. Knowledge stores keep the
|
|
35
|
+
built-in exception types their published factory has always raised.
|
|
36
|
+
"""
|
|
37
|
+
|
|
38
|
+
invalid_type: type[Exception] = RasaException
|
|
39
|
+
import_failed: type[Exception] = RasaException
|
|
40
|
+
not_a_class: type[Exception] = RasaException
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
_RASA_ERRORS = ResolveErrors()
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def import_version_module(
|
|
47
|
+
component: str,
|
|
48
|
+
name: str,
|
|
49
|
+
*,
|
|
50
|
+
version: str | None = None,
|
|
51
|
+
) -> Any:
|
|
52
|
+
"""Import ``rasa.api.<component>.<version>.<name>``.
|
|
53
|
+
|
|
54
|
+
``version`` defaults to the current published version of ``component``.
|
|
55
|
+
"""
|
|
56
|
+
resolved = version or current_version(component)
|
|
57
|
+
return importlib.import_module(f"rasa.api.{component}.{resolved}.{name}")
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def import_version_base(component: str, *, version: str | None = None) -> Any:
|
|
61
|
+
"""Import the published ``base`` module for ``component``."""
|
|
62
|
+
return import_version_module(component, "base", version=version)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def resolve_integration_class(
|
|
66
|
+
config_type: str,
|
|
67
|
+
*,
|
|
68
|
+
kind: str,
|
|
69
|
+
load_builtins: Callable[[], Mapping[str, type]],
|
|
70
|
+
validate: Callable[[type, str], None],
|
|
71
|
+
errors: ResolveErrors = _RASA_ERRORS,
|
|
72
|
+
) -> type:
|
|
73
|
+
"""Resolve a builtin short name or a ``module.path.ClassName`` import path.
|
|
74
|
+
|
|
75
|
+
A name without a dot is looked up among the builtins. Anything else is
|
|
76
|
+
imported and handed to ``validate``. Builtins are returned unvalidated;
|
|
77
|
+
a factory that also validates builtins does so itself.
|
|
78
|
+
|
|
79
|
+
Args:
|
|
80
|
+
config_type: Builtin short name or dotted import path.
|
|
81
|
+
kind: Human-readable kind used in error messages (for example
|
|
82
|
+
``lock store``).
|
|
83
|
+
load_builtins: Returns the short name → class map for the current
|
|
84
|
+
version. Called only for a name without a dot, so an import path
|
|
85
|
+
never imports the builtin backends.
|
|
86
|
+
validate: Checks an imported class against the stage contract and
|
|
87
|
+
raises when it does not satisfy it. Receives the class and
|
|
88
|
+
``config_type``.
|
|
89
|
+
errors: Exception types for the three import failures.
|
|
90
|
+
|
|
91
|
+
Raises:
|
|
92
|
+
Exception: The matching type from ``errors`` when ``config_type`` is
|
|
93
|
+
neither a builtin nor an import path, when its module cannot be
|
|
94
|
+
imported, or when the name is not a class. Whatever ``validate``
|
|
95
|
+
raises propagates unchanged.
|
|
96
|
+
"""
|
|
97
|
+
if "." not in config_type:
|
|
98
|
+
builtin = load_builtins().get(config_type.lower())
|
|
99
|
+
if builtin is not None:
|
|
100
|
+
return builtin
|
|
101
|
+
|
|
102
|
+
try:
|
|
103
|
+
module_name, class_name = config_type.rsplit(".", 1)
|
|
104
|
+
module = importlib.import_module(module_name)
|
|
105
|
+
except ValueError as error:
|
|
106
|
+
raise errors.invalid_type(
|
|
107
|
+
f"Invalid {kind} type '{config_type}'. "
|
|
108
|
+
f"Expected a builtin name ({', '.join(sorted(load_builtins()))}) "
|
|
109
|
+
f"or module.path.ClassName."
|
|
110
|
+
) from error
|
|
111
|
+
except ModuleNotFoundError as error:
|
|
112
|
+
raise errors.import_failed(
|
|
113
|
+
f"Cannot retrieve class from path {config_type}."
|
|
114
|
+
) from error
|
|
115
|
+
|
|
116
|
+
external_class = getattr(module, class_name, None)
|
|
117
|
+
if not isinstance(external_class, type):
|
|
118
|
+
raise errors.not_a_class(f"{config_type} did not resolve to a class.")
|
|
119
|
+
|
|
120
|
+
validate(external_class, config_type)
|
|
121
|
+
return external_class
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
def require_published_version(
|
|
125
|
+
cls: type,
|
|
126
|
+
component: str,
|
|
127
|
+
*,
|
|
128
|
+
message: str,
|
|
129
|
+
error_type: type[Exception] = RasaException,
|
|
130
|
+
) -> ResolvedApiVersion:
|
|
131
|
+
"""Resolve the published version of ``cls`` or raise ``error_type``.
|
|
132
|
+
|
|
133
|
+
Use this where a stage reports an unversioned or ambiguous class in its
|
|
134
|
+
own words. A stage that lets the versioning errors through calls
|
|
135
|
+
``resolve_version`` directly.
|
|
136
|
+
"""
|
|
137
|
+
try:
|
|
138
|
+
return resolve_version(cls, component)
|
|
139
|
+
except (UnknownApiVersionError, AmbiguousApiVersionError) as error:
|
|
140
|
+
raise error_type(message) from error
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
def require_version_base(
|
|
144
|
+
cls: type,
|
|
145
|
+
resolved: ResolvedApiVersion,
|
|
146
|
+
base_attr: str,
|
|
147
|
+
*,
|
|
148
|
+
config_type: str,
|
|
149
|
+
) -> type:
|
|
150
|
+
"""Require ``cls`` to subclass ``base_attr`` of its own published version.
|
|
151
|
+
|
|
152
|
+
A class can resolve to a version through any published type, such as a
|
|
153
|
+
storage port. This checks it against the base customers are meant to
|
|
154
|
+
subclass, and returns that base.
|
|
155
|
+
"""
|
|
156
|
+
version_base: type = getattr(
|
|
157
|
+
import_version_base(resolved.component, version=resolved.version),
|
|
158
|
+
base_attr,
|
|
159
|
+
)
|
|
160
|
+
if not issubclass(cls, version_base):
|
|
161
|
+
raise RasaException(
|
|
162
|
+
f"{config_type} must be a subclass of "
|
|
163
|
+
f"rasa.api.{resolved.component}.{resolved.version}.{base_attr}."
|
|
164
|
+
)
|
|
165
|
+
return version_base
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
def reject_compatibility_bases(
|
|
169
|
+
cls: type,
|
|
170
|
+
resolved: ResolvedApiVersion,
|
|
171
|
+
*,
|
|
172
|
+
config_type: str,
|
|
173
|
+
contract: str,
|
|
174
|
+
) -> None:
|
|
175
|
+
"""Reject a class that reaches the published contract through ``rasa.core``.
|
|
176
|
+
|
|
177
|
+
The ``rasa.core`` classes that subclass a published base are compatibility
|
|
178
|
+
shims for the other engine. A Mantle customization subclasses the published
|
|
179
|
+
contract directly.
|
|
180
|
+
"""
|
|
181
|
+
matched_base_index = cls.__mro__.index(resolved.matched_base)
|
|
182
|
+
if any(
|
|
183
|
+
base.__module__.startswith("rasa.core.")
|
|
184
|
+
for base in cls.__mro__[:matched_base_index]
|
|
185
|
+
):
|
|
186
|
+
raise RasaException(
|
|
187
|
+
f"{config_type} must subclass the published "
|
|
188
|
+
f"rasa.api.{resolved.component}.{resolved.version} {contract} "
|
|
189
|
+
"contract, not an internal compatibility class."
|
|
190
|
+
)
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
def require_implemented(
|
|
194
|
+
cls: type,
|
|
195
|
+
base: type,
|
|
196
|
+
method_names: Iterable[str],
|
|
197
|
+
*,
|
|
198
|
+
config_type: str,
|
|
199
|
+
) -> None:
|
|
200
|
+
"""Require ``cls`` to override each named method of ``base``.
|
|
201
|
+
|
|
202
|
+
Raised before construction, so a class that inherits an abstract method is
|
|
203
|
+
reported without running customer code.
|
|
204
|
+
"""
|
|
205
|
+
for method_name in method_names:
|
|
206
|
+
if getattr(cls, method_name, None) is getattr(base, method_name):
|
|
207
|
+
raise RasaException(f"{config_type} must implement {method_name}().")
|
rasa/api/brokers/_factory.py
CHANGED
|
@@ -11,18 +11,19 @@ a previous version so callers receive the current interface.
|
|
|
11
11
|
|
|
12
12
|
from __future__ import annotations
|
|
13
13
|
|
|
14
|
-
import importlib
|
|
15
14
|
from typing import Any
|
|
16
15
|
|
|
17
16
|
import structlog
|
|
18
17
|
|
|
19
|
-
from rasa.api.
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
18
|
+
from rasa.api._class_resolution import (
|
|
19
|
+
import_version_base,
|
|
20
|
+
import_version_module,
|
|
21
|
+
reject_compatibility_bases,
|
|
22
|
+
require_implemented,
|
|
23
|
+
require_published_version,
|
|
24
|
+
resolve_integration_class,
|
|
25
25
|
)
|
|
26
|
+
from rasa.api.versioning import current_version, prepare_instance
|
|
26
27
|
from rasa.shared.exceptions import ConnectionException, RasaException
|
|
27
28
|
|
|
28
29
|
structlogger = structlog.get_logger()
|
|
@@ -38,12 +39,11 @@ _BUILTIN_SPECS = {
|
|
|
38
39
|
|
|
39
40
|
|
|
40
41
|
def _version_base(version: str | None = None) -> Any:
|
|
41
|
-
|
|
42
|
-
return importlib.import_module(f"rasa.api.brokers.{resolved}.base")
|
|
42
|
+
return import_version_base("brokers", version=version)
|
|
43
43
|
|
|
44
44
|
|
|
45
45
|
def _version_submodule(version: str, name: str) -> Any:
|
|
46
|
-
return
|
|
46
|
+
return import_version_module("brokers", name, version=version)
|
|
47
47
|
|
|
48
48
|
|
|
49
49
|
def builtin_types(version: str | None = None) -> dict[str, type]:
|
|
@@ -55,6 +55,17 @@ def builtin_types(version: str | None = None) -> dict[str, type]:
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
|
|
58
|
+
_BUILTIN_TYPES: dict[str, type] | None = None
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def _builtin_types_cached() -> dict[str, type]:
|
|
62
|
+
"""Load builtin broker classes once, on first use of a short name."""
|
|
63
|
+
global _BUILTIN_TYPES
|
|
64
|
+
if _BUILTIN_TYPES is None:
|
|
65
|
+
_BUILTIN_TYPES = builtin_types()
|
|
66
|
+
return _BUILTIN_TYPES
|
|
67
|
+
|
|
68
|
+
|
|
58
69
|
async def create_event_broker(
|
|
59
70
|
config_type: str | None,
|
|
60
71
|
settings: Any,
|
|
@@ -99,64 +110,31 @@ async def create_event_broker(
|
|
|
99
110
|
|
|
100
111
|
def resolve_event_broker_class(config_type: str) -> type:
|
|
101
112
|
"""Resolve a builtin name or import path to an event broker class."""
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
try:
|
|
110
|
-
module_name, class_name = config_type.rsplit(".", 1)
|
|
111
|
-
module = importlib.import_module(module_name)
|
|
112
|
-
except ValueError as error:
|
|
113
|
-
raise RasaException(
|
|
114
|
-
f"Invalid event broker type '{config_type}'. "
|
|
115
|
-
f"Expected a builtin name ({', '.join(sorted(_BUILTIN_SPECS))}) "
|
|
116
|
-
f"or module.path.ClassName."
|
|
117
|
-
) from error
|
|
118
|
-
except ModuleNotFoundError as error:
|
|
119
|
-
raise RasaException(
|
|
120
|
-
f"Cannot retrieve class from path {config_type}."
|
|
121
|
-
) from error
|
|
122
|
-
|
|
123
|
-
external_class = getattr(module, class_name, None)
|
|
124
|
-
if not isinstance(external_class, type):
|
|
125
|
-
raise RasaException(f"{config_type} did not resolve to a class.")
|
|
126
|
-
_validate_event_broker_class(external_class, config_type)
|
|
127
|
-
return external_class
|
|
113
|
+
return resolve_integration_class(
|
|
114
|
+
config_type,
|
|
115
|
+
kind="event broker",
|
|
116
|
+
load_builtins=_builtin_types_cached,
|
|
117
|
+
validate=_validate_event_broker_class,
|
|
118
|
+
)
|
|
128
119
|
|
|
129
120
|
|
|
130
121
|
def _validate_event_broker_class(broker_cls: type, config_type: str) -> None:
|
|
131
122
|
"""Validate a broker contract before running customer construction code."""
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
) from error
|
|
138
|
-
|
|
123
|
+
resolved = require_published_version(
|
|
124
|
+
broker_cls,
|
|
125
|
+
"brokers",
|
|
126
|
+
message=f"{config_type} must be a subclass of EventBroker.",
|
|
127
|
+
)
|
|
139
128
|
broker_base = _version_base(resolved.version).EventBroker
|
|
140
129
|
if not issubclass(broker_cls, broker_base):
|
|
141
130
|
raise RasaException(f"{config_type} must be a subclass of EventBroker.")
|
|
142
131
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
if compatibility_bases:
|
|
150
|
-
raise RasaException(
|
|
151
|
-
f"{config_type} must subclass the published "
|
|
152
|
-
f"rasa.api.brokers.{resolved.version} EventBroker contract, "
|
|
153
|
-
"not an internal compatibility class."
|
|
154
|
-
)
|
|
155
|
-
|
|
156
|
-
if getattr(broker_cls, "connect", None) is broker_base.connect:
|
|
157
|
-
raise RasaException(f"{config_type} must implement connect().")
|
|
158
|
-
if getattr(broker_cls, "publish", None) is broker_base.publish:
|
|
159
|
-
raise RasaException(f"{config_type} must implement publish().")
|
|
132
|
+
reject_compatibility_bases(
|
|
133
|
+
broker_cls, resolved, config_type=config_type, contract="EventBroker"
|
|
134
|
+
)
|
|
135
|
+
require_implemented(
|
|
136
|
+
broker_cls, broker_base, ("connect", "publish"), config_type=config_type
|
|
137
|
+
)
|
|
160
138
|
|
|
161
139
|
|
|
162
140
|
def _connection_errors() -> tuple[type[BaseException], ...]:
|
rasa/api/channels/_factory.py
CHANGED
|
@@ -18,25 +18,26 @@ from typing import Any
|
|
|
18
18
|
|
|
19
19
|
import structlog
|
|
20
20
|
|
|
21
|
-
from rasa.api.
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
from rasa.api._class_resolution import (
|
|
22
|
+
import_version_base,
|
|
23
|
+
import_version_module,
|
|
24
|
+
reject_compatibility_bases,
|
|
25
|
+
require_implemented,
|
|
26
|
+
require_published_version,
|
|
27
|
+
resolve_integration_class,
|
|
27
28
|
)
|
|
29
|
+
from rasa.api.versioning import current_version, prepare_instance
|
|
28
30
|
from rasa.shared.exceptions import RasaException
|
|
29
31
|
|
|
30
32
|
structlogger = structlog.get_logger()
|
|
31
33
|
|
|
32
34
|
|
|
33
35
|
def _version_base(version: str | None = None) -> Any:
|
|
34
|
-
|
|
35
|
-
return importlib.import_module(f"rasa.api.channels.{resolved}.base")
|
|
36
|
+
return import_version_base("channels", version=version)
|
|
36
37
|
|
|
37
38
|
|
|
38
39
|
def _version_submodule(version: str, name: str) -> Any:
|
|
39
|
-
return
|
|
40
|
+
return import_version_module("channels", name, version=version)
|
|
40
41
|
|
|
41
42
|
|
|
42
43
|
# Module path under the published package, then the input channel class.
|
|
@@ -137,29 +138,12 @@ def create_input_channel(
|
|
|
137
138
|
|
|
138
139
|
def resolve_input_channel_class(config_type: str) -> type:
|
|
139
140
|
"""Resolve a builtin name or import path to an input channel class."""
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
module = importlib.import_module(module_name)
|
|
147
|
-
except ValueError as error:
|
|
148
|
-
raise RasaException(
|
|
149
|
-
f"Invalid input channel type '{config_type}'. "
|
|
150
|
-
f"Expected a builtin name ({', '.join(sorted(BUILTIN_TYPES))}) "
|
|
151
|
-
f"or module.path.ClassName."
|
|
152
|
-
) from error
|
|
153
|
-
except ModuleNotFoundError as error:
|
|
154
|
-
raise RasaException(
|
|
155
|
-
f"Cannot retrieve class from path {config_type}."
|
|
156
|
-
) from error
|
|
157
|
-
|
|
158
|
-
external_class = getattr(module, class_name, None)
|
|
159
|
-
if not isinstance(external_class, type):
|
|
160
|
-
raise RasaException(f"{config_type} did not resolve to a class.")
|
|
161
|
-
_validate_input_channel_class(external_class, config_type)
|
|
162
|
-
return external_class
|
|
141
|
+
return resolve_integration_class(
|
|
142
|
+
config_type,
|
|
143
|
+
kind="input channel",
|
|
144
|
+
load_builtins=lambda: BUILTIN_TYPES,
|
|
145
|
+
validate=_validate_input_channel_class,
|
|
146
|
+
)
|
|
163
147
|
|
|
164
148
|
|
|
165
149
|
def _is_internal_short_name(config_type: str, channel_cls: type) -> bool:
|
|
@@ -182,32 +166,20 @@ def _validate_input_channel_class(
|
|
|
182
166
|
allow_internal: bool = False,
|
|
183
167
|
) -> None:
|
|
184
168
|
"""Validate a channel contract before running customer construction code."""
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
) from error
|
|
191
|
-
|
|
169
|
+
resolved = require_published_version(
|
|
170
|
+
channel_cls,
|
|
171
|
+
"channels",
|
|
172
|
+
message=f"{config_type} must be a subclass of InputChannel.",
|
|
173
|
+
)
|
|
192
174
|
input_base = _version_base(resolved.version).InputChannel
|
|
193
175
|
if not issubclass(channel_cls, input_base):
|
|
194
176
|
raise RasaException(f"{config_type} must be a subclass of InputChannel.")
|
|
195
177
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
for base in channel_cls.__mro__[:matched_base_index]
|
|
200
|
-
if base.__module__.startswith("rasa.core.")
|
|
201
|
-
]
|
|
202
|
-
if compatibility_bases and not allow_internal:
|
|
203
|
-
raise RasaException(
|
|
204
|
-
f"{config_type} must subclass the published "
|
|
205
|
-
f"rasa.api.channels.{resolved.version} InputChannel contract, "
|
|
206
|
-
"not an internal compatibility class."
|
|
178
|
+
if not allow_internal:
|
|
179
|
+
reject_compatibility_bases(
|
|
180
|
+
channel_cls, resolved, config_type=config_type, contract="InputChannel"
|
|
207
181
|
)
|
|
208
|
-
|
|
209
|
-
if getattr(channel_cls, "connect", None) is input_base.connect:
|
|
210
|
-
raise RasaException(f"{config_type} must implement connect().")
|
|
182
|
+
require_implemented(channel_cls, input_base, ("connect",), config_type=config_type)
|
|
211
183
|
if not _implements_channel_routes(channel_cls, input_base):
|
|
212
184
|
raise RasaException(f"{config_type} must implement blueprint().")
|
|
213
185
|
|
|
@@ -87,7 +87,8 @@ from rasa.core.channels.voice_stream.tts.tts_engine import (
|
|
|
87
87
|
TTSError,
|
|
88
88
|
TTSResponse,
|
|
89
89
|
)
|
|
90
|
-
from rasa.core.channels.voice_stream.
|
|
90
|
+
from rasa.core.channels.voice_stream.tts.utterance_audio import UtteranceAudio
|
|
91
|
+
from rasa.core.channels.voice_stream.util import chunk_audio, generate_silence
|
|
91
92
|
from rasa.core.voice.call_config import VoiceCallConfig
|
|
92
93
|
from rasa.core.voice.event_composition.events.constants import (
|
|
93
94
|
BOT_TEXT_METADATA_KEY,
|
|
@@ -415,10 +416,8 @@ class VoiceOutputChannel(OutputChannel):
|
|
|
415
416
|
self.recording_session: Optional[CallRecordingSession] = None
|
|
416
417
|
self.background_audio: Optional[BackgroundAudioPlayer] = None
|
|
417
418
|
|
|
418
|
-
# Correlation id
|
|
419
|
-
# distinguish its diagnostic state from stale timing data.
|
|
419
|
+
# Correlation id that ties logs across one utterance.
|
|
420
420
|
self._utterance_id: Optional[str] = None
|
|
421
|
-
self._utterance_outcome: Optional[str] = None
|
|
422
421
|
# TODO (VO-941): Group current utterance state to avoid
|
|
423
422
|
# missed resets.
|
|
424
423
|
# https://rasahq.atlassian.net/browse/VO-941
|
|
@@ -746,10 +745,16 @@ class VoiceOutputChannel(OutputChannel):
|
|
|
746
745
|
async def _stream_tts(self, recipient_id: str, response: TTSResponse) -> None:
|
|
747
746
|
"""Background task: listens to TTS audio stream and sends to channel.
|
|
748
747
|
|
|
749
|
-
This pulls audio from TTS and directly sends it to the channel.
|
|
748
|
+
This pulls audio from TTS and directly sends it to the channel. A
|
|
749
|
+
provider failure ends this utterance without failing the response.
|
|
750
750
|
"""
|
|
751
|
+
utterance_audio = UtteranceAudio(
|
|
752
|
+
audio_stream=response,
|
|
753
|
+
audio_format=self.audio_format,
|
|
754
|
+
utterance_id=self._utterance_id,
|
|
755
|
+
)
|
|
751
756
|
await self._stream_audio_to_channel(
|
|
752
|
-
recipient_id,
|
|
757
|
+
recipient_id, utterance_audio.stream(), tts_response=response
|
|
753
758
|
)
|
|
754
759
|
|
|
755
760
|
async def _synthesize_and_stream_tts(
|
|
@@ -757,21 +762,24 @@ class VoiceOutputChannel(OutputChannel):
|
|
|
757
762
|
) -> Optional[RasaAudioBytes]:
|
|
758
763
|
"""Use producer/consumer pattern to send TTS audio and collect for caching.
|
|
759
764
|
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
audio_stream = self.tts_engine.synthesize(text)
|
|
765
|
-
except TTSError as e:
|
|
766
|
-
logger.error("voice_channel.tts_synthesis_error", error=str(e))
|
|
767
|
-
voice_tracing.get_current_synthesize_speech_recorder().record_error(e)
|
|
768
|
-
# TODO: add message that works without tts, e.g. loading from disc
|
|
769
|
-
audio_stream = self.chunk_audio(generate_silence(self.audio_format))
|
|
765
|
+
A synthesis failure, whether raised up front or midway through the
|
|
766
|
+
audio, costs only this utterance: the caller hears what was produced
|
|
767
|
+
(or silence), the engine reconnects for the next one, and the call
|
|
768
|
+
goes on.
|
|
770
769
|
|
|
770
|
+
Returns:
|
|
771
|
+
The collected audio bytes for caching, or ``None`` if synthesis
|
|
772
|
+
failed, so partial audio or the silence fallback is never cached.
|
|
773
|
+
"""
|
|
774
|
+
utterance_audio = UtteranceAudio(
|
|
775
|
+
audio_stream=self.tts_engine.synthesize_utterance(text),
|
|
776
|
+
audio_format=self.audio_format,
|
|
777
|
+
utterance_id=self._utterance_id,
|
|
778
|
+
)
|
|
771
779
|
collected_audio = await self._stream_audio_to_channel(
|
|
772
|
-
recipient_id,
|
|
780
|
+
recipient_id, utterance_audio.stream()
|
|
773
781
|
)
|
|
774
|
-
return collected_audio
|
|
782
|
+
return None if utterance_audio.failed else collected_audio
|
|
775
783
|
|
|
776
784
|
async def _send_cached_audio(
|
|
777
785
|
self, recipient_id: str, cached_audio: RasaAudioBytes
|
|
@@ -939,11 +947,6 @@ class VoiceOutputChannel(OutputChannel):
|
|
|
939
947
|
except WebsocketClosed:
|
|
940
948
|
call_state.connection_failed = True
|
|
941
949
|
|
|
942
|
-
if not self.stream_interrupted:
|
|
943
|
-
self._current_response_audio_duration_ms = int(
|
|
944
|
-
sent_audio_bytes / self.audio_format.bytes_per_second * 1000
|
|
945
|
-
)
|
|
946
|
-
|
|
947
950
|
return collected_audio
|
|
948
951
|
|
|
949
952
|
async def _send_scheduled_markers(
|
|
@@ -1176,7 +1179,6 @@ class VoiceOutputChannel(OutputChannel):
|
|
|
1176
1179
|
)
|
|
1177
1180
|
)
|
|
1178
1181
|
|
|
1179
|
-
voice_tracing.get_current_synthesize_speech_recorder().record_request()
|
|
1180
1182
|
self.audio_sender_task = asyncio.create_task(
|
|
1181
1183
|
self._stream_tts(recipient_id, response)
|
|
1182
1184
|
)
|
|
@@ -1318,20 +1320,16 @@ class VoiceOutputChannel(OutputChannel):
|
|
|
1318
1320
|
synthesis_recorder.record_cache_hit(True)
|
|
1319
1321
|
self.tts_engine._note_cache_hit(text)
|
|
1320
1322
|
await self._send_cached_audio(recipient_id, cached_audio_bytes)
|
|
1321
|
-
self._utterance_outcome = "sent:cached"
|
|
1322
1323
|
else:
|
|
1323
1324
|
synthesis_recorder.record_cache_hit(False)
|
|
1324
1325
|
collected_audio = await self._synthesize_and_stream_tts(recipient_id, text)
|
|
1326
|
+
# None means synthesis failed, which UtteranceAudio already logged.
|
|
1325
1327
|
if collected_audio:
|
|
1326
1328
|
self.tts_cache.put(text, collected_audio)
|
|
1327
|
-
|
|
1328
|
-
elif self.stream_interrupted:
|
|
1329
|
-
self._utterance_outcome = "interrupted"
|
|
1330
|
-
else:
|
|
1329
|
+
elif collected_audio is not None and not self.stream_interrupted:
|
|
1331
1330
|
# Watchdog: the bot decided to speak, nothing prevented it, yet
|
|
1332
1331
|
# TTS produced zero audio — the user heard silence. Self-report
|
|
1333
1332
|
# instead of failing silently.
|
|
1334
|
-
self._utterance_outcome = "audio_missing"
|
|
1335
1333
|
logger.warning(
|
|
1336
1334
|
"voice_channel.audio_missing",
|
|
1337
1335
|
text=text,
|
|
@@ -1373,13 +1371,8 @@ class VoiceOutputChannel(OutputChannel):
|
|
|
1373
1371
|
self, audio_bytes: RasaAudioBytes, chunk_size: int = 2048
|
|
1374
1372
|
) -> AsyncIterator[RasaAudioBytes]:
|
|
1375
1373
|
"""Generate chunks from cached audio bytes."""
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
chunk = audio_bytes[offset : offset + chunk_size]
|
|
1379
|
-
if len(chunk):
|
|
1380
|
-
yield chunk
|
|
1381
|
-
offset += chunk_size
|
|
1382
|
-
return
|
|
1374
|
+
async for chunk in chunk_audio(audio_bytes, chunk_size):
|
|
1375
|
+
yield chunk
|
|
1383
1376
|
|
|
1384
1377
|
async def hangup(self, recipient_id: str, **kwargs: Any) -> None:
|
|
1385
1378
|
voice_tracing.get_current_call_root_span().record_hangup_requested()
|
|
@@ -1639,12 +1632,9 @@ class VoiceInputChannel(InputChannel):
|
|
|
1639
1632
|
self,
|
|
1640
1633
|
input_queue: ConversationQueue[VoiceInputEvent],
|
|
1641
1634
|
call_parameters: CallParameters,
|
|
1642
|
-
recording_metadata: Optional[Dict[str, Any]] = None,
|
|
1643
1635
|
) -> None:
|
|
1644
1636
|
"""Start a voice session by enqueuing a SessionStartedInputEvent."""
|
|
1645
1637
|
metadata = self.build_turn_metadata(call_parameters)
|
|
1646
|
-
if recording_metadata is not None:
|
|
1647
|
-
metadata["recording"] = recording_metadata
|
|
1648
1638
|
event = SessionStartedInputEvent(
|
|
1649
1639
|
metadata=metadata,
|
|
1650
1640
|
)
|
|
@@ -1847,6 +1837,7 @@ class VoiceInputChannel(InputChannel):
|
|
|
1847
1837
|
conversation_id=sender_id,
|
|
1848
1838
|
call_parameters=call_parameters,
|
|
1849
1839
|
audio_format=self.audio_format,
|
|
1840
|
+
event_broker=agent.event_broker,
|
|
1850
1841
|
)
|
|
1851
1842
|
|
|
1852
1843
|
# Open the root span for this streaming session.
|
|
@@ -1980,13 +1971,7 @@ class VoiceInputChannel(InputChannel):
|
|
|
1980
1971
|
)
|
|
1981
1972
|
|
|
1982
1973
|
# Send session start event
|
|
1983
|
-
await self.start_session(
|
|
1984
|
-
input_queue,
|
|
1985
|
-
call_parameters,
|
|
1986
|
-
recording_session.started_metadata
|
|
1987
|
-
if recording_session
|
|
1988
|
-
else None,
|
|
1989
|
-
)
|
|
1974
|
+
await self.start_session(input_queue, call_parameters)
|
|
1990
1975
|
voice_tracing.get_current_call_root_span().record_call_started()
|
|
1991
1976
|
|
|
1992
1977
|
io_tasks = [
|
|
@@ -2181,13 +2166,7 @@ class VoiceInputChannel(InputChannel):
|
|
|
2181
2166
|
)
|
|
2182
2167
|
|
|
2183
2168
|
try:
|
|
2184
|
-
await self.start_session(
|
|
2185
|
-
input_queue,
|
|
2186
|
-
call_parameters,
|
|
2187
|
-
recording_session.started_metadata
|
|
2188
|
-
if recording_session
|
|
2189
|
-
else None,
|
|
2190
|
-
)
|
|
2169
|
+
await self.start_session(input_queue, call_parameters)
|
|
2191
2170
|
voice_tracing.get_current_call_root_span().record_call_started()
|
|
2192
2171
|
await asyncio.wait_for(
|
|
2193
2172
|
output_channel.wait_until_session_ready(), timeout=30.0
|