rasa-pro 3.13.5__py3-none-any.whl → 3.13.6__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.

@@ -24,6 +24,7 @@ from rasa.shared.constants import (
24
24
  )
25
25
  from rasa.shared.core.domain import KEY_RESPONSES_TEXT, Domain
26
26
  from rasa.shared.core.events import BotUttered, UserUttered
27
+ from rasa.shared.core.flows.constants import KEY_TRANSLATION
27
28
  from rasa.shared.core.trackers import DialogueStateTracker
28
29
  from rasa.shared.nlu.constants import (
29
30
  KEY_COMPONENT_NAME,
@@ -305,22 +306,23 @@ class ContextualResponseRephraser(
305
306
  Returns:
306
307
  The response with the rephrased text.
307
308
  """
308
- if not (response_text := response.get(KEY_RESPONSES_TEXT)):
309
+ translation_response = response.get(KEY_TRANSLATION) or {}
310
+ lang_code = getattr(tracker.current_language, "code", None)
311
+ response_text = translation_response.get(
312
+ lang_code, response.get(KEY_RESPONSES_TEXT)
313
+ )
314
+ if not response_text:
309
315
  return response
310
316
 
311
317
  prompt_template_text = self._template_for_response_rephrasing(response)
312
-
313
- # Last user message (=current input) should always be in prompt if available
314
318
  last_message_by_user = getattr(tracker.latest_message, "text", "")
315
319
  current_input = (
316
320
  f"{USER}: {last_message_by_user}" if last_message_by_user else ""
317
321
  )
318
322
 
319
- # Only summarise conversation history if flagged
320
323
  if self.summarize_history:
321
324
  history = await self._create_history(tracker)
322
325
  else:
323
- # Count multiple utterances by bot/user as single turn
324
326
  turns_wrapper = (
325
327
  _count_multiple_utterances_as_single_turn
326
328
  if self.count_multiple_utterances_as_single_turn
@@ -363,16 +365,20 @@ class ContextualResponseRephraser(
363
365
  )
364
366
 
365
367
  if not (llm_response and llm_response.choices and llm_response.choices[0]):
366
- # If the LLM fails to generate a response, return the original response.
367
368
  return response
368
369
 
369
370
  updated_text = llm_response.choices[0]
371
+
372
+ if lang_code in translation_response:
373
+ response[KEY_TRANSLATION][lang_code] = updated_text
374
+ else:
375
+ response[KEY_RESPONSES_TEXT] = updated_text
376
+
370
377
  structlogger.debug(
371
378
  "nlg.rewrite.complete",
372
379
  response_text=response_text,
373
380
  updated_text=updated_text,
374
381
  )
375
- response[KEY_RESPONSES_TEXT] = updated_text
376
382
  return response
377
383
 
378
384
  def does_response_allow_rephrasing(self, template: Dict[Text, Any]) -> bool:
rasa/studio/utils.py CHANGED
@@ -1,33 +1,44 @@
1
1
  import argparse
2
2
  from pathlib import Path
3
+ from typing import List
3
4
 
4
5
  import rasa.shared.utils.cli
5
- from rasa.shared.constants import (
6
- DEFAULT_CONFIG_PATH,
7
- DEFAULT_DATA_PATH,
8
- DEFAULT_ENDPOINTS_PATH,
9
- )
10
- from rasa.studio.constants import DOMAIN_FILENAME
6
+
7
+ DOMAIN_FILENAME = "domain.yml"
8
+ DEFAULT_CONFIG_PATH = "config.yml"
9
+ DEFAULT_ENDPOINTS_PATH = "endpoints.yml"
10
+ DEFAULT_DATA_PATH = "data"
11
11
 
12
12
 
13
13
  def validate_argument_paths(args: argparse.Namespace) -> None:
14
- """Validates the paths provided in the command line arguments.
14
+ """Validate every path passed via CLI arguments.
15
15
 
16
16
  Args:
17
- args: The command line arguments containing paths to validate.
17
+ args: CLI arguments containing paths to validate.
18
+
19
+ Raises:
20
+ rasa.shared.utils.cli.PrintErrorAndExit: If any path does not exist.
18
21
  """
22
+ invalid_paths: List[str] = []
23
+
24
+ def collect_invalid_paths(arg_name: str, default: str) -> None:
25
+ value = getattr(args, arg_name, None)
26
+ path_values = value if isinstance(value, list) else [value]
27
+ for path_value in path_values:
28
+ if not path_value or path_value == default:
29
+ continue
30
+
31
+ if not Path(path_value).resolve().exists():
32
+ invalid_paths.append(f"{arg_name}: '{path_value}'")
33
+
34
+ collect_invalid_paths("domain", DOMAIN_FILENAME)
35
+ collect_invalid_paths("config", DEFAULT_CONFIG_PATH)
36
+ collect_invalid_paths("endpoints", DEFAULT_ENDPOINTS_PATH)
37
+ collect_invalid_paths("data", DEFAULT_DATA_PATH)
19
38
 
20
- def validate_path(arg_name: str, default: str) -> None:
21
- path_value = getattr(args, arg_name, None)
22
- if path_value and path_value != default:
23
- resolved_path = Path(path_value).resolve()
24
- if not resolved_path.exists():
25
- rasa.shared.utils.cli.print_error_and_exit(
26
- f"{arg_name.capitalize()} file or directory "
27
- f"'{path_value}' does not exist."
28
- )
29
-
30
- validate_path("domain", DOMAIN_FILENAME)
31
- validate_path("config", DEFAULT_CONFIG_PATH)
32
- validate_path("endpoints", DEFAULT_ENDPOINTS_PATH)
33
- validate_path("data", DEFAULT_DATA_PATH)
39
+ if invalid_paths:
40
+ message = (
41
+ "The following files or directories do not exist:\n - "
42
+ + "\n - ".join(invalid_paths)
43
+ )
44
+ rasa.shared.utils.cli.print_error_and_exit(message)
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.13.5"
3
+ __version__ = "3.13.6"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: rasa-pro
3
- Version: 3.13.5
3
+ Version: 3.13.6
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
@@ -311,7 +311,7 @@ rasa/core/lock_store.py,sha256=wP_0S5bBNI0cnRPVOcGNZgD8usdzw4udT4ncP6CKy14,15443
311
311
  rasa/core/migrate.py,sha256=h1dOpXxmVmZlbLVGy1yOU_Obp2KzRiOiL0iuEacA0Cg,14618
312
312
  rasa/core/nlg/__init__.py,sha256=jZuQAhOUcxO-KqqHGqICHSY3oDeXlUiGr2trQDYfG6o,240
313
313
  rasa/core/nlg/callback.py,sha256=lxBBZdjXHS54fn_pH_YUW8ApbFOBO-kYSY5bL4gR1p0,5218
314
- rasa/core/nlg/contextual_response_rephraser.py,sha256=Kvns8mfc8HIhGHcK4p4p-LP_di9laPvRYWJdCtkoUqQ,15093
314
+ rasa/core/nlg/contextual_response_rephraser.py,sha256=MIoavmpIrILacaW_qRuWkc-WOflL6yCWuBNl3UCAolE,15202
315
315
  rasa/core/nlg/generator.py,sha256=P3JvT4qO3XHLDRb0DVstZ4MmLLA-d4LZt3BbD3S9yO8,10864
316
316
  rasa/core/nlg/interpolator.py,sha256=vI2ZyeKHkHESPScCbefrcRrY6mrClI0LNwvZ1GvS5Tk,5138
317
317
  rasa/core/nlg/response.py,sha256=kfBSFnQni0lDZlGpZEVRjuQvil7G1JMjS4xIdd3AKhs,6045
@@ -799,7 +799,7 @@ rasa/studio/push.py,sha256=_EopU6RQnbQub33x0TVXOTWCYUfOQMDc6KdDNmltLMs,4279
799
799
  rasa/studio/results_logger.py,sha256=lwKROoQjzzJVnFoceLQ-z-5Hg35TfHo-8R4MDrMLYHY,5126
800
800
  rasa/studio/train.py,sha256=-UTPABXNWlnp3iIMKeslgprEtRQWcr8mF-Q7bacKxEw,4240
801
801
  rasa/studio/upload.py,sha256=Ssop8gTrBDj4JTrI35bdiKy7IWmUV_I3YXgXM-DIXSo,22648
802
- rasa/studio/utils.py,sha256=yiJtEv_CuI3uwVsWvKvcFH1ODZw37_aFNtCqaStwyP4,1109
802
+ rasa/studio/utils.py,sha256=WgPbmMcdb3yuZU36zxFqUkJwqi5ma7TZT4Y-mXYe54k,1429
803
803
  rasa/telemetry.py,sha256=2W1Tq1HMQm60o5oiy5DEGrIqSlpYMaJybY4DvCa6Gg8,69712
804
804
  rasa/tracing/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
805
805
  rasa/tracing/config.py,sha256=Ev4U0Z_P-0JMxEtyjWFgyaoSluNlAm5tTm5wBr-7F0I,13083
@@ -846,9 +846,9 @@ rasa/utils/train_utils.py,sha256=ClJx-6x3-h3Vt6mskacgkcCUJTMXjFPe3zAcy_DfmaU,212
846
846
  rasa/utils/url_tools.py,sha256=dZ1HGkVdWTJB7zYEdwoDIrEuyX9HE5WsxKKFVsXBLE0,1218
847
847
  rasa/utils/yaml.py,sha256=KjbZq5C94ZP7Jdsw8bYYF7HASI6K4-C_kdHfrnPLpSI,2000
848
848
  rasa/validator.py,sha256=fhRlHQvuBkiup0FnNYmwRmqQwC3QpdCJt0TuvW4jMaI,83125
849
- rasa/version.py,sha256=_6P8ElAUdlJz5y_KjvcBH-20EBW7oVoMPw-02EzdvQ4,117
850
- rasa_pro-3.13.5.dist-info/METADATA,sha256=5UymF6f9eFVWxwUrpIIGiFBf3clAvyR5dq86Bds_LK0,10550
851
- rasa_pro-3.13.5.dist-info/NOTICE,sha256=7HlBoMHJY9CL2GlYSfTQ-PZsVmLmVkYmMiPlTjhuCqA,218
852
- rasa_pro-3.13.5.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
853
- rasa_pro-3.13.5.dist-info/entry_points.txt,sha256=ckJ2SfEyTPgBqj_I6vm_tqY9dZF_LAPJZA335Xp0Q9U,43
854
- rasa_pro-3.13.5.dist-info/RECORD,,
849
+ rasa/version.py,sha256=7fxIP1R0Ox9pq9ce7whc6LA_D3UwwS6902VsPX1o8Bo,117
850
+ rasa_pro-3.13.6.dist-info/METADATA,sha256=yZBwGIG27TynAKlkqS93_4hobShKknNbFhYslp1hSpQ,10550
851
+ rasa_pro-3.13.6.dist-info/NOTICE,sha256=7HlBoMHJY9CL2GlYSfTQ-PZsVmLmVkYmMiPlTjhuCqA,218
852
+ rasa_pro-3.13.6.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
853
+ rasa_pro-3.13.6.dist-info/entry_points.txt,sha256=ckJ2SfEyTPgBqj_I6vm_tqY9dZF_LAPJZA335Xp0Q9U,43
854
+ rasa_pro-3.13.6.dist-info/RECORD,,