rasa-pro 3.13.0.dev20250612__py3-none-any.whl → 3.13.0rc1__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 +1 -1
- rasa/cli/dialogue_understanding_test.py +1 -1
- rasa/cli/e2e_test.py +1 -8
- rasa/cli/evaluate.py +1 -1
- rasa/cli/export.py +3 -1
- rasa/cli/llm_fine_tuning.py +12 -11
- rasa/cli/project_templates/defaults.py +133 -0
- rasa/cli/project_templates/tutorial/config.yml +1 -1
- rasa/cli/project_templates/tutorial/endpoints.yml +1 -1
- rasa/cli/run.py +1 -1
- rasa/cli/studio/download.py +1 -23
- rasa/cli/studio/link.py +52 -0
- rasa/cli/studio/pull.py +79 -0
- rasa/cli/studio/push.py +78 -0
- rasa/cli/studio/studio.py +12 -0
- rasa/cli/studio/train.py +0 -1
- rasa/cli/studio/upload.py +8 -0
- rasa/cli/train.py +1 -1
- rasa/cli/utils.py +1 -1
- rasa/cli/x.py +1 -1
- rasa/constants.py +2 -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 +16 -1
- rasa/core/available_endpoints.py +146 -0
- rasa/core/brokers/pika.py +1 -2
- rasa/core/channels/__init__.py +2 -0
- rasa/core/channels/botframework.py +2 -2
- rasa/core/channels/channel.py +2 -2
- rasa/core/channels/development_inspector.py +1 -1
- rasa/core/channels/facebook.py +1 -4
- rasa/core/channels/hangouts.py +8 -5
- rasa/core/channels/inspector/README.md +3 -3
- rasa/core/channels/inspector/dist/assets/{arc-c4b064fc.js → arc-371401b1.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{blockDiagram-38ab4fdb-215b5026.js → blockDiagram-38ab4fdb-3f126156.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{c4Diagram-3d4e48cf-2b54a0a3.js → c4Diagram-3d4e48cf-12f22eb7.js} +1 -1
- rasa/core/channels/inspector/dist/assets/channel-f1efda17.js +1 -0
- rasa/core/channels/inspector/dist/assets/{classDiagram-70f12bd4-daacea5f.js → classDiagram-70f12bd4-03b1d386.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{classDiagram-v2-f2320105-930d4dc2.js → classDiagram-v2-f2320105-84f69d63.js} +1 -1
- rasa/core/channels/inspector/dist/assets/clone-fdf164e2.js +1 -0
- rasa/core/channels/inspector/dist/assets/{createText-2e5e7dd3-83c206ba.js → createText-2e5e7dd3-ca47fd38.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{edges-e0da2a9e-b0eb01d0.js → edges-e0da2a9e-f837ca8a.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{erDiagram-9861fffd-17586500.js → erDiagram-9861fffd-8717ac54.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{flowDb-956e92f1-be2a1776.js → flowDb-956e92f1-94f38b83.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{flowDiagram-66a62f08-c2120ebd.js → flowDiagram-66a62f08-b616f9fb.js} +1 -1
- rasa/core/channels/inspector/dist/assets/flowDiagram-v2-96b9c2cf-7d7a1629.js +1 -0
- rasa/core/channels/inspector/dist/assets/{flowchart-elk-definition-4a651766-a6ab5c48.js → flowchart-elk-definition-4a651766-f5d24bb8.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{ganttDiagram-c361ad54-ef613457.js → ganttDiagram-c361ad54-b43ba8d9.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{gitGraphDiagram-72cf32ee-d59185b3.js → gitGraphDiagram-72cf32ee-c3aafaa5.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{graph-0f155405.js → graph-0d0a2c10.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{index-3862675e-d5f1d1b7.js → index-3862675e-58ea0305.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{index-47737d3a.js → index-cce6f8a1.js} +3 -3
- rasa/core/channels/inspector/dist/assets/{infoDiagram-f8f76790-b07d141f.js → infoDiagram-f8f76790-b8f60461.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{journeyDiagram-49397b02-1936d429.js → journeyDiagram-49397b02-95be5545.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{layout-dde8d0f3.js → layout-da885b9b.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{line-0c2c7ee0.js → line-f1c817d3.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{linear-35dd89a4.js → linear-d42801e6.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{mindmap-definition-fc14e90a-56192851.js → mindmap-definition-fc14e90a-a38923a6.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{pieDiagram-8a3498a8-fc21ed78.js → pieDiagram-8a3498a8-ca6e71e9.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{quadrantDiagram-120e2f19-25e98518.js → quadrantDiagram-120e2f19-b290dae9.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{requirementDiagram-deff3bca-546ff1f5.js → requirementDiagram-deff3bca-03f02ceb.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{sankeyDiagram-04a897e0-02d8b82d.js → sankeyDiagram-04a897e0-c49eee40.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{sequenceDiagram-704730f1-3ca5a92e.js → sequenceDiagram-704730f1-b2cd6a3d.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{stateDiagram-587899a1-128ea07c.js → stateDiagram-587899a1-e53a2028.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{stateDiagram-v2-d93cdb3a-95f290af.js → stateDiagram-v2-d93cdb3a-e1982a03.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{styles-6aaf32cf-4984898a.js → styles-6aaf32cf-d0226ca5.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{styles-9a916d00-1bf266ba.js → styles-9a916d00-0e21dc00.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{styles-c10674c1-60521c63.js → styles-c10674c1-9588494e.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{svgDrawCommon-08f97a94-a25b6e12.js → svgDrawCommon-08f97a94-be478d4f.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{timeline-definition-85554ec2-0fc086bf.js → timeline-definition-85554ec2-74631749.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{xychartDiagram-e933f94c-44ee592e.js → xychartDiagram-e933f94c-a043552f.js} +1 -1
- rasa/core/channels/inspector/dist/index.html +1 -1
- rasa/core/channels/inspector/src/components/RecruitmentPanel.tsx +1 -1
- 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/socketio.py +56 -41
- rasa/core/channels/studio_chat.py +314 -10
- rasa/core/channels/vier_cvg.py +1 -2
- rasa/core/channels/voice_ready/audiocodes.py +2 -9
- rasa/core/channels/voice_stream/asr/azure.py +9 -0
- rasa/core/channels/voice_stream/audiocodes.py +8 -5
- rasa/core/channels/voice_stream/browser_audio.py +1 -1
- rasa/core/channels/voice_stream/genesys.py +2 -2
- rasa/core/channels/voice_stream/jambonz.py +166 -0
- rasa/core/channels/voice_stream/tts/__init__.py +8 -0
- rasa/core/channels/voice_stream/twilio_media_streams.py +17 -5
- rasa/core/channels/voice_stream/voice_channel.py +44 -24
- rasa/core/exporter.py +36 -0
- rasa/core/http_interpreter.py +3 -7
- rasa/core/information_retrieval/faiss.py +18 -11
- rasa/core/information_retrieval/ingestion/faq_parser.py +158 -0
- rasa/core/jobs.py +2 -1
- rasa/core/nlg/contextual_response_rephraser.py +48 -12
- rasa/core/nlg/generator.py +0 -1
- rasa/core/nlg/interpolator.py +2 -3
- rasa/core/nlg/summarize.py +39 -5
- rasa/core/policies/enterprise_search_policy.py +298 -184
- rasa/core/policies/enterprise_search_policy_config.py +241 -0
- rasa/core/policies/enterprise_search_prompt_with_relevancy_check_and_citation_template.jinja2 +64 -0
- rasa/core/policies/flow_policy.py +1 -1
- rasa/core/policies/flows/flow_executor.py +96 -17
- rasa/core/policies/intentless_policy.py +71 -26
- rasa/core/processor.py +104 -51
- rasa/core/run.py +33 -11
- rasa/core/tracker_stores/tracker_store.py +1 -1
- rasa/core/training/interactive.py +1 -1
- rasa/core/utils.py +35 -99
- rasa/dialogue_understanding/coexistence/intent_based_router.py +2 -1
- rasa/dialogue_understanding/coexistence/llm_based_router.py +13 -17
- rasa/dialogue_understanding/commands/__init__.py +4 -0
- rasa/dialogue_understanding/commands/can_not_handle_command.py +2 -0
- rasa/dialogue_understanding/commands/cancel_flow_command.py +6 -2
- rasa/dialogue_understanding/commands/chit_chat_answer_command.py +2 -0
- rasa/dialogue_understanding/commands/clarify_command.py +7 -3
- rasa/dialogue_understanding/commands/command_syntax_manager.py +1 -0
- rasa/dialogue_understanding/commands/correct_slots_command.py +5 -6
- rasa/dialogue_understanding/commands/error_command.py +1 -1
- rasa/dialogue_understanding/commands/human_handoff_command.py +3 -3
- 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 +15 -5
- rasa/dialogue_understanding/commands/skip_question_command.py +3 -3
- rasa/dialogue_understanding/commands/start_flow_command.py +7 -3
- rasa/dialogue_understanding/commands/utils.py +26 -2
- rasa/dialogue_understanding/generator/__init__.py +7 -1
- rasa/dialogue_understanding/generator/command_generator.py +15 -3
- 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/nlu_command_adapter.py +2 -2
- rasa/dialogue_understanding/generator/prompt_templates/command_prompt_template.jinja2 +0 -2
- rasa/dialogue_understanding/generator/prompt_templates/command_prompt_v2_claude_3_5_sonnet_20240620_template.jinja2 +1 -0
- rasa/dialogue_understanding/generator/prompt_templates/command_prompt_v2_gpt_4o_2024_11_20_template.jinja2 +1 -0
- rasa/dialogue_understanding/generator/prompt_templates/command_prompt_v3_claude_3_5_sonnet_20240620_template.jinja2 +79 -0
- rasa/dialogue_understanding/generator/prompt_templates/command_prompt_v3_gpt_4o_2024_11_20_template.jinja2 +79 -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 +461 -0
- rasa/dialogue_understanding/generator/single_step/single_step_llm_command_generator.py +11 -64
- rasa/dialogue_understanding/patterns/cancel.py +1 -2
- rasa/dialogue_understanding/patterns/clarify.py +1 -1
- rasa/dialogue_understanding/patterns/correction.py +2 -2
- 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 +11 -12
- rasa/dialogue_understanding/processor/command_processor_component.py +3 -3
- rasa/dialogue_understanding/stack/frames/flow_stack_frame.py +17 -4
- rasa/dialogue_understanding/stack/utils.py +3 -1
- 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_coverage_report.py +1 -1
- rasa/e2e_test/e2e_test_runner.py +1 -1
- rasa/engine/constants.py +1 -1
- rasa/engine/graph.py +2 -2
- rasa/engine/recipes/default_recipe.py +26 -2
- rasa/engine/validation.py +3 -2
- rasa/hooks.py +0 -28
- 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 +5 -7
- 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/model_api.py +88 -0
- rasa/model_manager/trainer_service.py +4 -4
- rasa/plugin.py +1 -11
- 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 +23 -2
- rasa/shared/constants.py +18 -0
- rasa/shared/core/command_payload_reader.py +1 -5
- rasa/shared/core/constants.py +4 -3
- rasa/shared/core/domain.py +7 -0
- rasa/shared/core/events.py +38 -10
- rasa/shared/core/flows/constants.py +2 -0
- rasa/shared/core/flows/flow.py +127 -14
- rasa/shared/core/flows/flows_list.py +18 -1
- rasa/shared/core/flows/flows_yaml_schema.json +3 -0
- rasa/shared/core/flows/steps/collect.py +46 -2
- rasa/shared/core/flows/steps/link.py +7 -2
- rasa/shared/core/flows/validation.py +25 -5
- rasa/shared/core/slots.py +28 -0
- rasa/shared/core/training_data/story_reader/yaml_story_reader.py +1 -4
- rasa/shared/exceptions.py +4 -0
- rasa/shared/providers/_configs/azure_openai_client_config.py +6 -2
- rasa/shared/providers/_configs/default_litellm_client_config.py +1 -1
- rasa/shared/providers/_configs/huggingface_local_embedding_client_config.py +1 -1
- rasa/shared/providers/_configs/openai_client_config.py +5 -1
- rasa/shared/providers/_configs/rasa_llm_client_config.py +1 -1
- rasa/shared/providers/_configs/self_hosted_llm_client_config.py +1 -1
- rasa/shared/providers/_configs/utils.py +0 -99
- rasa/shared/providers/embedding/_base_litellm_embedding_client.py +3 -0
- rasa/shared/providers/llm/_base_litellm_client.py +5 -2
- rasa/shared/utils/common.py +1 -1
- rasa/shared/utils/configs.py +110 -0
- rasa/shared/utils/constants.py +0 -3
- rasa/shared/utils/llm.py +195 -9
- rasa/shared/utils/pykwalify_extensions.py +0 -9
- rasa/shared/utils/yaml.py +32 -0
- rasa/studio/constants.py +1 -0
- rasa/studio/data_handler.py +11 -4
- rasa/studio/download.py +167 -0
- rasa/studio/link.py +200 -0
- rasa/studio/prompts.py +223 -0
- rasa/studio/pull/__init__.py +0 -0
- rasa/studio/{download/flows.py → pull/data.py} +23 -160
- rasa/studio/{download → pull}/domains.py +1 -1
- rasa/studio/pull/pull.py +235 -0
- rasa/studio/push.py +136 -0
- rasa/studio/train.py +1 -1
- rasa/studio/upload.py +117 -67
- rasa/telemetry.py +82 -25
- rasa/tracing/config.py +3 -4
- rasa/tracing/constants.py +19 -1
- rasa/tracing/instrumentation/attribute_extractors.py +30 -8
- rasa/tracing/instrumentation/instrumentation.py +53 -2
- rasa/tracing/instrumentation/metrics.py +98 -15
- rasa/tracing/metric_instrument_provider.py +75 -3
- rasa/utils/common.py +7 -22
- rasa/utils/log_utils.py +1 -45
- rasa/validator.py +2 -8
- rasa/version.py +1 -1
- {rasa_pro-3.13.0.dev20250612.dist-info → rasa_pro-3.13.0rc1.dist-info}/METADATA +8 -9
- {rasa_pro-3.13.0.dev20250612.dist-info → rasa_pro-3.13.0rc1.dist-info}/RECORD +241 -220
- 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-3730f5fd.js +0 -1
- rasa/core/channels/inspector/dist/assets/clone-e847561e.js +0 -1
- rasa/core/channels/inspector/dist/assets/flowDiagram-v2-96b9c2cf-efbbfe00.js +0 -1
- rasa/studio/download/download.py +0 -439
- /rasa/{studio/download → core/information_retrieval/ingestion}/__init__.py +0 -0
- {rasa_pro-3.13.0.dev20250612.dist-info → rasa_pro-3.13.0rc1.dist-info}/NOTICE +0 -0
- {rasa_pro-3.13.0.dev20250612.dist-info → rasa_pro-3.13.0rc1.dist-info}/WHEEL +0 -0
- {rasa_pro-3.13.0.dev20250612.dist-info → rasa_pro-3.13.0rc1.dist-info}/entry_points.txt +0 -0
|
@@ -11,20 +11,18 @@ from rasa.llm_fine_tuning.paraphrasing.rephrased_user_message import (
|
|
|
11
11
|
)
|
|
12
12
|
from rasa.shared.constants import (
|
|
13
13
|
LLM_CONFIG_KEY,
|
|
14
|
+
MAX_COMPLETION_TOKENS_CONFIG_KEY,
|
|
14
15
|
MODEL_CONFIG_KEY,
|
|
15
16
|
MODEL_NAME_CONFIG_KEY,
|
|
16
17
|
PROMPT_TEMPLATE_CONFIG_KEY,
|
|
17
18
|
PROVIDER_CONFIG_KEY,
|
|
19
|
+
TEMPERATURE_CONFIG_KEY,
|
|
18
20
|
TIMEOUT_CONFIG_KEY,
|
|
19
21
|
)
|
|
20
22
|
from rasa.shared.exceptions import ProviderClientAPIException
|
|
21
23
|
from rasa.shared.providers.mappings import OPENAI_PROVIDER
|
|
22
24
|
from rasa.shared.utils.constants import LOG_COMPONENT_SOURCE_METHOD_INIT
|
|
23
|
-
from rasa.shared.utils.llm import
|
|
24
|
-
USER,
|
|
25
|
-
get_prompt_template,
|
|
26
|
-
llm_factory,
|
|
27
|
-
)
|
|
25
|
+
from rasa.shared.utils.llm import USER, get_prompt_template, llm_factory
|
|
28
26
|
|
|
29
27
|
SEPARATOR = "\n\n"
|
|
30
28
|
BACKUP_SEPARATOR = "\nUSER:"
|
|
@@ -39,8 +37,8 @@ DEFAULT_LLM_CONFIG = {
|
|
|
39
37
|
PROVIDER_CONFIG_KEY: OPENAI_PROVIDER,
|
|
40
38
|
MODEL_CONFIG_KEY: "gpt-4o-mini",
|
|
41
39
|
TIMEOUT_CONFIG_KEY: 7,
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
TEMPERATURE_CONFIG_KEY: 0.0,
|
|
41
|
+
MAX_COMPLETION_TOKENS_CONFIG_KEY: 4096,
|
|
44
42
|
}
|
|
45
43
|
|
|
46
44
|
structlogger = structlog.get_logger()
|
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
from typing import
|
|
1
|
+
from typing import List, Optional
|
|
2
2
|
|
|
3
3
|
import structlog
|
|
4
4
|
|
|
5
|
+
from rasa.core.agent import Agent
|
|
6
|
+
from rasa.core.channels import UserMessage
|
|
5
7
|
from rasa.dialogue_understanding.commands import Command, SetSlotCommand
|
|
6
|
-
from rasa.dialogue_understanding.generator.llm_based_command_generator import (
|
|
7
|
-
LLMBasedCommandGenerator,
|
|
8
|
-
)
|
|
9
8
|
from rasa.llm_fine_tuning.conversations import Conversation, ConversationStep
|
|
10
9
|
from rasa.llm_fine_tuning.paraphrasing.rephrased_user_message import (
|
|
11
10
|
RephrasedUserMessage,
|
|
12
11
|
)
|
|
13
12
|
from rasa.shared.core.flows import FlowsList
|
|
14
|
-
from rasa.shared.
|
|
15
|
-
from rasa.shared.utils.llm import
|
|
13
|
+
from rasa.shared.core.trackers import DialogueStateTracker
|
|
14
|
+
from rasa.shared.utils.llm import (
|
|
15
|
+
create_tracker_for_user_step,
|
|
16
|
+
generate_sender_id,
|
|
17
|
+
)
|
|
16
18
|
|
|
17
19
|
structlogger = structlog.get_logger()
|
|
18
20
|
|
|
19
21
|
|
|
20
22
|
class RephraseValidator:
|
|
21
|
-
def __init__(self,
|
|
22
|
-
self.llm_config = llm_config
|
|
23
|
+
def __init__(self, flows: FlowsList) -> None:
|
|
23
24
|
self.flows = flows
|
|
24
25
|
|
|
25
26
|
async def validate_rephrasings(
|
|
26
27
|
self,
|
|
28
|
+
agent: Agent,
|
|
27
29
|
rephrasings: List[RephrasedUserMessage],
|
|
28
30
|
conversation: Conversation,
|
|
29
|
-
llm_command_generator: Type[LLMBasedCommandGenerator],
|
|
30
31
|
) -> List[RephrasedUserMessage]:
|
|
31
32
|
"""Split rephrased user messages into passing and failing.
|
|
32
33
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
message. The rephase is passing if the commands match and failing otherwise.
|
|
34
|
+
Handle the rephrased messages using agent the same way the original
|
|
35
|
+
message was handled. Check if the rephrased user message is producing
|
|
36
|
+
the same commands as the original user message. The rephrase is passing
|
|
37
|
+
if the commands match and failing otherwise.
|
|
38
38
|
|
|
39
39
|
Args:
|
|
40
|
+
agent: Rasa agent
|
|
40
41
|
rephrasings: The rephrased user messages.
|
|
41
42
|
conversation: The conversation.
|
|
42
|
-
llm_command_generator: A LLM based command generator class.
|
|
43
43
|
|
|
44
44
|
Returns:
|
|
45
45
|
A list of rephrased user messages including the passing and failing
|
|
@@ -52,7 +52,11 @@ class RephraseValidator:
|
|
|
52
52
|
|
|
53
53
|
for rephrase in current_rephrasings.rephrasings:
|
|
54
54
|
if await self._validate_rephrase_is_passing(
|
|
55
|
-
|
|
55
|
+
agent,
|
|
56
|
+
rephrase,
|
|
57
|
+
step,
|
|
58
|
+
conversation.name,
|
|
59
|
+
conversation.tracker,
|
|
56
60
|
):
|
|
57
61
|
current_rephrasings.passed_rephrasings.append(rephrase)
|
|
58
62
|
else:
|
|
@@ -62,40 +66,29 @@ class RephraseValidator:
|
|
|
62
66
|
|
|
63
67
|
async def _validate_rephrase_is_passing(
|
|
64
68
|
self,
|
|
69
|
+
agent: Agent,
|
|
65
70
|
rephrase: str,
|
|
66
71
|
step: ConversationStep,
|
|
67
|
-
|
|
72
|
+
test_case_name: str,
|
|
73
|
+
tracker: DialogueStateTracker,
|
|
68
74
|
) -> bool:
|
|
69
|
-
|
|
70
|
-
rephrase, step
|
|
71
|
-
)
|
|
72
|
-
|
|
73
|
-
action_list = await self._invoke_llm(
|
|
74
|
-
prompt, llm_command_generator.get_default_llm_config()
|
|
75
|
+
rephrased_tracker = await self._send_rephrased_message_to_agent(
|
|
76
|
+
rephrase, step, test_case_name, agent, tracker
|
|
75
77
|
)
|
|
78
|
+
if not (rephrased_tracker and rephrased_tracker.latest_message):
|
|
79
|
+
return False
|
|
76
80
|
|
|
77
81
|
commands_from_original_utterance = step.llm_commands
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
82
|
+
|
|
83
|
+
commands_from_rephrased_utterance = [
|
|
84
|
+
Command.command_from_json(command_json)
|
|
85
|
+
for command_json in rephrased_tracker.latest_message.commands
|
|
86
|
+
]
|
|
87
|
+
|
|
81
88
|
return self._check_commands_match(
|
|
82
89
|
commands_from_original_utterance, commands_from_rephrased_utterance
|
|
83
90
|
)
|
|
84
91
|
|
|
85
|
-
async def _invoke_llm(self, prompt: str, default_llm_config: Dict[str, Any]) -> str:
|
|
86
|
-
llm = llm_factory(self.llm_config, default_llm_config)
|
|
87
|
-
|
|
88
|
-
try:
|
|
89
|
-
llm_response = await llm.acompletion(prompt)
|
|
90
|
-
return llm_response.choices[0]
|
|
91
|
-
except Exception as e:
|
|
92
|
-
# unfortunately, langchain does not wrap LLM exceptions which means
|
|
93
|
-
# we have to catch all exceptions here
|
|
94
|
-
structlogger.error(
|
|
95
|
-
"rephrase_validator.validate_conversation.llm.error", error=e
|
|
96
|
-
)
|
|
97
|
-
raise ProviderClientAPIException(e, message="LLM call exception")
|
|
98
|
-
|
|
99
92
|
@staticmethod
|
|
100
93
|
def _check_commands_match(
|
|
101
94
|
expected_commands: List[Command], actual_commands: List[Command]
|
|
@@ -120,7 +113,22 @@ class RephraseValidator:
|
|
|
120
113
|
return True
|
|
121
114
|
|
|
122
115
|
@staticmethod
|
|
123
|
-
def
|
|
124
|
-
rephrased_user_message: str,
|
|
125
|
-
|
|
126
|
-
|
|
116
|
+
async def _send_rephrased_message_to_agent(
|
|
117
|
+
rephrased_user_message: str,
|
|
118
|
+
step: ConversationStep,
|
|
119
|
+
test_case_name: str,
|
|
120
|
+
agent: Agent,
|
|
121
|
+
tracker: DialogueStateTracker,
|
|
122
|
+
) -> Optional[DialogueStateTracker]:
|
|
123
|
+
# create a rephrased UserMessage
|
|
124
|
+
sender_id = generate_sender_id(test_case_name)
|
|
125
|
+
user_message = UserMessage(rephrased_user_message, sender_id=sender_id)
|
|
126
|
+
|
|
127
|
+
await create_tracker_for_user_step(
|
|
128
|
+
sender_id, agent, tracker, step.tracker_event_index
|
|
129
|
+
)
|
|
130
|
+
|
|
131
|
+
await agent.handle_message(user_message)
|
|
132
|
+
rephrased_tracker = await agent.tracker_store.retrieve(sender_id)
|
|
133
|
+
|
|
134
|
+
return rephrased_tracker
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
from typing import Any, Dict, List, Tuple
|
|
1
|
+
from typing import Any, Dict, List, Tuple
|
|
2
2
|
|
|
3
3
|
import structlog
|
|
4
4
|
from tqdm import tqdm
|
|
5
5
|
|
|
6
|
-
from rasa.
|
|
7
|
-
LLMBasedCommandGenerator,
|
|
8
|
-
)
|
|
6
|
+
from rasa.core.agent import Agent
|
|
9
7
|
from rasa.llm_fine_tuning.conversations import Conversation
|
|
10
8
|
from rasa.llm_fine_tuning.paraphrasing.conversation_rephraser import (
|
|
11
9
|
ConversationRephraser,
|
|
@@ -28,8 +26,7 @@ async def create_paraphrased_conversations(
|
|
|
28
26
|
rephrase_config: Dict[str, Any],
|
|
29
27
|
num_rephrases: int,
|
|
30
28
|
flows: FlowsList,
|
|
31
|
-
|
|
32
|
-
llm_command_generator_config: Dict[str, Any],
|
|
29
|
+
agent: Agent,
|
|
33
30
|
storage_context: StorageContext,
|
|
34
31
|
) -> Tuple[List[Conversation], Dict[str, Any]]:
|
|
35
32
|
"""Create paraphrased conversations.
|
|
@@ -42,7 +39,7 @@ async def create_paraphrased_conversations(
|
|
|
42
39
|
rephrase_config: The path to the rephrase configuration file.
|
|
43
40
|
num_rephrases: The number of rephrases to produce per user message.
|
|
44
41
|
flows: All flows.
|
|
45
|
-
|
|
42
|
+
agent: The Rasa agent.
|
|
46
43
|
storage_context: The storage context.
|
|
47
44
|
|
|
48
45
|
Returns:
|
|
@@ -50,7 +47,7 @@ async def create_paraphrased_conversations(
|
|
|
50
47
|
rephrasing.
|
|
51
48
|
"""
|
|
52
49
|
rephraser = ConversationRephraser(rephrase_config)
|
|
53
|
-
validator = RephraseValidator(
|
|
50
|
+
validator = RephraseValidator(flows)
|
|
54
51
|
|
|
55
52
|
if num_rephrases <= 0:
|
|
56
53
|
structlogger.info(
|
|
@@ -64,18 +61,19 @@ async def create_paraphrased_conversations(
|
|
|
64
61
|
rephrased_conversations: List[Conversation] = []
|
|
65
62
|
for i in tqdm(range(len(conversations))):
|
|
66
63
|
current_conversation = conversations[i]
|
|
67
|
-
|
|
68
64
|
try:
|
|
69
65
|
# rephrase all user messages even if rephrase=False is set
|
|
70
66
|
# to not confuse the LLM and get valid output
|
|
71
67
|
rephrasings = await rephraser.rephrase_conversation(
|
|
72
|
-
|
|
68
|
+
current_conversation, num_rephrases
|
|
73
69
|
)
|
|
74
70
|
# filter out the rephrasings for user messages that have rephrase=False set
|
|
75
|
-
rephrasings = _filter_rephrasings(rephrasings,
|
|
71
|
+
rephrasings = _filter_rephrasings(rephrasings, current_conversation)
|
|
76
72
|
# check if the rephrasings are still producing the same commands
|
|
77
73
|
rephrasings = await validator.validate_rephrasings(
|
|
78
|
-
|
|
74
|
+
agent,
|
|
75
|
+
rephrasings,
|
|
76
|
+
current_conversation,
|
|
79
77
|
)
|
|
80
78
|
except ProviderClientAPIException as e:
|
|
81
79
|
structlogger.error(
|
rasa/llm_fine_tuning/storage.py
CHANGED
|
@@ -96,9 +96,9 @@ class FileStorageStrategy(StorageStrategy):
|
|
|
96
96
|
file_path = self._get_file_path(storage_location)
|
|
97
97
|
self._create_output_dir(file_path)
|
|
98
98
|
|
|
99
|
-
with open(str(file_path), "w") as outfile:
|
|
99
|
+
with open(str(file_path), "w", encoding="utf-8") as outfile:
|
|
100
100
|
for example in llm_data:
|
|
101
|
-
json.dump(example.as_dict(), outfile)
|
|
101
|
+
json.dump(example.as_dict(), outfile, ensure_ascii=False)
|
|
102
102
|
outfile.write("\n")
|
|
103
103
|
|
|
104
104
|
def write_formatted_finetuning_data(
|
|
@@ -110,9 +110,9 @@ class FileStorageStrategy(StorageStrategy):
|
|
|
110
110
|
file_path = self._get_file_path(module_storage_location, file_name)
|
|
111
111
|
self._create_output_dir(file_path)
|
|
112
112
|
|
|
113
|
-
with open(str(file_path), "w") as file:
|
|
113
|
+
with open(str(file_path), "w", encoding="utf-8") as file:
|
|
114
114
|
for example in formatted_data:
|
|
115
|
-
json.dump(example.as_dict(), file)
|
|
115
|
+
json.dump(example.as_dict(), file, ensure_ascii=False)
|
|
116
116
|
file.write("\n")
|
|
117
117
|
|
|
118
118
|
def write_e2e_test_suite_to_yaml_file(
|
rasa/llm_fine_tuning/utils.py
CHANGED
|
@@ -1,7 +1,69 @@
|
|
|
1
|
-
from
|
|
1
|
+
from contextlib import contextmanager
|
|
2
|
+
from datetime import datetime
|
|
3
|
+
from typing import Callable, Generator, List, Union
|
|
4
|
+
|
|
5
|
+
import structlog
|
|
2
6
|
|
|
3
7
|
from rasa.dialogue_understanding.commands.prompt_command import PromptCommand
|
|
8
|
+
from rasa.dialogue_understanding.generator import LLMBasedCommandGenerator
|
|
9
|
+
from rasa.shared.providers.llm.llm_response import LLMResponse
|
|
10
|
+
|
|
11
|
+
structlogger = structlog.get_logger()
|
|
4
12
|
|
|
5
13
|
|
|
6
14
|
def commands_as_string(commands: List[PromptCommand], delimiter: str = "\n") -> str:
|
|
7
15
|
return delimiter.join([command.to_dsl() for command in commands])
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def make_mock_invoke_llm(commands: str) -> Callable:
|
|
19
|
+
"""Capture the `commands` in a closure so the resulting async function
|
|
20
|
+
can use it as its response.
|
|
21
|
+
|
|
22
|
+
Args:
|
|
23
|
+
commands: The commands to return from the mock LLM call.
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
async def _mock_invoke_llm(
|
|
27
|
+
self: LLMBasedCommandGenerator, prompt: Union[List[dict], List[str], str]
|
|
28
|
+
) -> LLMResponse:
|
|
29
|
+
structlogger.debug(
|
|
30
|
+
f"LLM call intercepted, response mocked. "
|
|
31
|
+
f"Responding with the following commands: '{commands}' "
|
|
32
|
+
f"to the prompt: {prompt}"
|
|
33
|
+
)
|
|
34
|
+
fake_response_dict = {
|
|
35
|
+
"id": "",
|
|
36
|
+
"choices": [commands],
|
|
37
|
+
"created": int(datetime.now().timestamp()),
|
|
38
|
+
"model": "mocked-llm",
|
|
39
|
+
}
|
|
40
|
+
return LLMResponse.from_dict(fake_response_dict)
|
|
41
|
+
|
|
42
|
+
return _mock_invoke_llm
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
@contextmanager
|
|
46
|
+
def patch_invoke_llm_in_generators(mock_impl: Callable) -> Generator:
|
|
47
|
+
"""Replace CommandGenerator.invoke_llm in the base class AND in all
|
|
48
|
+
current subclasses (recursively). Everything is restored on exit.
|
|
49
|
+
"""
|
|
50
|
+
originals = {}
|
|
51
|
+
|
|
52
|
+
def collect(cls: type[LLMBasedCommandGenerator]) -> None:
|
|
53
|
+
# store current attribute, then recurse
|
|
54
|
+
originals[cls] = cls.invoke_llm
|
|
55
|
+
for sub in cls.__subclasses__():
|
|
56
|
+
collect(sub)
|
|
57
|
+
|
|
58
|
+
# collect every existing subclass of CommandGenerator
|
|
59
|
+
collect(LLMBasedCommandGenerator) # type: ignore[type-abstract]
|
|
60
|
+
|
|
61
|
+
try:
|
|
62
|
+
# apply the monkey-patch everywhere
|
|
63
|
+
for cls in originals:
|
|
64
|
+
cls.invoke_llm = mock_impl # type: ignore[assignment]
|
|
65
|
+
yield
|
|
66
|
+
finally:
|
|
67
|
+
# restore originals (even if an exception happened)
|
|
68
|
+
for cls, orig in originals.items():
|
|
69
|
+
cls.invoke_llm = orig # type: ignore[assignment]
|
rasa/model_manager/model_api.py
CHANGED
|
@@ -7,12 +7,16 @@ from typing import Any, Callable, Dict, Optional, Union
|
|
|
7
7
|
import dotenv
|
|
8
8
|
import psutil
|
|
9
9
|
import structlog
|
|
10
|
+
from ruamel.yaml import YAMLError
|
|
10
11
|
from sanic import Blueprint, Sanic, response
|
|
11
12
|
from sanic.exceptions import NotFound
|
|
12
13
|
from sanic.request import Request
|
|
13
14
|
from sanic.response import json
|
|
14
15
|
from socketio import AsyncServer
|
|
15
16
|
|
|
17
|
+
import rasa
|
|
18
|
+
from rasa.cli.project_templates.defaults import get_rasa_defaults
|
|
19
|
+
from rasa.cli.scaffold import ProjectTemplateName, scaffold_path
|
|
16
20
|
from rasa.constants import MODEL_ARCHIVE_EXTENSION
|
|
17
21
|
from rasa.exceptions import ModelNotFound
|
|
18
22
|
from rasa.model_manager import config
|
|
@@ -45,6 +49,10 @@ from rasa.model_manager.warm_rasa_process import (
|
|
|
45
49
|
initialize_warm_rasa_process,
|
|
46
50
|
shutdown_warm_rasa_processes,
|
|
47
51
|
)
|
|
52
|
+
from rasa.server import ErrorResponse
|
|
53
|
+
from rasa.shared.exceptions import InvalidConfigException
|
|
54
|
+
from rasa.shared.utils.yaml import dump_obj_as_yaml_to_string
|
|
55
|
+
from rasa.studio.upload import build_calm_import_parts
|
|
48
56
|
|
|
49
57
|
dotenv.load_dotenv()
|
|
50
58
|
|
|
@@ -476,6 +484,86 @@ def internal_blueprint() -> Blueprint:
|
|
|
476
484
|
except ModelNotFound:
|
|
477
485
|
return response.raw(b"", status=404)
|
|
478
486
|
|
|
487
|
+
@bp.post("/defaults")
|
|
488
|
+
async def get_defaults(request: Request) -> response.HTTPResponse:
|
|
489
|
+
"""Returns the system defaults like prompts, patterns, etc."""
|
|
490
|
+
body = request.json or {}
|
|
491
|
+
config_yaml = body.get("config")
|
|
492
|
+
if config_yaml is None:
|
|
493
|
+
exc = ErrorResponse(
|
|
494
|
+
HTTPStatus.BAD_REQUEST,
|
|
495
|
+
"BadRequest",
|
|
496
|
+
"Missing `config` key in request body.",
|
|
497
|
+
)
|
|
498
|
+
return response.json(exc.error_info, status=exc.status)
|
|
499
|
+
|
|
500
|
+
endpoints_yaml = body.get("endpoints")
|
|
501
|
+
if endpoints_yaml is None:
|
|
502
|
+
exc = ErrorResponse(
|
|
503
|
+
HTTPStatus.BAD_REQUEST,
|
|
504
|
+
"BadRequest",
|
|
505
|
+
"Missing `endpoints` key in request body.",
|
|
506
|
+
)
|
|
507
|
+
return response.json(exc.error_info, status=exc.status)
|
|
508
|
+
|
|
509
|
+
try:
|
|
510
|
+
defaults = get_rasa_defaults(config_yaml, endpoints_yaml)
|
|
511
|
+
except (YAMLError, InvalidConfigException) as e:
|
|
512
|
+
exc = ErrorResponse(
|
|
513
|
+
HTTPStatus.INTERNAL_SERVER_ERROR,
|
|
514
|
+
"InitDataError",
|
|
515
|
+
f"Failed to load defaults. Error: {e!s}",
|
|
516
|
+
)
|
|
517
|
+
return response.json(exc.error_info, status=exc.status)
|
|
518
|
+
return response.json(defaults.model_dump(exclude_none=True))
|
|
519
|
+
|
|
520
|
+
@bp.get("/project_template")
|
|
521
|
+
async def get_project_template(request: Request) -> response.HTTPResponse:
|
|
522
|
+
"""Return initial project template data."""
|
|
523
|
+
template = request.args.get("template", ProjectTemplateName.DEFAULT.value)
|
|
524
|
+
|
|
525
|
+
try:
|
|
526
|
+
template_enum = ProjectTemplateName(template)
|
|
527
|
+
except ValueError:
|
|
528
|
+
valid_templates = ", ".join([t.value for t in ProjectTemplateName])
|
|
529
|
+
exc = ErrorResponse(
|
|
530
|
+
HTTPStatus.BAD_REQUEST,
|
|
531
|
+
"BadRequest",
|
|
532
|
+
f"Unknown template '{template}'. Valid templates: "
|
|
533
|
+
f"{valid_templates}",
|
|
534
|
+
)
|
|
535
|
+
return response.json(exc.error_info, status=exc.status)
|
|
536
|
+
|
|
537
|
+
template_dir = scaffold_path(template_enum)
|
|
538
|
+
if not os.path.isdir(template_dir):
|
|
539
|
+
exc = ErrorResponse(
|
|
540
|
+
HTTPStatus.INTERNAL_SERVER_ERROR,
|
|
541
|
+
"InitDataError",
|
|
542
|
+
f"Template directory '{template_dir}' not found.",
|
|
543
|
+
)
|
|
544
|
+
return response.json(exc.error_info, status=exc.status)
|
|
545
|
+
|
|
546
|
+
assistant_name, parts = build_calm_import_parts(
|
|
547
|
+
data_path=f"{template_dir}/data",
|
|
548
|
+
domain_path=f"{template_dir}/domain",
|
|
549
|
+
config_path=f"{template_dir}/config.yml",
|
|
550
|
+
endpoints_path=f"{template_dir}/endpoints.yml",
|
|
551
|
+
assistant_name=template_enum.value,
|
|
552
|
+
)
|
|
553
|
+
|
|
554
|
+
defaults = get_rasa_defaults(
|
|
555
|
+
config_yaml=dump_obj_as_yaml_to_string(parts.config),
|
|
556
|
+
endpoints_yaml=dump_obj_as_yaml_to_string(parts.endpoints),
|
|
557
|
+
)
|
|
558
|
+
return response.json(
|
|
559
|
+
{
|
|
560
|
+
**parts.model_dump(exclude_none=True),
|
|
561
|
+
"assistantName": assistant_name,
|
|
562
|
+
"defaults": defaults.model_dump(exclude_none=True),
|
|
563
|
+
"version": rasa.__version__,
|
|
564
|
+
}
|
|
565
|
+
)
|
|
566
|
+
|
|
479
567
|
return bp
|
|
480
568
|
|
|
481
569
|
|
|
@@ -7,7 +7,7 @@ from typing import Any, Dict, Optional
|
|
|
7
7
|
import structlog
|
|
8
8
|
from pydantic import BaseModel, ConfigDict
|
|
9
9
|
|
|
10
|
-
from rasa.constants import MODEL_ARCHIVE_EXTENSION
|
|
10
|
+
from rasa.constants import MODEL_ARCHIVE_EXTENSION, RASA_DIR_NAME
|
|
11
11
|
from rasa.model_manager import config
|
|
12
12
|
from rasa.model_manager.utils import (
|
|
13
13
|
ensure_base_directory_exists,
|
|
@@ -171,7 +171,7 @@ def seed_training_directory_with_rasa_cache(
|
|
|
171
171
|
training_base_path=training_base_path,
|
|
172
172
|
)
|
|
173
173
|
# copy the cache to the training directory
|
|
174
|
-
shutil.copytree(src=cache_path, dst=subpath(training_base_path,
|
|
174
|
+
shutil.copytree(src=cache_path, dst=subpath(training_base_path, RASA_DIR_NAME))
|
|
175
175
|
|
|
176
176
|
|
|
177
177
|
def persist_rasa_cache(assistant_id: str, training_base_path: str) -> None:
|
|
@@ -184,12 +184,12 @@ def persist_rasa_cache(assistant_id: str, training_base_path: str) -> None:
|
|
|
184
184
|
cache_path = cache_for_assistant_path(assistant_id)
|
|
185
185
|
|
|
186
186
|
# if the training failed and didn't create a cache, skip this step
|
|
187
|
-
if not os.path.exists(subpath(training_base_path,
|
|
187
|
+
if not os.path.exists(subpath(training_base_path, RASA_DIR_NAME)):
|
|
188
188
|
return
|
|
189
189
|
|
|
190
190
|
# clean up the cache directory first
|
|
191
191
|
shutil.rmtree(cache_path, ignore_errors=True)
|
|
192
|
-
shutil.copytree(src=subpath(training_base_path,
|
|
192
|
+
shutil.copytree(src=subpath(training_base_path, RASA_DIR_NAME), dst=cache_path)
|
|
193
193
|
|
|
194
194
|
|
|
195
195
|
def write_training_data_to_files(
|
rasa/plugin.py
CHANGED
|
@@ -3,7 +3,7 @@ from __future__ import annotations
|
|
|
3
3
|
import argparse
|
|
4
4
|
import functools
|
|
5
5
|
import sys
|
|
6
|
-
from typing import TYPE_CHECKING,
|
|
6
|
+
from typing import TYPE_CHECKING, List, Optional, Text, Union
|
|
7
7
|
|
|
8
8
|
import pluggy
|
|
9
9
|
|
|
@@ -69,16 +69,6 @@ def create_tracker_store( # type: ignore[empty-body]
|
|
|
69
69
|
"""Hook specification for wrapping with AuthRetryTrackerStore."""
|
|
70
70
|
|
|
71
71
|
|
|
72
|
-
@hookspec(firstresult=True) # type: ignore[misc]
|
|
73
|
-
def init_anonymization_pipeline(endpoints_file: Optional[Text]) -> None:
|
|
74
|
-
"""Hook specification for initialising the anonymization pipeline."""
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
@hookspec(firstresult=True) # type: ignore[misc]
|
|
78
|
-
def get_anonymization_pipeline() -> Optional[Any]:
|
|
79
|
-
"""Hook specification for getting the anonymization pipeline."""
|
|
80
|
-
|
|
81
|
-
|
|
82
72
|
@hookspec # type: ignore[misc]
|
|
83
73
|
def after_server_stop() -> None:
|
|
84
74
|
"""Hook specification for stopping the server.
|
rasa/privacy/__init__.py
ADDED
|
File without changes
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
PRIVACY_CONFIG_SCHEMA = "privacy/privacy_config_schema.json"
|
|
2
|
+
REDACTION_CHAR_KEY = "redaction_char"
|
|
3
|
+
KEEP_LEFT_KEY = "keep_left"
|
|
4
|
+
KEEP_RIGHT_KEY = "keep_right"
|
|
5
|
+
DELETION_KEY = "deletion"
|
|
6
|
+
ANONYMIZATION_KEY = "anonymization"
|
|
7
|
+
TRACKER_STORE_SETTINGS = "tracker_store_settings"
|
|
8
|
+
SLOT_KEY = "slot"
|
|
9
|
+
TEXT_KEY = "text"
|
|
10
|
+
ENTITIES_KEY = "entities"
|
|
11
|
+
VALUE_KEY = "value"
|
|
12
|
+
ENTITY_LABEL_KEY = "label"
|
|
13
|
+
|
|
14
|
+
USER_CHAT_INACTIVITY_IN_MINUTES_ENV_VAR_NAME = "USER_CHAT_INACTIVITY_IN_MINUTES"
|
|
15
|
+
GLINER_MODEL_PATH_ENV_VAR_NAME = "GLINER_MODEL_PATH"
|
|
16
|
+
HUGGINGFACE_CACHE_DIR_ENV_VAR_NAME = "HUGGINGFACE_HUB_CACHE_DIR"
|
|
17
|
+
|
|
18
|
+
DEFAULT_PII_MODEL = "urchade/gliner_multi_pii-v1"
|
|
19
|
+
GLINER_LABELS = [
|
|
20
|
+
"person",
|
|
21
|
+
"organization",
|
|
22
|
+
"company",
|
|
23
|
+
"phone number",
|
|
24
|
+
"address",
|
|
25
|
+
"full address",
|
|
26
|
+
"postcode",
|
|
27
|
+
"zip code",
|
|
28
|
+
"passport number",
|
|
29
|
+
"email",
|
|
30
|
+
"credit card number",
|
|
31
|
+
"social security number",
|
|
32
|
+
"health insurance id number",
|
|
33
|
+
"date of birth",
|
|
34
|
+
"mobile phone number",
|
|
35
|
+
"bank account number",
|
|
36
|
+
"medication",
|
|
37
|
+
"cpf",
|
|
38
|
+
"driver's license number",
|
|
39
|
+
"tax identification number",
|
|
40
|
+
"medical condition",
|
|
41
|
+
"identity card number",
|
|
42
|
+
"national id number",
|
|
43
|
+
"ip address",
|
|
44
|
+
"email address",
|
|
45
|
+
"iban",
|
|
46
|
+
"credit card expiration date",
|
|
47
|
+
"username",
|
|
48
|
+
"health insurance number",
|
|
49
|
+
"registration number",
|
|
50
|
+
"student id number",
|
|
51
|
+
"insurance number",
|
|
52
|
+
"membership number",
|
|
53
|
+
"booking number",
|
|
54
|
+
"landline phone number",
|
|
55
|
+
"blood type",
|
|
56
|
+
"cvv",
|
|
57
|
+
"reservation number",
|
|
58
|
+
"digital signature",
|
|
59
|
+
"social media handle",
|
|
60
|
+
"license plate number",
|
|
61
|
+
"cnpj",
|
|
62
|
+
"postal code",
|
|
63
|
+
"passport_number",
|
|
64
|
+
"serial number",
|
|
65
|
+
"vehicle registration number",
|
|
66
|
+
"fax number",
|
|
67
|
+
"visa number",
|
|
68
|
+
"insurance company",
|
|
69
|
+
"identity document number",
|
|
70
|
+
"transaction number",
|
|
71
|
+
"national health insurance number",
|
|
72
|
+
"cvc",
|
|
73
|
+
"birth certificate number",
|
|
74
|
+
"train ticket number",
|
|
75
|
+
"passport expiration date",
|
|
76
|
+
"social_security_number",
|
|
77
|
+
"personally identifiable information",
|
|
78
|
+
"banking routing number",
|
|
79
|
+
"sort code",
|
|
80
|
+
"routing number",
|
|
81
|
+
"tax number",
|
|
82
|
+
"swift code",
|
|
83
|
+
]
|