rasa-pro 3.13.0.dev5__py3-none-any.whl → 3.13.0.dev8__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.
Potentially problematic release.
This version of rasa-pro might be problematic. Click here for more details.
- rasa/__main__.py +0 -3
- rasa/api.py +5 -1
- rasa/cli/arguments/default_arguments.py +13 -1
- rasa/cli/arguments/train.py +2 -0
- rasa/cli/dialogue_understanding_test.py +1 -1
- rasa/cli/e2e_test.py +1 -1
- rasa/cli/evaluate.py +2 -2
- rasa/cli/export.py +3 -3
- rasa/cli/llm_fine_tuning.py +12 -11
- rasa/cli/project_templates/defaults.py +133 -0
- rasa/cli/run.py +1 -1
- rasa/cli/studio/link.py +53 -0
- rasa/cli/studio/pull.py +78 -0
- rasa/cli/studio/push.py +78 -0
- rasa/cli/studio/studio.py +12 -0
- rasa/cli/studio/upload.py +8 -0
- rasa/cli/train.py +2 -1
- rasa/cli/utils.py +1 -1
- rasa/cli/x.py +1 -1
- rasa/constants.py +4 -0
- rasa/core/__init__.py +0 -16
- rasa/core/actions/action.py +5 -1
- rasa/core/actions/action_repeat_bot_messages.py +18 -22
- rasa/core/actions/action_run_slot_rejections.py +0 -1
- rasa/core/agent.py +18 -3
- rasa/core/available_endpoints.py +146 -0
- rasa/core/brokers/kafka.py +4 -0
- rasa/core/brokers/pika.py +5 -2
- rasa/core/brokers/sql.py +1 -1
- rasa/core/channels/botframework.py +2 -2
- rasa/core/channels/channel.py +2 -2
- rasa/core/channels/hangouts.py +8 -5
- rasa/core/channels/inspector/.eslintrc.cjs +12 -6
- rasa/core/channels/inspector/.prettierrc +5 -0
- rasa/core/channels/inspector/README.md +10 -4
- rasa/core/channels/inspector/dist/assets/{arc-9f75cc3b.js → arc-c4b064fc.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{blockDiagram-38ab4fdb-7f34db23.js → blockDiagram-38ab4fdb-215b5026.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{c4Diagram-3d4e48cf-948bab2c.js → c4Diagram-3d4e48cf-2b54a0a3.js} +1 -1
- rasa/core/channels/inspector/dist/assets/channel-3730f5fd.js +1 -0
- rasa/core/channels/inspector/dist/assets/{classDiagram-70f12bd4-53b0dd0e.js → classDiagram-70f12bd4-daacea5f.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{classDiagram-v2-f2320105-fdf789e7.js → classDiagram-v2-f2320105-930d4dc2.js} +1 -1
- rasa/core/channels/inspector/dist/assets/clone-e847561e.js +1 -0
- rasa/core/channels/inspector/dist/assets/{createText-2e5e7dd3-87c4ece5.js → createText-2e5e7dd3-83c206ba.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{edges-e0da2a9e-5a8b0749.js → edges-e0da2a9e-b0eb01d0.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{erDiagram-9861fffd-66da90e2.js → erDiagram-9861fffd-17586500.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{flowDb-956e92f1-10044f05.js → flowDb-956e92f1-be2a1776.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{flowDiagram-66a62f08-f338f66a.js → flowDiagram-66a62f08-c2120ebd.js} +1 -1
- rasa/core/channels/inspector/dist/assets/flowDiagram-v2-96b9c2cf-efbbfe00.js +1 -0
- rasa/core/channels/inspector/dist/assets/{flowchart-elk-definition-4a651766-b13140aa.js → flowchart-elk-definition-4a651766-a6ab5c48.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{ganttDiagram-c361ad54-f2b4a55a.js → ganttDiagram-c361ad54-ef613457.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{gitGraphDiagram-72cf32ee-dedc298d.js → gitGraphDiagram-72cf32ee-d59185b3.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{graph-4ede11ff.js → graph-0f155405.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{index-3862675e-65549d37.js → index-3862675e-d5f1d1b7.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{index-3a23e736.js → index-47737d3a.js} +123 -123
- rasa/core/channels/inspector/dist/assets/{infoDiagram-f8f76790-65439671.js → infoDiagram-f8f76790-b07d141f.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{journeyDiagram-49397b02-56d03d98.js → journeyDiagram-49397b02-1936d429.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{layout-dd48f7f4.js → layout-dde8d0f3.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{line-1569ad2c.js → line-0c2c7ee0.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{linear-48bf4935.js → linear-35dd89a4.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{mindmap-definition-fc14e90a-688504c1.js → mindmap-definition-fc14e90a-56192851.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{pieDiagram-8a3498a8-78b6d7e6.js → pieDiagram-8a3498a8-fc21ed78.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{quadrantDiagram-120e2f19-048b84b3.js → quadrantDiagram-120e2f19-25e98518.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{requirementDiagram-deff3bca-dd67f107.js → requirementDiagram-deff3bca-546ff1f5.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{sankeyDiagram-04a897e0-8128436e.js → sankeyDiagram-04a897e0-02d8b82d.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{sequenceDiagram-704730f1-1a0d1461.js → sequenceDiagram-704730f1-3ca5a92e.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{stateDiagram-587899a1-46d388ed.js → stateDiagram-587899a1-128ea07c.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{stateDiagram-v2-d93cdb3a-ea42951a.js → stateDiagram-v2-d93cdb3a-95f290af.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{styles-6aaf32cf-7427ed0c.js → styles-6aaf32cf-4984898a.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{styles-9a916d00-ff5e5a16.js → styles-9a916d00-1bf266ba.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{styles-c10674c1-7b3680cf.js → styles-c10674c1-60521c63.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{svgDrawCommon-08f97a94-f860f2ad.js → svgDrawCommon-08f97a94-a25b6e12.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{timeline-definition-85554ec2-2eebf0c8.js → timeline-definition-85554ec2-0fc086bf.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{xychartDiagram-e933f94c-5d7f4e96.js → xychartDiagram-e933f94c-44ee592e.js} +1 -1
- rasa/core/channels/inspector/dist/index.html +1 -1
- rasa/core/channels/inspector/package.json +3 -1
- rasa/core/channels/inspector/src/App.tsx +91 -90
- rasa/core/channels/inspector/src/components/Chat.tsx +45 -41
- rasa/core/channels/inspector/src/components/DiagramFlow.tsx +40 -40
- rasa/core/channels/inspector/src/components/DialogueInformation.tsx +57 -57
- rasa/core/channels/inspector/src/components/DialogueStack.tsx +36 -27
- rasa/core/channels/inspector/src/components/ExpandIcon.tsx +4 -4
- rasa/core/channels/inspector/src/components/FullscreenButton.tsx +7 -7
- rasa/core/channels/inspector/src/components/LoadingSpinner.tsx +28 -12
- rasa/core/channels/inspector/src/components/NoActiveFlow.tsx +9 -9
- rasa/core/channels/inspector/src/components/RasaLogo.tsx +5 -5
- rasa/core/channels/inspector/src/components/RecruitmentPanel.tsx +55 -60
- rasa/core/channels/inspector/src/components/SaraDiagrams.tsx +5 -5
- rasa/core/channels/inspector/src/components/Slots.tsx +22 -22
- rasa/core/channels/inspector/src/components/Welcome.tsx +28 -31
- rasa/core/channels/inspector/src/helpers/audio/audiostream.ts +245 -0
- rasa/core/channels/inspector/src/helpers/audio/microphone-processor.js +12 -0
- rasa/core/channels/inspector/src/helpers/audio/playback-processor.js +36 -0
- rasa/core/channels/inspector/src/helpers/conversation.ts +7 -7
- rasa/core/channels/inspector/src/helpers/formatters.test.ts +181 -181
- rasa/core/channels/inspector/src/helpers/formatters.ts +111 -111
- rasa/core/channels/inspector/src/helpers/utils.ts +78 -61
- rasa/core/channels/inspector/src/main.tsx +8 -8
- rasa/core/channels/inspector/src/theme/Button/Button.ts +8 -8
- rasa/core/channels/inspector/src/theme/Heading/Heading.ts +7 -7
- rasa/core/channels/inspector/src/theme/Input/Input.ts +9 -9
- rasa/core/channels/inspector/src/theme/Link/Link.ts +6 -6
- rasa/core/channels/inspector/src/theme/Modal/Modal.ts +13 -13
- rasa/core/channels/inspector/src/theme/Table/Table.tsx +10 -10
- rasa/core/channels/inspector/src/theme/Tooltip/Tooltip.ts +5 -5
- rasa/core/channels/inspector/src/theme/base/breakpoints.ts +7 -7
- rasa/core/channels/inspector/src/theme/base/colors.ts +64 -64
- rasa/core/channels/inspector/src/theme/base/fonts/fontFaces.css +21 -18
- rasa/core/channels/inspector/src/theme/base/radii.ts +8 -8
- rasa/core/channels/inspector/src/theme/base/shadows.ts +5 -5
- rasa/core/channels/inspector/src/theme/base/sizes.ts +5 -5
- rasa/core/channels/inspector/src/theme/base/space.ts +12 -12
- rasa/core/channels/inspector/src/theme/base/styles.ts +5 -5
- rasa/core/channels/inspector/src/theme/base/typography.ts +12 -12
- rasa/core/channels/inspector/src/theme/base/zIndices.ts +3 -3
- rasa/core/channels/inspector/src/theme/index.ts +38 -38
- rasa/core/channels/inspector/src/types.ts +56 -50
- rasa/core/channels/inspector/yarn.lock +5 -0
- rasa/core/channels/mattermost.py +1 -1
- rasa/core/channels/rasa_chat.py +2 -4
- rasa/core/channels/rest.py +5 -4
- rasa/core/channels/studio_chat.py +3 -2
- rasa/core/channels/vier_cvg.py +1 -2
- rasa/core/channels/voice_ready/audiocodes.py +35 -25
- rasa/core/channels/voice_stream/audiocodes.py +7 -4
- rasa/core/channels/voice_stream/genesys.py +2 -2
- rasa/core/channels/voice_stream/twilio_media_streams.py +10 -5
- rasa/core/channels/voice_stream/voice_channel.py +33 -22
- rasa/core/evaluation/marker_tracker_loader.py +1 -1
- rasa/core/exporter.py +1 -1
- rasa/core/http_interpreter.py +3 -7
- rasa/core/jobs.py +2 -1
- rasa/core/nlg/contextual_response_rephraser.py +38 -11
- rasa/core/nlg/generator.py +0 -1
- rasa/core/nlg/interpolator.py +2 -3
- rasa/core/nlg/summarize.py +40 -6
- rasa/core/persistor.py +55 -20
- rasa/core/policies/enterprise_search_policy.py +290 -66
- rasa/core/policies/enterprise_search_prompt_with_relevancy_check_and_citation_template.jinja2 +63 -0
- rasa/core/policies/flow_policy.py +1 -1
- rasa/core/policies/flows/flow_executor.py +96 -17
- rasa/core/policies/intentless_policy.py +24 -16
- rasa/core/processor.py +106 -53
- rasa/core/run.py +40 -13
- rasa/core/tracker_stores/__init__.py +0 -0
- rasa/core/{auth_retry_tracker_store.py → tracker_stores/auth_retry_tracker_store.py} +5 -1
- rasa/core/tracker_stores/dynamo_tracker_store.py +218 -0
- rasa/core/tracker_stores/mongo_tracker_store.py +206 -0
- rasa/core/tracker_stores/redis_tracker_store.py +219 -0
- rasa/core/tracker_stores/sql_tracker_store.py +555 -0
- rasa/core/tracker_stores/tracker_store.py +805 -0
- rasa/core/training/interactive.py +1 -1
- rasa/core/utils.py +24 -91
- rasa/dialogue_understanding/coexistence/intent_based_router.py +2 -1
- rasa/dialogue_understanding/coexistence/llm_based_router.py +8 -3
- rasa/dialogue_understanding/commands/can_not_handle_command.py +2 -0
- rasa/dialogue_understanding/commands/cancel_flow_command.py +2 -0
- rasa/dialogue_understanding/commands/chit_chat_answer_command.py +2 -0
- rasa/dialogue_understanding/commands/clarify_command.py +6 -2
- rasa/dialogue_understanding/commands/command_syntax_manager.py +1 -0
- rasa/dialogue_understanding/commands/human_handoff_command.py +2 -0
- rasa/dialogue_understanding/commands/knowledge_answer_command.py +2 -0
- rasa/dialogue_understanding/commands/repeat_bot_messages_command.py +2 -0
- rasa/dialogue_understanding/commands/set_slot_command.py +11 -1
- rasa/dialogue_understanding/commands/skip_question_command.py +2 -0
- rasa/dialogue_understanding/commands/start_flow_command.py +4 -0
- rasa/dialogue_understanding/commands/utils.py +26 -2
- rasa/dialogue_understanding/generator/__init__.py +7 -1
- rasa/dialogue_understanding/generator/command_generator.py +4 -2
- rasa/dialogue_understanding/generator/command_parser.py +2 -2
- rasa/dialogue_understanding/generator/command_parser_validator.py +63 -0
- rasa/dialogue_understanding/generator/constants.py +2 -2
- rasa/dialogue_understanding/generator/llm_based_command_generator.py +1 -1
- rasa/dialogue_understanding/generator/prompt_templates/command_prompt_v3_gpt_4o_2024_11_20_template.jinja2 +78 -0
- rasa/dialogue_understanding/generator/single_step/compact_llm_command_generator.py +28 -463
- rasa/dialogue_understanding/generator/single_step/search_ready_llm_command_generator.py +147 -0
- rasa/dialogue_understanding/generator/single_step/single_step_based_llm_command_generator.py +477 -0
- rasa/dialogue_understanding/generator/single_step/single_step_llm_command_generator.py +8 -58
- rasa/dialogue_understanding/patterns/default_flows_for_patterns.yml +37 -25
- rasa/dialogue_understanding/patterns/domain_for_patterns.py +190 -0
- rasa/dialogue_understanding/processor/command_processor.py +3 -3
- rasa/dialogue_understanding/processor/command_processor_component.py +3 -3
- rasa/dialogue_understanding/stack/frames/flow_stack_frame.py +17 -4
- rasa/dialogue_understanding/utils.py +68 -12
- rasa/dialogue_understanding_test/du_test_case.py +1 -1
- rasa/dialogue_understanding_test/du_test_runner.py +4 -22
- rasa/dialogue_understanding_test/test_case_simulation/test_case_tracker_simulator.py +2 -6
- rasa/e2e_test/e2e_test_runner.py +1 -1
- rasa/engine/constants.py +1 -1
- rasa/engine/recipes/default_recipe.py +26 -2
- rasa/engine/validation.py +3 -2
- rasa/hooks.py +2 -30
- rasa/keys +1 -0
- rasa/llm_fine_tuning/annotation_module.py +39 -9
- rasa/llm_fine_tuning/conversations.py +3 -0
- rasa/llm_fine_tuning/llm_data_preparation_module.py +66 -49
- rasa/llm_fine_tuning/paraphrasing/conversation_rephraser.py +4 -2
- rasa/llm_fine_tuning/paraphrasing/rephrase_validator.py +52 -44
- rasa/llm_fine_tuning/paraphrasing_module.py +10 -12
- rasa/llm_fine_tuning/storage.py +4 -4
- rasa/llm_fine_tuning/utils.py +63 -1
- rasa/model_manager/config.py +3 -1
- rasa/model_manager/model_api.py +89 -2
- rasa/model_manager/runner_service.py +8 -4
- rasa/model_manager/trainer_service.py +5 -4
- rasa/model_training.py +12 -3
- rasa/nlu/extractors/crf_entity_extractor.py +66 -16
- rasa/plugin.py +2 -12
- rasa/privacy/__init__.py +0 -0
- rasa/privacy/constants.py +83 -0
- rasa/privacy/event_broker_utils.py +77 -0
- rasa/privacy/privacy_config.py +281 -0
- rasa/privacy/privacy_config_schema.json +86 -0
- rasa/privacy/privacy_filter.py +340 -0
- rasa/privacy/privacy_manager.py +576 -0
- rasa/server.py +29 -4
- rasa/shared/constants.py +6 -0
- rasa/shared/core/constants.py +4 -3
- rasa/shared/core/domain.py +7 -0
- rasa/shared/core/events.py +99 -3
- rasa/shared/core/flows/flow.py +1 -2
- rasa/shared/core/flows/flows_yaml_schema.json +3 -0
- rasa/shared/core/flows/steps/collect.py +46 -2
- rasa/shared/core/slots.py +28 -0
- rasa/shared/exceptions.py +4 -0
- rasa/shared/providers/_configs/azure_openai_client_config.py +4 -0
- rasa/shared/providers/_configs/openai_client_config.py +4 -0
- rasa/shared/providers/embedding/_base_litellm_embedding_client.py +3 -0
- rasa/shared/providers/llm/_base_litellm_client.py +5 -2
- rasa/shared/utils/llm.py +161 -6
- rasa/shared/utils/yaml.py +32 -0
- rasa/studio/data_handler.py +3 -3
- rasa/studio/download/download.py +37 -60
- rasa/studio/download/flows.py +23 -31
- rasa/studio/link.py +200 -0
- rasa/studio/pull.py +94 -0
- rasa/studio/push.py +131 -0
- rasa/studio/upload.py +117 -67
- rasa/telemetry.py +84 -27
- rasa/tracing/config.py +4 -5
- rasa/tracing/constants.py +19 -1
- rasa/tracing/instrumentation/attribute_extractors.py +11 -3
- rasa/tracing/instrumentation/instrumentation.py +54 -3
- rasa/tracing/instrumentation/metrics.py +98 -15
- rasa/tracing/metric_instrument_provider.py +75 -3
- rasa/utils/common.py +1 -27
- rasa/utils/licensing.py +1 -2
- rasa/utils/log_utils.py +1 -45
- rasa/validator.py +2 -8
- rasa/version.py +1 -1
- {rasa_pro-3.13.0.dev5.dist-info → rasa_pro-3.13.0.dev8.dist-info}/METADATA +8 -9
- {rasa_pro-3.13.0.dev5.dist-info → rasa_pro-3.13.0.dev8.dist-info}/RECORD +254 -231
- rasa/anonymization/__init__.py +0 -2
- rasa/anonymization/anonymisation_rule_yaml_reader.py +0 -91
- rasa/anonymization/anonymization_pipeline.py +0 -286
- rasa/anonymization/anonymization_rule_executor.py +0 -266
- rasa/anonymization/anonymization_rule_orchestrator.py +0 -119
- rasa/anonymization/schemas/config.yml +0 -47
- rasa/anonymization/utils.py +0 -118
- rasa/core/channels/inspector/dist/assets/channel-dfa68278.js +0 -1
- rasa/core/channels/inspector/dist/assets/clone-edb7f119.js +0 -1
- rasa/core/channels/inspector/dist/assets/flowDiagram-v2-96b9c2cf-65e7c670.js +0 -1
- rasa/core/channels/inspector/src/helpers/audiostream.ts +0 -191
- rasa/core/tracker_store.py +0 -1792
- {rasa_pro-3.13.0.dev5.dist-info → rasa_pro-3.13.0.dev8.dist-info}/NOTICE +0 -0
- {rasa_pro-3.13.0.dev5.dist-info → rasa_pro-3.13.0.dev8.dist-info}/WHEEL +0 -0
- {rasa_pro-3.13.0.dev5.dist-info → rasa_pro-3.13.0.dev8.dist-info}/entry_points.txt +0 -0
rasa/shared/core/domain.py
CHANGED
|
@@ -32,6 +32,7 @@ from ruamel.yaml.scalarstring import DoubleQuotedScalarString
|
|
|
32
32
|
import rasa.shared.core.slot_mappings
|
|
33
33
|
import rasa.shared.utils.common
|
|
34
34
|
import rasa.shared.utils.io
|
|
35
|
+
from rasa.core.available_endpoints import AvailableEndpoints
|
|
35
36
|
from rasa.shared.constants import (
|
|
36
37
|
DEFAULT_CARRY_OVER_SLOTS_TO_NEW_SESSION,
|
|
37
38
|
DEFAULT_SESSION_EXPIRATION_TIME_IN_MINUTES,
|
|
@@ -48,6 +49,7 @@ from rasa.shared.core.constants import (
|
|
|
48
49
|
ACTION_SHOULD_SEND_DOMAIN,
|
|
49
50
|
KEY_MAPPING_TYPE,
|
|
50
51
|
KNOWLEDGE_BASE_SLOT_NAMES,
|
|
52
|
+
SILENCE_TIMEOUT_SLOT,
|
|
51
53
|
SLOT_MAPPINGS,
|
|
52
54
|
SlotMappingType,
|
|
53
55
|
)
|
|
@@ -306,6 +308,11 @@ class Domain:
|
|
|
306
308
|
responses = data.get(KEY_RESPONSES, {})
|
|
307
309
|
|
|
308
310
|
domain_slots = data.get(KEY_SLOTS, {})
|
|
311
|
+
for slot_name, slot in domain_slots.items():
|
|
312
|
+
if slot_name == SILENCE_TIMEOUT_SLOT:
|
|
313
|
+
slot["initial_value"] = (
|
|
314
|
+
AvailableEndpoints.get_instance().interaction_handling.global_silence_timeout
|
|
315
|
+
)
|
|
309
316
|
slots = cls.collect_slots(domain_slots)
|
|
310
317
|
domain_actions = data.get(KEY_ACTIONS, [])
|
|
311
318
|
actions = cls._collect_action_names(domain_actions)
|
rasa/shared/core/events.py
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
1
3
|
import abc
|
|
2
4
|
import copy
|
|
3
5
|
import json
|
|
@@ -6,7 +8,7 @@ import re
|
|
|
6
8
|
import time
|
|
7
9
|
import uuid
|
|
8
10
|
from abc import ABC
|
|
9
|
-
from datetime import datetime
|
|
11
|
+
from datetime import datetime, timezone
|
|
10
12
|
from typing import (
|
|
11
13
|
TYPE_CHECKING,
|
|
12
14
|
Any,
|
|
@@ -107,6 +109,8 @@ if TYPE_CHECKING:
|
|
|
107
109
|
logger = logging.getLogger(__name__)
|
|
108
110
|
structlogger = structlog.get_logger()
|
|
109
111
|
|
|
112
|
+
INVALID_DATETIME_ERROR_MESSAGE = "`anonymized_at` must be a datetime object."
|
|
113
|
+
|
|
110
114
|
|
|
111
115
|
def deserialise_events(serialized_events: List[Dict[Text, Any]]) -> List["Event"]:
|
|
112
116
|
"""Convert a list of dictionaries to a list of corresponding events.
|
|
@@ -451,6 +455,7 @@ class UserUttered(Event):
|
|
|
451
455
|
message_id: Optional[Text] = None,
|
|
452
456
|
metadata: Optional[Dict] = None,
|
|
453
457
|
use_text_for_featurization: Optional[bool] = None,
|
|
458
|
+
anonymized_at: Optional[float] = None,
|
|
454
459
|
) -> None:
|
|
455
460
|
"""Creates event for incoming user message.
|
|
456
461
|
|
|
@@ -465,6 +470,7 @@ class UserUttered(Event):
|
|
|
465
470
|
message_id: Unique ID for message.
|
|
466
471
|
use_text_for_featurization: `True` if the message's text was used to predict
|
|
467
472
|
next action. `False` if the message's intent was used.
|
|
473
|
+
anonymized_at: When the event was anonymized in the tracker store.
|
|
468
474
|
|
|
469
475
|
"""
|
|
470
476
|
self.text = text
|
|
@@ -498,6 +504,27 @@ class UserUttered(Event):
|
|
|
498
504
|
if parse_data:
|
|
499
505
|
self.parse_data.update(**parse_data)
|
|
500
506
|
|
|
507
|
+
self._anonymized_at: Optional[datetime] = (
|
|
508
|
+
datetime.fromtimestamp(anonymized_at, tz=timezone.utc)
|
|
509
|
+
if anonymized_at is not None
|
|
510
|
+
else None
|
|
511
|
+
)
|
|
512
|
+
|
|
513
|
+
@property
|
|
514
|
+
def anonymized_at(self) -> Optional[datetime]:
|
|
515
|
+
"""Returns the time when the event was anonymized in the tracker store.
|
|
516
|
+
|
|
517
|
+
If the event was not anonymized, it returns None.
|
|
518
|
+
"""
|
|
519
|
+
return self._anonymized_at
|
|
520
|
+
|
|
521
|
+
@anonymized_at.setter
|
|
522
|
+
def anonymized_at(self, value: Optional[datetime]) -> None:
|
|
523
|
+
"""Sets the time when the event was anonymized in the tracker store."""
|
|
524
|
+
if value is not None and not isinstance(value, datetime):
|
|
525
|
+
raise ValueError(INVALID_DATETIME_ERROR_MESSAGE)
|
|
526
|
+
self._anonymized_at = value
|
|
527
|
+
|
|
501
528
|
@staticmethod
|
|
502
529
|
def _from_parse_data(
|
|
503
530
|
text: Text,
|
|
@@ -506,6 +533,7 @@ class UserUttered(Event):
|
|
|
506
533
|
input_channel: Optional[Text] = None,
|
|
507
534
|
message_id: Optional[Text] = None,
|
|
508
535
|
metadata: Optional[Dict] = None,
|
|
536
|
+
anonymized_at: Optional[float] = None,
|
|
509
537
|
) -> "UserUttered":
|
|
510
538
|
return UserUttered(
|
|
511
539
|
text,
|
|
@@ -516,6 +544,7 @@ class UserUttered(Event):
|
|
|
516
544
|
input_channel,
|
|
517
545
|
message_id,
|
|
518
546
|
metadata,
|
|
547
|
+
anonymized_at,
|
|
519
548
|
)
|
|
520
549
|
|
|
521
550
|
def __hash__(self) -> int:
|
|
@@ -614,6 +643,9 @@ class UserUttered(Event):
|
|
|
614
643
|
"input_channel": getattr(self, "input_channel", None),
|
|
615
644
|
"message_id": getattr(self, "message_id", None),
|
|
616
645
|
"metadata": self.metadata,
|
|
646
|
+
"anonymized_at": self.anonymized_at.timestamp()
|
|
647
|
+
if self.anonymized_at
|
|
648
|
+
else None,
|
|
617
649
|
}
|
|
618
650
|
)
|
|
619
651
|
return _dict
|
|
@@ -673,6 +705,7 @@ class UserUttered(Event):
|
|
|
673
705
|
parameters.get("input_channel"),
|
|
674
706
|
parameters.get("message_id"),
|
|
675
707
|
parameters.get("metadata"),
|
|
708
|
+
parameters.get("anonymized_at"),
|
|
676
709
|
)
|
|
677
710
|
]
|
|
678
711
|
except KeyError as e:
|
|
@@ -900,6 +933,7 @@ class BotUttered(SkipEventInMDStoryMixin):
|
|
|
900
933
|
data: Optional[Dict] = None,
|
|
901
934
|
metadata: Optional[Dict[Text, Any]] = None,
|
|
902
935
|
timestamp: Optional[float] = None,
|
|
936
|
+
anonymized_at: Optional[float] = None,
|
|
903
937
|
) -> None:
|
|
904
938
|
"""Creates event for a bot response.
|
|
905
939
|
|
|
@@ -908,11 +942,32 @@ class BotUttered(SkipEventInMDStoryMixin):
|
|
|
908
942
|
data: Additional data for more complex utterances (e.g. buttons).
|
|
909
943
|
timestamp: When the event was created.
|
|
910
944
|
metadata: Additional event metadata.
|
|
945
|
+
anonymized_at: When the event was anonymized in the tracker store.
|
|
911
946
|
"""
|
|
912
947
|
self.text = text
|
|
913
948
|
self.data = data or {}
|
|
949
|
+
self._anonymized_at: Optional[datetime] = (
|
|
950
|
+
datetime.fromtimestamp(anonymized_at, tz=timezone.utc)
|
|
951
|
+
if anonymized_at is not None
|
|
952
|
+
else None
|
|
953
|
+
)
|
|
914
954
|
super().__init__(timestamp, metadata)
|
|
915
955
|
|
|
956
|
+
@property
|
|
957
|
+
def anonymized_at(self) -> Optional[datetime]:
|
|
958
|
+
"""Returns the time when the event was anonymized in the tracker store.
|
|
959
|
+
|
|
960
|
+
If the event was not anonymized, it returns None.
|
|
961
|
+
"""
|
|
962
|
+
return self._anonymized_at
|
|
963
|
+
|
|
964
|
+
@anonymized_at.setter
|
|
965
|
+
def anonymized_at(self, value: Optional[datetime]) -> None:
|
|
966
|
+
"""Sets the time when the event was anonymized in the tracker store."""
|
|
967
|
+
if value is not None and not isinstance(value, datetime):
|
|
968
|
+
raise ValueError(INVALID_DATETIME_ERROR_MESSAGE)
|
|
969
|
+
self._anonymized_at = value
|
|
970
|
+
|
|
916
971
|
def __members(self) -> Tuple[Optional[Text], Text, Text]:
|
|
917
972
|
data_no_nones = {k: v for k, v in self.data.items() if v is not None}
|
|
918
973
|
meta_no_nones = {k: v for k, v in self.metadata.items() if v is not None}
|
|
@@ -999,7 +1054,16 @@ class BotUttered(SkipEventInMDStoryMixin):
|
|
|
999
1054
|
def as_dict(self) -> Dict[Text, Any]:
|
|
1000
1055
|
"""Returns serialized event."""
|
|
1001
1056
|
d = super().as_dict()
|
|
1002
|
-
d.update(
|
|
1057
|
+
d.update(
|
|
1058
|
+
{
|
|
1059
|
+
"text": self.text,
|
|
1060
|
+
"data": self.data,
|
|
1061
|
+
"metadata": self.metadata,
|
|
1062
|
+
"anonymized_at": self.anonymized_at.timestamp()
|
|
1063
|
+
if self.anonymized_at
|
|
1064
|
+
else None,
|
|
1065
|
+
}
|
|
1066
|
+
)
|
|
1003
1067
|
return d
|
|
1004
1068
|
|
|
1005
1069
|
@classmethod
|
|
@@ -1010,6 +1074,7 @@ class BotUttered(SkipEventInMDStoryMixin):
|
|
|
1010
1074
|
parameters.get("data"),
|
|
1011
1075
|
parameters.get("metadata"),
|
|
1012
1076
|
parameters.get("timestamp"),
|
|
1077
|
+
parameters.get("anonymized_at"),
|
|
1013
1078
|
)
|
|
1014
1079
|
except KeyError as e:
|
|
1015
1080
|
raise ValueError(f"Failed to parse bot uttered event. {e}")
|
|
@@ -1034,6 +1099,7 @@ class SlotSet(Event):
|
|
|
1034
1099
|
timestamp: Optional[float] = None,
|
|
1035
1100
|
metadata: Optional[Dict[Text, Any]] = None,
|
|
1036
1101
|
filled_by: Optional[str] = None,
|
|
1102
|
+
anonymized_at: Optional[float] = None,
|
|
1037
1103
|
) -> None:
|
|
1038
1104
|
"""Creates event to set slot.
|
|
1039
1105
|
|
|
@@ -1046,8 +1112,28 @@ class SlotSet(Event):
|
|
|
1046
1112
|
self.key = key
|
|
1047
1113
|
self.value = value
|
|
1048
1114
|
self._filled_by = filled_by
|
|
1115
|
+
self._anonymized_at: Optional[datetime] = (
|
|
1116
|
+
datetime.fromtimestamp(anonymized_at, tz=timezone.utc)
|
|
1117
|
+
if anonymized_at is not None
|
|
1118
|
+
else None
|
|
1119
|
+
)
|
|
1049
1120
|
super().__init__(timestamp, metadata)
|
|
1050
1121
|
|
|
1122
|
+
@property
|
|
1123
|
+
def anonymized_at(self) -> Optional[datetime]:
|
|
1124
|
+
"""Returns the time when the event was anonymized in the tracker store.
|
|
1125
|
+
|
|
1126
|
+
If the event was not anonymized, it returns None.
|
|
1127
|
+
"""
|
|
1128
|
+
return self._anonymized_at
|
|
1129
|
+
|
|
1130
|
+
@anonymized_at.setter
|
|
1131
|
+
def anonymized_at(self, value: Optional[datetime]) -> None:
|
|
1132
|
+
"""Sets the time when the event was anonymized in the tracker store."""
|
|
1133
|
+
if value is not None and not isinstance(value, datetime):
|
|
1134
|
+
raise ValueError(INVALID_DATETIME_ERROR_MESSAGE)
|
|
1135
|
+
self._anonymized_at = value
|
|
1136
|
+
|
|
1051
1137
|
def __repr__(self) -> Text:
|
|
1052
1138
|
"""Returns text representation of event."""
|
|
1053
1139
|
return f"SlotSet(key: {self.key}, value: {self.value})"
|
|
@@ -1092,7 +1178,16 @@ class SlotSet(Event):
|
|
|
1092
1178
|
def as_dict(self) -> Dict[Text, Any]:
|
|
1093
1179
|
"""Returns serialized event."""
|
|
1094
1180
|
d = super().as_dict()
|
|
1095
|
-
d.update(
|
|
1181
|
+
d.update(
|
|
1182
|
+
{
|
|
1183
|
+
"name": self.key,
|
|
1184
|
+
"value": self.value,
|
|
1185
|
+
"filled_by": self.filled_by,
|
|
1186
|
+
"anonymized_at": self.anonymized_at.timestamp()
|
|
1187
|
+
if self.anonymized_at
|
|
1188
|
+
else None,
|
|
1189
|
+
}
|
|
1190
|
+
)
|
|
1096
1191
|
return d
|
|
1097
1192
|
|
|
1098
1193
|
@classmethod
|
|
@@ -1104,6 +1199,7 @@ class SlotSet(Event):
|
|
|
1104
1199
|
parameters.get("timestamp"),
|
|
1105
1200
|
parameters.get("metadata"),
|
|
1106
1201
|
filled_by=parameters.get("filled_by"),
|
|
1202
|
+
anonymized_at=parameters.get("anonymized_at"),
|
|
1107
1203
|
)
|
|
1108
1204
|
except KeyError as e:
|
|
1109
1205
|
raise ValueError(f"Failed to parse set slot event. {e}")
|
rasa/shared/core/flows/flow.py
CHANGED
|
@@ -1,16 +1,23 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
from dataclasses import dataclass
|
|
4
|
-
from typing import Any, Dict, List, Set, Text
|
|
4
|
+
from typing import Any, Dict, List, Optional, Set, Text, Union
|
|
5
|
+
|
|
6
|
+
import structlog
|
|
5
7
|
|
|
6
8
|
from rasa.shared.constants import ACTION_ASK_PREFIX, UTTER_ASK_PREFIX
|
|
7
9
|
from rasa.shared.core.flows.flow_step import FlowStep
|
|
8
10
|
from rasa.shared.core.slots import SlotRejection
|
|
11
|
+
from rasa.shared.exceptions import RasaException
|
|
9
12
|
|
|
10
13
|
DEFAULT_ASK_BEFORE_FILLING = False
|
|
11
14
|
DEFAULT_RESET_AFTER_FLOW_ENDS = True
|
|
12
15
|
DEFAULT_FORCE_SLOT_FILLING = False
|
|
13
16
|
|
|
17
|
+
logger = structlog.get_logger(__name__)
|
|
18
|
+
|
|
19
|
+
SilenceTimeoutInstructionType = Union[int, float, Dict[str, Any]]
|
|
20
|
+
|
|
14
21
|
|
|
15
22
|
@dataclass
|
|
16
23
|
class CollectInformationFlowStep(FlowStep):
|
|
@@ -30,6 +37,8 @@ class CollectInformationFlowStep(FlowStep):
|
|
|
30
37
|
"""Whether to reset the slot value at the end of the flow."""
|
|
31
38
|
force_slot_filling: bool = False
|
|
32
39
|
"""Whether to keep only the SetSlot command for the collected slot."""
|
|
40
|
+
silence_timeout: Optional[float] = None
|
|
41
|
+
"""The silence timeout for the collect information step."""
|
|
33
42
|
|
|
34
43
|
@classmethod
|
|
35
44
|
def from_json(
|
|
@@ -44,6 +53,11 @@ class CollectInformationFlowStep(FlowStep):
|
|
|
44
53
|
Returns:
|
|
45
54
|
A CollectInformationFlowStep object
|
|
46
55
|
"""
|
|
56
|
+
|
|
57
|
+
silence_timeout = cls._deserialise_silence_timeout(
|
|
58
|
+
data.get("silence_timeout", None)
|
|
59
|
+
)
|
|
60
|
+
|
|
47
61
|
base = super().from_json(flow_id, data)
|
|
48
62
|
return CollectInformationFlowStep(
|
|
49
63
|
collect=data["collect"],
|
|
@@ -58,14 +72,40 @@ class CollectInformationFlowStep(FlowStep):
|
|
|
58
72
|
for rejection in data.get("rejections", [])
|
|
59
73
|
],
|
|
60
74
|
force_slot_filling=data.get("force_slot_filling", False),
|
|
75
|
+
silence_timeout=silence_timeout,
|
|
61
76
|
**base.__dict__,
|
|
62
77
|
)
|
|
63
78
|
|
|
79
|
+
@staticmethod
|
|
80
|
+
def _deserialise_silence_timeout(
|
|
81
|
+
silence_timeout_json: Optional[SilenceTimeoutInstructionType],
|
|
82
|
+
) -> Optional[float]:
|
|
83
|
+
"""Deserialize silence timeout from JSON."""
|
|
84
|
+
if not silence_timeout_json:
|
|
85
|
+
return None
|
|
86
|
+
|
|
87
|
+
if not isinstance(silence_timeout_json, (int, float)):
|
|
88
|
+
raise RasaException(
|
|
89
|
+
f"Invalid silence timeout value: {silence_timeout_json}. "
|
|
90
|
+
"If defined at collect step, silence timeout must be a number."
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
silence_timeout = silence_timeout_json
|
|
94
|
+
|
|
95
|
+
if silence_timeout and silence_timeout < 0:
|
|
96
|
+
raise RasaException(
|
|
97
|
+
f"Invalid silence timeout value: {silence_timeout}. "
|
|
98
|
+
"Silence timeout must be a non-negative number."
|
|
99
|
+
)
|
|
100
|
+
return silence_timeout
|
|
101
|
+
|
|
64
102
|
@staticmethod
|
|
65
103
|
def _default_utter(collect: str) -> str:
|
|
66
104
|
return f"{UTTER_ASK_PREFIX}{collect}"
|
|
67
105
|
|
|
68
|
-
def as_json(
|
|
106
|
+
def as_json(
|
|
107
|
+
self, step_properties: Optional[Dict[Text, Any]] = None
|
|
108
|
+
) -> Dict[str, Any]:
|
|
69
109
|
"""Serialize the CollectInformationFlowStep object.
|
|
70
110
|
|
|
71
111
|
Returns:
|
|
@@ -78,6 +118,9 @@ class CollectInformationFlowStep(FlowStep):
|
|
|
78
118
|
data["reset_after_flow_ends"] = self.reset_after_flow_ends
|
|
79
119
|
data["rejections"] = [rejection.as_dict() for rejection in self.rejections]
|
|
80
120
|
data["force_slot_filling"] = self.force_slot_filling
|
|
121
|
+
if self.silence_timeout:
|
|
122
|
+
data["silence_timeout"] = self.silence_timeout
|
|
123
|
+
|
|
81
124
|
return super().as_json(step_properties=data)
|
|
82
125
|
|
|
83
126
|
@property
|
|
@@ -100,6 +143,7 @@ class CollectInformationFlowStep(FlowStep):
|
|
|
100
143
|
and self.ask_before_filling == other.ask_before_filling
|
|
101
144
|
and self.reset_after_flow_ends == other.reset_after_flow_ends
|
|
102
145
|
and self.force_slot_filling == other.force_slot_filling
|
|
146
|
+
and self.silence_timeout == other.silence_timeout
|
|
103
147
|
and super().__eq__(other)
|
|
104
148
|
)
|
|
105
149
|
return False
|
rasa/shared/core/slots.py
CHANGED
|
@@ -311,6 +311,34 @@ class Slot(ABC):
|
|
|
311
311
|
"""Indicates if the slot requires validation."""
|
|
312
312
|
return True if self.validation else False
|
|
313
313
|
|
|
314
|
+
def to_dict(
|
|
315
|
+
self,
|
|
316
|
+
*,
|
|
317
|
+
include_private: bool = False,
|
|
318
|
+
) -> Dict[str, Any]:
|
|
319
|
+
"""Return a dictionary with attributes of this slot instance.
|
|
320
|
+
|
|
321
|
+
Args:
|
|
322
|
+
include_private: If `True`, private attributes are included.
|
|
323
|
+
|
|
324
|
+
Returns:
|
|
325
|
+
A plain `dict` that can be JSON-serialised.
|
|
326
|
+
"""
|
|
327
|
+
result: Dict[str, Any] = {}
|
|
328
|
+
|
|
329
|
+
for attr, value in vars(self).items():
|
|
330
|
+
if not include_private and attr.startswith("_"):
|
|
331
|
+
continue
|
|
332
|
+
|
|
333
|
+
if attr == "mappings":
|
|
334
|
+
result[attr] = [mapping.as_dict() for mapping in value]
|
|
335
|
+
continue
|
|
336
|
+
|
|
337
|
+
result[attr] = value
|
|
338
|
+
|
|
339
|
+
result.setdefault("type", self.type_name)
|
|
340
|
+
return result
|
|
341
|
+
|
|
314
342
|
|
|
315
343
|
class FloatSlot(Slot):
|
|
316
344
|
"""A slot storing a float value."""
|
rasa/shared/exceptions.py
CHANGED
|
@@ -165,3 +165,7 @@ class ProviderClientAPIException(RasaException):
|
|
|
165
165
|
|
|
166
166
|
class ProviderClientValidationError(RasaException):
|
|
167
167
|
"""Raised for errors that occur during validation of the API client."""
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
class FinetuningDataPreparationException(RasaException):
|
|
171
|
+
"""Raised when there is an error in data preparation for fine-tuning."""
|
|
@@ -23,6 +23,8 @@ from rasa.shared.constants import (
|
|
|
23
23
|
DEPLOYMENT_NAME_CONFIG_KEY,
|
|
24
24
|
ENGINE_CONFIG_KEY,
|
|
25
25
|
LANGCHAIN_TYPE_CONFIG_KEY,
|
|
26
|
+
MAX_COMPLETION_TOKENS_CONFIG_KEY,
|
|
27
|
+
MAX_TOKENS_CONFIG_KEY,
|
|
26
28
|
MODEL_CONFIG_KEY,
|
|
27
29
|
MODEL_NAME_CONFIG_KEY,
|
|
28
30
|
N_REPHRASES_CONFIG_KEY,
|
|
@@ -71,6 +73,8 @@ DEPRECATED_ALIASES_TO_STANDARD_KEY_MAPPING = {
|
|
|
71
73
|
MODEL_NAME_CONFIG_KEY: MODEL_CONFIG_KEY,
|
|
72
74
|
# Timeout aliases
|
|
73
75
|
REQUEST_TIMEOUT_CONFIG_KEY: TIMEOUT_CONFIG_KEY,
|
|
76
|
+
# Max tokens aliases
|
|
77
|
+
MAX_TOKENS_CONFIG_KEY: MAX_COMPLETION_TOKENS_CONFIG_KEY,
|
|
74
78
|
}
|
|
75
79
|
|
|
76
80
|
REQUIRED_KEYS = [DEPLOYMENT_CONFIG_KEY]
|
|
@@ -10,6 +10,8 @@ from rasa.shared.constants import (
|
|
|
10
10
|
API_TYPE_CONFIG_KEY,
|
|
11
11
|
API_VERSION_CONFIG_KEY,
|
|
12
12
|
LANGCHAIN_TYPE_CONFIG_KEY,
|
|
13
|
+
MAX_COMPLETION_TOKENS_CONFIG_KEY,
|
|
14
|
+
MAX_TOKENS_CONFIG_KEY,
|
|
13
15
|
MODEL_CONFIG_KEY,
|
|
14
16
|
MODEL_NAME_CONFIG_KEY,
|
|
15
17
|
N_REPHRASES_CONFIG_KEY,
|
|
@@ -48,6 +50,8 @@ DEPRECATED_ALIASES_TO_STANDARD_KEY_MAPPING = {
|
|
|
48
50
|
OPENAI_API_VERSION_CONFIG_KEY: API_VERSION_CONFIG_KEY,
|
|
49
51
|
# Timeout aliases
|
|
50
52
|
REQUEST_TIMEOUT_CONFIG_KEY: TIMEOUT_CONFIG_KEY,
|
|
53
|
+
# Max tokens aliases
|
|
54
|
+
MAX_TOKENS_CONFIG_KEY: MAX_COMPLETION_TOKENS_CONFIG_KEY,
|
|
51
55
|
}
|
|
52
56
|
|
|
53
57
|
REQUIRED_KEYS = [MODEL_CONFIG_KEY]
|
|
@@ -70,7 +70,10 @@ class _BaseLiteLLMEmbeddingClient:
|
|
|
70
70
|
def _embedding_fn_args(self) -> Dict[str, Any]:
|
|
71
71
|
"""Returns the arguments to be passed to the embedding function."""
|
|
72
72
|
return {
|
|
73
|
+
# Parameters set through config, can override drop_params
|
|
73
74
|
**self._litellm_extra_parameters,
|
|
75
|
+
# Model name is constructed in the LiteLLM format from the provided config
|
|
76
|
+
# Non-overridable to ensure consistency
|
|
74
77
|
"model": self._litellm_model_name,
|
|
75
78
|
}
|
|
76
79
|
|
|
@@ -84,12 +84,15 @@ class _BaseLiteLLMClient:
|
|
|
84
84
|
@property
|
|
85
85
|
def _completion_fn_args(self) -> dict:
|
|
86
86
|
return {
|
|
87
|
-
**self._litellm_extra_parameters,
|
|
88
|
-
"model": self._litellm_model_name,
|
|
89
87
|
# Since all providers covered by LiteLLM use the OpenAI format, but
|
|
90
88
|
# not all support every OpenAI parameter, raise an exception if
|
|
91
89
|
# provider/model uses unsupported parameter
|
|
92
90
|
"drop_params": False,
|
|
91
|
+
# All other parameters set through config, can override drop_params
|
|
92
|
+
**self._litellm_extra_parameters,
|
|
93
|
+
# Model name is constructed in the LiteLLM format from the provided config
|
|
94
|
+
# Non-overridable to ensure consistency
|
|
95
|
+
"model": self._litellm_model_name,
|
|
93
96
|
}
|
|
94
97
|
|
|
95
98
|
def validate_client_setup(self) -> None:
|