rasa-pro 3.12.18.dev1__py3-none-any.whl → 3.12.25__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 (53) hide show
  1. rasa/__init__.py +0 -6
  2. rasa/core/actions/action.py +2 -5
  3. rasa/core/actions/action_repeat_bot_messages.py +18 -22
  4. rasa/core/channels/voice_stream/asr/asr_engine.py +5 -1
  5. rasa/core/channels/voice_stream/asr/azure.py +9 -0
  6. rasa/core/channels/voice_stream/asr/deepgram.py +5 -0
  7. rasa/core/channels/voice_stream/audiocodes.py +9 -4
  8. rasa/core/channels/voice_stream/twilio_media_streams.py +7 -0
  9. rasa/core/channels/voice_stream/voice_channel.py +47 -9
  10. rasa/core/policies/enterprise_search_policy.py +196 -72
  11. rasa/core/policies/intentless_policy.py +1 -3
  12. rasa/core/processor.py +50 -5
  13. rasa/core/utils.py +11 -2
  14. rasa/dialogue_understanding/coexistence/llm_based_router.py +1 -0
  15. rasa/dialogue_understanding/commands/__init__.py +4 -0
  16. rasa/dialogue_understanding/commands/cancel_flow_command.py +3 -1
  17. rasa/dialogue_understanding/commands/correct_slots_command.py +0 -10
  18. rasa/dialogue_understanding/commands/set_slot_command.py +6 -0
  19. rasa/dialogue_understanding/commands/utils.py +26 -2
  20. rasa/dialogue_understanding/generator/command_generator.py +15 -5
  21. rasa/dialogue_understanding/generator/llm_based_command_generator.py +4 -15
  22. rasa/dialogue_understanding/generator/llm_command_generator.py +1 -3
  23. rasa/dialogue_understanding/generator/multi_step/multi_step_llm_command_generator.py +4 -44
  24. rasa/dialogue_understanding/generator/single_step/compact_llm_command_generator.py +1 -14
  25. rasa/dialogue_understanding/processor/command_processor.py +23 -16
  26. rasa/dialogue_understanding/stack/frames/flow_stack_frame.py +17 -4
  27. rasa/dialogue_understanding/stack/utils.py +3 -1
  28. rasa/dialogue_understanding/utils.py +68 -12
  29. rasa/dialogue_understanding_test/du_test_schema.yml +3 -3
  30. rasa/e2e_test/e2e_test_coverage_report.py +1 -1
  31. rasa/e2e_test/e2e_test_schema.yml +3 -3
  32. rasa/hooks.py +0 -55
  33. rasa/llm_fine_tuning/annotation_module.py +43 -11
  34. rasa/llm_fine_tuning/utils.py +2 -4
  35. rasa/shared/constants.py +0 -5
  36. rasa/shared/core/constants.py +1 -0
  37. rasa/shared/core/flows/constants.py +2 -0
  38. rasa/shared/core/flows/flow.py +129 -13
  39. rasa/shared/core/flows/flows_list.py +18 -1
  40. rasa/shared/core/flows/steps/link.py +7 -2
  41. rasa/shared/providers/constants.py +0 -9
  42. rasa/shared/providers/llm/_base_litellm_client.py +4 -14
  43. rasa/shared/providers/llm/litellm_router_llm_client.py +7 -17
  44. rasa/shared/providers/llm/llm_client.py +15 -24
  45. rasa/shared/providers/llm/self_hosted_llm_client.py +2 -10
  46. rasa/tracing/instrumentation/attribute_extractors.py +2 -2
  47. rasa/version.py +1 -1
  48. {rasa_pro-3.12.18.dev1.dist-info → rasa_pro-3.12.25.dist-info}/METADATA +3 -4
  49. {rasa_pro-3.12.18.dev1.dist-info → rasa_pro-3.12.25.dist-info}/RECORD +52 -53
  50. rasa/monkey_patches.py +0 -91
  51. {rasa_pro-3.12.18.dev1.dist-info → rasa_pro-3.12.25.dist-info}/NOTICE +0 -0
  52. {rasa_pro-3.12.18.dev1.dist-info → rasa_pro-3.12.25.dist-info}/WHEEL +0 -0
  53. {rasa_pro-3.12.18.dev1.dist-info → rasa_pro-3.12.25.dist-info}/entry_points.txt +0 -0
@@ -1,9 +1,12 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  from dataclasses import dataclass
4
- from typing import Any, Dict, Text
4
+ from typing import TYPE_CHECKING, Any, Dict, Text
5
5
 
6
- from rasa.shared.core.flows.flow_step import FlowStep
6
+ from rasa.shared.core.flows.flow_step import FlowStep, Optional
7
+
8
+ if TYPE_CHECKING:
9
+ from rasa.shared.core.flows.flow import Flow
7
10
 
8
11
 
9
12
  @dataclass
@@ -12,6 +15,8 @@ class LinkFlowStep(FlowStep):
12
15
 
13
16
  link: Text
14
17
  """The id of the flow that should be started subsequently."""
18
+ linked_flow_reference: Optional["Flow"] = None
19
+ """The flow that is linked to by this step."""
15
20
 
16
21
  def does_allow_for_next_step(self) -> bool:
17
22
  """Returns whether this step allows for following steps.
@@ -4,12 +4,3 @@ LITE_LLM_API_KEY_FIELD = "api_key"
4
4
  LITE_LLM_API_VERSION_FIELD = "api_version"
5
5
  LITE_LLM_MODEL_FIELD = "model"
6
6
  LITE_LLM_AZURE_AD_TOKEN = "azure_ad_token"
7
-
8
- # Enable or disable Langfuse integration
9
- RASA_LANGFUSE_INTEGRATION_ENABLED_ENV_VAR = "RASA_LANGFUSE_INTEGRATION_ENABLED"
10
- # Langfuse configuration
11
- LANGFUSE_CALLBACK_NAME = "langfuse"
12
- LANGFUSE_HOST_ENV_VAR = "LANGFUSE_HOST"
13
- LANGFUSE_PROJECT_ID_ENV_VAR = "LANGFUSE_PROJECT_ID"
14
- LANGFUSE_PUBLIC_KEY_ENV_VAR = "LANGFUSE_PUBLIC_KEY"
15
- LANGFUSE_SECRET_KEY_ENV_VAR = "LANGFUSE_SECRET_KEY"
@@ -2,7 +2,7 @@ from __future__ import annotations
2
2
 
3
3
  import logging
4
4
  from abc import abstractmethod
5
- from typing import Any, Dict, List, Optional, Union, cast
5
+ from typing import Any, Dict, List, Union, cast
6
6
 
7
7
  import structlog
8
8
  from litellm import acompletion, completion, validate_environment
@@ -126,11 +126,7 @@ class _BaseLiteLLMClient:
126
126
  raise ProviderClientValidationError(event_info)
127
127
 
128
128
  @suppress_logs(log_level=logging.WARNING)
129
- def completion(
130
- self,
131
- messages: Union[List[dict], List[str], str],
132
- metadata: Optional[Dict[str, Any]] = None,
133
- ) -> LLMResponse:
129
+ def completion(self, messages: Union[List[dict], List[str], str]) -> LLMResponse:
134
130
  """Synchronously generate completions for given list of messages.
135
131
 
136
132
  Args:
@@ -142,7 +138,6 @@ class _BaseLiteLLMClient:
142
138
  - a list of messages. Each message is a string and will be formatted
143
139
  as a user message.
144
140
  - a single message as a string which will be formatted as user message.
145
- metadata: Optional metadata to be passed to the LLM call.
146
141
 
147
142
  Returns:
148
143
  List of message completions.
@@ -160,9 +155,7 @@ class _BaseLiteLLMClient:
160
155
 
161
156
  @suppress_logs(log_level=logging.WARNING)
162
157
  async def acompletion(
163
- self,
164
- messages: Union[List[dict], List[str], str],
165
- metadata: Optional[Dict[str, Any]] = None,
158
+ self, messages: Union[List[dict], List[str], str]
166
159
  ) -> LLMResponse:
167
160
  """Asynchronously generate completions for given list of messages.
168
161
 
@@ -175,7 +168,6 @@ class _BaseLiteLLMClient:
175
168
  - a list of messages. Each message is a string and will be formatted
176
169
  as a user message.
177
170
  - a single message as a string which will be formatted as user message.
178
- metadata: Optional metadata to be passed to the LLM call.
179
171
 
180
172
  Returns:
181
173
  List of message completions.
@@ -186,9 +178,7 @@ class _BaseLiteLLMClient:
186
178
  try:
187
179
  formatted_messages = self._get_formatted_messages(messages)
188
180
  arguments = resolve_environment_variables(self._completion_fn_args)
189
- response = await acompletion(
190
- messages=formatted_messages, metadata=metadata, **arguments
191
- )
181
+ response = await acompletion(messages=formatted_messages, **arguments)
192
182
  return self._format_response(response)
193
183
  except Exception as e:
194
184
  message = ""
@@ -1,7 +1,7 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  import logging
4
- from typing import Any, Dict, List, Optional, Union
4
+ from typing import Any, Dict, List, Union
5
5
 
6
6
  import structlog
7
7
 
@@ -122,12 +122,9 @@ class LiteLLMRouterLLMClient(_BaseLiteLLMRouterClient, _BaseLiteLLMClient):
122
122
  raise ProviderClientAPIException(e)
123
123
 
124
124
  @suppress_logs(log_level=logging.WARNING)
125
- def completion(
126
- self,
127
- messages: Union[List[dict], List[str], str],
128
- metadata: Optional[Dict[str, Any]] = None,
129
- ) -> LLMResponse:
130
- """Synchronously generate completions for given list of messages.
125
+ def completion(self, messages: Union[List[dict], List[str], str]) -> LLMResponse:
126
+ """
127
+ Synchronously generate completions for given list of messages.
131
128
 
132
129
  Method overrides the base class method to call the appropriate
133
130
  completion method based on the configuration. If the chat completions
@@ -143,11 +140,8 @@ class LiteLLMRouterLLMClient(_BaseLiteLLMRouterClient, _BaseLiteLLMClient):
143
140
  - a list of messages. Each message is a string and will be formatted
144
141
  as a user message.
145
142
  - a single message as a string which will be formatted as user message.
146
- metadata: Optional metadata to be passed to the LLM call.
147
-
148
143
  Returns:
149
144
  List of message completions.
150
-
151
145
  Raises:
152
146
  ProviderClientAPIException: If the API request fails.
153
147
  """
@@ -164,11 +158,10 @@ class LiteLLMRouterLLMClient(_BaseLiteLLMRouterClient, _BaseLiteLLMClient):
164
158
 
165
159
  @suppress_logs(log_level=logging.WARNING)
166
160
  async def acompletion(
167
- self,
168
- messages: Union[List[dict], List[str], str],
169
- metadata: Optional[Dict[str, Any]] = None,
161
+ self, messages: Union[List[dict], List[str], str]
170
162
  ) -> LLMResponse:
171
- """Asynchronously generate completions for given list of messages.
163
+ """
164
+ Asynchronously generate completions for given list of messages.
172
165
 
173
166
  Method overrides the base class method to call the appropriate
174
167
  completion method based on the configuration. If the chat completions
@@ -184,11 +177,8 @@ class LiteLLMRouterLLMClient(_BaseLiteLLMRouterClient, _BaseLiteLLMClient):
184
177
  - a list of messages. Each message is a string and will be formatted
185
178
  as a user message.
186
179
  - a single message as a string which will be formatted as user message.
187
- metadata: Optional metadata to be passed to the LLM call.
188
-
189
180
  Returns:
190
181
  List of message completions.
191
-
192
182
  Raises:
193
183
  ProviderClientAPIException: If the API request fails.
194
184
  """
@@ -1,19 +1,21 @@
1
1
  from __future__ import annotations
2
2
 
3
- from typing import Any, Dict, List, Optional, Protocol, Union, runtime_checkable
3
+ from typing import Dict, List, Protocol, Union, runtime_checkable
4
4
 
5
5
  from rasa.shared.providers.llm.llm_response import LLMResponse
6
6
 
7
7
 
8
8
  @runtime_checkable
9
9
  class LLMClient(Protocol):
10
- """Protocol for an LLM client that specifies the interface for interacting
10
+ """
11
+ Protocol for an LLM client that specifies the interface for interacting
11
12
  with the API.
12
13
  """
13
14
 
14
15
  @classmethod
15
16
  def from_config(cls, config: dict) -> LLMClient:
16
- """Initializes the llm client with the given configuration.
17
+ """
18
+ Initializes the llm client with the given configuration.
17
19
 
18
20
  This class method should be implemented to parse the given
19
21
  configuration and create an instance of an llm client.
@@ -22,24 +24,17 @@ class LLMClient(Protocol):
22
24
 
23
25
  @property
24
26
  def config(self) -> Dict:
25
- """Returns the configuration for that the llm client is initialized with.
27
+ """
28
+ Returns the configuration for that the llm client is initialized with.
26
29
 
27
30
  This property should be implemented to return a dictionary containing
28
31
  the configuration settings for the llm client.
29
32
  """
30
33
  ...
31
34
 
32
- def completion(
33
- self,
34
- messages: Union[List[dict], List[str], str],
35
- metadata: Optional[Dict[str, Any]] = None,
36
- ) -> LLMResponse:
37
- """Synchronously generate completions for given list of messages.
38
- def completion(
39
- self,
40
- messages: Union[List[dict], List[str], str],
41
- metadata: Optional[Dict[str, Any]] = None,
42
- ) -> LLMResponse:
35
+ def completion(self, messages: Union[List[dict], List[str], str]) -> LLMResponse:
36
+ """
37
+ Synchronously generate completions for given list of messages.
43
38
 
44
39
  This method should be implemented to take a list of messages (as
45
40
  strings) and return a list of completions (as strings).
@@ -53,19 +48,16 @@ class LLMClient(Protocol):
53
48
  - a list of messages. Each message is a string and will be formatted
54
49
  as a user message.
55
50
  - a single message as a string which will be formatted as user message.
56
- metadata: Optional metadata to be passed to the LLM call.
57
-
58
51
  Returns:
59
52
  LLMResponse
60
53
  """
61
54
  ...
62
55
 
63
56
  async def acompletion(
64
- self,
65
- messages: Union[List[dict], List[str], str],
66
- metadata: Optional[Dict[str, Any]] = None,
57
+ self, messages: Union[List[dict], List[str], str]
67
58
  ) -> LLMResponse:
68
- """Asynchronously generate completions for given list of messages.
59
+ """
60
+ Asynchronously generate completions for given list of messages.
69
61
 
70
62
  This method should be implemented to take a list of messages (as
71
63
  strings) and return a list of completions (as strings).
@@ -79,15 +71,14 @@ class LLMClient(Protocol):
79
71
  - a list of messages. Each message is a string and will be formatted
80
72
  as a user message.
81
73
  - a single message as a string which will be formatted as user message.
82
- metadata: Optional metadata to be passed to the LLM call.
83
-
84
74
  Returns:
85
75
  LLMResponse
86
76
  """
87
77
  ...
88
78
 
89
79
  def validate_client_setup(self, *args, **kwargs) -> None: # type: ignore
90
- """Perform client setup validation.
80
+ """
81
+ Perform client setup validation.
91
82
 
92
83
  This method should be implemented to validate whether the client can be
93
84
  used with the parameters provided through configuration or environment
@@ -237,9 +237,7 @@ class SelfHostedLLMClient(_BaseLiteLLMClient):
237
237
  raise ProviderClientAPIException(e)
238
238
 
239
239
  async def acompletion(
240
- self,
241
- messages: Union[List[dict], List[str], str],
242
- metadata: Optional[Dict[str, Any]] = None,
240
+ self, messages: Union[List[dict], List[str], str]
243
241
  ) -> LLMResponse:
244
242
  """Asynchronous completion of the model with the given messages.
245
243
 
@@ -257,7 +255,6 @@ class SelfHostedLLMClient(_BaseLiteLLMClient):
257
255
  - a list of messages. Each message is a string and will be formatted
258
256
  as a user message.
259
257
  - a single message as a string which will be formatted as user message.
260
- metadata: Optional metadata to be passed to the LLM call.
261
258
 
262
259
  Returns:
263
260
  The completion response.
@@ -266,11 +263,7 @@ class SelfHostedLLMClient(_BaseLiteLLMClient):
266
263
  return await super().acompletion(messages)
267
264
  return await self._atext_completion(messages)
268
265
 
269
- def completion(
270
- self,
271
- messages: Union[List[dict], List[str], str],
272
- metadata: Optional[Dict[str, Any]] = None,
273
- ) -> LLMResponse:
266
+ def completion(self, messages: Union[List[dict], List[str], str]) -> LLMResponse:
274
267
  """Completion of the model with the given messages.
275
268
 
276
269
  Method overrides the base class method to call the appropriate
@@ -280,7 +273,6 @@ class SelfHostedLLMClient(_BaseLiteLLMClient):
280
273
 
281
274
  Args:
282
275
  messages: The messages to be used for completion.
283
- metadata: Optional metadata to be passed to the LLM call.
284
276
 
285
277
  Returns:
286
278
  The completion response.
@@ -372,7 +372,6 @@ def extract_llm_config(
372
372
  def extract_attrs_for_llm_based_command_generator(
373
373
  self: "LLMBasedCommandGenerator",
374
374
  prompt: str,
375
- metadata: Optional[Dict[str, Any]] = None,
376
375
  ) -> Dict[str, Any]:
377
376
  from rasa.dialogue_understanding.generator.flow_retrieval import (
378
377
  DEFAULT_EMBEDDINGS_CONFIG,
@@ -388,7 +387,8 @@ def extract_attrs_for_llm_based_command_generator(
388
387
 
389
388
 
390
389
  def extract_attrs_for_contextual_response_rephraser(
391
- self: Any, prompt: str
390
+ self: Any,
391
+ prompt: str,
392
392
  ) -> Dict[str, Any]:
393
393
  from rasa.core.nlg.contextual_response_rephraser import DEFAULT_LLM_CONFIG
394
394
 
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.18.dev1"
3
+ __version__ = "3.12.25"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: rasa-pro
3
- Version: 3.12.18.dev1
3
+ Version: 3.12.25
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
@@ -63,7 +63,6 @@ Requires-Dist: keras (==2.14.0)
63
63
  Requires-Dist: langchain (>=0.2.17,<0.3.0)
64
64
  Requires-Dist: langchain-community (>=0.2.19,<0.3.0)
65
65
  Requires-Dist: langcodes (>=3.5.0,<4.0.0)
66
- Requires-Dist: langfuse (>=2.60.2,<2.61.0)
67
66
  Requires-Dist: litellm (>=1.69.0,<1.70.0)
68
67
  Requires-Dist: matplotlib (>=3.7,<3.8)
69
68
  Requires-Dist: mattermostwrapper (>=2.2,<2.3)
@@ -82,7 +81,7 @@ Requires-Dist: portalocker (>=2.7.0,<3.0.0)
82
81
  Requires-Dist: presidio-analyzer (>=2.2.33,<2.2.34)
83
82
  Requires-Dist: presidio-anonymizer (>=2.2.354,<3.0.0)
84
83
  Requires-Dist: prompt-toolkit (>=3.0.28,<3.0.29)
85
- Requires-Dist: protobuf (>=4.23.3,<4.25.4)
84
+ Requires-Dist: protobuf (>=4.25.8,<4.26.0)
86
85
  Requires-Dist: psutil (>=5.9.5,<6.0.0)
87
86
  Requires-Dist: psycopg2-binary (>=2.9.9,<2.10.0)
88
87
  Requires-Dist: pycountry (>=22.3.5,<23.0.0)
@@ -117,7 +116,7 @@ Requires-Dist: scikit-learn (>=1.5.1,<1.6.0)
117
116
  Requires-Dist: scipy (>=1.13.1,<1.14.0)
118
117
  Requires-Dist: sentencepiece[sentencepiece] (>=0.1.99,<0.2.0) ; extra == "transformers" or extra == "full"
119
118
  Requires-Dist: sentry-sdk (>=2.8.0,<3)
120
- Requires-Dist: setuptools (>=78.1.0,<78.2.0)
119
+ Requires-Dist: setuptools (>=78.1.1,<78.2.0)
121
120
  Requires-Dist: sklearn-crfsuite (>=0.3.6,<0.4.0)
122
121
  Requires-Dist: skops (>=0.10.0,<0.11.0)
123
122
  Requires-Dist: slack-sdk (>=3.27.1,<3.28.0)