rasa-pro 3.13.0.dev20250613__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/cli/e2e_test.py +0 -7
- rasa/cli/export.py +2 -0
- rasa/cli/project_templates/tutorial/config.yml +1 -1
- rasa/cli/project_templates/tutorial/endpoints.yml +1 -1
- rasa/cli/studio/download.py +1 -23
- rasa/cli/studio/link.py +1 -2
- rasa/cli/studio/pull.py +3 -2
- rasa/cli/studio/push.py +1 -1
- rasa/cli/studio/train.py +0 -1
- rasa/core/channels/__init__.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-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/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/asr/azure.py +9 -0
- rasa/core/channels/voice_stream/audiocodes.py +1 -1
- rasa/core/channels/voice_stream/browser_audio.py +1 -1
- 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 +7 -0
- rasa/core/channels/voice_stream/voice_channel.py +14 -5
- rasa/core/exporter.py +36 -0
- rasa/core/information_retrieval/faiss.py +18 -11
- 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 +152 -262
- rasa/core/policies/enterprise_search_policy_config.py +241 -0
- rasa/core/policies/enterprise_search_prompt_with_relevancy_check_and_citation_template.jinja2 +6 -5
- rasa/core/policies/intentless_policy.py +47 -10
- rasa/core/utils.py +11 -2
- rasa/dialogue_understanding/coexistence/llm_based_router.py +9 -18
- rasa/dialogue_understanding/commands/__init__.py +4 -0
- rasa/dialogue_understanding/commands/cancel_flow_command.py +4 -2
- rasa/dialogue_understanding/commands/clarify_command.py +2 -2
- 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 +1 -3
- rasa/dialogue_understanding/commands/set_slot_command.py +4 -4
- rasa/dialogue_understanding/commands/skip_question_command.py +1 -3
- rasa/dialogue_understanding/commands/start_flow_command.py +3 -3
- rasa/dialogue_understanding/generator/command_generator.py +11 -1
- 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 +1 -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 -18
- 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 +8 -9
- rasa/dialogue_understanding/stack/utils.py +3 -1
- rasa/e2e_test/e2e_test_coverage_report.py +1 -1
- rasa/engine/graph.py +2 -2
- rasa/llm_fine_tuning/paraphrasing/conversation_rephraser.py +1 -5
- rasa/shared/constants.py +12 -0
- rasa/shared/core/command_payload_reader.py +1 -5
- rasa/shared/core/events.py +1 -3
- rasa/shared/core/flows/constants.py +2 -0
- rasa/shared/core/flows/flow.py +126 -12
- rasa/shared/core/flows/flows_list.py +18 -1
- rasa/shared/core/flows/steps/link.py +7 -2
- 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/constants.py +0 -3
- rasa/shared/utils/llm.py +37 -6
- rasa/shared/utils/pykwalify_extensions.py +0 -9
- rasa/studio/constants.py +1 -0
- rasa/studio/data_handler.py +8 -1
- rasa/studio/download.py +167 -0
- rasa/studio/link.py +1 -1
- rasa/studio/prompts.py +223 -0
- rasa/studio/pull/__init__.py +0 -0
- rasa/studio/{download/flows.py → pull/data.py} +2 -131
- rasa/studio/{download → pull}/domains.py +1 -1
- rasa/studio/pull/pull.py +235 -0
- rasa/studio/push.py +5 -0
- rasa/studio/train.py +1 -1
- rasa/tracing/instrumentation/attribute_extractors.py +20 -6
- rasa/utils/common.py +11 -0
- rasa/version.py +1 -1
- {rasa_pro-3.13.0.dev20250613.dist-info → rasa_pro-3.13.0rc1.dist-info}/METADATA +4 -4
- {rasa_pro-3.13.0.dev20250613.dist-info → rasa_pro-3.13.0rc1.dist-info}/RECORD +141 -134
- 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 -416
- rasa/studio/pull.py +0 -94
- /rasa/{studio/download → core/information_retrieval/ingestion}/__init__.py +0 -0
- {rasa_pro-3.13.0.dev20250613.dist-info → rasa_pro-3.13.0rc1.dist-info}/NOTICE +0 -0
- {rasa_pro-3.13.0.dev20250613.dist-info → rasa_pro-3.13.0rc1.dist-info}/WHEEL +0 -0
- {rasa_pro-3.13.0.dev20250613.dist-info → rasa_pro-3.13.0rc1.dist-info}/entry_points.txt +0 -0
|
@@ -3,101 +3,16 @@ from pathlib import Path
|
|
|
3
3
|
from typing import Any, Dict, List, Set, Text
|
|
4
4
|
|
|
5
5
|
from rasa.shared.core.flows import Flow
|
|
6
|
-
from rasa.shared.core.flows.flow_step_links import StaticFlowStepLink
|
|
7
6
|
from rasa.shared.core.flows.flows_list import FlowsList
|
|
8
7
|
from rasa.shared.core.flows.yaml_flows_io import YAMLFlowsReader, YamlFlowsWriter
|
|
9
8
|
from rasa.shared.importers.importer import TrainingDataImporter
|
|
10
9
|
from rasa.shared.utils.yaml import read_yaml
|
|
11
10
|
from rasa.studio.constants import STUDIO_NLU_FILENAME
|
|
12
|
-
from rasa.studio.data_handler import StudioDataHandler
|
|
13
11
|
from rasa.utils.mapper import RasaPrimitiveStorageMapper
|
|
14
12
|
|
|
15
13
|
logger = logging.getLogger(__name__)
|
|
16
14
|
|
|
17
|
-
STUDIO_FLOWS_DIR_NAME = "
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
def merge_flows_with_overwrite(
|
|
21
|
-
data_path: Path,
|
|
22
|
-
handler: Any,
|
|
23
|
-
data_from_studio: TrainingDataImporter,
|
|
24
|
-
data_local: TrainingDataImporter,
|
|
25
|
-
mapper: RasaPrimitiveStorageMapper,
|
|
26
|
-
) -> None:
|
|
27
|
-
"""
|
|
28
|
-
Merges flows data from a file or directory when overwrite is enabled.
|
|
29
|
-
|
|
30
|
-
Args:
|
|
31
|
-
data_path: List of paths to the training data.
|
|
32
|
-
handler: The StudioDataHandler instance.
|
|
33
|
-
data_from_studio: The TrainingDataImporter instance for Studio data.
|
|
34
|
-
data_local: The TrainingDataImporter instance for local data.
|
|
35
|
-
mapper: The RasaPrimitiveStorageMapper instance for mapping.
|
|
36
|
-
"""
|
|
37
|
-
if data_path.is_file():
|
|
38
|
-
merge_training_data_file(handler, data_from_studio, data_local, data_path)
|
|
39
|
-
elif data_path.is_dir():
|
|
40
|
-
merge_training_data_dir(
|
|
41
|
-
handler, data_from_studio, data_local, data_path, mapper
|
|
42
|
-
)
|
|
43
|
-
else:
|
|
44
|
-
raise ValueError("Provided data path is neither a file nor a directory.")
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
def merge_training_data_file(
|
|
48
|
-
handler: StudioDataHandler,
|
|
49
|
-
data_from_studio: TrainingDataImporter,
|
|
50
|
-
data_local: TrainingDataImporter,
|
|
51
|
-
file_path: Path,
|
|
52
|
-
) -> None:
|
|
53
|
-
"""
|
|
54
|
-
Merges NLU and flows data when training data is stored in a single file.
|
|
55
|
-
|
|
56
|
-
Args:
|
|
57
|
-
handler: The StudioDataHandler instance.
|
|
58
|
-
data_from_studio: The TrainingDataImporter instance for Studio data.
|
|
59
|
-
data_local: The TrainingDataImporter instance for local data.
|
|
60
|
-
file_path: The path to the training data file.
|
|
61
|
-
"""
|
|
62
|
-
if handler.has_nlu():
|
|
63
|
-
nlu_data_merged = data_from_studio.get_nlu_data().merge(
|
|
64
|
-
data_local.get_nlu_data()
|
|
65
|
-
)
|
|
66
|
-
nlu_data_merged.persist_nlu(file_path)
|
|
67
|
-
|
|
68
|
-
if handler.has_flows():
|
|
69
|
-
flows_data_merged = data_from_studio.get_user_flows().merge(
|
|
70
|
-
data_local.get_user_flows()
|
|
71
|
-
)
|
|
72
|
-
YamlFlowsWriter.dump(
|
|
73
|
-
flows=flows_data_merged.underlying_flows,
|
|
74
|
-
filename=file_path,
|
|
75
|
-
should_clean_json=True,
|
|
76
|
-
)
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
def merge_training_data_dir(
|
|
80
|
-
handler: StudioDataHandler,
|
|
81
|
-
data_from_studio: TrainingDataImporter,
|
|
82
|
-
data_local: TrainingDataImporter,
|
|
83
|
-
data_path: Path,
|
|
84
|
-
mapper: RasaPrimitiveStorageMapper,
|
|
85
|
-
) -> None:
|
|
86
|
-
"""
|
|
87
|
-
Merges NLU and flows data when training data is stored in a directory.
|
|
88
|
-
|
|
89
|
-
Args:
|
|
90
|
-
handler: The StudioDataHandler instance.
|
|
91
|
-
data_from_studio: The TrainingDataImporter instance for Studio data.
|
|
92
|
-
data_local: The TrainingDataImporter instance for local data.
|
|
93
|
-
data_path: The path to the training data directory.
|
|
94
|
-
mapper: The RasaPrimitiveStorageMapper instance for mapping.
|
|
95
|
-
"""
|
|
96
|
-
if handler.has_nlu():
|
|
97
|
-
merge_nlu_in_directory(data_from_studio, data_local, data_path, mapper)
|
|
98
|
-
|
|
99
|
-
if handler.has_flows():
|
|
100
|
-
merge_flows_in_directory(data_from_studio, data_path, mapper)
|
|
15
|
+
STUDIO_FLOWS_DIR_NAME = "flows"
|
|
101
16
|
|
|
102
17
|
|
|
103
18
|
def merge_nlu_in_directory(
|
|
@@ -116,7 +31,7 @@ def merge_nlu_in_directory(
|
|
|
116
31
|
data_path: The path to the training data directory.
|
|
117
32
|
mapper: The RasaPrimitiveStorageMapper instance for mapping.
|
|
118
33
|
"""
|
|
119
|
-
from rasa.studio.download
|
|
34
|
+
from rasa.studio.download import pretty_write_nlu_yaml
|
|
120
35
|
|
|
121
36
|
nlu_data = data_from_studio.get_nlu_data()
|
|
122
37
|
nlu_file_path = get_nlu_path(data_path, data_local, mapper)
|
|
@@ -154,29 +69,6 @@ def get_nlu_path(
|
|
|
154
69
|
return _select_path(nlu_paths, "nlu", base_path, STUDIO_NLU_FILENAME)
|
|
155
70
|
|
|
156
71
|
|
|
157
|
-
def get_flows_path(
|
|
158
|
-
base_path: Path,
|
|
159
|
-
data_local: TrainingDataImporter,
|
|
160
|
-
mapper: RasaPrimitiveStorageMapper,
|
|
161
|
-
) -> Path:
|
|
162
|
-
"""Determines where flows data should be stored.
|
|
163
|
-
|
|
164
|
-
Args:
|
|
165
|
-
base_path: The base path for the training data.
|
|
166
|
-
data_local: The TrainingDataImporter instance for local data.
|
|
167
|
-
mapper: The RasaPrimitiveStorageMapper instance for mapping.
|
|
168
|
-
|
|
169
|
-
Returns:
|
|
170
|
-
The path where flows data should be stored.
|
|
171
|
-
"""
|
|
172
|
-
flow_paths = set()
|
|
173
|
-
for flow in data_local.get_user_flows().underlying_flows:
|
|
174
|
-
for p in mapper.get_file(flow.id, "flows").get("training", []):
|
|
175
|
-
flow_paths.add(p)
|
|
176
|
-
|
|
177
|
-
return _select_path(flow_paths, "flows", base_path, "flows.yml")
|
|
178
|
-
|
|
179
|
-
|
|
180
72
|
def merge_flows_in_directory(
|
|
181
73
|
data_from_studio: TrainingDataImporter,
|
|
182
74
|
data_path: Path,
|
|
@@ -298,27 +190,6 @@ def _dump_flows_as_separate_files(flows: List[Any], data_path: Path) -> None:
|
|
|
298
190
|
)
|
|
299
191
|
|
|
300
192
|
|
|
301
|
-
def strip_default_next_references(flows: FlowsList) -> FlowsList:
|
|
302
|
-
"""Strips default next references from flows.
|
|
303
|
-
|
|
304
|
-
Args:
|
|
305
|
-
flows: The FlowsList instance containing the flows.
|
|
306
|
-
|
|
307
|
-
Returns:
|
|
308
|
-
An updated FlowsList instance with default next references removed.
|
|
309
|
-
"""
|
|
310
|
-
default_step_ids = [step.default_id for flow in flows for step in flow.steps]
|
|
311
|
-
for flow in flows:
|
|
312
|
-
for step in flow.steps:
|
|
313
|
-
if (
|
|
314
|
-
step.next.links
|
|
315
|
-
and isinstance(step.next.links[0], StaticFlowStepLink)
|
|
316
|
-
and step.next.links[0].target in default_step_ids
|
|
317
|
-
):
|
|
318
|
-
step.next.links = []
|
|
319
|
-
return flows
|
|
320
|
-
|
|
321
|
-
|
|
322
193
|
def _select_path(
|
|
323
194
|
paths: Set[Path], primitive_type: str, default_path: Path, default: str
|
|
324
195
|
) -> Path:
|
|
@@ -10,7 +10,7 @@ from rasa.studio.constants import STUDIO_DOMAIN_FILENAME
|
|
|
10
10
|
logger = logging.getLogger(__name__)
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
def
|
|
13
|
+
def merge_domain(
|
|
14
14
|
data_from_studio: TrainingDataImporter,
|
|
15
15
|
data_local: TrainingDataImporter,
|
|
16
16
|
domain_path: Path,
|
rasa/studio/pull/pull.py
ADDED
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import argparse
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
from typing import Any, Tuple
|
|
6
|
+
|
|
7
|
+
import structlog
|
|
8
|
+
|
|
9
|
+
import rasa.cli.utils
|
|
10
|
+
import rasa.shared.utils.cli
|
|
11
|
+
from rasa.shared.constants import (
|
|
12
|
+
DEFAULT_CONFIG_PATH,
|
|
13
|
+
DEFAULT_DATA_PATH,
|
|
14
|
+
DEFAULT_DOMAIN_PATH,
|
|
15
|
+
DEFAULT_DOMAIN_PATHS,
|
|
16
|
+
DEFAULT_ENDPOINTS_PATH,
|
|
17
|
+
)
|
|
18
|
+
from rasa.shared.importers.importer import TrainingDataImporter
|
|
19
|
+
from rasa.shared.utils.io import write_text_file
|
|
20
|
+
from rasa.studio.config import StudioConfig
|
|
21
|
+
from rasa.studio.data_handler import StudioDataHandler, import_data_from_studio
|
|
22
|
+
from rasa.studio.link import read_assistant_name
|
|
23
|
+
from rasa.studio.pull.data import merge_flows_in_directory, merge_nlu_in_directory
|
|
24
|
+
from rasa.studio.pull.domains import merge_domain
|
|
25
|
+
from rasa.utils.mapper import RasaPrimitiveStorageMapper
|
|
26
|
+
|
|
27
|
+
structlogger = structlog.get_logger(__name__)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def handle_pull(args: argparse.Namespace) -> None:
|
|
31
|
+
"""Pull the complete assistant and overwrite all local files.
|
|
32
|
+
|
|
33
|
+
Args:
|
|
34
|
+
args: The command line arguments.
|
|
35
|
+
"""
|
|
36
|
+
handler = _create_studio_handler()
|
|
37
|
+
handler.request_all_data()
|
|
38
|
+
|
|
39
|
+
_pull_config_file(handler, args.config or DEFAULT_CONFIG_PATH)
|
|
40
|
+
_pull_endpoints_file(handler, args.endpoints or DEFAULT_ENDPOINTS_PATH)
|
|
41
|
+
|
|
42
|
+
domain_path, data_path = _prepare_data_and_domain_paths(args)
|
|
43
|
+
_merge_domain_and_data(handler, domain_path, data_path)
|
|
44
|
+
|
|
45
|
+
structlogger.info(
|
|
46
|
+
"studio.push.success",
|
|
47
|
+
event_info="Pulled assistant data from Studio.",
|
|
48
|
+
)
|
|
49
|
+
rasa.shared.utils.cli.print_success("Pulled assistant data from Studio.")
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def handle_pull_config(args: argparse.Namespace) -> None:
|
|
53
|
+
"""Pull nothing but the assistant's `config.yml`.
|
|
54
|
+
|
|
55
|
+
Args:
|
|
56
|
+
args: The command line arguments.
|
|
57
|
+
"""
|
|
58
|
+
handler = _create_studio_handler()
|
|
59
|
+
handler.request_all_data()
|
|
60
|
+
|
|
61
|
+
_pull_config_file(handler, args.config or DEFAULT_CONFIG_PATH)
|
|
62
|
+
|
|
63
|
+
structlogger.info(
|
|
64
|
+
"studio.push.success",
|
|
65
|
+
event_info="Pulled assistant data from Studio.",
|
|
66
|
+
)
|
|
67
|
+
rasa.shared.utils.cli.print_success("Pulled assistant data from Studio.")
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def handle_pull_endpoints(args: argparse.Namespace) -> None:
|
|
71
|
+
"""Pull nothing but the assistant's `endpoints.yml`.
|
|
72
|
+
|
|
73
|
+
Args:
|
|
74
|
+
args: The command line arguments.
|
|
75
|
+
"""
|
|
76
|
+
handler = _create_studio_handler()
|
|
77
|
+
handler.request_all_data()
|
|
78
|
+
|
|
79
|
+
_pull_endpoints_file(handler, args.endpoints or DEFAULT_ENDPOINTS_PATH)
|
|
80
|
+
structlogger.info(
|
|
81
|
+
"studio.push.success",
|
|
82
|
+
event_info="Pulled assistant data from Studio.",
|
|
83
|
+
)
|
|
84
|
+
rasa.shared.utils.cli.print_success("Pulled assistant data from Studio.")
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
def _create_studio_handler() -> StudioDataHandler:
|
|
88
|
+
"""Return an initialised StudioDataHandler for the linked assistant.
|
|
89
|
+
|
|
90
|
+
Returns:
|
|
91
|
+
An instance of `StudioDataHandler` for the linked assistant.
|
|
92
|
+
"""
|
|
93
|
+
assistant_name = read_assistant_name()
|
|
94
|
+
return StudioDataHandler(
|
|
95
|
+
studio_config=StudioConfig.read_config(), assistant_name=assistant_name
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
def _pull_config_file(handler: StudioDataHandler, target_path: str | Path) -> None:
|
|
100
|
+
"""Pull the assistant's `config.yml` file and write it to the specified path.
|
|
101
|
+
|
|
102
|
+
Args:
|
|
103
|
+
handler: The data handler to retrieve the config from.
|
|
104
|
+
target_path: The path where the config file should be written.
|
|
105
|
+
"""
|
|
106
|
+
config_yaml = handler.get_config()
|
|
107
|
+
if not config_yaml:
|
|
108
|
+
rasa.shared.utils.cli.print_error_and_exit("No config data found in assistant.")
|
|
109
|
+
|
|
110
|
+
_write_text(config_yaml, target_path)
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
def _pull_endpoints_file(handler: StudioDataHandler, target_path: str | Path) -> None:
|
|
114
|
+
"""Pull the assistant's `endpoints.yml` file and write it to the specified path.
|
|
115
|
+
|
|
116
|
+
Args:
|
|
117
|
+
handler: The data handler to retrieve the endpoints from.
|
|
118
|
+
target_path: The path where the endpoints file should be written.
|
|
119
|
+
"""
|
|
120
|
+
endpoints_yaml = handler.get_endpoints()
|
|
121
|
+
if not endpoints_yaml:
|
|
122
|
+
rasa.shared.utils.cli.print_error_and_exit(
|
|
123
|
+
"No endpoints data found in assistant."
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
_write_text(endpoints_yaml, target_path)
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
def _prepare_data_and_domain_paths(args: argparse.Namespace) -> Tuple[Path, Path]:
|
|
130
|
+
"""Prepars the domain and data paths based on the provided arguments.
|
|
131
|
+
|
|
132
|
+
Args:
|
|
133
|
+
args: The command line arguments.
|
|
134
|
+
|
|
135
|
+
Returns:
|
|
136
|
+
A tuple containing the domain path and a data path.
|
|
137
|
+
"""
|
|
138
|
+
# Prepare domain path.
|
|
139
|
+
domain_path = rasa.cli.utils.get_validated_path(
|
|
140
|
+
args.domain, "domain", DEFAULT_DOMAIN_PATHS, none_is_valid=True
|
|
141
|
+
)
|
|
142
|
+
domain_or_default_path = args.domain or DEFAULT_DOMAIN_PATH
|
|
143
|
+
|
|
144
|
+
if domain_path is None:
|
|
145
|
+
domain_path = Path(domain_or_default_path)
|
|
146
|
+
domain_path.touch()
|
|
147
|
+
|
|
148
|
+
if isinstance(domain_path, str):
|
|
149
|
+
domain_path = Path(domain_path)
|
|
150
|
+
|
|
151
|
+
data_path = rasa.cli.utils.get_validated_path(
|
|
152
|
+
args.data[0], "data", DEFAULT_DATA_PATH, none_is_valid=True
|
|
153
|
+
)
|
|
154
|
+
|
|
155
|
+
data_path = Path(data_path or args.data[0])
|
|
156
|
+
if not (data_path.is_file() or data_path.is_dir()):
|
|
157
|
+
data_path.mkdir(parents=True, exist_ok=True)
|
|
158
|
+
|
|
159
|
+
return domain_path, data_path
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
def _merge_domain_and_data(
|
|
163
|
+
handler: StudioDataHandler, domain_path: Path, data_path: Path
|
|
164
|
+
) -> None:
|
|
165
|
+
"""Merge local assistant data with Studio assistant data.
|
|
166
|
+
|
|
167
|
+
Args:
|
|
168
|
+
handler: The data handler to retrieve the assistant data from.
|
|
169
|
+
domain_path: The path to the local domain file or directory.
|
|
170
|
+
data_path: The path to the local training data file or directory.
|
|
171
|
+
"""
|
|
172
|
+
data_from_studio, data_local = import_data_from_studio(
|
|
173
|
+
handler, domain_path, data_path
|
|
174
|
+
)
|
|
175
|
+
mapper = RasaPrimitiveStorageMapper(
|
|
176
|
+
domain_path=domain_path, training_data_paths=[data_path]
|
|
177
|
+
)
|
|
178
|
+
|
|
179
|
+
merge_domain(data_from_studio, data_local, domain_path)
|
|
180
|
+
merge_data(data_path, handler, data_from_studio, data_local, mapper)
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
def merge_data(
|
|
184
|
+
data_path: Path,
|
|
185
|
+
handler: Any,
|
|
186
|
+
data_from_studio: TrainingDataImporter,
|
|
187
|
+
data_local: TrainingDataImporter,
|
|
188
|
+
mapper: RasaPrimitiveStorageMapper,
|
|
189
|
+
) -> None:
|
|
190
|
+
"""
|
|
191
|
+
Merges flows data from a file or directory.
|
|
192
|
+
|
|
193
|
+
Args:
|
|
194
|
+
data_path: List of paths to the training data.
|
|
195
|
+
handler: The StudioDataHandler instance.
|
|
196
|
+
data_from_studio: The TrainingDataImporter instance for Studio data.
|
|
197
|
+
data_local: The TrainingDataImporter instance for local data.
|
|
198
|
+
mapper: The RasaPrimitiveStorageMapper instance for mapping.
|
|
199
|
+
"""
|
|
200
|
+
if not data_path.is_file() and not data_path.is_dir():
|
|
201
|
+
raise ValueError("Provided data path is neither a file nor a directory.")
|
|
202
|
+
|
|
203
|
+
if handler.has_nlu():
|
|
204
|
+
if data_path.is_file():
|
|
205
|
+
nlu_data_merged = data_from_studio.get_nlu_data().merge(
|
|
206
|
+
data_local.get_nlu_data()
|
|
207
|
+
)
|
|
208
|
+
nlu_data_merged.persist_nlu(data_path)
|
|
209
|
+
else:
|
|
210
|
+
merge_nlu_in_directory(
|
|
211
|
+
data_from_studio,
|
|
212
|
+
data_local,
|
|
213
|
+
data_path,
|
|
214
|
+
mapper,
|
|
215
|
+
)
|
|
216
|
+
|
|
217
|
+
if handler.has_flows():
|
|
218
|
+
flows_root = data_path.parent if data_path.is_file() else data_path
|
|
219
|
+
merge_flows_in_directory(
|
|
220
|
+
data_from_studio,
|
|
221
|
+
flows_root,
|
|
222
|
+
mapper,
|
|
223
|
+
)
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
def _write_text(content: str, target: str | Path) -> None:
|
|
227
|
+
"""Write `content` to `target`, ensuring parent directories exist.
|
|
228
|
+
|
|
229
|
+
Args:
|
|
230
|
+
content: The content to write to the file.
|
|
231
|
+
target: The path where the content should be written.
|
|
232
|
+
"""
|
|
233
|
+
path = Path(target)
|
|
234
|
+
path.parent.mkdir(parents=True, exist_ok=True)
|
|
235
|
+
write_text_file(content, path, encoding="utf-8")
|
rasa/studio/push.py
CHANGED
|
@@ -48,6 +48,11 @@ def _send_to_studio(
|
|
|
48
48
|
if not result.was_successful:
|
|
49
49
|
rasa.shared.utils.cli.print_error_and_exit(result.message)
|
|
50
50
|
|
|
51
|
+
structlogger.info(
|
|
52
|
+
"studio.push.success",
|
|
53
|
+
event_info=f"Pushed data to assistant '{assistant_name}'.",
|
|
54
|
+
assistant_name=assistant_name,
|
|
55
|
+
)
|
|
51
56
|
rasa.shared.utils.cli.print_success(f"Pushed data to assistant '{assistant_name}'.")
|
|
52
57
|
|
|
53
58
|
|
rasa/studio/train.py
CHANGED
|
@@ -34,7 +34,7 @@ def handle_train(args: argparse.Namespace) -> Optional[str]:
|
|
|
34
34
|
from rasa.api import train as train_all
|
|
35
35
|
|
|
36
36
|
handler = StudioDataHandler(
|
|
37
|
-
studio_config=StudioConfig.read_config(), assistant_name=args.assistant_name
|
|
37
|
+
studio_config=StudioConfig.read_config(), assistant_name=args.assistant_name
|
|
38
38
|
)
|
|
39
39
|
if args.entities or args.intents:
|
|
40
40
|
handler.request_data(args.intents, args.entities)
|
|
@@ -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 = {
|
|
@@ -821,7 +826,16 @@ def compute_prompt_tokens_length(
|
|
|
821
826
|
)
|
|
822
827
|
model_name = f"{model_name}-0613"
|
|
823
828
|
|
|
824
|
-
|
|
829
|
+
try:
|
|
830
|
+
encoding = tiktoken.encoding_for_model(model_name)
|
|
831
|
+
except KeyError:
|
|
832
|
+
# Fallback for unknown models
|
|
833
|
+
logger.warning(
|
|
834
|
+
f"Unknown model name '{model_name}', "
|
|
835
|
+
f"using 'cl100k_base' encoding as fallback."
|
|
836
|
+
)
|
|
837
|
+
encoding = tiktoken.get_encoding("cl100k_base")
|
|
838
|
+
|
|
825
839
|
return len(encoding.encode(prompt))
|
|
826
840
|
|
|
827
841
|
|
rasa/utils/common.py
CHANGED
|
@@ -280,6 +280,7 @@ def configure_library_logging() -> None:
|
|
|
280
280
|
update_matplotlib_log_level(library_log_level)
|
|
281
281
|
update_kafka_log_level(library_log_level)
|
|
282
282
|
update_rabbitmq_log_level(library_log_level)
|
|
283
|
+
update_websockets_log_level(library_log_level)
|
|
283
284
|
|
|
284
285
|
|
|
285
286
|
def update_apscheduler_log_level() -> None:
|
|
@@ -404,6 +405,16 @@ def update_rabbitmq_log_level(library_log_level: Text) -> None:
|
|
|
404
405
|
logging.getLogger("aiormq").setLevel(log_level)
|
|
405
406
|
|
|
406
407
|
|
|
408
|
+
def update_websockets_log_level(library_log_level: Text) -> None:
|
|
409
|
+
"""Set the log level of websockets.
|
|
410
|
+
|
|
411
|
+
Uses the library specific log level or the general libraries log level.
|
|
412
|
+
"""
|
|
413
|
+
log_level = os.environ.get(ENV_LOG_LEVEL_LIBRARIES, library_log_level)
|
|
414
|
+
logging.getLogger("websockets").setLevel(log_level)
|
|
415
|
+
logging.getLogger("websockets").propagate = False
|
|
416
|
+
|
|
417
|
+
|
|
407
418
|
def sort_list_of_dicts_by_first_key(dicts: List[Dict]) -> List[Dict]:
|
|
408
419
|
"""Sorts a list of dictionaries by their first key."""
|
|
409
420
|
return sorted(dicts, key=lambda d: next(iter(d.keys())))
|
rasa/version.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: rasa-pro
|
|
3
|
-
Version: 3.13.
|
|
3
|
+
Version: 3.13.0rc1
|
|
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)
|
|
@@ -99,7 +99,7 @@ Requires-Dist: pyyaml (>=6.0)
|
|
|
99
99
|
Requires-Dist: qdrant-client (>=1.9.1,<1.10.0)
|
|
100
100
|
Requires-Dist: questionary (>=1.10.0,<2.1.0)
|
|
101
101
|
Requires-Dist: randomname (>=0.2.1,<0.3.0)
|
|
102
|
-
Requires-Dist: rasa-sdk (==3.13.
|
|
102
|
+
Requires-Dist: rasa-sdk (==3.13.0rc1)
|
|
103
103
|
Requires-Dist: redis (>=4.6.0,<6.0)
|
|
104
104
|
Requires-Dist: regex (>=2024.7.24,<2024.8.0)
|
|
105
105
|
Requires-Dist: requests (>=2.32.3,<2.33.0)
|