rasa-pro 3.13.0rc4__py3-none-any.whl → 3.13.1a3__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.

Files changed (59) hide show
  1. rasa/builder/README.md +120 -0
  2. rasa/builder/__init__.py +0 -0
  3. rasa/builder/config.py +69 -0
  4. rasa/builder/create_openai_vector_store.py +228 -0
  5. rasa/builder/exceptions.py +49 -0
  6. rasa/builder/llm-helper-schema.json +69 -0
  7. rasa/builder/llm_context.py +81 -0
  8. rasa/builder/llm_helper_prompt.jinja2 +245 -0
  9. rasa/builder/llm_service.py +327 -0
  10. rasa/builder/logging_utils.py +51 -0
  11. rasa/builder/main.py +61 -0
  12. rasa/builder/models.py +174 -0
  13. rasa/builder/project_generator.py +264 -0
  14. rasa/builder/scrape_rasa_docs.py +97 -0
  15. rasa/builder/service.py +447 -0
  16. rasa/builder/skill_to_bot_prompt.jinja2 +164 -0
  17. rasa/builder/training_service.py +123 -0
  18. rasa/builder/validation_service.py +79 -0
  19. rasa/cli/project_templates/finance/config.yml +17 -0
  20. rasa/cli/project_templates/finance/credentials.yml +33 -0
  21. rasa/cli/project_templates/finance/data/flows/transfer_money.yml +5 -0
  22. rasa/cli/project_templates/finance/data/patterns/pattern_session_start.yml +7 -0
  23. rasa/cli/project_templates/finance/domain.yml +7 -0
  24. rasa/cli/project_templates/finance/endpoints.yml +58 -0
  25. rasa/cli/project_templates/plain/config.yml +17 -0
  26. rasa/cli/project_templates/plain/credentials.yml +33 -0
  27. rasa/cli/project_templates/plain/data/patterns/pattern_session_start.yml +7 -0
  28. rasa/cli/project_templates/plain/domain.yml +5 -0
  29. rasa/cli/project_templates/plain/endpoints.yml +58 -0
  30. rasa/cli/project_templates/telecom/config.yml +17 -0
  31. rasa/cli/project_templates/telecom/credentials.yml +33 -0
  32. rasa/cli/project_templates/telecom/data/flows/upgrade_contract.yml +5 -0
  33. rasa/cli/project_templates/telecom/data/patterns/pattern_session_start.yml +7 -0
  34. rasa/cli/project_templates/telecom/domain.yml +7 -0
  35. rasa/cli/project_templates/telecom/endpoints.yml +58 -0
  36. rasa/cli/scaffold.py +20 -3
  37. rasa/core/actions/action.py +5 -3
  38. rasa/core/channels/studio_chat.py +29 -8
  39. rasa/core/policies/flows/flow_executor.py +8 -1
  40. rasa/model_manager/model_api.py +2 -2
  41. rasa/model_manager/runner_service.py +1 -1
  42. rasa/model_manager/trainer_service.py +12 -9
  43. rasa/model_manager/utils.py +1 -29
  44. rasa/shared/core/domain.py +62 -15
  45. rasa/shared/core/flows/flow_step.py +7 -1
  46. rasa/shared/core/flows/yaml_flows_io.py +16 -8
  47. rasa/shared/core/slots.py +4 -0
  48. rasa/shared/importers/importer.py +6 -0
  49. rasa/shared/importers/static.py +63 -0
  50. rasa/telemetry.py +2 -1
  51. rasa/utils/io.py +27 -9
  52. rasa/utils/log_utils.py +5 -1
  53. rasa/validator.py +7 -3
  54. rasa/version.py +1 -1
  55. {rasa_pro-3.13.0rc4.dist-info → rasa_pro-3.13.1a3.dist-info}/METADATA +3 -3
  56. {rasa_pro-3.13.0rc4.dist-info → rasa_pro-3.13.1a3.dist-info}/RECORD +59 -23
  57. {rasa_pro-3.13.0rc4.dist-info → rasa_pro-3.13.1a3.dist-info}/NOTICE +0 -0
  58. {rasa_pro-3.13.0rc4.dist-info → rasa_pro-3.13.1a3.dist-info}/WHEEL +0 -0
  59. {rasa_pro-3.13.0rc4.dist-info → rasa_pro-3.13.1a3.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,123 @@
1
+ """Functions for training and loading Rasa models."""
2
+
3
+ import tempfile
4
+
5
+ import structlog
6
+
7
+ from rasa.builder import config
8
+ from rasa.builder.exceptions import AgentLoadError, TrainingError
9
+ from rasa.core import agent
10
+ from rasa.core.utils import AvailableEndpoints, read_endpoints_from_path
11
+ from rasa.model_training import train
12
+ from rasa.shared.importers.importer import TrainingDataImporter
13
+ from rasa.shared.utils.yaml import dump_obj_as_yaml_to_string
14
+
15
+ structlogger = structlog.get_logger()
16
+
17
+
18
+ async def train_and_load_agent(importer: TrainingDataImporter) -> agent.Agent:
19
+ """Train a model and load an agent.
20
+
21
+ Args:
22
+ importer: Training data importer with domain, flows, and config
23
+
24
+ Returns:
25
+ Loaded and ready agent
26
+
27
+ Raises:
28
+ TrainingError: If training fails
29
+ AgentLoadError: If agent loading fails
30
+ """
31
+ try:
32
+ # Setup endpoints for training validation
33
+ await _setup_endpoints()
34
+
35
+ # Train the model
36
+ training_result = await _train_model(importer)
37
+
38
+ # Load the agent
39
+ agent_instance = await _load_agent(training_result.model)
40
+
41
+ # Verify agent is ready
42
+ if not agent_instance.is_ready():
43
+ raise AgentLoadError("Agent failed to load properly - model is not ready")
44
+
45
+ structlogger.info("training.agent_ready", model_path=training_result.model)
46
+
47
+ return agent_instance
48
+
49
+ except (TrainingError, AgentLoadError):
50
+ raise
51
+ except Exception as e:
52
+ raise TrainingError(f"Unexpected error during training: {e}")
53
+
54
+
55
+ async def _setup_endpoints():
56
+ """Setup endpoints configuration for training."""
57
+ try:
58
+ with tempfile.NamedTemporaryFile(
59
+ mode="w", suffix=".yml", delete=False
60
+ ) as temp_file:
61
+ endpoints_yaml = dump_obj_as_yaml_to_string(config.get_default_endpoints())
62
+ temp_file.write(endpoints_yaml)
63
+ temp_file.flush()
64
+
65
+ # Reset and load endpoints
66
+ AvailableEndpoints.reset_instance()
67
+ read_endpoints_from_path(temp_file.name)
68
+
69
+ structlogger.debug("training.endpoints_setup", temp_file=temp_file.name)
70
+
71
+ except Exception as e:
72
+ raise TrainingError(f"Failed to setup endpoints: {e}")
73
+
74
+
75
+ async def _train_model(importer: TrainingDataImporter):
76
+ """Train the Rasa model."""
77
+ try:
78
+ structlogger.info("training.started")
79
+
80
+ training_result = await train(
81
+ domain="",
82
+ config="",
83
+ training_files=None,
84
+ file_importer=importer,
85
+ )
86
+
87
+ if not training_result or not training_result.model:
88
+ raise TrainingError("Training completed but no model was produced")
89
+
90
+ structlogger.info("training.completed", model_path=training_result.model)
91
+
92
+ return training_result
93
+
94
+ except Exception as e:
95
+ raise TrainingError(f"Model training failed: {e}")
96
+
97
+
98
+ async def _load_agent(model_path: str) -> agent.Agent:
99
+ """Load the trained agent."""
100
+ try:
101
+ structlogger.info("training.loading_agent", model_path=model_path)
102
+
103
+ available_endpoints = AvailableEndpoints.get_instance()
104
+ if available_endpoints is None:
105
+ raise AgentLoadError("No endpoints available for agent loading")
106
+
107
+ agent_instance = await agent.load_agent(
108
+ model_path=model_path,
109
+ remote_storage=None,
110
+ endpoints=available_endpoints,
111
+ )
112
+
113
+ if agent_instance is None:
114
+ raise AgentLoadError("Agent loading returned None")
115
+
116
+ structlogger.info("training.agent_loaded", model_path=model_path)
117
+
118
+ return agent_instance
119
+
120
+ except AgentLoadError:
121
+ raise
122
+ except Exception as e:
123
+ raise AgentLoadError(f"Failed to load agent: {e}")
@@ -0,0 +1,79 @@
1
+ """Functions for validating Rasa projects."""
2
+
3
+ import sys
4
+ from contextlib import contextmanager
5
+ from typing import Optional
6
+
7
+ import structlog
8
+ from structlog.testing import capture_logs
9
+
10
+ from rasa.builder import config
11
+ from rasa.builder.exceptions import ValidationError
12
+ from rasa.cli.utils import validate_files
13
+ from rasa.shared.importers.importer import TrainingDataImporter
14
+
15
+ structlogger = structlog.get_logger()
16
+
17
+
18
+ @contextmanager
19
+ def _mock_sys_exit():
20
+ """Context manager to prevent sys.exit from being called during validation."""
21
+ was_sys_exit_called = {"value": False}
22
+
23
+ def sys_exit_mock(code: int = 0):
24
+ was_sys_exit_called["value"] = True
25
+
26
+ original_exit = sys.exit
27
+ sys.exit = sys_exit_mock
28
+
29
+ try:
30
+ yield was_sys_exit_called
31
+ finally:
32
+ sys.exit = original_exit
33
+
34
+
35
+ async def validate_project(importer: TrainingDataImporter) -> Optional[str]:
36
+ """Validate a Rasa project.
37
+
38
+ Args:
39
+ importer: Training data importer with domain, flows, and config
40
+
41
+ Returns:
42
+ None if validation passes, error message if validation fails.
43
+
44
+ Raises:
45
+ ValidationError: If validation fails
46
+ """
47
+ try:
48
+ with _mock_sys_exit() as exit_tracker:
49
+ with capture_logs() as cap_logs:
50
+ validate_files(
51
+ fail_on_warnings=config.VALIDATION_FAIL_ON_WARNINGS,
52
+ max_history=config.VALIDATION_MAX_HISTORY,
53
+ importer=importer,
54
+ )
55
+
56
+ if exit_tracker["value"]:
57
+ error_logs = [
58
+ log for log in cap_logs if log.get("log_level") != "debug"
59
+ ]
60
+ structlogger.error(
61
+ "validation.failed.sys_exit",
62
+ error_logs=error_logs,
63
+ )
64
+ raise ValidationError(
65
+ "Validation failed with sys.exit", validation_logs=error_logs
66
+ )
67
+
68
+ structlogger.info("validation.success")
69
+ return None
70
+
71
+ except ValidationError:
72
+ raise
73
+ except Exception as e:
74
+ error_msg = f"Validation failed with exception: {e}"
75
+ structlogger.error(
76
+ "validation.failed.exception",
77
+ error=str(e),
78
+ )
79
+ raise ValidationError(error_msg)
@@ -0,0 +1,17 @@
1
+ # The config recipe.
2
+ recipe: default.v1
3
+
4
+ # The assistant project unique identifier
5
+ # This default value must be replaced with a unique assistant name within your deployment
6
+ assistant_id: placeholder_default
7
+
8
+ language: en
9
+ pipeline:
10
+ - name: CompactLLMCommandGenerator
11
+ llm:
12
+ model_group: openai-gpt-4o
13
+
14
+ # Configuration for Rasa Core.
15
+ policies:
16
+ - name: FlowPolicy
17
+ - name: IntentlessPolicy
@@ -0,0 +1,33 @@
1
+ # This file contains the credentials for the voice & chat platforms
2
+ # which your bot is using.
3
+ # https://rasa.com/docs/rasa-pro/connectors/messaging-and-voice-channels/
4
+
5
+ rest:
6
+ # # you don't need to provide anything here - this channel doesn't
7
+ # # require any credentials
8
+
9
+
10
+ #facebook:
11
+ # verify: "<verify>"
12
+ # secret: "<your secret>"
13
+ # page-access-token: "<your page access token>"
14
+
15
+ #slack:
16
+ # slack_token: "<your slack token>"
17
+ # slack_channel: "<the slack channel>"
18
+ # slack_signing_secret: "<your slack signing secret>"
19
+
20
+ #socketio:
21
+ # user_message_evt: <event name for user message>
22
+ # bot_message_evt: <event name for bot messages>
23
+ # session_persistence: <true/false>
24
+
25
+ #mattermost:
26
+ # url: "https://<mattermost instance>/api/v4"
27
+ # token: "<bot token>"
28
+ # webhook_url: "<callback URL>"
29
+
30
+ # This entry is needed if you are using Rasa Enterprise. The entry represents credentials
31
+ # for the Rasa Enterprise "channel", i.e. Talk to your bot and Share with guest testers.
32
+ rasa:
33
+ url: "http://localhost:5002/api"
@@ -0,0 +1,5 @@
1
+ flows:
2
+ transfer_money:
3
+ description: Transfer money between accounts.
4
+ steps:
5
+ - action: utter_transfer_money
@@ -0,0 +1,7 @@
1
+ flows:
2
+ pattern_session_start:
3
+ description: Custom session start to greet the user.
4
+ nlu_trigger:
5
+ - intent: session_start
6
+ steps:
7
+ - action: utter_greet
@@ -0,0 +1,7 @@
1
+ version: "3.1"
2
+
3
+ responses:
4
+ utter_greet:
5
+ - text: "Hello! Welcome to your finance assistant. How can I help you today?"
6
+ utter_transfer_money:
7
+ - text: "I'm sorry, I can't transfer money between accounts."
@@ -0,0 +1,58 @@
1
+ # This file contains the different endpoints your bot can use.
2
+
3
+ # Server where the models are pulled from.
4
+ # https://rasa.com/docs/rasa-pro/production/model-storage#fetching-models-from-a-server
5
+
6
+ #models:
7
+ # url: http://my-server.com/models/default_core@latest
8
+ # wait_time_between_pulls: 10 # [optional](default: 100)
9
+
10
+ # Server which runs your custom actions.
11
+ # https://rasa.com/docs/rasa-pro/concepts/custom-actions
12
+
13
+ action_endpoint:
14
+ actions_module: "actions"
15
+
16
+ # Tracker store which is used to store the conversations.
17
+ # By default the conversations are stored in memory.
18
+ # https://rasa.com/docs/rasa-pro/production/tracker-stores
19
+
20
+ #tracker_store:
21
+ # type: redis
22
+ # url: <host of the redis instance, e.g. localhost>
23
+ # port: <port of your redis instance, usually 6379>
24
+ # db: <number of your database within redis, e.g. 0>
25
+ # password: <password used for authentication>
26
+ # use_ssl: <whether or not the communication is encrypted, default false>
27
+
28
+ #tracker_store:
29
+ # type: mongod
30
+ # url: <url to your mongo instance, e.g. mongodb://localhost:27017>
31
+ # db: <name of the db within your mongo instance, e.g. rasa>
32
+ # username: <username used for authentication>
33
+ # password: <password used for authentication>
34
+
35
+ # Event broker which all conversation events should be streamed to.
36
+ # https://rasa.com/docs/rasa-pro/production/event-brokers
37
+
38
+ #event_broker:
39
+ # url: localhost
40
+ # username: username
41
+ # password: password
42
+ # queue: queue
43
+
44
+ # The lines below activate contextual rephrasing, using the default OpenAI language model.
45
+ # Ensure the OPENAI_API_KEY is set to prevent any missing API key errors.
46
+ # For more details, refer to the documentation:
47
+ # https://rasa.com/docs/rasa-pro/concepts/contextual-response-rephraser
48
+ # To enable the rephraser, remove the comment symbols in the lines below.
49
+ #nlg:
50
+ # type: rephrase
51
+
52
+ model_groups:
53
+ - id: openai-gpt-4o
54
+ models:
55
+ - provider: openai
56
+ model: gpt-4o-2024-11-20
57
+ request_timeout: 7
58
+ max_tokens: 256
@@ -0,0 +1,17 @@
1
+ # The config recipe.
2
+ recipe: default.v1
3
+
4
+ # The assistant project unique identifier
5
+ # This default value must be replaced with a unique assistant name within your deployment
6
+ assistant_id: placeholder_default
7
+
8
+ language: en
9
+ pipeline:
10
+ - name: CompactLLMCommandGenerator
11
+ llm:
12
+ model_group: openai-gpt-4o
13
+
14
+ # Configuration for Rasa Core.
15
+ policies:
16
+ - name: FlowPolicy
17
+ - name: IntentlessPolicy
@@ -0,0 +1,33 @@
1
+ # This file contains the credentials for the voice & chat platforms
2
+ # which your bot is using.
3
+ # https://rasa.com/docs/rasa-pro/connectors/messaging-and-voice-channels/
4
+
5
+ rest:
6
+ # # you don't need to provide anything here - this channel doesn't
7
+ # # require any credentials
8
+
9
+
10
+ #facebook:
11
+ # verify: "<verify>"
12
+ # secret: "<your secret>"
13
+ # page-access-token: "<your page access token>"
14
+
15
+ #slack:
16
+ # slack_token: "<your slack token>"
17
+ # slack_channel: "<the slack channel>"
18
+ # slack_signing_secret: "<your slack signing secret>"
19
+
20
+ #socketio:
21
+ # user_message_evt: <event name for user message>
22
+ # bot_message_evt: <event name for bot messages>
23
+ # session_persistence: <true/false>
24
+
25
+ #mattermost:
26
+ # url: "https://<mattermost instance>/api/v4"
27
+ # token: "<bot token>"
28
+ # webhook_url: "<callback URL>"
29
+
30
+ # This entry is needed if you are using Rasa Enterprise. The entry represents credentials
31
+ # for the Rasa Enterprise "channel", i.e. Talk to your bot and Share with guest testers.
32
+ rasa:
33
+ url: "http://localhost:5002/api"
@@ -0,0 +1,7 @@
1
+ flows:
2
+ pattern_session_start:
3
+ description: Custom session start to greet the user.
4
+ nlu_trigger:
5
+ - intent: session_start
6
+ steps:
7
+ - action: utter_greet
@@ -0,0 +1,5 @@
1
+ version: "3.1"
2
+
3
+ responses:
4
+ utter_greet:
5
+ - text: "Hello! Welcome to your finance assistant. How can I help you today?"
@@ -0,0 +1,58 @@
1
+ # This file contains the different endpoints your bot can use.
2
+
3
+ # Server where the models are pulled from.
4
+ # https://rasa.com/docs/rasa-pro/production/model-storage#fetching-models-from-a-server
5
+
6
+ #models:
7
+ # url: http://my-server.com/models/default_core@latest
8
+ # wait_time_between_pulls: 10 # [optional](default: 100)
9
+
10
+ # Server which runs your custom actions.
11
+ # https://rasa.com/docs/rasa-pro/concepts/custom-actions
12
+
13
+ action_endpoint:
14
+ actions_module: "actions"
15
+
16
+ # Tracker store which is used to store the conversations.
17
+ # By default the conversations are stored in memory.
18
+ # https://rasa.com/docs/rasa-pro/production/tracker-stores
19
+
20
+ #tracker_store:
21
+ # type: redis
22
+ # url: <host of the redis instance, e.g. localhost>
23
+ # port: <port of your redis instance, usually 6379>
24
+ # db: <number of your database within redis, e.g. 0>
25
+ # password: <password used for authentication>
26
+ # use_ssl: <whether or not the communication is encrypted, default false>
27
+
28
+ #tracker_store:
29
+ # type: mongod
30
+ # url: <url to your mongo instance, e.g. mongodb://localhost:27017>
31
+ # db: <name of the db within your mongo instance, e.g. rasa>
32
+ # username: <username used for authentication>
33
+ # password: <password used for authentication>
34
+
35
+ # Event broker which all conversation events should be streamed to.
36
+ # https://rasa.com/docs/rasa-pro/production/event-brokers
37
+
38
+ #event_broker:
39
+ # url: localhost
40
+ # username: username
41
+ # password: password
42
+ # queue: queue
43
+
44
+ # The lines below activate contextual rephrasing, using the default OpenAI language model.
45
+ # Ensure the OPENAI_API_KEY is set to prevent any missing API key errors.
46
+ # For more details, refer to the documentation:
47
+ # https://rasa.com/docs/rasa-pro/concepts/contextual-response-rephraser
48
+ # To enable the rephraser, remove the comment symbols in the lines below.
49
+ #nlg:
50
+ # type: rephrase
51
+
52
+ model_groups:
53
+ - id: openai-gpt-4o
54
+ models:
55
+ - provider: openai
56
+ model: gpt-4o-2024-11-20
57
+ request_timeout: 7
58
+ max_tokens: 256
@@ -0,0 +1,17 @@
1
+ # The config recipe.
2
+ recipe: default.v1
3
+
4
+ # The assistant project unique identifier
5
+ # This default value must be replaced with a unique assistant name within your deployment
6
+ assistant_id: placeholder_default
7
+
8
+ language: en
9
+ pipeline:
10
+ - name: CompactLLMCommandGenerator
11
+ llm:
12
+ model_group: openai-gpt-4o
13
+
14
+ # Configuration for Rasa Core.
15
+ policies:
16
+ - name: FlowPolicy
17
+ - name: IntentlessPolicy
@@ -0,0 +1,33 @@
1
+ # This file contains the credentials for the voice & chat platforms
2
+ # which your bot is using.
3
+ # https://rasa.com/docs/rasa-pro/connectors/messaging-and-voice-channels/
4
+
5
+ rest:
6
+ # # you don't need to provide anything here - this channel doesn't
7
+ # # require any credentials
8
+
9
+
10
+ #facebook:
11
+ # verify: "<verify>"
12
+ # secret: "<your secret>"
13
+ # page-access-token: "<your page access token>"
14
+
15
+ #slack:
16
+ # slack_token: "<your slack token>"
17
+ # slack_channel: "<the slack channel>"
18
+ # slack_signing_secret: "<your slack signing secret>"
19
+
20
+ #socketio:
21
+ # user_message_evt: <event name for user message>
22
+ # bot_message_evt: <event name for bot messages>
23
+ # session_persistence: <true/false>
24
+
25
+ #mattermost:
26
+ # url: "https://<mattermost instance>/api/v4"
27
+ # token: "<bot token>"
28
+ # webhook_url: "<callback URL>"
29
+
30
+ # This entry is needed if you are using Rasa Enterprise. The entry represents credentials
31
+ # for the Rasa Enterprise "channel", i.e. Talk to your bot and Share with guest testers.
32
+ rasa:
33
+ url: "http://localhost:5002/api"
@@ -0,0 +1,5 @@
1
+ flows:
2
+ upgrade_contract:
3
+ description: Upgrade contract.
4
+ steps:
5
+ - action: utter_upgrade_contract
@@ -0,0 +1,7 @@
1
+ flows:
2
+ pattern_session_start:
3
+ description: Custom session start to greet the user.
4
+ nlu_trigger:
5
+ - intent: session_start
6
+ steps:
7
+ - action: utter_greet
@@ -0,0 +1,7 @@
1
+ version: "3.1"
2
+
3
+ responses:
4
+ utter_greet:
5
+ - text: "Hello! Welcome to your telecom assistant. How can I help you today?"
6
+ utter_upgrade_contract:
7
+ - text: "I'm sorry, I can't upgrade your contract."
@@ -0,0 +1,58 @@
1
+ # This file contains the different endpoints your bot can use.
2
+
3
+ # Server where the models are pulled from.
4
+ # https://rasa.com/docs/rasa-pro/production/model-storage#fetching-models-from-a-server
5
+
6
+ #models:
7
+ # url: http://my-server.com/models/default_core@latest
8
+ # wait_time_between_pulls: 10 # [optional](default: 100)
9
+
10
+ # Server which runs your custom actions.
11
+ # https://rasa.com/docs/rasa-pro/concepts/custom-actions
12
+
13
+ action_endpoint:
14
+ actions_module: "actions"
15
+
16
+ # Tracker store which is used to store the conversations.
17
+ # By default the conversations are stored in memory.
18
+ # https://rasa.com/docs/rasa-pro/production/tracker-stores
19
+
20
+ #tracker_store:
21
+ # type: redis
22
+ # url: <host of the redis instance, e.g. localhost>
23
+ # port: <port of your redis instance, usually 6379>
24
+ # db: <number of your database within redis, e.g. 0>
25
+ # password: <password used for authentication>
26
+ # use_ssl: <whether or not the communication is encrypted, default false>
27
+
28
+ #tracker_store:
29
+ # type: mongod
30
+ # url: <url to your mongo instance, e.g. mongodb://localhost:27017>
31
+ # db: <name of the db within your mongo instance, e.g. rasa>
32
+ # username: <username used for authentication>
33
+ # password: <password used for authentication>
34
+
35
+ # Event broker which all conversation events should be streamed to.
36
+ # https://rasa.com/docs/rasa-pro/production/event-brokers
37
+
38
+ #event_broker:
39
+ # url: localhost
40
+ # username: username
41
+ # password: password
42
+ # queue: queue
43
+
44
+ # The lines below activate contextual rephrasing, using the default OpenAI language model.
45
+ # Ensure the OPENAI_API_KEY is set to prevent any missing API key errors.
46
+ # For more details, refer to the documentation:
47
+ # https://rasa.com/docs/rasa-pro/concepts/contextual-response-rephraser
48
+ # To enable the rephraser, remove the comment symbols in the lines below.
49
+ #nlg:
50
+ # type: rephrase
51
+
52
+ model_groups:
53
+ - id: openai-gpt-4o
54
+ models:
55
+ - provider: openai
56
+ model: gpt-4o-2024-11-20
57
+ request_timeout: 7
58
+ max_tokens: 256
rasa/cli/scaffold.py CHANGED
@@ -24,10 +24,21 @@ class ProjectTemplateName(Enum):
24
24
 
25
25
  DEFAULT = "default"
26
26
  TUTORIAL = "tutorial"
27
+ PLAIN = "plain"
28
+ FINANCE = "finance"
29
+ TELECOM = "telecom"
27
30
 
28
31
  def __str__(self) -> str:
29
32
  return self.value
30
33
 
34
+ @classmethod
35
+ def get_all_values(cls) -> List[str]:
36
+ return [name.value for name in cls]
37
+
38
+ @classmethod
39
+ def supported_values(cls) -> str:
40
+ return ", ".join(cls.get_all_values())
41
+
31
42
 
32
43
  template_domain_path = defaultdict(lambda: DEFAULT_DOMAIN_PATH)
33
44
  template_domain_path[ProjectTemplateName.DEFAULT] = "domain"
@@ -159,9 +170,15 @@ def create_initial_project(
159
170
  path: Text, template: ProjectTemplateName = ProjectTemplateName.DEFAULT
160
171
  ) -> None:
161
172
  """Creates directory structure and templates for initial project."""
162
- from distutils.dir_util import copy_tree
163
-
164
- copy_tree(scaffold_path(template), path)
173
+ import distutils.dir_util as dir_util
174
+
175
+ # clear the cache of the copy_tree function, this avoids issues if
176
+ # a project directory existed before and we removed folders in it
177
+ # with shutil.rmtree. see
178
+ # https://stackoverflow.com/questions/9160227/dir-util-copy-tree-fails-after-shutil-rmtree
179
+ if hasattr(dir_util, "_path_created"):
180
+ dir_util._path_created.clear()
181
+ dir_util.copy_tree(scaffold_path(template), path)
165
182
 
166
183
 
167
184
  def scaffold_path(template: ProjectTemplateName) -> Text:
@@ -908,10 +908,12 @@ class RemoteAction(Action):
908
908
  draft.setdefault("buttons", [])
909
909
  draft["buttons"].extend(buttons)
910
910
 
911
- # Avoid overwriting `draft` values with empty values
912
911
  response = {k: v for k, v in response.items() if v}
913
- draft.update(response)
914
- bot_messages.append(create_bot_utterance(draft, tracker.current_language))
912
+
913
+ response.update(draft)
914
+ bot_messages.append(
915
+ create_bot_utterance(response, tracker.current_language)
916
+ )
915
917
 
916
918
  return bot_messages
917
919