rasa-pro 3.12.0rc2__py3-none-any.whl → 3.12.1.dev1__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 (99) hide show
  1. rasa/cli/dialogue_understanding_test.py +5 -8
  2. rasa/cli/llm_fine_tuning.py +47 -12
  3. rasa/cli/train.py +3 -0
  4. rasa/cli/utils.py +6 -0
  5. rasa/core/channels/development_inspector.py +77 -21
  6. rasa/core/channels/inspector/dist/assets/{arc-f0f8bd46.js → arc-9f1365dc.js} +1 -1
  7. rasa/core/channels/inspector/dist/assets/{blockDiagram-38ab4fdb-7162c77d.js → blockDiagram-38ab4fdb-e0f81b12.js} +1 -1
  8. rasa/core/channels/inspector/dist/assets/{c4Diagram-3d4e48cf-b1d0d098.js → c4Diagram-3d4e48cf-9deaee1c.js} +1 -1
  9. rasa/core/channels/inspector/dist/assets/channel-44956714.js +1 -0
  10. rasa/core/channels/inspector/dist/assets/{classDiagram-70f12bd4-807a1b27.js → classDiagram-70f12bd4-20450a96.js} +1 -1
  11. rasa/core/channels/inspector/dist/assets/{classDiagram-v2-f2320105-5238dcdb.js → classDiagram-v2-f2320105-749d2abf.js} +1 -1
  12. rasa/core/channels/inspector/dist/assets/clone-a9475142.js +1 -0
  13. rasa/core/channels/inspector/dist/assets/{createText-2e5e7dd3-75dfaa67.js → createText-2e5e7dd3-bef0b38c.js} +1 -1
  14. rasa/core/channels/inspector/dist/assets/{edges-e0da2a9e-df20501d.js → edges-e0da2a9e-943801a7.js} +1 -1
  15. rasa/core/channels/inspector/dist/assets/{erDiagram-9861fffd-13cf4797.js → erDiagram-9861fffd-d523a948.js} +1 -1
  16. rasa/core/channels/inspector/dist/assets/{flowDb-956e92f1-a4991264.js → flowDb-956e92f1-54e4cf19.js} +1 -1
  17. rasa/core/channels/inspector/dist/assets/{flowDiagram-66a62f08-ccecf773.js → flowDiagram-66a62f08-48bfbbe8.js} +1 -1
  18. rasa/core/channels/inspector/dist/assets/flowDiagram-v2-96b9c2cf-43fa749a.js +1 -0
  19. rasa/core/channels/inspector/dist/assets/{flowchart-elk-definition-4a651766-b5801783.js → flowchart-elk-definition-4a651766-17c30827.js} +1 -1
  20. rasa/core/channels/inspector/dist/assets/{ganttDiagram-c361ad54-161e079a.js → ganttDiagram-c361ad54-43086f2d.js} +1 -1
  21. rasa/core/channels/inspector/dist/assets/{gitGraphDiagram-72cf32ee-f38e86a4.js → gitGraphDiagram-72cf32ee-5c8b693e.js} +1 -1
  22. rasa/core/channels/inspector/dist/assets/{graph-be6ef5d8.js → graph-41a90d26.js} +1 -1
  23. rasa/core/channels/inspector/dist/assets/{index-3862675e-d9ce8994.js → index-3862675e-b43eeae9.js} +1 -1
  24. rasa/core/channels/inspector/dist/assets/{index-7794b245.js → index-e8affe45.js} +155 -155
  25. rasa/core/channels/inspector/dist/assets/{infoDiagram-f8f76790-5000a3dc.js → infoDiagram-f8f76790-0b20676b.js} +1 -1
  26. rasa/core/channels/inspector/dist/assets/{journeyDiagram-49397b02-8ef0a17a.js → journeyDiagram-49397b02-39bce7b5.js} +1 -1
  27. rasa/core/channels/inspector/dist/assets/{layout-d649bc98.js → layout-dc8eeea4.js} +1 -1
  28. rasa/core/channels/inspector/dist/assets/{line-95add810.js → line-c4d2e756.js} +1 -1
  29. rasa/core/channels/inspector/dist/assets/{linear-f6025094.js → linear-86f6f2d9.js} +1 -1
  30. rasa/core/channels/inspector/dist/assets/{mindmap-definition-fc14e90a-2e8531c4.js → mindmap-definition-fc14e90a-4216f771.js} +1 -1
  31. rasa/core/channels/inspector/dist/assets/{pieDiagram-8a3498a8-918adfdb.js → pieDiagram-8a3498a8-1a0cfa96.js} +1 -1
  32. rasa/core/channels/inspector/dist/assets/{quadrantDiagram-120e2f19-cbd01797.js → quadrantDiagram-120e2f19-f91e67cf.js} +1 -1
  33. rasa/core/channels/inspector/dist/assets/{requirementDiagram-deff3bca-6a8b877b.js → requirementDiagram-deff3bca-d4046bed.js} +1 -1
  34. rasa/core/channels/inspector/dist/assets/{sankeyDiagram-04a897e0-c377c3fe.js → sankeyDiagram-04a897e0-2cf6d1d7.js} +1 -1
  35. rasa/core/channels/inspector/dist/assets/{sequenceDiagram-704730f1-ab9e9b7f.js → sequenceDiagram-704730f1-751ac4f5.js} +1 -1
  36. rasa/core/channels/inspector/dist/assets/{stateDiagram-587899a1-5e6ae67d.js → stateDiagram-587899a1-f734f4d4.js} +1 -1
  37. rasa/core/channels/inspector/dist/assets/{stateDiagram-v2-d93cdb3a-40643476.js → stateDiagram-v2-d93cdb3a-91c65710.js} +1 -1
  38. rasa/core/channels/inspector/dist/assets/{styles-6aaf32cf-afb8d108.js → styles-6aaf32cf-e0cff7be.js} +1 -1
  39. rasa/core/channels/inspector/dist/assets/{styles-9a916d00-7edc9423.js → styles-9a916d00-c8029e5d.js} +1 -1
  40. rasa/core/channels/inspector/dist/assets/{styles-c10674c1-c1d8f7e9.js → styles-c10674c1-114f312a.js} +1 -1
  41. rasa/core/channels/inspector/dist/assets/{svgDrawCommon-08f97a94-f494b2ef.js → svgDrawCommon-08f97a94-b7b9dc00.js} +1 -1
  42. rasa/core/channels/inspector/dist/assets/{timeline-definition-85554ec2-11c7cdd0.js → timeline-definition-85554ec2-9536d189.js} +1 -1
  43. rasa/core/channels/inspector/dist/assets/{xychartDiagram-e933f94c-3f191ec1.js → xychartDiagram-e933f94c-bf3b0f36.js} +1 -1
  44. rasa/core/channels/inspector/dist/index.html +1 -1
  45. rasa/core/channels/inspector/package.json +1 -0
  46. rasa/core/channels/inspector/src/App.tsx +15 -2
  47. rasa/core/channels/inspector/src/components/RasaLogo.tsx +31 -0
  48. rasa/core/channels/inspector/src/components/RecruitmentPanel.tsx +68 -0
  49. rasa/core/channels/inspector/src/components/Welcome.tsx +19 -13
  50. rasa/core/channels/inspector/yarn.lock +5 -0
  51. rasa/core/channels/voice_ready/audiocodes.py +2 -2
  52. rasa/core/channels/voice_stream/asr/asr_event.py +5 -0
  53. rasa/core/channels/voice_stream/audiocodes.py +63 -35
  54. rasa/core/channels/voice_stream/call_state.py +3 -9
  55. rasa/core/channels/voice_stream/genesys.py +40 -55
  56. rasa/core/channels/voice_stream/voice_channel.py +61 -39
  57. rasa/core/tracker_store.py +123 -34
  58. rasa/dialogue_understanding/commands/set_slot_command.py +1 -0
  59. rasa/dialogue_understanding/commands/utils.py +1 -4
  60. rasa/dialogue_understanding/generator/command_parser.py +41 -0
  61. rasa/dialogue_understanding/generator/constants.py +7 -2
  62. rasa/dialogue_understanding/generator/llm_based_command_generator.py +9 -2
  63. rasa/dialogue_understanding/generator/prompt_templates/command_prompt_v2_claude_3_5_sonnet_20240620_template.jinja2 +29 -48
  64. rasa/dialogue_understanding/generator/prompt_templates/command_prompt_v2_gpt_4o_2024_11_20_template.jinja2 +23 -50
  65. rasa/dialogue_understanding/generator/single_step/compact_llm_command_generator.py +76 -24
  66. rasa/dialogue_understanding/generator/single_step/single_step_llm_command_generator.py +32 -18
  67. rasa/dialogue_understanding/processor/command_processor.py +39 -19
  68. rasa/dialogue_understanding/stack/utils.py +11 -6
  69. rasa/engine/language.py +67 -25
  70. rasa/engine/validation.py +2 -0
  71. rasa/llm_fine_tuning/conversations.py +3 -31
  72. rasa/llm_fine_tuning/llm_data_preparation_module.py +5 -3
  73. rasa/llm_fine_tuning/paraphrasing/rephrase_validator.py +18 -13
  74. rasa/llm_fine_tuning/paraphrasing_module.py +6 -2
  75. rasa/llm_fine_tuning/train_test_split_module.py +27 -27
  76. rasa/llm_fine_tuning/utils.py +7 -0
  77. rasa/model_training.py +3 -1
  78. rasa/server.py +1 -0
  79. rasa/shared/constants.py +4 -0
  80. rasa/shared/core/domain.py +6 -0
  81. rasa/shared/importers/importer.py +9 -1
  82. rasa/shared/providers/_configs/azure_entra_id_config.py +8 -8
  83. rasa/shared/providers/llm/litellm_router_llm_client.py +1 -0
  84. rasa/shared/providers/router/_base_litellm_router_client.py +38 -7
  85. rasa/shared/utils/common.py +14 -0
  86. rasa/shared/utils/llm.py +69 -13
  87. rasa/telemetry.py +13 -3
  88. rasa/tracing/instrumentation/attribute_extractors.py +2 -5
  89. rasa/validator.py +4 -4
  90. rasa/version.py +1 -1
  91. {rasa_pro-3.12.0rc2.dist-info → rasa_pro-3.12.1.dev1.dist-info}/METADATA +2 -2
  92. {rasa_pro-3.12.0rc2.dist-info → rasa_pro-3.12.1.dev1.dist-info}/RECORD +95 -94
  93. rasa/core/channels/inspector/dist/assets/channel-e265ea59.js +0 -1
  94. rasa/core/channels/inspector/dist/assets/clone-21f8a43d.js +0 -1
  95. rasa/core/channels/inspector/dist/assets/flowDiagram-v2-96b9c2cf-5c8ce12d.js +0 -1
  96. rasa/dialogue_understanding/generator/prompt_templates/command_prompt_v2_default.jinja2 +0 -68
  97. {rasa_pro-3.12.0rc2.dist-info → rasa_pro-3.12.1.dev1.dist-info}/NOTICE +0 -0
  98. {rasa_pro-3.12.0rc2.dist-info → rasa_pro-3.12.1.dev1.dist-info}/WHEEL +0 -0
  99. {rasa_pro-3.12.0rc2.dist-info → rasa_pro-3.12.1.dev1.dist-info}/entry_points.txt +0 -0
@@ -8,7 +8,7 @@ from functools import lru_cache
8
8
  from typing import Any, Callable, Dict, List, Optional, Set, Type
9
9
 
10
10
  import structlog
11
- from azure.core.credentials import TokenProvider
11
+ from azure.core.credentials import TokenCredential
12
12
  from azure.identity import (
13
13
  CertificateCredential,
14
14
  ClientSecretCredential,
@@ -77,7 +77,7 @@ class AzureEntraIDTokenProviderConfig(abc.ABC):
77
77
  """Interface for Azure Entra ID OAuth credential configuration."""
78
78
 
79
79
  @abc.abstractmethod
80
- def create_azure_token_provider(self) -> TokenProvider:
80
+ def create_azure_token_provider(self) -> TokenCredential:
81
81
  """Create an Azure Entra ID token provider."""
82
82
  ...
83
83
 
@@ -159,7 +159,7 @@ class AzureEntraIDClientCredentialsConfig(AzureEntraIDTokenProviderConfig, BaseM
159
159
  ),
160
160
  )
161
161
 
162
- def create_azure_token_provider(self) -> TokenProvider:
162
+ def create_azure_token_provider(self) -> TokenCredential:
163
163
  """Create a ClientSecretCredential for Azure Entra ID."""
164
164
  return create_azure_entra_id_client_credentials(
165
165
  client_id=self.client_id,
@@ -286,7 +286,7 @@ class AzureEntraIDClientCertificateConfig(AzureEntraIDTokenProviderConfig, BaseM
286
286
  ),
287
287
  )
288
288
 
289
- def create_azure_token_provider(self) -> TokenProvider:
289
+ def create_azure_token_provider(self) -> TokenCredential:
290
290
  """Creates a CertificateCredential for Azure Entra ID."""
291
291
  return create_azure_entra_id_certificate_credentials(
292
292
  client_id=self.client_id,
@@ -369,7 +369,7 @@ class AzureEntraIDDefaultCredentialsConfig(AzureEntraIDTokenProviderConfig, Base
369
369
  """
370
370
  return cls(authority_host=config.pop(AZURE_AUTHORITY_FIELD, None))
371
371
 
372
- def create_azure_token_provider(self) -> TokenProvider:
372
+ def create_azure_token_provider(self) -> TokenCredential:
373
373
  """Creates a DefaultAzureCredential."""
374
374
  return create_azure_entra_id_default_credentials(
375
375
  authority_host=self.authority_host
@@ -530,12 +530,12 @@ class AzureEntraIDOAuthConfig(OAuth, BaseModel):
530
530
  azure_oauth_class = AzureEntraIDOAuthConfig._get_azure_oauth_by_type(oauth_type)
531
531
  return azure_oauth_class.from_dict(oauth_config)
532
532
 
533
- def _create_azure_credential(
533
+ def create_azure_credential(
534
534
  self,
535
- ) -> TokenProvider:
535
+ ) -> TokenCredential:
536
536
  """Create an Azure Entra ID client which can be used to get a bearer token."""
537
537
  return self.azure_entra_id_token_provider_config.create_azure_token_provider()
538
538
 
539
539
  def get_bearer_token(self) -> str:
540
540
  """Returns a bearer token."""
541
- return self._create_azure_credential().get_token(*self.scopes).token # type: ignore
541
+ return self.create_azure_credential().get_token(*self.scopes).token
@@ -198,6 +198,7 @@ class LiteLLMRouterLLMClient(_BaseLiteLLMRouterClient, _BaseLiteLLMClient):
198
198
  """Returns the completion arguments for invoking a call through
199
199
  LiteLLM's completion functions.
200
200
  """
201
+
201
202
  return {
202
203
  **self._litellm_extra_parameters,
203
204
  LITE_LLM_MODEL_FIELD: self.model_group_id,
@@ -1,6 +1,7 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  import os
4
+ from copy import deepcopy
4
5
  from typing import Any, Dict, List
5
6
 
6
7
  import structlog
@@ -18,6 +19,7 @@ from rasa.shared.constants import (
18
19
  USE_CHAT_COMPLETIONS_ENDPOINT_CONFIG_KEY,
19
20
  )
20
21
  from rasa.shared.exceptions import ProviderClientValidationError
22
+ from rasa.shared.providers._configs.azure_entra_id_config import AzureEntraIDOAuthConfig
21
23
  from rasa.shared.providers._configs.litellm_router_client_config import (
22
24
  LiteLLMRouterClientConfig,
23
25
  )
@@ -61,12 +63,8 @@ class _BaseLiteLLMRouterClient:
61
63
  self._extra_parameters = kwargs or {}
62
64
  self.additional_client_setup()
63
65
  try:
64
- resolved_model_configurations = (
65
- self._resolve_env_vars_in_model_configurations()
66
- )
67
- self._router_client = Router(
68
- model_list=resolved_model_configurations, **router_settings
69
- )
66
+ # We instantiate a router client here to validate the configuration.
67
+ self._router_client = self._create_router_client()
70
68
  except Exception as e:
71
69
  event_info = "Cannot instantiate a router client."
72
70
  structlogger.error(
@@ -145,6 +143,14 @@ class _BaseLiteLLMRouterClient:
145
143
  @property
146
144
  def router_client(self) -> Router:
147
145
  """Returns the instantiated LiteLLM Router client."""
146
+ # In ca se oauth is used, due to a bug in LiteLLM,
147
+ # azure_ad_token_provider is not working as expected.
148
+ # To work around this, we create a new client every
149
+ # time we need to make a call which will
150
+ # ensure that the token is always fresh.
151
+ # GitHub issue for LiteLLm: https://github.com/BerriAI/litellm/issues/4417
152
+ if self._has_oauth():
153
+ return self._create_router_client()
148
154
  return self._router_client
149
155
 
150
156
  @property
@@ -175,11 +181,36 @@ class _BaseLiteLLMRouterClient:
175
181
  **self._litellm_extra_parameters,
176
182
  }
177
183
 
184
+ def _create_router_client(self) -> Router:
185
+ resolved_model_configurations = self._resolve_env_vars_in_model_configurations()
186
+ return Router(model_list=resolved_model_configurations, **self.router_settings)
187
+
188
+ def _has_oauth(self) -> bool:
189
+ for model_configuration in self.model_configurations:
190
+ if model_configuration.get("litellm_params", {}).get("oauth", None):
191
+ return True
192
+ return False
193
+
178
194
  def _resolve_env_vars_in_model_configurations(self) -> List:
179
195
  model_configuration_with_resolved_keys = []
180
196
  for model_configuration in self.model_configurations:
181
197
  resolved_model_configuration = resolve_environment_variables(
182
- model_configuration
198
+ deepcopy(model_configuration)
183
199
  )
200
+
201
+ if not isinstance(resolved_model_configuration, dict):
202
+ continue
203
+
204
+ lite_llm_params = resolved_model_configuration.get("litellm_params", {})
205
+ if lite_llm_params.get("oauth", None):
206
+ oauth_config_dict = lite_llm_params.pop("oauth")
207
+ oauth_config = AzureEntraIDOAuthConfig.from_dict(oauth_config_dict)
208
+ credential = oauth_config.create_azure_credential()
209
+ # token_provider = get_bearer_token_provider(
210
+ # credential, *oauth_config.scopes
211
+ # )
212
+ resolved_model_configuration["litellm_params"]["azure_ad_token"] = (
213
+ credential.get_token(*oauth_config.scopes).token
214
+ )
184
215
  model_configuration_with_resolved_keys.append(resolved_model_configuration)
185
216
  return model_configuration_with_resolved_keys
@@ -13,6 +13,7 @@ import rasa.shared.utils.io
13
13
  from rasa.exceptions import MissingDependencyException
14
14
  from rasa.shared.constants import DOCS_URL_MIGRATION_GUIDE
15
15
  from rasa.shared.exceptions import ProviderClientValidationError, RasaException
16
+ from rasa.shared.utils.cli import print_success
16
17
 
17
18
  logger = logging.getLogger(__name__)
18
19
 
@@ -322,3 +323,16 @@ def validate_environment(
322
323
  raise MissingDependencyException(
323
324
  f"Missing package for {component_name}: {p}"
324
325
  )
326
+
327
+
328
+ def display_research_study_prompt() -> None:
329
+ """Logs a prompt to get users to participate in a UX Improvement research study."""
330
+ separator = "-" * 54
331
+ message = f"""
332
+ {separator}
333
+ Want to help shape the future of Rasa Pro?
334
+ Share your feedback in a short conversation with our team.
335
+ Sign up at: https://calendly.com/alvaro-rasa/rasa-pro-installation
336
+ {separator}
337
+ """
338
+ print_success(message)
rasa/shared/utils/llm.py CHANGED
@@ -667,38 +667,94 @@ def get_prompt_template(
667
667
  """
668
668
  try:
669
669
  if jinja_file_path is not None:
670
- return rasa.shared.utils.io.read_file(jinja_file_path)
670
+ prompt_template = rasa.shared.utils.io.read_file(jinja_file_path)
671
+ structlogger.info(
672
+ "utils.llm.get_prompt_template.custom_prompt_template_read_successfull",
673
+ event_info=(
674
+ f"Custom prompt template read successfully from "
675
+ f"`{jinja_file_path}`."
676
+ ),
677
+ prompt_file_path=jinja_file_path,
678
+ )
679
+ return prompt_template
671
680
  except (FileIOException, FileNotFoundException):
672
681
  structlogger.warning(
673
- "Failed to read custom prompt template. Using default template instead.",
674
- jinja_file_path=jinja_file_path,
682
+ "utils.llm.get_prompt_template.failed_to_read_custom_prompt_template",
683
+ event_info=(
684
+ "Failed to read custom prompt template. Using default template instead."
685
+ ),
675
686
  )
676
687
  return default_prompt_template
677
688
 
678
689
 
679
690
  def get_default_prompt_template_based_on_model(
680
- config: Dict[str, Any],
691
+ llm_config: Dict[str, Any],
681
692
  model_prompt_mapping: Dict[str, Any],
693
+ default_prompt_path: str,
682
694
  fallback_prompt_path: str,
683
695
  ) -> Text:
684
696
  """Returns the default prompt template based on the model name.
685
697
 
686
698
  Args:
687
- config: The model config.
699
+ llm_config: The model config.
688
700
  model_prompt_mapping: The mapping of model name to prompt template.
689
- fallback_prompt_path: The fallback prompt path.
701
+ default_prompt_path: The default prompt path of the component.
702
+ fallback_prompt_path: The fallback prompt path for all other models
703
+ that do not have a mapping in the model_prompt_mapping.
690
704
 
691
705
  Returns:
692
706
  The default prompt template.
693
707
  """
694
- _config = deepcopy(config)
695
- if MODELS_CONFIG_KEY in _config:
696
- _config = _config[MODELS_CONFIG_KEY][0]
697
- provider = _config.get(PROVIDER_CONFIG_KEY)
698
- model = _config.get(MODEL_CONFIG_KEY, "")
708
+ _llm_config = deepcopy(llm_config)
709
+ if MODELS_CONFIG_KEY in _llm_config:
710
+ _llm_config = _llm_config[MODELS_CONFIG_KEY][0]
711
+ provider = _llm_config.get(PROVIDER_CONFIG_KEY)
712
+ model = _llm_config.get(MODEL_CONFIG_KEY)
713
+ if not model:
714
+ # If the model is not defined, we default to the default prompt template.
715
+ structlogger.info(
716
+ "utils.llm.get_default_prompt_template_based_on_model.using_default_prompt_template",
717
+ event_info=(
718
+ f"Model not defined in the config. Default prompt template read from"
719
+ f" - `{default_prompt_path}`."
720
+ ),
721
+ default_prompt_path=default_prompt_path,
722
+ )
723
+ return importlib.resources.read_text(
724
+ DEFAULT_PROMPT_PACKAGE_NAME, default_prompt_path
725
+ )
726
+
699
727
  model_name = model if provider and provider in model else f"{provider}/{model}"
700
- prompt_file_path = model_prompt_mapping.get(model_name, fallback_prompt_path)
701
- return importlib.resources.read_text(DEFAULT_PROMPT_PACKAGE_NAME, prompt_file_path)
728
+ if prompt_file_path := model_prompt_mapping.get(model_name):
729
+ # If the model is found in the mapping, we use the model-specific prompt
730
+ # template.
731
+ structlogger.info(
732
+ "utils.llm.get_default_prompt_template_based_on_model.using_model_specific_prompt_template",
733
+ event_info=(
734
+ f"Using model-specific default prompt template. Default prompt "
735
+ f"template read from - `{prompt_file_path}`."
736
+ ),
737
+ default_prompt_path=prompt_file_path,
738
+ model_name=model_name,
739
+ )
740
+ return importlib.resources.read_text(
741
+ DEFAULT_PROMPT_PACKAGE_NAME, prompt_file_path
742
+ )
743
+
744
+ # If the model is not found in the mapping, we default to the fallback prompt
745
+ # template.
746
+ structlogger.info(
747
+ "utils.llm.get_default_prompt_template_based_on_model.using_fallback_prompt_template",
748
+ event_info=(
749
+ f"Model not found in the model prompt mapping. Fallback prompt template "
750
+ f"read from - `{fallback_prompt_path}`."
751
+ ),
752
+ fallback_prompt_path=fallback_prompt_path,
753
+ model_name=model_name,
754
+ )
755
+ return importlib.resources.read_text(
756
+ DEFAULT_PROMPT_PACKAGE_NAME, fallback_prompt_path
757
+ )
702
758
 
703
759
 
704
760
  def allowed_values_for_slot(slot: Slot) -> Union[str, None]:
rasa/telemetry.py CHANGED
@@ -15,7 +15,7 @@ from collections import defaultdict
15
15
  from datetime import datetime
16
16
  from functools import wraps
17
17
  from pathlib import Path
18
- from typing import Any, Callable, Dict, List, Optional, Text, Tuple
18
+ from typing import Any, Callable, Dict, List, Optional, Text, Tuple, Type, cast
19
19
 
20
20
  import importlib_resources
21
21
  import requests
@@ -1126,12 +1126,12 @@ def _get_llm_command_generator_config(config: Dict[str, Any]) -> Optional[Dict]:
1126
1126
  """
1127
1127
  from rasa.dialogue_understanding.generator import (
1128
1128
  CompactLLMCommandGenerator,
1129
+ LLMBasedCommandGenerator,
1129
1130
  LLMCommandGenerator,
1130
1131
  MultiStepLLMCommandGenerator,
1131
1132
  SingleStepLLMCommandGenerator,
1132
1133
  )
1133
1134
  from rasa.dialogue_understanding.generator.constants import (
1134
- DEFAULT_LLM_CONFIG,
1135
1135
  FLOW_RETRIEVAL_KEY,
1136
1136
  LLM_CONFIG_KEY,
1137
1137
  )
@@ -1162,6 +1162,12 @@ def _get_llm_command_generator_config(config: Dict[str, Any]) -> Optional[Dict]:
1162
1162
 
1163
1163
  def extract_llm_command_generator_llm_client_settings(component: Dict) -> Dict:
1164
1164
  """Extracts settings related to LLM command generator."""
1165
+ component_class_lookup = {
1166
+ LLMCommandGenerator.__name__: LLMCommandGenerator,
1167
+ SingleStepLLMCommandGenerator.__name__: SingleStepLLMCommandGenerator,
1168
+ MultiStepLLMCommandGenerator.__name__: MultiStepLLMCommandGenerator,
1169
+ CompactLLMCommandGenerator.__name__: CompactLLMCommandGenerator,
1170
+ }
1165
1171
  llm_config = component.get(LLM_CONFIG_KEY, {})
1166
1172
  # Config at this stage is not yet resolved, so read from `model_group`
1167
1173
  llm_model_group_id = llm_config.get(MODEL_GROUP_CONFIG_KEY)
@@ -1169,7 +1175,11 @@ def _get_llm_command_generator_config(config: Dict[str, Any]) -> Optional[Dict]:
1169
1175
  MODEL_NAME_CONFIG_KEY
1170
1176
  )
1171
1177
  if llm_model_group_id is None and llm_model_name is None:
1172
- llm_model_name = DEFAULT_LLM_CONFIG[MODEL_CONFIG_KEY]
1178
+ component_clz = cast(
1179
+ Type[LLMBasedCommandGenerator],
1180
+ component_class_lookup[component["name"]],
1181
+ )
1182
+ llm_model_name = component_clz.get_default_llm_config()[MODEL_CONFIG_KEY]
1173
1183
 
1174
1184
  custom_prompt_used = (
1175
1185
  PROMPT_CONFIG_KEY in component or PROMPT_TEMPLATE_CONFIG_KEY in component
@@ -58,9 +58,7 @@ from rasa.shared.core.trackers import DialogueStateTracker
58
58
  from rasa.shared.core.training_data.structures import StoryGraph
59
59
  from rasa.shared.importers.importer import TrainingDataImporter
60
60
  from rasa.shared.nlu.constants import INTENT_NAME_KEY, SET_SLOT_COMMAND
61
- from rasa.shared.utils.llm import (
62
- combine_custom_and_default_config,
63
- )
61
+ from rasa.shared.utils.llm import combine_custom_and_default_config
64
62
  from rasa.tracing.constants import (
65
63
  PROMPT_TOKEN_LENGTH_ATTRIBUTE_NAME,
66
64
  REQUEST_BODY_SIZE_IN_BYTES_ATTRIBUTE_NAME,
@@ -375,14 +373,13 @@ def extract_attrs_for_llm_based_command_generator(
375
373
  self: "LLMBasedCommandGenerator",
376
374
  prompt: str,
377
375
  ) -> Dict[str, Any]:
378
- from rasa.dialogue_understanding.generator.constants import DEFAULT_LLM_CONFIG
379
376
  from rasa.dialogue_understanding.generator.flow_retrieval import (
380
377
  DEFAULT_EMBEDDINGS_CONFIG,
381
378
  )
382
379
 
383
380
  attributes = extract_llm_config(
384
381
  self,
385
- default_llm_config=DEFAULT_LLM_CONFIG,
382
+ default_llm_config=self.get_default_llm_config(),
386
383
  default_embeddings_config=DEFAULT_EMBEDDINGS_CONFIG,
387
384
  )
388
385
 
rasa/validator.py CHANGED
@@ -1429,7 +1429,7 @@ class Validator:
1429
1429
  event_info=(
1430
1430
  f"{count} response{' is' if count == 1 else 's are'} "
1431
1431
  f"missing translations for some languages. "
1432
- "Run 'rasa data validate language' for details."
1432
+ "Run 'rasa data validate translations' for details."
1433
1433
  ),
1434
1434
  )
1435
1435
  if flow_warnings:
@@ -1440,7 +1440,7 @@ class Validator:
1440
1440
  event_info=(
1441
1441
  f"{count} flow{' is' if count == 1 else 's are'} "
1442
1442
  f"missing translations for some languages. "
1443
- "Run 'rasa data validate language' for details."
1443
+ "Run 'rasa data validate translations' for details."
1444
1444
  ),
1445
1445
  )
1446
1446
  else:
@@ -2061,7 +2061,7 @@ class Validator:
2061
2061
 
2062
2062
  def validate_conditional_response_variation_predicates(self) -> bool:
2063
2063
  """Validate the conditional response variation predicates."""
2064
- context = {"slots": {slot.name: None for slot in self.domain.slots}}
2064
+ context = {SLOTS: {slot.name: None for slot in self.domain.slots}}
2065
2065
  all_good = True
2066
2066
 
2067
2067
  for utter_name, variations in self.domain.responses.items():
@@ -2115,7 +2115,7 @@ class Validator:
2115
2115
 
2116
2116
  if (
2117
2117
  slot_namespace is not None
2118
- and slot_namespace[1] not in self.domain.slots
2118
+ and slot_namespace[1] not in context[SLOTS]
2119
2119
  ):
2120
2120
  structlogger.error(
2121
2121
  "validator.validate_conditional_response_variation_predicates.invalid_slot",
rasa/version.py CHANGED
@@ -1,3 +1,3 @@
1
1
  # this file will automatically be changed,
2
2
  # do not add anything but the version number here!
3
- __version__ = "3.12.0rc2"
3
+ __version__ = "3.12.0"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: rasa-pro
3
- Version: 3.12.0rc2
3
+ Version: 3.12.1.dev1
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
  Home-page: https://rasa.com
6
6
  Keywords: nlp,machine-learning,machine-learning-library,bot,bots,botkit,rasa conversational-agents,conversational-ai,chatbot,chatbot-framework,bot-framework
@@ -103,7 +103,7 @@ Requires-Dist: pyyaml (>=6.0)
103
103
  Requires-Dist: qdrant-client (>=1.9.1,<1.10.0)
104
104
  Requires-Dist: questionary (>=1.10.0,<2.1.0)
105
105
  Requires-Dist: randomname (>=0.2.1,<0.3.0)
106
- Requires-Dist: rasa-sdk (==3.12.0.dev2)
106
+ Requires-Dist: rasa-sdk (==3.12.0)
107
107
  Requires-Dist: redis (>=4.6.0,<6.0)
108
108
  Requires-Dist: regex (>=2024.7.24,<2024.8.0)
109
109
  Requires-Dist: requests (>=2.32.3,<2.33.0)