rasa-pro 3.13.0.dev8__py3-none-any.whl → 3.13.0.dev10__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/cli/export.py +2 -0
- rasa/core/channels/development_inspector.py +1 -1
- rasa/core/channels/facebook.py +1 -4
- rasa/core/channels/inspector/README.md +3 -3
- rasa/core/channels/inspector/dist/assets/{arc-c4b064fc.js → arc-02053cc1.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{blockDiagram-38ab4fdb-215b5026.js → blockDiagram-38ab4fdb-008b6289.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{c4Diagram-3d4e48cf-2b54a0a3.js → c4Diagram-3d4e48cf-fb2597be.js} +1 -1
- rasa/core/channels/inspector/dist/assets/channel-078dada8.js +1 -0
- rasa/core/channels/inspector/dist/assets/{classDiagram-70f12bd4-daacea5f.js → classDiagram-70f12bd4-7f847e00.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{classDiagram-v2-f2320105-930d4dc2.js → classDiagram-v2-f2320105-ba1d689b.js} +1 -1
- rasa/core/channels/inspector/dist/assets/clone-5b4516de.js +1 -0
- rasa/core/channels/inspector/dist/assets/{createText-2e5e7dd3-83c206ba.js → createText-2e5e7dd3-dd8e67c4.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{edges-e0da2a9e-b0eb01d0.js → edges-e0da2a9e-10784939.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{erDiagram-9861fffd-17586500.js → erDiagram-9861fffd-24947ae6.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{flowDb-956e92f1-be2a1776.js → flowDb-956e92f1-a9ced505.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{flowDiagram-66a62f08-c2120ebd.js → flowDiagram-66a62f08-afda9c7c.js} +1 -1
- rasa/core/channels/inspector/dist/assets/flowDiagram-v2-96b9c2cf-f9613071.js +1 -0
- rasa/core/channels/inspector/dist/assets/{flowchart-elk-definition-4a651766-a6ab5c48.js → flowchart-elk-definition-4a651766-6ef530b8.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{ganttDiagram-c361ad54-ef613457.js → ganttDiagram-c361ad54-0c7dd39a.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{gitGraphDiagram-72cf32ee-d59185b3.js → gitGraphDiagram-72cf32ee-b57239d6.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{graph-0f155405.js → graph-9ed57cec.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{index-3862675e-d5f1d1b7.js → index-3862675e-233090de.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{index-47737d3a.js → index-72184470.js} +3 -3
- rasa/core/channels/inspector/dist/assets/{infoDiagram-f8f76790-b07d141f.js → infoDiagram-f8f76790-aa116649.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{journeyDiagram-49397b02-1936d429.js → journeyDiagram-49397b02-e51877cc.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{layout-dde8d0f3.js → layout-3ca3798c.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{line-0c2c7ee0.js → line-26ee10d3.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{linear-35dd89a4.js → linear-aedded32.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{mindmap-definition-fc14e90a-56192851.js → mindmap-definition-fc14e90a-d8957261.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{pieDiagram-8a3498a8-fc21ed78.js → pieDiagram-8a3498a8-d771f885.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{quadrantDiagram-120e2f19-25e98518.js → quadrantDiagram-120e2f19-09fdf50c.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{requirementDiagram-deff3bca-546ff1f5.js → requirementDiagram-deff3bca-9f0af02e.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{sankeyDiagram-04a897e0-02d8b82d.js → sankeyDiagram-04a897e0-84415b37.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{sequenceDiagram-704730f1-3ca5a92e.js → sequenceDiagram-704730f1-8dec4055.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{stateDiagram-587899a1-128ea07c.js → stateDiagram-587899a1-c5431d07.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{stateDiagram-v2-d93cdb3a-95f290af.js → stateDiagram-v2-d93cdb3a-274e77d9.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{styles-6aaf32cf-4984898a.js → styles-6aaf32cf-e364a1d7.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{styles-9a916d00-1bf266ba.js → styles-9a916d00-0dae36f6.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{styles-c10674c1-60521c63.js → styles-c10674c1-c4641675.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{svgDrawCommon-08f97a94-a25b6e12.js → svgDrawCommon-08f97a94-831fe9a1.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{timeline-definition-85554ec2-0fc086bf.js → timeline-definition-85554ec2-c3304b3a.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{xychartDiagram-e933f94c-44ee592e.js → xychartDiagram-e933f94c-da799369.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/socketio.py +56 -41
- rasa/core/channels/studio_chat.py +311 -8
- rasa/core/channels/voice_ready/audiocodes.py +1 -1
- rasa/core/channels/voice_stream/audiocodes.py +1 -1
- rasa/core/channels/voice_stream/browser_audio.py +1 -1
- rasa/core/channels/voice_stream/tts/__init__.py +8 -0
- rasa/core/channels/voice_stream/voice_channel.py +6 -1
- rasa/core/exporter.py +36 -0
- rasa/core/information_retrieval/faiss.py +18 -11
- rasa/core/information_retrieval/ingestion/__init__.py +0 -0
- rasa/core/information_retrieval/ingestion/faq_parser.py +158 -0
- rasa/core/nlg/contextual_response_rephraser.py +10 -1
- rasa/core/policies/enterprise_search_policy.py +151 -258
- rasa/core/policies/enterprise_search_policy_config.py +242 -0
- rasa/core/policies/intentless_policy.py +47 -10
- rasa/dialogue_understanding/coexistence/llm_based_router.py +9 -6
- rasa/dialogue_understanding/commands/cancel_flow_command.py +3 -1
- rasa/dialogue_understanding/commands/correct_slots_command.py +1 -3
- rasa/dialogue_understanding/generator/nlu_command_adapter.py +2 -2
- rasa/dialogue_understanding/generator/prompt_templates/command_prompt_v3_claude_3_5_sonnet_20240620_template.jinja2 +78 -0
- rasa/dialogue_understanding/generator/single_step/search_ready_llm_command_generator.py +2 -2
- rasa/dialogue_understanding/generator/single_step/single_step_based_llm_command_generator.py +2 -2
- rasa/dialogue_understanding/generator/single_step/single_step_llm_command_generator.py +8 -11
- 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/processor/command_processor.py +3 -4
- rasa/dialogue_understanding/stack/utils.py +3 -1
- rasa/engine/graph.py +2 -2
- rasa/llm_fine_tuning/paraphrasing/conversation_rephraser.py +1 -5
- rasa/shared/constants.py +11 -0
- rasa/shared/core/command_payload_reader.py +1 -5
- rasa/shared/core/events.py +1 -3
- rasa/shared/core/flows/validation.py +25 -5
- rasa/shared/core/training_data/story_reader/yaml_story_reader.py +1 -4
- rasa/shared/providers/_configs/azure_openai_client_config.py +2 -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 +1 -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/utils/common.py +1 -1
- rasa/shared/utils/configs.py +110 -0
- rasa/shared/utils/llm.py +30 -0
- rasa/tracing/instrumentation/attribute_extractors.py +10 -5
- rasa/version.py +1 -1
- {rasa_pro-3.13.0.dev8.dist-info → rasa_pro-3.13.0.dev10.dist-info}/METADATA +3 -3
- {rasa_pro-3.13.0.dev8.dist-info → rasa_pro-3.13.0.dev10.dist-info}/RECORD +96 -91
- 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_pro-3.13.0.dev8.dist-info → rasa_pro-3.13.0.dev10.dist-info}/NOTICE +0 -0
- {rasa_pro-3.13.0.dev8.dist-info → rasa_pro-3.13.0.dev10.dist-info}/WHEEL +0 -0
- {rasa_pro-3.13.0.dev8.dist-info → rasa_pro-3.13.0.dev10.dist-info}/entry_points.txt +0 -0
|
@@ -209,7 +209,9 @@ def get_collect_steps_excluding_ask_before_filling_for_active_flow(
|
|
|
209
209
|
All collect steps that are part of the current active flow,
|
|
210
210
|
excluding the collect steps that have to be asked before filling.
|
|
211
211
|
"""
|
|
212
|
-
active_frame = top_user_flow_frame(
|
|
212
|
+
active_frame = top_user_flow_frame(
|
|
213
|
+
dialogue_stack, ignore_call_and_link_frames=False
|
|
214
|
+
)
|
|
213
215
|
if active_frame is None:
|
|
214
216
|
return set()
|
|
215
217
|
active_flow = active_frame.flow(all_flows)
|
rasa/engine/graph.py
CHANGED
|
@@ -500,9 +500,9 @@ class GraphNode:
|
|
|
500
500
|
structlogger.warning(
|
|
501
501
|
"graph.node.input_not_resolved",
|
|
502
502
|
node_name=self._node_name,
|
|
503
|
-
input_name=i,
|
|
503
|
+
input_name=i, # no PII
|
|
504
504
|
event_info=(
|
|
505
|
-
"Node input was not resolved, there is no
|
|
505
|
+
"Node input was not resolved, there is no output. "
|
|
506
506
|
"Another component should have provided this as an output."
|
|
507
507
|
),
|
|
508
508
|
)
|
|
@@ -22,11 +22,7 @@ from rasa.shared.constants import (
|
|
|
22
22
|
from rasa.shared.exceptions import ProviderClientAPIException
|
|
23
23
|
from rasa.shared.providers.mappings import OPENAI_PROVIDER
|
|
24
24
|
from rasa.shared.utils.constants import LOG_COMPONENT_SOURCE_METHOD_INIT
|
|
25
|
-
from rasa.shared.utils.llm import
|
|
26
|
-
USER,
|
|
27
|
-
get_prompt_template,
|
|
28
|
-
llm_factory,
|
|
29
|
-
)
|
|
25
|
+
from rasa.shared.utils.llm import USER, get_prompt_template, llm_factory
|
|
30
26
|
|
|
31
27
|
SEPARATOR = "\n\n"
|
|
32
28
|
BACKUP_SEPARATOR = "\nUSER:"
|
rasa/shared/constants.py
CHANGED
|
@@ -295,6 +295,7 @@ CONTEXT = "context"
|
|
|
295
295
|
|
|
296
296
|
RASA_PATTERN_INTERNAL_ERROR = "pattern_internal_error"
|
|
297
297
|
RASA_PATTERN_HUMAN_HANDOFF = "pattern_human_handoff"
|
|
298
|
+
RASA_PATTERN_CHITCHAT = "pattern_chitchat"
|
|
298
299
|
|
|
299
300
|
RASA_INTERNAL_ERROR_PREFIX = "rasa_internal_error_"
|
|
300
301
|
RASA_PATTERN_INTERNAL_ERROR_DEFAULT = RASA_INTERNAL_ERROR_PREFIX + "default"
|
|
@@ -345,3 +346,13 @@ ROLE_SYSTEM = "system"
|
|
|
345
346
|
# Used for key values in ValidateSlotPatternFlowStackFrame
|
|
346
347
|
REFILL_UTTER = "refill_utter"
|
|
347
348
|
REJECTIONS = "rejections"
|
|
349
|
+
|
|
350
|
+
# Constants for extractive search FAQ parsing (QA pairs from input documents)
|
|
351
|
+
FAQ_DOCUMENT_METADATA_TITLE = "title"
|
|
352
|
+
FAQ_DOCUMENT_METADATA_ANSWER = "answer"
|
|
353
|
+
FAQ_DOCUMENT_METADATA_TYPE = "type"
|
|
354
|
+
DOCUMENT_TYPE_FAQ = "faq"
|
|
355
|
+
FAQ_INPUT_DATA_QUESTION_LINE_PREFIX = "Q:"
|
|
356
|
+
FAQ_INPUT_DATA_ANSWER_LINE_PREFIX = "A:"
|
|
357
|
+
FAQ_DOCUMENT_ENTRY_SEPARATOR = "\n\n"
|
|
358
|
+
FAQ_DOCUMENT_LINE_SEPARATOR = "\n"
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import copy
|
|
2
1
|
import re
|
|
3
2
|
from typing import List, Optional
|
|
4
3
|
|
|
@@ -35,9 +34,7 @@ class CommandPayloadReader:
|
|
|
35
34
|
|
|
36
35
|
matches = CommandPayloadReader.find_matches(user_text)
|
|
37
36
|
if not matches:
|
|
38
|
-
structlogger.warning(
|
|
39
|
-
"message.parsing.failed", user_text=copy.deepcopy(user_text)
|
|
40
|
-
)
|
|
37
|
+
structlogger.warning("message.parsing.failed")
|
|
41
38
|
return message
|
|
42
39
|
|
|
43
40
|
return CommandPayloadReader.extract_commands_from_pattern_matches(
|
|
@@ -110,7 +107,6 @@ class CommandPayloadReader:
|
|
|
110
107
|
if user_text.count("=") > MAX_NUMBER_OF_SLOTS:
|
|
111
108
|
structlogger.warning(
|
|
112
109
|
"too.many.slots",
|
|
113
|
-
user_text=copy.deepcopy(user_text),
|
|
114
110
|
slot_limit=10,
|
|
115
111
|
)
|
|
116
112
|
return True
|
rasa/shared/core/events.py
CHANGED
|
@@ -126,9 +126,7 @@ def deserialise_events(serialized_events: List[Dict[Text, Any]]) -> List["Event"
|
|
|
126
126
|
if event:
|
|
127
127
|
deserialised.append(event)
|
|
128
128
|
else:
|
|
129
|
-
structlogger.warning(
|
|
130
|
-
"event.deserialization.failed", rasa_event=copy.deepcopy(event)
|
|
131
|
-
)
|
|
129
|
+
structlogger.warning("event.deserialization.failed")
|
|
132
130
|
|
|
133
131
|
return deserialised
|
|
134
132
|
|
|
@@ -8,6 +8,7 @@ from typing import List, Optional, Set, Text
|
|
|
8
8
|
|
|
9
9
|
from rasa.shared.constants import (
|
|
10
10
|
RASA_DEFAULT_FLOW_PATTERN_PREFIX,
|
|
11
|
+
RASA_PATTERN_CHITCHAT,
|
|
11
12
|
RASA_PATTERN_HUMAN_HANDOFF,
|
|
12
13
|
RASA_PATTERN_INTERNAL_ERROR,
|
|
13
14
|
)
|
|
@@ -186,8 +187,10 @@ class ReferenceToPatternException(RasaException):
|
|
|
186
187
|
return message + "Patterns can not be used as a target for a call step."
|
|
187
188
|
else:
|
|
188
189
|
return message + (
|
|
189
|
-
"
|
|
190
|
-
"
|
|
190
|
+
"Patterns cannot be used as a target in link steps, except for "
|
|
191
|
+
"'pattern_human_handoff', which may be linked from both user-defined "
|
|
192
|
+
"flows and other patterns. 'pattern_chitchat' may only be linked "
|
|
193
|
+
"from other patterns."
|
|
191
194
|
)
|
|
192
195
|
|
|
193
196
|
|
|
@@ -578,11 +581,18 @@ def validate_linked_flows_exists(flows: "FlowsList") -> None:
|
|
|
578
581
|
continue
|
|
579
582
|
|
|
580
583
|
# It might be that the flows do not contain the default rasa patterns, but
|
|
581
|
-
# only the user flows. Manually check for `pattern_human_handoff`
|
|
582
|
-
#
|
|
584
|
+
# only the user flows. Manually check for `pattern_human_handoff` and
|
|
585
|
+
# 'pattern_chitchat' as these patterns can be linked to and are part of the
|
|
586
|
+
# default patterns of rasa.
|
|
583
587
|
if (
|
|
584
588
|
flows.flow_by_id(step.link) is None
|
|
589
|
+
# Allow linking to human-handoff from both patterns
|
|
590
|
+
# and user-defined flows
|
|
585
591
|
and step.link != RASA_PATTERN_HUMAN_HANDOFF
|
|
592
|
+
# Allow linking to 'pattern_chitchat' only from other patterns
|
|
593
|
+
and not (
|
|
594
|
+
flow.is_rasa_default_flow and step.link == RASA_PATTERN_CHITCHAT
|
|
595
|
+
)
|
|
586
596
|
):
|
|
587
597
|
raise UnresolvedFlowException(step.link, flow.id, step.id)
|
|
588
598
|
|
|
@@ -597,7 +607,13 @@ def validate_patterns_are_not_called_or_linked(flows: "FlowsList") -> None:
|
|
|
597
607
|
if (
|
|
598
608
|
isinstance(step, LinkFlowStep)
|
|
599
609
|
and step.link.startswith(RASA_DEFAULT_FLOW_PATTERN_PREFIX)
|
|
610
|
+
# Allow linking to human-handoff from both patterns
|
|
611
|
+
# and user-defined flows
|
|
600
612
|
and step.link != RASA_PATTERN_HUMAN_HANDOFF
|
|
613
|
+
# Allow linking to 'pattern_chitchat' only from other patterns
|
|
614
|
+
and not (
|
|
615
|
+
flow.is_rasa_default_flow and step.link == RASA_PATTERN_CHITCHAT
|
|
616
|
+
)
|
|
601
617
|
):
|
|
602
618
|
raise ReferenceToPatternException(
|
|
603
619
|
step.link, flow.id, step.id, call_step=False
|
|
@@ -617,7 +633,8 @@ def validate_patterns_are_not_calling_or_linking_other_flows(
|
|
|
617
633
|
"""Validates that patterns do not contain call or link steps.
|
|
618
634
|
|
|
619
635
|
Link steps to user flows are allowed for all patterns but 'pattern_internal_error'.
|
|
620
|
-
Link steps to other patterns, except for 'pattern_human_handoff'
|
|
636
|
+
Link steps to other patterns, except for 'pattern_human_handoff' and
|
|
637
|
+
'pattern_chitchat' are forbidden.
|
|
621
638
|
"""
|
|
622
639
|
for flow in flows.underlying_flows:
|
|
623
640
|
if not flow.is_rasa_default_flow:
|
|
@@ -627,6 +644,9 @@ def validate_patterns_are_not_calling_or_linking_other_flows(
|
|
|
627
644
|
if step.link == RASA_PATTERN_HUMAN_HANDOFF:
|
|
628
645
|
# links to 'pattern_human_handoff' are allowed
|
|
629
646
|
continue
|
|
647
|
+
if step.link == RASA_PATTERN_CHITCHAT:
|
|
648
|
+
# links to 'pattern_chitchat' are allowed
|
|
649
|
+
continue
|
|
630
650
|
if step.link.startswith(RASA_DEFAULT_FLOW_PATTERN_PREFIX):
|
|
631
651
|
# all other patterns are allowed to link to user flows, but not
|
|
632
652
|
# to other patterns
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import copy
|
|
2
1
|
import functools
|
|
3
2
|
import json
|
|
4
3
|
import logging
|
|
@@ -648,9 +647,7 @@ class YAMLStoryReader(StoryReader):
|
|
|
648
647
|
# message text did start with the special prefix -- however, a user might
|
|
649
648
|
# just have decided to start their text this way.
|
|
650
649
|
if not match:
|
|
651
|
-
structlogger.warning(
|
|
652
|
-
"message.parsing.failed", user_text=copy.deepcopy(user_text)
|
|
653
|
-
)
|
|
650
|
+
structlogger.warning("message.parsing.failed")
|
|
654
651
|
return message
|
|
655
652
|
|
|
656
653
|
# Extract attributes from the match - and validate it via the domain.
|
|
@@ -46,13 +46,13 @@ from rasa.shared.providers._configs.oauth_config import (
|
|
|
46
46
|
OAUTH_TYPE_FIELD,
|
|
47
47
|
OAuth,
|
|
48
48
|
)
|
|
49
|
-
from rasa.shared.
|
|
49
|
+
from rasa.shared.utils.common import class_from_module_path
|
|
50
|
+
from rasa.shared.utils.configs import (
|
|
50
51
|
raise_deprecation_warnings,
|
|
51
52
|
resolve_aliases,
|
|
52
53
|
validate_forbidden_keys,
|
|
53
54
|
validate_required_keys,
|
|
54
55
|
)
|
|
55
|
-
from rasa.shared.utils.common import class_from_module_path
|
|
56
56
|
|
|
57
57
|
structlogger = structlog.get_logger()
|
|
58
58
|
|
|
@@ -15,7 +15,7 @@ from rasa.shared.constants import (
|
|
|
15
15
|
STREAM_CONFIG_KEY,
|
|
16
16
|
TIMEOUT_CONFIG_KEY,
|
|
17
17
|
)
|
|
18
|
-
from rasa.shared.
|
|
18
|
+
from rasa.shared.utils.configs import (
|
|
19
19
|
raise_deprecation_warnings,
|
|
20
20
|
resolve_aliases,
|
|
21
21
|
validate_forbidden_keys,
|
|
@@ -21,7 +21,7 @@ from rasa.shared.constants import (
|
|
|
21
21
|
REQUEST_TIMEOUT_CONFIG_KEY,
|
|
22
22
|
TIMEOUT_CONFIG_KEY,
|
|
23
23
|
)
|
|
24
|
-
from rasa.shared.
|
|
24
|
+
from rasa.shared.utils.configs import (
|
|
25
25
|
raise_deprecation_warnings,
|
|
26
26
|
resolve_aliases,
|
|
27
27
|
validate_required_keys,
|
|
@@ -26,7 +26,7 @@ from rasa.shared.constants import (
|
|
|
26
26
|
STREAM_CONFIG_KEY,
|
|
27
27
|
TIMEOUT_CONFIG_KEY,
|
|
28
28
|
)
|
|
29
|
-
from rasa.shared.
|
|
29
|
+
from rasa.shared.utils.configs import (
|
|
30
30
|
raise_deprecation_warnings,
|
|
31
31
|
resolve_aliases,
|
|
32
32
|
validate_forbidden_keys,
|
|
@@ -25,7 +25,7 @@ from rasa.shared.constants import (
|
|
|
25
25
|
TIMEOUT_CONFIG_KEY,
|
|
26
26
|
USE_CHAT_COMPLETIONS_ENDPOINT_CONFIG_KEY,
|
|
27
27
|
)
|
|
28
|
-
from rasa.shared.
|
|
28
|
+
from rasa.shared.utils.configs import (
|
|
29
29
|
raise_deprecation_warnings,
|
|
30
30
|
resolve_aliases,
|
|
31
31
|
validate_forbidden_keys,
|
|
@@ -1,107 +1,8 @@
|
|
|
1
1
|
import structlog
|
|
2
2
|
|
|
3
|
-
from rasa.shared.utils.io import raise_deprecation_warning
|
|
4
|
-
|
|
5
3
|
structlogger = structlog.get_logger()
|
|
6
4
|
|
|
7
5
|
|
|
8
|
-
def resolve_aliases(config: dict, deprecated_alias_mapping: dict) -> dict:
|
|
9
|
-
"""
|
|
10
|
-
Resolve aliases in the configuration to standard keys.
|
|
11
|
-
|
|
12
|
-
Args:
|
|
13
|
-
config: Dictionary containing the configuration.
|
|
14
|
-
deprecated_alias_mapping: Dictionary mapping aliases to
|
|
15
|
-
their standard keys.
|
|
16
|
-
|
|
17
|
-
Returns:
|
|
18
|
-
New dictionary containing the processed configuration.
|
|
19
|
-
"""
|
|
20
|
-
config = config.copy()
|
|
21
|
-
|
|
22
|
-
for alias, standard_key in deprecated_alias_mapping.items():
|
|
23
|
-
# We check for the alias instead of the standard key because our goal is to
|
|
24
|
-
# update the standard key when the alias is found. Since the standard key is
|
|
25
|
-
# always included in the default component configurations, we overwrite it
|
|
26
|
-
# with the alias value if the alias exists.
|
|
27
|
-
if alias in config:
|
|
28
|
-
config[standard_key] = config.pop(alias)
|
|
29
|
-
|
|
30
|
-
return config
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
def raise_deprecation_warnings(config: dict, deprecated_alias_mapping: dict) -> None:
|
|
34
|
-
"""
|
|
35
|
-
Raises warnings for deprecated keys in the configuration.
|
|
36
|
-
|
|
37
|
-
Args:
|
|
38
|
-
config: Dictionary containing the configuration.
|
|
39
|
-
deprecated_alias_mapping: Dictionary mapping deprecated keys to
|
|
40
|
-
their standard keys.
|
|
41
|
-
|
|
42
|
-
Raises:
|
|
43
|
-
DeprecationWarning: If any deprecated key is found in the config.
|
|
44
|
-
"""
|
|
45
|
-
for alias, standard_key in deprecated_alias_mapping.items():
|
|
46
|
-
if alias in config:
|
|
47
|
-
raise_deprecation_warning(
|
|
48
|
-
message=(
|
|
49
|
-
f"'{alias}' is deprecated and will be removed in "
|
|
50
|
-
f"4.0.0. Use '{standard_key}' instead."
|
|
51
|
-
)
|
|
52
|
-
)
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
def validate_required_keys(config: dict, required_keys: list) -> None:
|
|
56
|
-
"""
|
|
57
|
-
Validates that the passed config contains all the required keys.
|
|
58
|
-
|
|
59
|
-
Args:
|
|
60
|
-
config: Dictionary containing the configuration.
|
|
61
|
-
required_keys: List of keys that must be present in the config.
|
|
62
|
-
|
|
63
|
-
Raises:
|
|
64
|
-
ValueError: If any required key is missing.
|
|
65
|
-
"""
|
|
66
|
-
missing_keys = [key for key in required_keys if key not in config]
|
|
67
|
-
if missing_keys:
|
|
68
|
-
message = f"Missing required keys '{missing_keys}' for configuration."
|
|
69
|
-
structlogger.error(
|
|
70
|
-
"validate_required_keys",
|
|
71
|
-
message=message,
|
|
72
|
-
missing_keys=missing_keys,
|
|
73
|
-
config=config,
|
|
74
|
-
)
|
|
75
|
-
raise ValueError(message)
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
def validate_forbidden_keys(config: dict, forbidden_keys: list) -> None:
|
|
79
|
-
"""
|
|
80
|
-
Validates that the passed config doesn't contain any forbidden keys.
|
|
81
|
-
|
|
82
|
-
Args:
|
|
83
|
-
config: Dictionary containing the configuration.
|
|
84
|
-
forbidden_keys: List of keys that are forbidden in the config.
|
|
85
|
-
|
|
86
|
-
Raises:
|
|
87
|
-
ValueError: If any forbidden key is present.
|
|
88
|
-
"""
|
|
89
|
-
forbidden_keys_in_config = set(config.keys()).intersection(set(forbidden_keys))
|
|
90
|
-
|
|
91
|
-
if forbidden_keys_in_config:
|
|
92
|
-
message = (
|
|
93
|
-
f"Forbidden keys '{forbidden_keys_in_config}' present "
|
|
94
|
-
f"in the configuration."
|
|
95
|
-
)
|
|
96
|
-
structlogger.error(
|
|
97
|
-
"validate_forbidden_keys",
|
|
98
|
-
message=message,
|
|
99
|
-
forbidden_keys=forbidden_keys_in_config,
|
|
100
|
-
config=config,
|
|
101
|
-
)
|
|
102
|
-
raise ValueError(message)
|
|
103
|
-
|
|
104
|
-
|
|
105
6
|
def get_provider_prefixed_model_name(provider: str, model: str) -> str:
|
|
106
7
|
"""
|
|
107
8
|
Returns the model name with the provider prefixed.
|
rasa/shared/utils/common.py
CHANGED
|
@@ -384,7 +384,7 @@ def display_research_study_prompt() -> None:
|
|
|
384
384
|
{separator}
|
|
385
385
|
Want to help shape the future of Rasa Pro?
|
|
386
386
|
Share your feedback in a short conversation with our team.
|
|
387
|
-
Sign up at: https://
|
|
387
|
+
Sign up at: https://rasa.com/book-feedback-call
|
|
388
388
|
{separator}
|
|
389
389
|
"""
|
|
390
390
|
print_success(message)
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
3
|
+
import structlog
|
|
4
|
+
|
|
5
|
+
from rasa.shared.utils.io import raise_deprecation_warning
|
|
6
|
+
|
|
7
|
+
structlogger = structlog.get_logger()
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def resolve_aliases(config: dict, deprecated_alias_mapping: dict) -> dict:
|
|
11
|
+
"""
|
|
12
|
+
Resolve aliases in the configuration to standard keys.
|
|
13
|
+
|
|
14
|
+
Args:
|
|
15
|
+
config: Dictionary containing the configuration.
|
|
16
|
+
deprecated_alias_mapping: Dictionary mapping aliases to
|
|
17
|
+
their standard keys.
|
|
18
|
+
|
|
19
|
+
Returns:
|
|
20
|
+
New dictionary containing the processed configuration.
|
|
21
|
+
"""
|
|
22
|
+
config = config.copy()
|
|
23
|
+
|
|
24
|
+
for alias, standard_key in deprecated_alias_mapping.items():
|
|
25
|
+
# We check for the alias instead of the standard key because our goal is to
|
|
26
|
+
# update the standard key when the alias is found. Since the standard key is
|
|
27
|
+
# always included in the default component configurations, we overwrite it
|
|
28
|
+
# with the alias value if the alias exists.
|
|
29
|
+
if alias in config:
|
|
30
|
+
config[standard_key] = config.pop(alias)
|
|
31
|
+
|
|
32
|
+
return config
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def raise_deprecation_warnings(
|
|
36
|
+
config: dict,
|
|
37
|
+
deprecated_alias_mapping: dict,
|
|
38
|
+
source: Optional[str] = None,
|
|
39
|
+
) -> None:
|
|
40
|
+
"""
|
|
41
|
+
Raises warnings for deprecated keys in the configuration.
|
|
42
|
+
|
|
43
|
+
Args:
|
|
44
|
+
config: Dictionary containing the configuration.
|
|
45
|
+
deprecated_alias_mapping: Dictionary mapping deprecated keys to
|
|
46
|
+
their standard keys.
|
|
47
|
+
|
|
48
|
+
Raises:
|
|
49
|
+
DeprecationWarning: If any deprecated key is found in the config.
|
|
50
|
+
"""
|
|
51
|
+
for alias, standard_key in deprecated_alias_mapping.items():
|
|
52
|
+
if alias in config:
|
|
53
|
+
source = f"{source}: " or ""
|
|
54
|
+
raise_deprecation_warning(
|
|
55
|
+
message=(
|
|
56
|
+
f"{source}"
|
|
57
|
+
f"'{alias}' is deprecated and will be removed in "
|
|
58
|
+
f"4.0.0. Use '{standard_key}' instead."
|
|
59
|
+
)
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def validate_required_keys(config: dict, required_keys: list) -> None:
|
|
64
|
+
"""
|
|
65
|
+
Validates that the passed config contains all the required keys.
|
|
66
|
+
|
|
67
|
+
Args:
|
|
68
|
+
config: Dictionary containing the configuration.
|
|
69
|
+
required_keys: List of keys that must be present in the config.
|
|
70
|
+
|
|
71
|
+
Raises:
|
|
72
|
+
ValueError: If any required key is missing.
|
|
73
|
+
"""
|
|
74
|
+
missing_keys = [key for key in required_keys if key not in config]
|
|
75
|
+
if missing_keys:
|
|
76
|
+
message = f"Missing required keys '{missing_keys}' for configuration."
|
|
77
|
+
structlogger.error(
|
|
78
|
+
"validate_required_keys",
|
|
79
|
+
message=message,
|
|
80
|
+
missing_keys=missing_keys,
|
|
81
|
+
config=config,
|
|
82
|
+
)
|
|
83
|
+
raise ValueError(message)
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def validate_forbidden_keys(config: dict, forbidden_keys: list) -> None:
|
|
87
|
+
"""
|
|
88
|
+
Validates that the passed config doesn't contain any forbidden keys.
|
|
89
|
+
|
|
90
|
+
Args:
|
|
91
|
+
config: Dictionary containing the configuration.
|
|
92
|
+
forbidden_keys: List of keys that are forbidden in the config.
|
|
93
|
+
|
|
94
|
+
Raises:
|
|
95
|
+
ValueError: If any forbidden key is present.
|
|
96
|
+
"""
|
|
97
|
+
forbidden_keys_in_config = set(config.keys()).intersection(set(forbidden_keys))
|
|
98
|
+
|
|
99
|
+
if forbidden_keys_in_config:
|
|
100
|
+
message = (
|
|
101
|
+
f"Forbidden keys '{forbidden_keys_in_config}' present "
|
|
102
|
+
f"in the configuration."
|
|
103
|
+
)
|
|
104
|
+
structlogger.error(
|
|
105
|
+
"validate_forbidden_keys",
|
|
106
|
+
message=message,
|
|
107
|
+
forbidden_keys=forbidden_keys_in_config,
|
|
108
|
+
config=config,
|
|
109
|
+
)
|
|
110
|
+
raise ValueError(message)
|
rasa/shared/utils/llm.py
CHANGED
|
@@ -37,6 +37,8 @@ from rasa.shared.constants import (
|
|
|
37
37
|
MODEL_GROUP_ID_CONFIG_KEY,
|
|
38
38
|
MODEL_GROUPS_CONFIG_KEY,
|
|
39
39
|
MODELS_CONFIG_KEY,
|
|
40
|
+
PROMPT_CONFIG_KEY,
|
|
41
|
+
PROMPT_TEMPLATE_CONFIG_KEY,
|
|
40
42
|
PROVIDER_CONFIG_KEY,
|
|
41
43
|
RASA_PATTERN_INTERNAL_ERROR_USER_INPUT_EMPTY,
|
|
42
44
|
RASA_PATTERN_INTERNAL_ERROR_USER_INPUT_TOO_LONG,
|
|
@@ -950,6 +952,34 @@ async def create_tracker_for_user_step(
|
|
|
950
952
|
await agent.tracker_store.save(tracker)
|
|
951
953
|
|
|
952
954
|
|
|
955
|
+
def check_prompt_config_keys_and_warn_if_deprecated(
|
|
956
|
+
config: dict, component_source: str
|
|
957
|
+
) -> None:
|
|
958
|
+
"""Checks and warns about deprecated config parameters."""
|
|
959
|
+
if PROMPT_CONFIG_KEY in config and PROMPT_TEMPLATE_CONFIG_KEY in config:
|
|
960
|
+
structlogger.warning(
|
|
961
|
+
f"{component_source}.init"
|
|
962
|
+
".both_deprecated_and_non_deprecated_config_keys_used_at_the_same_time",
|
|
963
|
+
event_info=(
|
|
964
|
+
f"Both '{PROMPT_CONFIG_KEY}' and '{PROMPT_TEMPLATE_CONFIG_KEY}' "
|
|
965
|
+
f"are present in the config. '{PROMPT_CONFIG_KEY}' will be ignored "
|
|
966
|
+
f"in favor of {PROMPT_TEMPLATE_CONFIG_KEY}."
|
|
967
|
+
),
|
|
968
|
+
)
|
|
969
|
+
|
|
970
|
+
# 'prompt' config key is deprecated in favor of 'prompt_template'
|
|
971
|
+
if PROMPT_CONFIG_KEY in config:
|
|
972
|
+
structlogger.warning(
|
|
973
|
+
f"{component_source}.init.deprecated_config_key",
|
|
974
|
+
event_info=(
|
|
975
|
+
f"The config parameter '{PROMPT_CONFIG_KEY}' is deprecated "
|
|
976
|
+
"and will be removed in Rasa 4.0.0. "
|
|
977
|
+
f"Please use the config parameter '{PROMPT_TEMPLATE_CONFIG_KEY}'"
|
|
978
|
+
f" instead. "
|
|
979
|
+
),
|
|
980
|
+
)
|
|
981
|
+
|
|
982
|
+
|
|
953
983
|
def _get_llm_command_generator_config(
|
|
954
984
|
config: Dict[Text, Any],
|
|
955
985
|
) -> Optional[Dict[Text, Any]]:
|
|
@@ -64,7 +64,10 @@ from rasa.shared.core.trackers import DialogueStateTracker
|
|
|
64
64
|
from rasa.shared.core.training_data.structures import StoryGraph
|
|
65
65
|
from rasa.shared.importers.importer import TrainingDataImporter
|
|
66
66
|
from rasa.shared.nlu.constants import INTENT_NAME_KEY, SET_SLOT_COMMAND
|
|
67
|
-
from rasa.shared.utils.llm import
|
|
67
|
+
from rasa.shared.utils.llm import (
|
|
68
|
+
combine_custom_and_default_config,
|
|
69
|
+
resolve_model_client_config,
|
|
70
|
+
)
|
|
68
71
|
from rasa.tracing.constants import (
|
|
69
72
|
PROMPT_TOKEN_LENGTH_ATTRIBUTE_NAME,
|
|
70
73
|
REQUEST_BODY_SIZE_IN_BYTES_ATTRIBUTE_NAME,
|
|
@@ -335,9 +338,8 @@ def extract_llm_config(
|
|
|
335
338
|
else:
|
|
336
339
|
config = self.config
|
|
337
340
|
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
)
|
|
341
|
+
llm_config = resolve_model_client_config(config.get(LLM_CONFIG_KEY))
|
|
342
|
+
llm_property = combine_custom_and_default_config(llm_config, default_llm_config)
|
|
341
343
|
|
|
342
344
|
if isinstance(self, LLMBasedCommandGenerator):
|
|
343
345
|
flow_retrieval_config = config.get(FLOW_RETRIEVAL_KEY, {}) or {}
|
|
@@ -346,8 +348,11 @@ def extract_llm_config(
|
|
|
346
348
|
default_embeddings_config,
|
|
347
349
|
)
|
|
348
350
|
else:
|
|
351
|
+
embeddings_config = resolve_model_client_config(
|
|
352
|
+
config.get(EMBEDDINGS_CONFIG_KEY)
|
|
353
|
+
)
|
|
349
354
|
embeddings_property = combine_custom_and_default_config(
|
|
350
|
-
|
|
355
|
+
embeddings_config, default_embeddings_config
|
|
351
356
|
)
|
|
352
357
|
|
|
353
358
|
attributes = {
|
rasa/version.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: rasa-pro
|
|
3
|
-
Version: 3.13.0.
|
|
3
|
+
Version: 3.13.0.dev10
|
|
4
4
|
Summary: State-of-the-art open-core Conversational AI framework for Enterprises that natively leverages generative AI for effortless assistant development.
|
|
5
5
|
Keywords: nlp,machine-learning,machine-learning-library,bot,bots,botkit,rasa conversational-agents,conversational-ai,chatbot,chatbot-framework,bot-framework
|
|
6
6
|
Author: Rasa Technologies GmbH
|
|
@@ -23,7 +23,7 @@ Provides-Extra: spacy
|
|
|
23
23
|
Provides-Extra: transformers
|
|
24
24
|
Requires-Dist: CacheControl (>=0.14.2,<0.15.0)
|
|
25
25
|
Requires-Dist: PyJWT[crypto] (>=2.8.0,<3.0.0)
|
|
26
|
-
Requires-Dist: SQLAlchemy (>=2.0.
|
|
26
|
+
Requires-Dist: SQLAlchemy (>=2.0.41,<2.1.0)
|
|
27
27
|
Requires-Dist: absl-py (>=2.0,<2.1)
|
|
28
28
|
Requires-Dist: aio-pika (>=8.2.3,<9.4.4)
|
|
29
29
|
Requires-Dist: aiogram (>=3.15,<3.16)
|
|
@@ -91,7 +91,7 @@ Requires-Dist: pymongo (>=4.10.1,<4.11.0)
|
|
|
91
91
|
Requires-Dist: pypred (>=0.4.0,<0.5.0)
|
|
92
92
|
Requires-Dist: python-dateutil (>=2.8.2,<2.9.0)
|
|
93
93
|
Requires-Dist: python-dotenv (>=1.0.1,<2.0.0)
|
|
94
|
-
Requires-Dist: python-engineio (>=4.12.
|
|
94
|
+
Requires-Dist: python-engineio (>=4.12.2,<4.13.0)
|
|
95
95
|
Requires-Dist: python-keycloak (>=3.12.0,<4.0.0)
|
|
96
96
|
Requires-Dist: python-socketio (>=5.8,<6)
|
|
97
97
|
Requires-Dist: pytz (>=2022.7.1,<2023.0)
|