rasa-pro 3.14.0rc3__py3-none-any.whl → 3.14.1__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/agents/agent_manager.py +7 -5
- rasa/agents/protocol/a2a/a2a_agent.py +13 -11
- rasa/agents/protocol/mcp/mcp_base_agent.py +64 -12
- rasa/agents/validation.py +61 -6
- rasa/builder/copilot/constants.py +4 -0
- rasa/builder/copilot/copilot_templated_message_provider.py +24 -1
- rasa/builder/copilot/templated_messages/copilot_templated_responses.yml +3 -0
- rasa/builder/copilot/templated_messages/copilot_welcome_messages.yml +56 -0
- rasa/builder/jobs.py +162 -5
- rasa/builder/models.py +3 -0
- rasa/builder/validation_service.py +4 -0
- rasa/cli/arguments/data.py +9 -0
- rasa/cli/data.py +72 -6
- rasa/cli/interactive.py +3 -0
- rasa/cli/llm_fine_tuning.py +1 -0
- rasa/cli/project_templates/defaults.py +1 -0
- rasa/cli/validation/bot_config.py +4 -0
- rasa/constants.py +1 -1
- rasa/core/actions/action_exceptions.py +1 -1
- rasa/core/agent.py +4 -1
- rasa/core/available_agents.py +1 -1
- rasa/core/config/available_endpoints.py +6 -0
- rasa/core/exceptions.py +1 -1
- rasa/core/featurizers/tracker_featurizers.py +3 -2
- rasa/core/persistor.py +7 -7
- rasa/core/policies/flows/agent_executor.py +84 -4
- rasa/core/policies/flows/flow_exceptions.py +5 -2
- rasa/core/policies/flows/flow_executor.py +3 -2
- rasa/core/policies/flows/mcp_tool_executor.py +7 -1
- rasa/core/policies/rule_policy.py +1 -1
- rasa/dialogue_understanding/commands/cancel_flow_command.py +1 -1
- rasa/dialogue_understanding/patterns/default_flows_for_patterns.yml +22 -20
- rasa/engine/validation.py +6 -2
- rasa/model_manager/runner_service.py +1 -1
- rasa/privacy/privacy_config.py +1 -1
- rasa/shared/agents/auth/auth_strategy/oauth2_auth_strategy.py +4 -7
- rasa/shared/agents/auth/utils.py +85 -0
- rasa/shared/constants.py +3 -0
- rasa/shared/core/training_data/story_reader/story_reader.py +1 -1
- rasa/shared/exceptions.py +23 -2
- rasa/shared/providers/llm/litellm_router_llm_client.py +2 -2
- rasa/shared/utils/llm.py +54 -4
- rasa/shared/utils/mcp/server_connection.py +7 -4
- rasa/studio/download.py +3 -0
- rasa/studio/prompts.py +1 -0
- rasa/studio/upload.py +4 -0
- rasa/utils/log_utils.py +20 -1
- rasa/utils/pypred.py +7 -0
- rasa/validator.py +90 -2
- rasa/version.py +1 -1
- {rasa_pro-3.14.0rc3.dist-info → rasa_pro-3.14.1.dist-info}/METADATA +8 -7
- {rasa_pro-3.14.0rc3.dist-info → rasa_pro-3.14.1.dist-info}/RECORD +55 -53
- {rasa_pro-3.14.0rc3.dist-info → rasa_pro-3.14.1.dist-info}/NOTICE +0 -0
- {rasa_pro-3.14.0rc3.dist-info → rasa_pro-3.14.1.dist-info}/WHEEL +0 -0
- {rasa_pro-3.14.0rc3.dist-info → rasa_pro-3.14.1.dist-info}/entry_points.txt +0 -0
rasa/builder/jobs.py
CHANGED
|
@@ -4,6 +4,13 @@ import structlog
|
|
|
4
4
|
from sanic import Sanic
|
|
5
5
|
|
|
6
6
|
from rasa.builder import config
|
|
7
|
+
from rasa.builder.copilot.constants import (
|
|
8
|
+
PROMPT_TO_BOT_KEY,
|
|
9
|
+
)
|
|
10
|
+
from rasa.builder.copilot.copilot_templated_message_provider import (
|
|
11
|
+
load_copilot_handler_default_responses,
|
|
12
|
+
load_copilot_welcome_messages,
|
|
13
|
+
)
|
|
7
14
|
from rasa.builder.copilot.models import (
|
|
8
15
|
CopilotContext,
|
|
9
16
|
FileContent,
|
|
@@ -80,11 +87,20 @@ async def run_prompt_to_bot_job(
|
|
|
80
87
|
update_agent(agent, app)
|
|
81
88
|
await push_job_status_event(job, JobStatus.train_success)
|
|
82
89
|
|
|
90
|
+
# 3. Create copilot welcome message job
|
|
91
|
+
copilot_welcome_job = job_manager.create_job()
|
|
92
|
+
app.add_task(run_copilot_welcome_message_job(app, copilot_welcome_job))
|
|
93
|
+
|
|
83
94
|
structlogger.info(
|
|
84
95
|
"bot_builder_service.prompt_to_bot.success",
|
|
85
96
|
files_generated=list(bot_files.keys()),
|
|
97
|
+
copilot_welcome_job_id=copilot_welcome_job.id,
|
|
98
|
+
)
|
|
99
|
+
await push_job_status_event(
|
|
100
|
+
job=job,
|
|
101
|
+
status=JobStatus.done,
|
|
102
|
+
payload={"copilot_welcome_job_id": copilot_welcome_job.id},
|
|
86
103
|
)
|
|
87
|
-
await push_job_status_event(job, JobStatus.done)
|
|
88
104
|
job_manager.mark_done(job)
|
|
89
105
|
|
|
90
106
|
except TrainingError as exc:
|
|
@@ -165,12 +181,23 @@ async def run_template_to_bot_job(
|
|
|
165
181
|
update_agent(agent, app)
|
|
166
182
|
await push_job_status_event(job, JobStatus.train_success)
|
|
167
183
|
|
|
168
|
-
# 3)
|
|
184
|
+
# 3) Create copilot welcome message job
|
|
185
|
+
copilot_welcome_job = job_manager.create_job()
|
|
186
|
+
app.add_task(
|
|
187
|
+
run_copilot_welcome_message_job(app, copilot_welcome_job, template_name)
|
|
188
|
+
)
|
|
189
|
+
|
|
190
|
+
# 4) Done - include welcome job ID in payload
|
|
169
191
|
structlogger.info(
|
|
170
192
|
"bot_builder_service.template_to_bot.success",
|
|
171
193
|
files_generated=list(bot_files.keys()),
|
|
194
|
+
copilot_welcome_job_id=copilot_welcome_job.id,
|
|
195
|
+
)
|
|
196
|
+
await push_job_status_event(
|
|
197
|
+
job=job,
|
|
198
|
+
status=JobStatus.done,
|
|
199
|
+
payload={"copilot_welcome_job_id": copilot_welcome_job.id},
|
|
172
200
|
)
|
|
173
|
-
await push_job_status_event(job, JobStatus.done)
|
|
174
201
|
job_manager.mark_done(job)
|
|
175
202
|
|
|
176
203
|
except TrainingError as exc:
|
|
@@ -256,8 +283,19 @@ async def run_replace_all_files_job(
|
|
|
256
283
|
update_agent(agent, app)
|
|
257
284
|
await push_job_status_event(job, JobStatus.train_success)
|
|
258
285
|
|
|
259
|
-
# Send final done event
|
|
260
|
-
|
|
286
|
+
# Send final done event with copilot training success response job ID
|
|
287
|
+
copilot_training_success_job = job_manager.create_job()
|
|
288
|
+
app.add_task(
|
|
289
|
+
run_copilot_training_success_job(app, copilot_training_success_job)
|
|
290
|
+
)
|
|
291
|
+
|
|
292
|
+
await push_job_status_event(
|
|
293
|
+
job=job,
|
|
294
|
+
status=JobStatus.done,
|
|
295
|
+
payload={
|
|
296
|
+
"copilot_training_success_job_id": copilot_training_success_job.id
|
|
297
|
+
},
|
|
298
|
+
)
|
|
261
299
|
job_manager.mark_done(job)
|
|
262
300
|
|
|
263
301
|
except ValidationError as exc:
|
|
@@ -450,3 +488,122 @@ async def run_copilot_training_error_analysis_job(
|
|
|
450
488
|
job, JobStatus.copilot_analysis_error, message=str(exc)
|
|
451
489
|
)
|
|
452
490
|
job_manager.mark_done(job, error=str(exc))
|
|
491
|
+
|
|
492
|
+
|
|
493
|
+
async def run_copilot_welcome_message_job(
|
|
494
|
+
app: "Sanic",
|
|
495
|
+
job: JobInfo,
|
|
496
|
+
template_name: Optional[ProjectTemplateName] = None,
|
|
497
|
+
) -> None:
|
|
498
|
+
"""Run the welcome message job in the background.
|
|
499
|
+
|
|
500
|
+
This job sends a welcome message to the user after successful bot creation.
|
|
501
|
+
For template-based bots, it sends a predefined message.
|
|
502
|
+
For prompt-based bots, it can be extended to stream generated messages.
|
|
503
|
+
|
|
504
|
+
Args:
|
|
505
|
+
app: The Sanic application instance.
|
|
506
|
+
job: The job information instance.
|
|
507
|
+
template_name: The template name for template-based bots, None for prompt-based.
|
|
508
|
+
"""
|
|
509
|
+
try:
|
|
510
|
+
# Load welcome messages from YAML
|
|
511
|
+
welcome_messages = load_copilot_welcome_messages()
|
|
512
|
+
|
|
513
|
+
# Get the appropriate welcome message
|
|
514
|
+
if template_name:
|
|
515
|
+
welcome_message = welcome_messages.get(
|
|
516
|
+
template_name.value,
|
|
517
|
+
welcome_messages.get(PROMPT_TO_BOT_KEY),
|
|
518
|
+
)
|
|
519
|
+
else:
|
|
520
|
+
welcome_message = welcome_messages.get(PROMPT_TO_BOT_KEY)
|
|
521
|
+
|
|
522
|
+
# Send the welcome message as a single event
|
|
523
|
+
await push_job_status_event(
|
|
524
|
+
job,
|
|
525
|
+
JobStatus.copilot_welcome_message,
|
|
526
|
+
payload={
|
|
527
|
+
"content": welcome_message,
|
|
528
|
+
"response_category": "copilot",
|
|
529
|
+
"completeness": "complete",
|
|
530
|
+
},
|
|
531
|
+
)
|
|
532
|
+
|
|
533
|
+
# Mark job as done
|
|
534
|
+
await push_job_status_event(job, JobStatus.done)
|
|
535
|
+
job_manager.mark_done(job)
|
|
536
|
+
|
|
537
|
+
structlogger.info(
|
|
538
|
+
"copilot_welcome_message_job.success",
|
|
539
|
+
job_id=job.id,
|
|
540
|
+
template=template_name.value if template_name else PROMPT_TO_BOT_KEY,
|
|
541
|
+
)
|
|
542
|
+
|
|
543
|
+
except Exception as exc:
|
|
544
|
+
structlogger.exception(
|
|
545
|
+
"welcome_message_job.error",
|
|
546
|
+
job_id=job.id,
|
|
547
|
+
error=str(exc),
|
|
548
|
+
)
|
|
549
|
+
await push_job_status_event(job, JobStatus.error, message=str(exc))
|
|
550
|
+
job_manager.mark_done(job, error=str(exc))
|
|
551
|
+
|
|
552
|
+
|
|
553
|
+
async def run_copilot_training_success_job(
|
|
554
|
+
app: "Sanic",
|
|
555
|
+
job: JobInfo,
|
|
556
|
+
) -> None:
|
|
557
|
+
"""Run the training success job in the background.
|
|
558
|
+
|
|
559
|
+
This job sends a training success message to the user after successful bot training.
|
|
560
|
+
|
|
561
|
+
Args:
|
|
562
|
+
app: The Sanic application instance.
|
|
563
|
+
job: The job information instance.
|
|
564
|
+
"""
|
|
565
|
+
try:
|
|
566
|
+
# Load copilot default messages from YAML
|
|
567
|
+
internal_messages = load_copilot_handler_default_responses()
|
|
568
|
+
|
|
569
|
+
# Get the appropriate training success message
|
|
570
|
+
training_success_message = internal_messages.get("training_success_response")
|
|
571
|
+
|
|
572
|
+
# Send the training success message
|
|
573
|
+
await push_job_status_event(
|
|
574
|
+
job,
|
|
575
|
+
JobStatus.train_success_message,
|
|
576
|
+
payload={
|
|
577
|
+
"content": training_success_message,
|
|
578
|
+
"response_category": "copilot",
|
|
579
|
+
"completeness": "complete",
|
|
580
|
+
},
|
|
581
|
+
)
|
|
582
|
+
|
|
583
|
+
# Send the training success category
|
|
584
|
+
await push_job_status_event(
|
|
585
|
+
job,
|
|
586
|
+
JobStatus.train_success_message,
|
|
587
|
+
payload={
|
|
588
|
+
"response_category": "copilot_training_success",
|
|
589
|
+
"completeness": "complete",
|
|
590
|
+
},
|
|
591
|
+
)
|
|
592
|
+
|
|
593
|
+
# Mark job as done
|
|
594
|
+
await push_job_status_event(job, JobStatus.done)
|
|
595
|
+
job_manager.mark_done(job)
|
|
596
|
+
|
|
597
|
+
structlogger.info(
|
|
598
|
+
"copilot_training_success_job.success",
|
|
599
|
+
job_id=job.id,
|
|
600
|
+
)
|
|
601
|
+
|
|
602
|
+
except Exception as exc:
|
|
603
|
+
structlogger.exception(
|
|
604
|
+
"copilot_training_success_job.error",
|
|
605
|
+
job_id=job.id,
|
|
606
|
+
error=str(exc),
|
|
607
|
+
)
|
|
608
|
+
await push_job_status_event(job, JobStatus.error, message=str(exc))
|
|
609
|
+
job_manager.mark_done(job, error=str(exc))
|
rasa/builder/models.py
CHANGED
|
@@ -191,6 +191,7 @@ class JobStatus(str, Enum):
|
|
|
191
191
|
|
|
192
192
|
training = "training"
|
|
193
193
|
train_success = "train_success"
|
|
194
|
+
train_success_message = "train_success_message"
|
|
194
195
|
train_error = "train_error"
|
|
195
196
|
|
|
196
197
|
validating = "validating"
|
|
@@ -202,6 +203,8 @@ class JobStatus(str, Enum):
|
|
|
202
203
|
copilot_analysis_success = "copilot_analysis_success"
|
|
203
204
|
copilot_analysis_error = "copilot_analysis_error"
|
|
204
205
|
|
|
206
|
+
copilot_welcome_message = "copilot_welcome_message"
|
|
207
|
+
|
|
205
208
|
|
|
206
209
|
class JobCreateResponse(BaseModel):
|
|
207
210
|
job_id: str = Field(...)
|
|
@@ -47,6 +47,10 @@ async def validate_project(importer: TrainingDataImporter) -> Optional[str]:
|
|
|
47
47
|
with capture_validation_logs() as captured_logs:
|
|
48
48
|
try:
|
|
49
49
|
with _mock_sys_exit() as exit_tracker:
|
|
50
|
+
from rasa.core.config.configuration import Configuration
|
|
51
|
+
|
|
52
|
+
Configuration.initialise_empty()
|
|
53
|
+
|
|
50
54
|
validate_files(
|
|
51
55
|
fail_on_warnings=config.VALIDATION_FAIL_ON_WARNINGS,
|
|
52
56
|
max_history=config.VALIDATION_MAX_HISTORY,
|
rasa/cli/arguments/data.py
CHANGED
|
@@ -4,8 +4,10 @@ from typing import Text
|
|
|
4
4
|
from rasa.cli.arguments.default_arguments import (
|
|
5
5
|
add_data_param,
|
|
6
6
|
add_domain_param,
|
|
7
|
+
add_endpoint_param,
|
|
7
8
|
add_nlu_data_param,
|
|
8
9
|
add_out_param,
|
|
10
|
+
add_sub_agents_param,
|
|
9
11
|
)
|
|
10
12
|
from rasa.shared.constants import DEFAULT_CONVERTED_DATA_PATH
|
|
11
13
|
|
|
@@ -91,6 +93,13 @@ def set_validator_arguments(parser: argparse.ArgumentParser) -> None:
|
|
|
91
93
|
)
|
|
92
94
|
add_domain_param(parser)
|
|
93
95
|
add_data_param(parser)
|
|
96
|
+
add_sub_agents_param(parser)
|
|
97
|
+
# Endpoints are optional for `data validate` command
|
|
98
|
+
add_endpoint_param(
|
|
99
|
+
parser,
|
|
100
|
+
help_text="Configuration file for the connectors as a yml file.",
|
|
101
|
+
default=None,
|
|
102
|
+
)
|
|
94
103
|
|
|
95
104
|
|
|
96
105
|
def set_migrate_arguments(parser: argparse.ArgumentParser) -> None:
|
rasa/cli/data.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import argparse
|
|
2
2
|
import logging
|
|
3
3
|
import pathlib
|
|
4
|
-
from typing import List
|
|
4
|
+
from typing import List, Optional
|
|
5
5
|
|
|
6
6
|
import rasa.cli.utils
|
|
7
7
|
import rasa.shared.core.domain
|
|
@@ -17,6 +17,7 @@ from rasa.cli.arguments import data as arguments
|
|
|
17
17
|
from rasa.cli.arguments import default_arguments
|
|
18
18
|
from rasa.cli.validation.bot_config import validate_files
|
|
19
19
|
from rasa.cli.validation.config_path_validation import get_validated_path
|
|
20
|
+
from rasa.core.config.configuration import Configuration
|
|
20
21
|
from rasa.e2e_test.e2e_config import create_llm_e2e_test_converter_config
|
|
21
22
|
from rasa.e2e_test.e2e_test_converter import E2ETestConverter
|
|
22
23
|
from rasa.e2e_test.utils.e2e_yaml_utils import E2ETestYAMLWriter
|
|
@@ -139,8 +140,12 @@ def _add_data_validate_parsers(
|
|
|
139
140
|
)
|
|
140
141
|
_append_story_structure_arguments(validate_parser)
|
|
141
142
|
validate_parser.set_defaults(
|
|
142
|
-
func=lambda args:
|
|
143
|
-
args.fail_on_warnings,
|
|
143
|
+
func=lambda args: _validate_files_with_configuration(
|
|
144
|
+
args.fail_on_warnings,
|
|
145
|
+
args.max_history,
|
|
146
|
+
_build_training_data_importer(args),
|
|
147
|
+
sub_agents=args.sub_agents,
|
|
148
|
+
endpoints=args.endpoints,
|
|
144
149
|
)
|
|
145
150
|
)
|
|
146
151
|
arguments.set_validator_arguments(validate_parser)
|
|
@@ -155,10 +160,12 @@ def _add_data_validate_parsers(
|
|
|
155
160
|
_append_story_structure_arguments(story_structure_parser)
|
|
156
161
|
|
|
157
162
|
story_structure_parser.set_defaults(
|
|
158
|
-
func=lambda args:
|
|
163
|
+
func=lambda args: _validate_files_with_configuration(
|
|
159
164
|
args.fail_on_warnings,
|
|
160
165
|
args.max_history,
|
|
161
166
|
_build_training_data_importer(args),
|
|
167
|
+
sub_agents=args.sub_agents,
|
|
168
|
+
endpoints=args.endpoints,
|
|
162
169
|
stories_only=True,
|
|
163
170
|
)
|
|
164
171
|
)
|
|
@@ -171,10 +178,12 @@ def _add_data_validate_parsers(
|
|
|
171
178
|
help="Checks for inconsistencies in the flows files.",
|
|
172
179
|
)
|
|
173
180
|
flows_structure_parser.set_defaults(
|
|
174
|
-
func=lambda args:
|
|
181
|
+
func=lambda args: _validate_files_with_configuration(
|
|
175
182
|
args.fail_on_warnings,
|
|
176
183
|
args.max_history,
|
|
177
184
|
_build_training_data_importer(args),
|
|
185
|
+
sub_agents=args.sub_agents,
|
|
186
|
+
endpoints=args.endpoints,
|
|
178
187
|
flows_only=True,
|
|
179
188
|
)
|
|
180
189
|
)
|
|
@@ -187,10 +196,12 @@ def _add_data_validate_parsers(
|
|
|
187
196
|
help="Checks for inconsistencies of the flow and response translation.",
|
|
188
197
|
)
|
|
189
198
|
translations_structure_parser.set_defaults(
|
|
190
|
-
func=lambda args:
|
|
199
|
+
func=lambda args: _validate_files_with_configuration(
|
|
191
200
|
args.fail_on_warnings,
|
|
192
201
|
args.max_history,
|
|
193
202
|
_build_training_data_importer(args),
|
|
203
|
+
sub_agents=args.sub_agents,
|
|
204
|
+
endpoints=args.endpoints,
|
|
194
205
|
translations_only=True,
|
|
195
206
|
)
|
|
196
207
|
)
|
|
@@ -376,3 +387,58 @@ def convert_data_to_e2e_tests(args: argparse.Namespace) -> None:
|
|
|
376
387
|
rasa.shared.utils.cli.print_error_and_exit(
|
|
377
388
|
f"Failed to convert the data into E2E tests. Error: {exc}"
|
|
378
389
|
)
|
|
390
|
+
|
|
391
|
+
|
|
392
|
+
def _initialize_configuration_for_validation(
|
|
393
|
+
sub_agents: Optional[str] = None, endpoints: Optional[str] = None
|
|
394
|
+
) -> None:
|
|
395
|
+
"""Initialize Configuration before validation.
|
|
396
|
+
|
|
397
|
+
Args:
|
|
398
|
+
sub_agents: Path to sub-agents directory for validation.
|
|
399
|
+
endpoints: Path to the endpoints configuration file.
|
|
400
|
+
"""
|
|
401
|
+
if endpoints:
|
|
402
|
+
Configuration.initialise_endpoints(endpoints_path=pathlib.Path(endpoints))
|
|
403
|
+
if sub_agents:
|
|
404
|
+
Configuration.initialise_sub_agents(pathlib.Path(sub_agents))
|
|
405
|
+
if not endpoints and not sub_agents:
|
|
406
|
+
Configuration.initialise_empty()
|
|
407
|
+
|
|
408
|
+
|
|
409
|
+
def _validate_files_with_configuration(
|
|
410
|
+
fail_on_warnings: bool,
|
|
411
|
+
max_history: int,
|
|
412
|
+
importer: TrainingDataImporter,
|
|
413
|
+
sub_agents: Optional[str] = None,
|
|
414
|
+
endpoints: Optional[str] = None,
|
|
415
|
+
stories_only: bool = False,
|
|
416
|
+
flows_only: bool = False,
|
|
417
|
+
translations_only: bool = False,
|
|
418
|
+
) -> None:
|
|
419
|
+
"""Wrapper for validate_files that ensures Configuration is initialized first.
|
|
420
|
+
|
|
421
|
+
Args:
|
|
422
|
+
fail_on_warnings: `True` if the process should exit with a non-zero status
|
|
423
|
+
max_history: The max history to use when validating the story structure.
|
|
424
|
+
importer: The `TrainingDataImporter` to use to load the training data.
|
|
425
|
+
sub_agents: Path to sub-agents directory for validation.
|
|
426
|
+
endpoints: Path to the endpoints configuration file.
|
|
427
|
+
stories_only: If `True`, only the story structure is validated.
|
|
428
|
+
flows_only: If `True`, only the flows are validated.
|
|
429
|
+
translations_only: If `True`, only the translations data is validated.
|
|
430
|
+
"""
|
|
431
|
+
# Initialize Configuration before calling validate_files
|
|
432
|
+
_initialize_configuration_for_validation(sub_agents=sub_agents, endpoints=endpoints)
|
|
433
|
+
|
|
434
|
+
# Call the original validate_files function
|
|
435
|
+
validate_files(
|
|
436
|
+
fail_on_warnings=fail_on_warnings,
|
|
437
|
+
max_history=max_history,
|
|
438
|
+
importer=importer,
|
|
439
|
+
stories_only=stories_only,
|
|
440
|
+
flows_only=flows_only,
|
|
441
|
+
translations_only=translations_only,
|
|
442
|
+
sub_agents=sub_agents,
|
|
443
|
+
endpoints=endpoints,
|
|
444
|
+
)
|
rasa/cli/interactive.py
CHANGED
|
@@ -12,6 +12,7 @@ from rasa import model
|
|
|
12
12
|
from rasa.cli import SubParsersAction
|
|
13
13
|
from rasa.cli.arguments import interactive as arguments
|
|
14
14
|
from rasa.cli.validation.config_path_validation import get_validated_path
|
|
15
|
+
from rasa.core.config.configuration import Configuration
|
|
15
16
|
from rasa.core.constants import DEFAULT_SUB_AGENTS
|
|
16
17
|
from rasa.engine.storage.local_model_storage import LocalModelStorage
|
|
17
18
|
from rasa.shared.constants import (
|
|
@@ -140,6 +141,8 @@ def perform_interactive_learning(
|
|
|
140
141
|
args.endpoints, "endpoints", DEFAULT_ENDPOINTS_PATH, True
|
|
141
142
|
)
|
|
142
143
|
|
|
144
|
+
Configuration.initialise_endpoints(endpoints_path=Path(args.endpoints))
|
|
145
|
+
|
|
143
146
|
do_interactive_learning(args, file_importer)
|
|
144
147
|
|
|
145
148
|
|
rasa/cli/llm_fine_tuning.py
CHANGED
|
@@ -414,6 +414,7 @@ def get_valid_endpoints(endpoints_file: str) -> AvailableEndpoints:
|
|
|
414
414
|
|
|
415
415
|
def set_up_e2e_test_runner(args: argparse.Namespace) -> E2ETestRunner:
|
|
416
416
|
endpoints = get_valid_endpoints(args.endpoints)
|
|
417
|
+
Configuration.initialise_sub_agents(args.sub_agents)
|
|
417
418
|
|
|
418
419
|
if endpoints.model is None:
|
|
419
420
|
args.model = validate_model_path(args.model, "model", DEFAULT_MODELS_PATH)
|
|
@@ -138,6 +138,7 @@ def get_rasa_defaults(config_yaml: Text, endpoints_yaml: Text) -> RasaDefaults:
|
|
|
138
138
|
A RasaDefaults object containing the default values for the project.
|
|
139
139
|
"""
|
|
140
140
|
config = read_yaml(config_yaml)
|
|
141
|
+
# Does not read from file, it converts the YAML content to a dictionary.
|
|
141
142
|
endpoints = read_yaml(endpoints_yaml)
|
|
142
143
|
|
|
143
144
|
prompts = get_system_default_prompts(config, endpoints)
|
|
@@ -149,6 +149,7 @@ def validate_files(
|
|
|
149
149
|
flows_only: bool = False,
|
|
150
150
|
translations_only: bool = False,
|
|
151
151
|
sub_agents: Optional[str] = None,
|
|
152
|
+
endpoints: Optional[str] = None,
|
|
152
153
|
) -> None:
|
|
153
154
|
"""Validates either the story structure or the entire project.
|
|
154
155
|
|
|
@@ -160,6 +161,7 @@ def validate_files(
|
|
|
160
161
|
flows_only: If `True`, only the flows are validated.
|
|
161
162
|
translations_only: If `True`, only the translations data is validated.
|
|
162
163
|
sub_agents: Path to sub-agents directory for validation.
|
|
164
|
+
endpoints: Path to the endpoints configuration file.
|
|
163
165
|
"""
|
|
164
166
|
from rasa.validator import Validator
|
|
165
167
|
|
|
@@ -189,6 +191,7 @@ def validate_files(
|
|
|
189
191
|
validator, max_history, fail_on_warnings
|
|
190
192
|
)
|
|
191
193
|
valid_flows = validator.verify_flows()
|
|
194
|
+
valid_prompt_templates = validator.verify_prompt_templates()
|
|
192
195
|
if validator.config:
|
|
193
196
|
valid_translations = validator.verify_translations(summary_mode=True)
|
|
194
197
|
else:
|
|
@@ -207,6 +210,7 @@ def validate_files(
|
|
|
207
210
|
and valid_nlu
|
|
208
211
|
and valid_stories
|
|
209
212
|
and valid_flows
|
|
213
|
+
and valid_prompt_templates
|
|
210
214
|
and valid_translations
|
|
211
215
|
and valid_CALM_slot_mappings
|
|
212
216
|
and valid_sub_agents
|
rasa/constants.py
CHANGED
|
@@ -18,7 +18,7 @@ CONFIG_TELEMETRY_ID = "rasa_user_id"
|
|
|
18
18
|
CONFIG_TELEMETRY_ENABLED = "enabled"
|
|
19
19
|
CONFIG_TELEMETRY_DATE = "date"
|
|
20
20
|
|
|
21
|
-
MINIMUM_COMPATIBLE_VERSION = "3.14.
|
|
21
|
+
MINIMUM_COMPATIBLE_VERSION = "3.14.0rc3"
|
|
22
22
|
|
|
23
23
|
GLOBAL_USER_CONFIG_PATH = os.path.expanduser("~/.config/rasa/global.yml")
|
|
24
24
|
|
|
@@ -12,7 +12,7 @@ class ActionExecutionRejection(RasaException):
|
|
|
12
12
|
self.message = message or "Custom action '{}' rejected to run".format(
|
|
13
13
|
action_name
|
|
14
14
|
)
|
|
15
|
-
super(ActionExecutionRejection, self).__init__()
|
|
15
|
+
super(ActionExecutionRejection, self).__init__(self.message)
|
|
16
16
|
|
|
17
17
|
def __str__(self) -> str:
|
|
18
18
|
return self.message
|
rasa/core/agent.py
CHANGED
|
@@ -297,7 +297,10 @@ async def load_agent(
|
|
|
297
297
|
return agent
|
|
298
298
|
|
|
299
299
|
except AgentInitializationException as e:
|
|
300
|
-
|
|
300
|
+
if e.suppress_stack_trace:
|
|
301
|
+
raise e from None
|
|
302
|
+
else:
|
|
303
|
+
raise e
|
|
301
304
|
except Exception as e:
|
|
302
305
|
logger.error(f"Could not load model due to {e}.", exc_info=True)
|
|
303
306
|
return agent
|
rasa/core/available_agents.py
CHANGED
|
@@ -114,7 +114,7 @@ class AvailableAgents:
|
|
|
114
114
|
else:
|
|
115
115
|
# We are using the default folder, it may not be created yet
|
|
116
116
|
# Init with an empty agents in this case
|
|
117
|
-
structlogger.
|
|
117
|
+
structlogger.debug(
|
|
118
118
|
f"Default agents config folder '{sub_agents_folder}' does not "
|
|
119
119
|
f"exist. Agent configurations won't be loaded."
|
|
120
120
|
)
|
|
@@ -7,6 +7,7 @@ from typing import Any, Dict, List, Optional, Union
|
|
|
7
7
|
from pydantic import BaseModel, ConfigDict, Field, model_validator
|
|
8
8
|
|
|
9
9
|
from rasa.core.constants import MCP_SERVERS_KEY
|
|
10
|
+
from rasa.shared.agents.auth.utils import validate_secrets_in_params
|
|
10
11
|
from rasa.shared.core.constants import (
|
|
11
12
|
GLOBAL_SILENCE_TIMEOUT_DEFAULT_VALUE,
|
|
12
13
|
GLOBAL_SILENCE_TIMEOUT_KEY,
|
|
@@ -77,6 +78,11 @@ class MCPServerConfig(BaseModel):
|
|
|
77
78
|
# validate that name and url are not empty
|
|
78
79
|
if not self.name or not self.url:
|
|
79
80
|
raise ValueError("Name and URL cannot be empty")
|
|
81
|
+
# validate secrets in additional_params
|
|
82
|
+
if self.additional_params:
|
|
83
|
+
validate_secrets_in_params(
|
|
84
|
+
self.additional_params, f"MCP server - '{self.name}'"
|
|
85
|
+
)
|
|
80
86
|
return self
|
|
81
87
|
|
|
82
88
|
@model_validator(mode="before")
|
rasa/core/exceptions.py
CHANGED
|
@@ -14,7 +14,7 @@ class AgentNotReady(RasaCoreException):
|
|
|
14
14
|
def __init__(self, message: Text) -> None:
|
|
15
15
|
"""Initialize message attribute."""
|
|
16
16
|
self.message = message
|
|
17
|
-
super(AgentNotReady, self).__init__()
|
|
17
|
+
super(AgentNotReady, self).__init__(message)
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
class ChannelConfigError(RasaCoreException):
|
|
@@ -58,7 +58,7 @@ class InvalidStory(RasaException):
|
|
|
58
58
|
message: a custom exception message.
|
|
59
59
|
"""
|
|
60
60
|
self.message = message
|
|
61
|
-
super(InvalidStory, self).__init__()
|
|
61
|
+
super(InvalidStory, self).__init__(message)
|
|
62
62
|
|
|
63
63
|
def __str__(self) -> Text:
|
|
64
64
|
return self.message
|
|
@@ -174,6 +174,7 @@ class TrackerFeaturizer:
|
|
|
174
174
|
|
|
175
175
|
Args:
|
|
176
176
|
trackers_as_actions: A list of tracker labels.
|
|
177
|
+
domain: The domain containing action names.
|
|
177
178
|
|
|
178
179
|
Returns:
|
|
179
180
|
Label IDs for each tracker
|
|
@@ -854,7 +855,7 @@ class MaxHistoryTrackerFeaturizer(TrackerFeaturizer):
|
|
|
854
855
|
"""Creates an iterator over training examples from a tracker.
|
|
855
856
|
|
|
856
857
|
Args:
|
|
857
|
-
|
|
858
|
+
tracker: The tracker from which to extract training examples.
|
|
858
859
|
domain: The domain of the training data.
|
|
859
860
|
omit_unset_slots: If `True` do not include the initial values of slots.
|
|
860
861
|
ignore_action_unlikely_intent: Whether to remove `action_unlikely_intent`
|
rasa/core/persistor.py
CHANGED
|
@@ -314,7 +314,7 @@ class AWSPersistor(Persistor):
|
|
|
314
314
|
obj = self.s3.Object(self.bucket_name, model_path)
|
|
315
315
|
return obj.content_length
|
|
316
316
|
except Exception:
|
|
317
|
-
raise ModelNotFound()
|
|
317
|
+
raise ModelNotFound("Model not found")
|
|
318
318
|
|
|
319
319
|
def _retrieve_tar(
|
|
320
320
|
self, target_filename: str, target_path: Optional[str] = None
|
|
@@ -349,7 +349,7 @@ class AWSPersistor(Persistor):
|
|
|
349
349
|
target_filename=target_filename,
|
|
350
350
|
event_info=log,
|
|
351
351
|
)
|
|
352
|
-
raise ModelNotFound() from exc
|
|
352
|
+
raise ModelNotFound("Model not found") from exc
|
|
353
353
|
except exceptions.BotoCoreError as exc:
|
|
354
354
|
structlogger.error(
|
|
355
355
|
"aws_persistor.retrieve_tar.model_download_error",
|
|
@@ -357,7 +357,7 @@ class AWSPersistor(Persistor):
|
|
|
357
357
|
target_filename=target_filename,
|
|
358
358
|
event_info=log,
|
|
359
359
|
)
|
|
360
|
-
raise ModelNotFound() from exc
|
|
360
|
+
raise ModelNotFound("Model not found") from exc
|
|
361
361
|
|
|
362
362
|
|
|
363
363
|
class GCSPersistor(Persistor):
|
|
@@ -447,7 +447,7 @@ class GCSPersistor(Persistor):
|
|
|
447
447
|
blob = self.bucket.blob(target_filename)
|
|
448
448
|
return blob.size
|
|
449
449
|
except Exception:
|
|
450
|
-
raise ModelNotFound()
|
|
450
|
+
raise ModelNotFound("Model not found")
|
|
451
451
|
|
|
452
452
|
def _retrieve_tar(
|
|
453
453
|
self, target_filename: str, target_path: Optional[str] = None
|
|
@@ -481,7 +481,7 @@ class GCSPersistor(Persistor):
|
|
|
481
481
|
target_filename=target_filename,
|
|
482
482
|
event_info=log,
|
|
483
483
|
)
|
|
484
|
-
raise ModelNotFound() from exc
|
|
484
|
+
raise ModelNotFound("Model not found") from exc
|
|
485
485
|
|
|
486
486
|
|
|
487
487
|
class AzurePersistor(Persistor):
|
|
@@ -534,7 +534,7 @@ class AzurePersistor(Persistor):
|
|
|
534
534
|
properties = blob_client.get_blob_properties()
|
|
535
535
|
return properties.size
|
|
536
536
|
except Exception:
|
|
537
|
-
raise ModelNotFound()
|
|
537
|
+
raise ModelNotFound("Model not found")
|
|
538
538
|
|
|
539
539
|
def _retrieve_tar(
|
|
540
540
|
self, target_filename: Text, target_path: Optional[str] = None
|
|
@@ -570,4 +570,4 @@ class AzurePersistor(Persistor):
|
|
|
570
570
|
event_info=log,
|
|
571
571
|
exception=exc,
|
|
572
572
|
)
|
|
573
|
-
raise ModelNotFound() from exc
|
|
573
|
+
raise ModelNotFound("Model not found") from exc
|