rasa-pro 3.14.0a4__py3-none-any.whl → 3.14.0a5__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/builder/jobs.py CHANGED
@@ -16,10 +16,13 @@ from rasa.builder.models import (
16
16
  JobStatusEvent,
17
17
  )
18
18
  from rasa.builder.project_generator import ProjectGenerator
19
- from rasa.builder.training_service import train_and_load_agent, try_load_existing_agent
19
+ from rasa.builder.training_service import (
20
+ train_and_load_agent,
21
+ try_load_existing_agent,
22
+ update_agent,
23
+ )
20
24
  from rasa.builder.validation_service import validate_project
21
25
  from rasa.cli.scaffold import ProjectTemplateName
22
- from rasa.core.channels.studio_chat import StudioChatInput
23
26
 
24
27
  structlogger = structlog.get_logger()
25
28
 
@@ -45,7 +48,6 @@ async def run_prompt_to_bot_job(
45
48
  prompt: The natural language prompt for bot generation.
46
49
  """
47
50
  project_generator: ProjectGenerator = app.ctx.project_generator
48
- input_channel: StudioChatInput = app.ctx.input_channel
49
51
 
50
52
  await push_job_status_event(job, JobStatus.received)
51
53
 
@@ -60,10 +62,8 @@ async def run_prompt_to_bot_job(
60
62
 
61
63
  # 2. Training
62
64
  await push_job_status_event(job, JobStatus.training)
63
- app.ctx.agent = await train_and_load_agent(
64
- project_generator.get_training_input()
65
- )
66
- input_channel.agent = app.ctx.agent
65
+ agent = await train_and_load_agent(project_generator.get_training_input())
66
+ update_agent(agent, app)
67
67
  await push_job_status_event(job, JobStatus.train_success)
68
68
 
69
69
  structlogger.info(
@@ -129,7 +129,6 @@ async def run_template_to_bot_job(
129
129
  template_name: The name of the template to use for bot generation.
130
130
  """
131
131
  project_generator: ProjectGenerator = app.ctx.project_generator
132
- input_channel = app.ctx.input_channel
133
132
 
134
133
  await push_job_status_event(job, JobStatus.received)
135
134
 
@@ -142,16 +141,14 @@ async def run_template_to_bot_job(
142
141
 
143
142
  # 2) Training
144
143
  await push_job_status_event(job, JobStatus.training)
145
- app.ctx.agent = await try_load_existing_agent(project_generator.project_folder)
146
- if app.ctx.agent is None:
147
- app.ctx.agent = await train_and_load_agent(
148
- project_generator.get_training_input()
149
- )
144
+ agent = await try_load_existing_agent(project_generator.project_folder)
145
+ if agent is None:
146
+ agent = await train_and_load_agent(project_generator.get_training_input())
150
147
  else:
151
148
  structlogger.info(
152
149
  "bot_builder_service.template_to_bot.agent_loaded_from_cache",
153
150
  )
154
- input_channel.agent = app.ctx.agent
151
+ update_agent(agent, app)
155
152
  await push_job_status_event(job, JobStatus.train_success)
156
153
 
157
154
  # 3) Done
@@ -216,7 +213,6 @@ async def run_update_files_job(
216
213
  bot_files: dict,
217
214
  ) -> None:
218
215
  project_generator = app.ctx.project_generator
219
- input_channel = app.ctx.input_channel
220
216
  await push_job_status_event(job, JobStatus.received)
221
217
 
222
218
  try:
@@ -232,8 +228,8 @@ async def run_update_files_job(
232
228
 
233
229
  # 2. Training
234
230
  await push_job_status_event(job, JobStatus.training)
235
- app.ctx.agent = await train_and_load_agent(training_input)
236
- input_channel.agent = app.ctx.agent
231
+ agent = await train_and_load_agent(training_input)
232
+ update_agent(agent, app)
237
233
  await push_job_status_event(job, JobStatus.train_success)
238
234
 
239
235
  await push_job_status_event(job, JobStatus.done)
rasa/builder/main.py CHANGED
@@ -25,7 +25,7 @@ from rasa.builder.service import bp, setup_project_generator
25
25
  from rasa.builder.template_cache import (
26
26
  background_download_template_caches,
27
27
  )
28
- from rasa.builder.training_service import try_load_existing_agent
28
+ from rasa.builder.training_service import try_load_existing_agent, update_agent
29
29
  from rasa.core.channels.studio_chat import StudioChatInput
30
30
  from rasa.server import configure_cors
31
31
  from rasa.utils.common import configure_logging_and_warnings
@@ -101,7 +101,6 @@ def create_app(project_folder: str) -> Sanic:
101
101
  use_authentication=app.config.USE_AUTHENTICATION,
102
102
  rasa_version=rasa.__version__,
103
103
  )
104
- app.ctx.agent = None
105
104
 
106
105
  # Set up project generator and store in app context
107
106
  app.ctx.project_generator = setup_project_generator(project_folder)
@@ -109,6 +108,8 @@ def create_app(project_folder: str) -> Sanic:
109
108
  # Set up input channel and store in app context
110
109
  app.ctx.input_channel = setup_input_channel()
111
110
 
111
+ update_agent(None, app)
112
+
112
113
  # Register the blueprint
113
114
  app.blueprint(bp)
114
115
 
@@ -140,7 +141,7 @@ def create_app(project_folder: str) -> Sanic:
140
141
  try:
141
142
  existing_agent = await try_load_existing_agent(project_folder)
142
143
  if existing_agent:
143
- app.ctx.agent = existing_agent
144
+ update_agent(existing_agent, app)
144
145
  structlogger.info("Agent loaded on server startup")
145
146
  else:
146
147
  structlogger.info(
@@ -5,10 +5,12 @@ from pathlib import Path
5
5
  from typing import Optional
6
6
 
7
7
  import structlog
8
+ from sanic import Sanic
8
9
 
9
10
  from rasa.builder.exceptions import AgentLoadError, TrainingError
10
11
  from rasa.builder.models import TrainingInput
11
12
  from rasa.core.agent import Agent, load_agent
13
+ from rasa.core.channels.studio_chat import StudioChatInput
12
14
  from rasa.core.utils import AvailableEndpoints, read_endpoints_from_path
13
15
  from rasa.model import get_latest_model
14
16
  from rasa.model_training import TrainingResult, train
@@ -17,6 +19,15 @@ from rasa.shared.importers.importer import TrainingDataImporter
17
19
  structlogger = structlog.get_logger()
18
20
 
19
21
 
22
+ def update_agent(agent: Optional[Agent], app: Sanic) -> None:
23
+ """Update the agent in the request context."""
24
+ app.ctx.agent = agent
25
+ if hasattr(app.ctx, "input_channel") and isinstance(
26
+ app.ctx.input_channel, StudioChatInput
27
+ ):
28
+ app.ctx.input_channel.agent = agent
29
+
30
+
20
31
  async def train_and_load_agent(input: TrainingInput) -> Agent:
21
32
  """Train a model and load an agent.
22
33
 
@@ -480,7 +480,8 @@ class StudioChatInput(SocketIOInput, VoiceInputChannel):
480
480
  async def after_server_start(
481
481
  app: "Sanic", _: asyncio.AbstractEventLoop
482
482
  ) -> None:
483
- self.agent = app.ctx.agent
483
+ if hasattr(app.ctx, "agent"):
484
+ self.agent = app.ctx.agent
484
485
 
485
486
  @self.sio_server.on("disconnect", namespace=self.namespace)
486
487
  async def disconnect(sid: Text) -> None:
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.14.0a4"
3
+ __version__ = "3.14.0a5"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: rasa-pro
3
- Version: 3.14.0a4
3
+ Version: 3.14.0a5
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
@@ -34,10 +34,10 @@ rasa/builder/guardrails/models.py,sha256=WlNoZWjDGo4Tigx7LLTkmR-zmMhVKpro0PjNdwM
34
34
  rasa/builder/guardrails/store.py,sha256=-mJdsCnHgSI08uPnPwZRObIyRV9u98zcpQ5QkeHdVK0,7660
35
35
  rasa/builder/guardrails/utils.py,sha256=2eudDOqPCTFiKWEGRfsCHUXNhjsht-tMsLJlh8hv0AE,11275
36
36
  rasa/builder/job_manager.py,sha256=eQ5HRff-U4Cj3joHKqpjDcfCMWj4nz4D_oQmoozpwPM,2507
37
- rasa/builder/jobs.py,sha256=fyx6gpiotgTu7YmflbkJDACaIW3Fg0-F-U7SmMTSY_4,9642
37
+ rasa/builder/jobs.py,sha256=KgqWNW5e8Nh5kYBm3Fm0wZWspbPRe5Qr1cRfrVKnYlM,9346
38
38
  rasa/builder/llm_service.py,sha256=y3CPQS0qHGFhe6Z4lbs2HkEVztYYVZtnWiTNjghlBdE,8859
39
39
  rasa/builder/logging_utils.py,sha256=E1YZs5BdHT9TrnoA2758sFMD1Xw7e5mnAtqWSAZs1gk,9296
40
- rasa/builder/main.py,sha256=mvbttnSrSUc8RmrS_1P8D9Z5fMJJGFlr42_Cn_zVo6w,7925
40
+ rasa/builder/main.py,sha256=7UhHynU4pTiWj6v7_c9bfRutfT8TIFIZmQs3BRy2aKY,7946
41
41
  rasa/builder/models.py,sha256=UWMN1Z20Btrc2fBK4y4eAyRmx3RVyQiqiUHYQTJfyIE,5937
42
42
  rasa/builder/project_generator.py,sha256=1CMFZxhOD0pmrTIC-1nMRdQRqDvUgW0zMFNBwVuT-Og,13834
43
43
  rasa/builder/project_info.py,sha256=ZBwFCigZLSo1RBMhlZDYBoVl2G-9OnhRrYxdMWHn6S4,2093
@@ -46,7 +46,7 @@ rasa/builder/service.py,sha256=DBIZeF9IDS-C0SWDfDwo8ieU6Ok9q5N417S3Mz82eLc,46649
46
46
  rasa/builder/shared/tracker_context.py,sha256=2P-DsWjWEkZ32dqrx6s4zVxdo0_mokZNrU3LYisu6MY,7691
47
47
  rasa/builder/skill_to_bot_prompt.jinja2,sha256=h2Fgoh9k3XinN0blEEqMuOWuvwXxJifP3GJs-GczgBU,5530
48
48
  rasa/builder/template_cache.py,sha256=GFI7o0peOFbbV4RQECsx7s60rhCc5FDOPM5a0DAfpuQ,8592
49
- rasa/builder/training_service.py,sha256=w2Z_nZqXQkBoPLNPxgLFPb3jBoq9GJMLXyfQ6k6F5MU,5596
49
+ rasa/builder/training_service.py,sha256=kmcxgCxZzklxr4RKqan3aA_BU3pRE7WS_q-AO5sFyxM,5975
50
50
  rasa/builder/validation_service.py,sha256=FAHSf2tQZ8yDlckWWjqMqhjb0rANbXR2DJTybh4fHnM,3099
51
51
  rasa/cli/__init__.py,sha256=eO5vp9rFCANtbTVU-pxN3iMBKw4p9WRcgzytt9MzinY,115
52
52
  rasa/cli/arguments/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -529,7 +529,7 @@ rasa/core/channels/rest.py,sha256=LWBYBdVzOz5Vv5tZCkB1QA7LxXJFTeC87CQLAi_ZGeI,73
529
529
  rasa/core/channels/rocketchat.py,sha256=hajaH6549CjEYFM5jSapw1DQKBPKTXbn7cVSuZzknmI,5999
530
530
  rasa/core/channels/slack.py,sha256=jVsTTUu9wUjukPoIsAhbee9o0QFUMCNlQHbR8LTcMBc,24406
531
531
  rasa/core/channels/socketio.py,sha256=N3aldDMzXotO85lX5pkmVtVq7g6gh9YpUpQpbAH3ogs,17560
532
- rasa/core/channels/studio_chat.py,sha256=WieWixHQm3p_laVGqobxI_1vN3M_jhNyi2ZkacutwxI,23502
532
+ rasa/core/channels/studio_chat.py,sha256=qkA16kwXEJh5Emo7Xh7TmQfRD6xKS0TN9gVTqObGCGE,23548
533
533
  rasa/core/channels/telegram.py,sha256=TKVknsk3U9tYeY1a8bzlhqkltWmZfGSOvrcmwa9qozc,12499
534
534
  rasa/core/channels/twilio.py,sha256=2BTQpyx0b0yPpc0A2BHYfxLPgodrLGLs8nq6i3lVGAM,5906
535
535
  rasa/core/channels/vier_cvg.py,sha256=5O4yx0TDQIMppvlCxTOzmPB60CA-vqQXqWQ7upfrTO0,13496
@@ -1123,9 +1123,9 @@ rasa/utils/train_utils.py,sha256=ClJx-6x3-h3Vt6mskacgkcCUJTMXjFPe3zAcy_DfmaU,212
1123
1123
  rasa/utils/url_tools.py,sha256=dZ1HGkVdWTJB7zYEdwoDIrEuyX9HE5WsxKKFVsXBLE0,1218
1124
1124
  rasa/utils/yaml.py,sha256=KjbZq5C94ZP7Jdsw8bYYF7HASI6K4-C_kdHfrnPLpSI,2000
1125
1125
  rasa/validator.py,sha256=_5IjhhzG-_LM5_Bpa09siEQATgFRYEsPp9FbOwXzVmM,83275
1126
- rasa/version.py,sha256=CVp2O7CCDqX98uHAnt9kwsG8ZSG18A11bBm0SQxxJ00,119
1127
- rasa_pro-3.14.0a4.dist-info/METADATA,sha256=weoGWM1LM-e_6diRVhuzENAKVdWMM6hnGgoWVHCYjOY,10152
1128
- rasa_pro-3.14.0a4.dist-info/NOTICE,sha256=7HlBoMHJY9CL2GlYSfTQ-PZsVmLmVkYmMiPlTjhuCqA,218
1129
- rasa_pro-3.14.0a4.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
1130
- rasa_pro-3.14.0a4.dist-info/entry_points.txt,sha256=ckJ2SfEyTPgBqj_I6vm_tqY9dZF_LAPJZA335Xp0Q9U,43
1131
- rasa_pro-3.14.0a4.dist-info/RECORD,,
1126
+ rasa/version.py,sha256=rUwLFIVnTPMfbY-jvJdgnI3ZzFod3g_Nwg8lIZlpWiI,119
1127
+ rasa_pro-3.14.0a5.dist-info/METADATA,sha256=PIV_8xQrTC_Kw6MkVRJynStykgYZK8aCcj28R1xv1sQ,10152
1128
+ rasa_pro-3.14.0a5.dist-info/NOTICE,sha256=7HlBoMHJY9CL2GlYSfTQ-PZsVmLmVkYmMiPlTjhuCqA,218
1129
+ rasa_pro-3.14.0a5.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
1130
+ rasa_pro-3.14.0a5.dist-info/entry_points.txt,sha256=ckJ2SfEyTPgBqj_I6vm_tqY9dZF_LAPJZA335Xp0Q9U,43
1131
+ rasa_pro-3.14.0a5.dist-info/RECORD,,