rasa-pro 3.14.0.dev1__py3-none-any.whl → 3.14.0.dev20250818__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/api.py +0 -5
- rasa/cli/arguments/default_arguments.py +0 -12
- rasa/cli/arguments/run.py +0 -2
- rasa/cli/dialogue_understanding_test.py +0 -4
- rasa/cli/e2e_test.py +0 -4
- rasa/cli/inspect.py +0 -3
- rasa/cli/llm_fine_tuning.py +0 -5
- rasa/cli/run.py +0 -4
- rasa/cli/shell.py +0 -3
- rasa/constants.py +0 -6
- rasa/core/actions/action.py +2 -42
- rasa/core/agent.py +0 -16
- rasa/core/available_endpoints.py +0 -30
- rasa/core/channels/inspector/dist/assets/{arc-2e78c586.js → arc-1ddec37b.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{blockDiagram-38ab4fdb-806b712e.js → blockDiagram-38ab4fdb-18af387c.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{c4Diagram-3d4e48cf-0745efa9.js → c4Diagram-3d4e48cf-250127a3.js} +1 -1
- rasa/core/channels/inspector/dist/assets/channel-59f6d54b.js +1 -0
- rasa/core/channels/inspector/dist/assets/{classDiagram-70f12bd4-7bd1082b.js → classDiagram-70f12bd4-c3388b34.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{classDiagram-v2-f2320105-d937ba49.js → classDiagram-v2-f2320105-9c893a82.js} +1 -1
- rasa/core/channels/inspector/dist/assets/clone-26177ddb.js +1 -0
- rasa/core/channels/inspector/dist/assets/{createText-2e5e7dd3-a2a564ca.js → createText-2e5e7dd3-c111213b.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{edges-e0da2a9e-b5256940.js → edges-e0da2a9e-812a729d.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{erDiagram-9861fffd-e6883ad2.js → erDiagram-9861fffd-fd5051bc.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{flowDb-956e92f1-e576fc02.js → flowDb-956e92f1-3287ac02.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{flowDiagram-66a62f08-2e298d01.js → flowDiagram-66a62f08-692fb0b2.js} +1 -1
- rasa/core/channels/inspector/dist/assets/flowDiagram-v2-96b9c2cf-29c03f5a.js +1 -0
- rasa/core/channels/inspector/dist/assets/{flowchart-elk-definition-4a651766-dd7b150a.js → flowchart-elk-definition-4a651766-008376f1.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{ganttDiagram-c361ad54-5b79575c.js → ganttDiagram-c361ad54-df330a69.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{gitGraphDiagram-72cf32ee-3016f40a.js → gitGraphDiagram-72cf32ee-e03676fb.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{graph-3e19170f.js → graph-46fad2ba.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{index-3862675e-eb9c86de.js → index-3862675e-a484ac55.js} +1 -1
- rasa/core/channels/inspector/dist/assets/index-a003633f.js +1335 -0
- rasa/core/channels/inspector/dist/assets/{infoDiagram-f8f76790-b4280e4d.js → infoDiagram-f8f76790-3f9e6ec2.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{journeyDiagram-49397b02-556091f8.js → journeyDiagram-49397b02-79f72383.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{layout-08436411.js → layout-aad098e5.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{line-683c4f3b.js → line-219ab7ae.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{linear-cee6d791.js → linear-2cddbe62.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{mindmap-definition-fc14e90a-a0bf0b1a.js → mindmap-definition-fc14e90a-1d41ed99.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{pieDiagram-8a3498a8-3730d5c4.js → pieDiagram-8a3498a8-cc496ee8.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{quadrantDiagram-120e2f19-12a20fed.js → quadrantDiagram-120e2f19-84d32884.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{requirementDiagram-deff3bca-b9732102.js → requirementDiagram-deff3bca-c0deb984.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{sankeyDiagram-04a897e0-a2e72776.js → sankeyDiagram-04a897e0-b9d7fd62.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{sequenceDiagram-704730f1-8b7a76bb.js → sequenceDiagram-704730f1-7d517565.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{stateDiagram-587899a1-e65853ac.js → stateDiagram-587899a1-98ef9b27.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{stateDiagram-v2-d93cdb3a-6f58a44b.js → stateDiagram-v2-d93cdb3a-cee70748.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{styles-6aaf32cf-df25b934.js → styles-6aaf32cf-3f9d1c96.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{styles-9a916d00-88357141.js → styles-9a916d00-67471923.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{styles-c10674c1-d600174d.js → styles-c10674c1-bd093fb7.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{svgDrawCommon-08f97a94-4adc3e0b.js → svgDrawCommon-08f97a94-675794e8.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{timeline-definition-85554ec2-42816fa1.js → timeline-definition-85554ec2-0ac67617.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{xychartDiagram-e933f94c-621eb66a.js → xychartDiagram-e933f94c-c018dc37.js} +1 -1
- rasa/core/channels/inspector/dist/index.html +1 -1
- rasa/core/channels/inspector/src/components/DialogueStack.tsx +5 -7
- rasa/core/channels/inspector/src/helpers/formatters.ts +3 -24
- rasa/core/channels/inspector/src/theme/base/styles.ts +1 -19
- rasa/core/channels/inspector/src/types.ts +0 -4
- rasa/core/constants.py +0 -4
- rasa/core/policies/enterprise_search_policy.py +2 -4
- rasa/core/policies/flow_policy.py +2 -2
- rasa/core/policies/flows/flow_executor.py +35 -374
- rasa/core/processor.py +1 -6
- rasa/core/run.py +1 -8
- rasa/core/utils.py +1 -21
- rasa/dialogue_understanding/commands/__init__.py +0 -8
- rasa/dialogue_understanding/commands/cancel_flow_command.py +4 -97
- rasa/dialogue_understanding/commands/chit_chat_answer_command.py +0 -11
- rasa/dialogue_understanding/commands/knowledge_answer_command.py +0 -11
- rasa/dialogue_understanding/commands/start_flow_command.py +8 -129
- rasa/dialogue_understanding/commands/utils.py +2 -6
- rasa/dialogue_understanding/generator/command_parser.py +0 -4
- rasa/dialogue_understanding/generator/llm_based_command_generator.py +12 -50
- rasa/dialogue_understanding/generator/single_step/compact_llm_command_generator.py +6 -7
- rasa/dialogue_understanding/generator/single_step/search_ready_llm_command_generator.py +6 -7
- rasa/dialogue_understanding/generator/single_step/single_step_based_llm_command_generator.py +2 -41
- rasa/dialogue_understanding/patterns/continue_interrupted.py +1 -163
- rasa/dialogue_understanding/patterns/default_flows_for_patterns.yml +7 -51
- rasa/dialogue_understanding/stack/dialogue_stack.py +2 -123
- rasa/dialogue_understanding/stack/frames/flow_stack_frame.py +0 -57
- rasa/dialogue_understanding/stack/utils.py +2 -3
- rasa/dialogue_understanding_test/du_test_runner.py +2 -7
- rasa/e2e_test/e2e_test_runner.py +0 -5
- rasa/server.py +0 -10
- rasa/shared/constants.py +0 -5
- rasa/shared/core/constants.py +1 -12
- rasa/shared/core/domain.py +5 -5
- rasa/shared/core/events.py +0 -319
- rasa/shared/core/flows/flows_list.py +2 -2
- rasa/shared/core/flows/flows_yaml_schema.json +186 -101
- rasa/shared/core/flows/steps/call.py +5 -51
- rasa/shared/core/flows/validation.py +7 -45
- rasa/shared/core/flows/yaml_flows_io.py +3 -3
- rasa/shared/providers/llm/_base_litellm_client.py +7 -39
- rasa/shared/providers/llm/litellm_router_llm_client.py +4 -8
- rasa/shared/providers/llm/llm_client.py +3 -7
- rasa/shared/providers/llm/llm_response.py +0 -49
- rasa/shared/providers/llm/self_hosted_llm_client.py +4 -8
- rasa/shared/utils/llm.py +5 -28
- rasa/shared/utils/schemas/events.py +0 -42
- rasa/studio/upload.py +7 -4
- rasa/tracing/instrumentation/instrumentation.py +2 -4
- rasa/utils/common.py +0 -53
- rasa/version.py +1 -1
- {rasa_pro-3.14.0.dev1.dist-info → rasa_pro-3.14.0.dev20250818.dist-info}/METADATA +2 -3
- {rasa_pro-3.14.0.dev1.dist-info → rasa_pro-3.14.0.dev20250818.dist-info}/RECORD +107 -143
- rasa/agents/__init__.py +0 -0
- rasa/agents/agent_factory.py +0 -122
- rasa/agents/agent_manager.py +0 -162
- rasa/agents/constants.py +0 -31
- rasa/agents/core/__init__.py +0 -0
- rasa/agents/core/agent_protocol.py +0 -108
- rasa/agents/core/types.py +0 -70
- rasa/agents/exceptions.py +0 -8
- rasa/agents/protocol/__init__.py +0 -5
- rasa/agents/protocol/a2a/__init__.py +0 -0
- rasa/agents/protocol/a2a/a2a_agent.py +0 -51
- rasa/agents/protocol/mcp/__init__.py +0 -0
- rasa/agents/protocol/mcp/mcp_base_agent.py +0 -697
- rasa/agents/protocol/mcp/mcp_open_agent.py +0 -275
- rasa/agents/protocol/mcp/mcp_task_agent.py +0 -447
- rasa/agents/schemas/__init__.py +0 -6
- rasa/agents/schemas/agent_input.py +0 -24
- rasa/agents/schemas/agent_output.py +0 -26
- rasa/agents/schemas/agent_tool_result.py +0 -51
- rasa/agents/schemas/agent_tool_schema.py +0 -112
- rasa/agents/templates/__init__.py +0 -0
- rasa/agents/templates/mcp_open_agent_prompt_template.jinja2 +0 -15
- rasa/agents/templates/mcp_task_agent_prompt_template.jinja2 +0 -13
- rasa/agents/utils.py +0 -72
- rasa/core/available_agents.py +0 -196
- rasa/core/channels/inspector/dist/assets/channel-c436ca7c.js +0 -1
- rasa/core/channels/inspector/dist/assets/clone-50dd656b.js +0 -1
- rasa/core/channels/inspector/dist/assets/flowDiagram-v2-96b9c2cf-2b2aeaf8.js +0 -1
- rasa/core/channels/inspector/dist/assets/index-1bd9135e.js +0 -1353
- rasa/core/policies/flows/mcp_tool_executor.py +0 -240
- rasa/dialogue_understanding/commands/continue_agent_command.py +0 -91
- rasa/dialogue_understanding/commands/restart_agent_command.py +0 -146
- rasa/dialogue_understanding/generator/prompt_templates/agent_command_prompt_v2_claude_3_5_sonnet_20240620_template.jinja2 +0 -61
- rasa/dialogue_understanding/generator/prompt_templates/agent_command_prompt_v2_gpt_4o_2024_11_20_template.jinja2 +0 -61
- rasa/dialogue_understanding/generator/prompt_templates/agent_command_prompt_v3_claude_3_5_sonnet_20240620_template.jinja2 +0 -81
- rasa/dialogue_understanding/generator/prompt_templates/agent_command_prompt_v3_gpt_4o_2024_11_20_template.jinja2 +0 -81
- rasa/shared/agents/__init__.py +0 -0
- rasa/shared/agents/utils.py +0 -35
- rasa/shared/utils/mcp/__init__.py +0 -0
- rasa/shared/utils/mcp/server_connection.py +0 -157
- {rasa_pro-3.14.0.dev1.dist-info → rasa_pro-3.14.0.dev20250818.dist-info}/NOTICE +0 -0
- {rasa_pro-3.14.0.dev1.dist-info → rasa_pro-3.14.0.dev20250818.dist-info}/WHEEL +0 -0
- {rasa_pro-3.14.0.dev1.dist-info → rasa_pro-3.14.0.dev20250818.dist-info}/entry_points.txt +0 -0
rasa/core/processor.py
CHANGED
|
@@ -69,7 +69,6 @@ from rasa.shared.constants import (
|
|
|
69
69
|
UTTER_PREFIX,
|
|
70
70
|
)
|
|
71
71
|
from rasa.shared.core.constants import (
|
|
72
|
-
ACTION_AGENT_REQUEST_USER_INPUT_NAME,
|
|
73
72
|
ACTION_CORRECT_FLOW_SLOT,
|
|
74
73
|
ACTION_EXTRACT_SLOTS,
|
|
75
74
|
ACTION_LISTEN_NAME,
|
|
@@ -1195,11 +1194,7 @@ class MessageProcessor:
|
|
|
1195
1194
|
`False` if `action_name` is `ACTION_LISTEN_NAME` or
|
|
1196
1195
|
`ACTION_SESSION_START_NAME`, otherwise `True`.
|
|
1197
1196
|
"""
|
|
1198
|
-
return action_name not in (
|
|
1199
|
-
ACTION_LISTEN_NAME,
|
|
1200
|
-
ACTION_SESSION_START_NAME,
|
|
1201
|
-
ACTION_AGENT_REQUEST_USER_INPUT_NAME,
|
|
1202
|
-
)
|
|
1197
|
+
return action_name not in (ACTION_LISTEN_NAME, ACTION_SESSION_START_NAME)
|
|
1203
1198
|
|
|
1204
1199
|
async def execute_side_effects(
|
|
1205
1200
|
self,
|
rasa/core/run.py
CHANGED
|
@@ -30,7 +30,6 @@ from rasa import server, telemetry
|
|
|
30
30
|
from rasa.constants import ENV_SANIC_BACKLOG
|
|
31
31
|
from rasa.core import agent, channels, constants
|
|
32
32
|
from rasa.core.agent import Agent
|
|
33
|
-
from rasa.core.available_agents import AvailableAgents
|
|
34
33
|
from rasa.core.available_endpoints import AvailableEndpoints
|
|
35
34
|
from rasa.core.channels import console
|
|
36
35
|
from rasa.core.channels.channel import InputChannel
|
|
@@ -142,7 +141,6 @@ def configure_app(
|
|
|
142
141
|
route: Optional[Text] = "/webhooks/",
|
|
143
142
|
port: int = constants.DEFAULT_SERVER_PORT,
|
|
144
143
|
endpoints: Optional[AvailableEndpoints] = None,
|
|
145
|
-
sub_agents: Optional[AvailableAgents] = None,
|
|
146
144
|
log_file: Optional[Text] = None,
|
|
147
145
|
conversation_id: Optional[Text] = uuid.uuid4().hex,
|
|
148
146
|
use_syslog: bool = False,
|
|
@@ -171,7 +169,6 @@ def configure_app(
|
|
|
171
169
|
jwt_private_key=jwt_private_key,
|
|
172
170
|
jwt_method=jwt_method,
|
|
173
171
|
endpoints=endpoints,
|
|
174
|
-
sub_agents=sub_agents,
|
|
175
172
|
is_inspector_enabled=is_inspector_enabled,
|
|
176
173
|
)
|
|
177
174
|
)
|
|
@@ -236,7 +233,6 @@ def serve_application(
|
|
|
236
233
|
jwt_private_key: Optional[Text] = None,
|
|
237
234
|
jwt_method: Optional[Text] = None,
|
|
238
235
|
endpoints: Optional[AvailableEndpoints] = None,
|
|
239
|
-
sub_agents: Optional[AvailableAgents] = None,
|
|
240
236
|
remote_storage: Optional[StorageType] = None,
|
|
241
237
|
log_file: Optional[Text] = None,
|
|
242
238
|
ssl_certificate: Optional[Text] = None,
|
|
@@ -277,7 +273,6 @@ def serve_application(
|
|
|
277
273
|
jwt_method,
|
|
278
274
|
port=port,
|
|
279
275
|
endpoints=endpoints,
|
|
280
|
-
sub_agents=sub_agents,
|
|
281
276
|
log_file=log_file,
|
|
282
277
|
conversation_id=conversation_id,
|
|
283
278
|
use_syslog=use_syslog,
|
|
@@ -297,7 +292,7 @@ def serve_application(
|
|
|
297
292
|
logger.info(f"Starting Rasa server on {protocol}://{interface}:{port}")
|
|
298
293
|
|
|
299
294
|
app.register_listener(
|
|
300
|
-
partial(load_agent_on_start, model_path, endpoints, remote_storage
|
|
295
|
+
partial(load_agent_on_start, model_path, endpoints, remote_storage),
|
|
301
296
|
"before_server_start",
|
|
302
297
|
)
|
|
303
298
|
|
|
@@ -335,7 +330,6 @@ async def load_agent_on_start(
|
|
|
335
330
|
model_path: Text,
|
|
336
331
|
endpoints: AvailableEndpoints,
|
|
337
332
|
remote_storage: Optional[StorageType],
|
|
338
|
-
sub_agents: Optional[AvailableAgents],
|
|
339
333
|
app: Sanic,
|
|
340
334
|
loop: AbstractEventLoop,
|
|
341
335
|
) -> Agent:
|
|
@@ -348,7 +342,6 @@ async def load_agent_on_start(
|
|
|
348
342
|
model_path=model_path,
|
|
349
343
|
remote_storage=remote_storage,
|
|
350
344
|
endpoints=endpoints,
|
|
351
|
-
sub_agents=sub_agents,
|
|
352
345
|
loop=loop,
|
|
353
346
|
)
|
|
354
347
|
|
rasa/core/utils.py
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
import os
|
|
3
|
-
import re
|
|
4
3
|
from pathlib import Path
|
|
5
4
|
from socket import SOCK_DGRAM, SOCK_STREAM
|
|
6
|
-
from typing import TYPE_CHECKING, Any, Dict,
|
|
5
|
+
from typing import TYPE_CHECKING, Any, Dict, Optional, Set, Text, Tuple, Union
|
|
7
6
|
|
|
8
7
|
import numpy as np
|
|
9
8
|
import structlog
|
|
@@ -360,22 +359,3 @@ def should_force_slot_filling(
|
|
|
360
359
|
return True, slot_name
|
|
361
360
|
|
|
362
361
|
return False, None
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
def get_slot_names_from_exit_conditions(exit_conditions: List[str]) -> List[str]:
|
|
366
|
-
"""Extract slot names from exit conditions.
|
|
367
|
-
|
|
368
|
-
Args:
|
|
369
|
-
exit_conditions: The exit conditions to extract slot names from.
|
|
370
|
-
|
|
371
|
-
Returns:
|
|
372
|
-
A list of slot names.
|
|
373
|
-
"""
|
|
374
|
-
# Find all unique names matching "slots.<name>"
|
|
375
|
-
return list(
|
|
376
|
-
{
|
|
377
|
-
name
|
|
378
|
-
for condition in exit_conditions
|
|
379
|
-
for name in re.findall(r"\bslots\.(\w+)", condition)
|
|
380
|
-
}
|
|
381
|
-
)
|
|
@@ -8,9 +8,6 @@ from rasa.dialogue_understanding.commands.chit_chat_answer_command import (
|
|
|
8
8
|
)
|
|
9
9
|
from rasa.dialogue_understanding.commands.clarify_command import ClarifyCommand
|
|
10
10
|
from rasa.dialogue_understanding.commands.command import Command
|
|
11
|
-
from rasa.dialogue_understanding.commands.continue_agent_command import (
|
|
12
|
-
ContinueAgentCommand,
|
|
13
|
-
)
|
|
14
11
|
from rasa.dialogue_understanding.commands.correct_slots_command import (
|
|
15
12
|
CorrectedSlot,
|
|
16
13
|
CorrectSlotsCommand,
|
|
@@ -32,9 +29,6 @@ from rasa.dialogue_understanding.commands.noop_command import NoopCommand
|
|
|
32
29
|
from rasa.dialogue_understanding.commands.repeat_bot_messages_command import (
|
|
33
30
|
RepeatBotMessagesCommand,
|
|
34
31
|
)
|
|
35
|
-
from rasa.dialogue_understanding.commands.restart_agent_command import (
|
|
36
|
-
RestartAgentCommand,
|
|
37
|
-
)
|
|
38
32
|
from rasa.dialogue_understanding.commands.restart_command import RestartCommand
|
|
39
33
|
from rasa.dialogue_understanding.commands.session_end_command import SessionEndCommand
|
|
40
34
|
from rasa.dialogue_understanding.commands.session_start_command import (
|
|
@@ -68,6 +62,4 @@ __all__ = [
|
|
|
68
62
|
"SessionEndCommand",
|
|
69
63
|
"RepeatBotMessagesCommand",
|
|
70
64
|
"RestartCommand",
|
|
71
|
-
"ContinueAgentCommand",
|
|
72
|
-
"RestartAgentCommand",
|
|
73
65
|
]
|
|
@@ -2,13 +2,10 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
import re
|
|
4
4
|
from dataclasses import dataclass
|
|
5
|
-
from typing import Any, Dict, List
|
|
5
|
+
from typing import Any, Dict, List
|
|
6
6
|
|
|
7
7
|
import structlog
|
|
8
8
|
|
|
9
|
-
from rasa.core.policies.flows.flow_executor import (
|
|
10
|
-
remove_agent_stack_frame,
|
|
11
|
-
)
|
|
12
9
|
from rasa.dialogue_understanding.commands.command import Command
|
|
13
10
|
from rasa.dialogue_understanding.commands.command_syntax_manager import (
|
|
14
11
|
CommandSyntaxManager,
|
|
@@ -16,13 +13,12 @@ from rasa.dialogue_understanding.commands.command_syntax_manager import (
|
|
|
16
13
|
)
|
|
17
14
|
from rasa.dialogue_understanding.patterns.cancel import CancelPatternFlowStackFrame
|
|
18
15
|
from rasa.dialogue_understanding.stack.dialogue_stack import DialogueStack
|
|
19
|
-
from rasa.dialogue_understanding.stack.frames import DialogueStackFrame
|
|
20
16
|
from rasa.dialogue_understanding.stack.frames.flow_stack_frame import (
|
|
21
17
|
FlowStackFrameType,
|
|
22
18
|
UserFlowStackFrame,
|
|
23
19
|
)
|
|
24
20
|
from rasa.dialogue_understanding.stack.utils import top_user_flow_frame
|
|
25
|
-
from rasa.shared.core.events import
|
|
21
|
+
from rasa.shared.core.events import Event, FlowCancelled
|
|
26
22
|
from rasa.shared.core.flows import FlowsList
|
|
27
23
|
from rasa.shared.core.trackers import DialogueStateTracker
|
|
28
24
|
|
|
@@ -52,7 +48,8 @@ class CancelFlowCommand(Command):
|
|
|
52
48
|
"""Selects the frames that were canceled.
|
|
53
49
|
|
|
54
50
|
Args:
|
|
55
|
-
|
|
51
|
+
dialogue_stack: The dialogue stack.
|
|
52
|
+
current_flow: The current flow.
|
|
56
53
|
|
|
57
54
|
Returns:
|
|
58
55
|
The frames that were canceled.
|
|
@@ -109,19 +106,6 @@ class CancelFlowCommand(Command):
|
|
|
109
106
|
)
|
|
110
107
|
return []
|
|
111
108
|
|
|
112
|
-
if agent_frame := original_tracker.stack.find_active_agent_stack_frame_for_flow(
|
|
113
|
-
current_flow.id
|
|
114
|
-
):
|
|
115
|
-
structlogger.debug(
|
|
116
|
-
"cancel_command.remove_agent_stack_frame",
|
|
117
|
-
command=self,
|
|
118
|
-
frame=agent_frame,
|
|
119
|
-
)
|
|
120
|
-
remove_agent_stack_frame(stack, agent_frame.agent_id)
|
|
121
|
-
applied_events.append(
|
|
122
|
-
AgentCancelled(agent_id=agent_frame.agent_id, flow_id=current_flow.id)
|
|
123
|
-
)
|
|
124
|
-
|
|
125
109
|
# we pass in the original dialogue stack (before any of the currently
|
|
126
110
|
# predicted commands were applied) to make sure we don't cancel any
|
|
127
111
|
# frames that were added by the currently predicted commands.
|
|
@@ -175,80 +159,3 @@ class CancelFlowCommand(Command):
|
|
|
175
159
|
CommandSyntaxManager.get_syntax_version(),
|
|
176
160
|
mapper[CommandSyntaxManager.get_default_syntax_version()],
|
|
177
161
|
)
|
|
178
|
-
|
|
179
|
-
def cancel_flow(
|
|
180
|
-
self,
|
|
181
|
-
tracker: DialogueStateTracker,
|
|
182
|
-
stack: DialogueStack,
|
|
183
|
-
flow_id: str,
|
|
184
|
-
) -> List[Event]:
|
|
185
|
-
"""Cancels a flow by flow id."""
|
|
186
|
-
applied_events: List[Event] = []
|
|
187
|
-
|
|
188
|
-
frames_to_cancel, user_frame_to_cancel = self._collect_frames_to_cancel(
|
|
189
|
-
stack, flow_id
|
|
190
|
-
)
|
|
191
|
-
|
|
192
|
-
# if the flow is not on the stack, do nothing
|
|
193
|
-
if user_frame_to_cancel is None:
|
|
194
|
-
structlogger.error(
|
|
195
|
-
"cancel_flow_command.cancel_flow.no_user_frame_to_cancel",
|
|
196
|
-
command=self,
|
|
197
|
-
)
|
|
198
|
-
return []
|
|
199
|
-
|
|
200
|
-
frames_ids_to_cancel = [frame.frame_id for frame in frames_to_cancel]
|
|
201
|
-
|
|
202
|
-
stack.push(
|
|
203
|
-
CancelPatternFlowStackFrame(
|
|
204
|
-
canceled_name=flow_id,
|
|
205
|
-
canceled_frames=frames_ids_to_cancel,
|
|
206
|
-
)
|
|
207
|
-
)
|
|
208
|
-
|
|
209
|
-
# create flow cancelled event
|
|
210
|
-
applied_events.extend(
|
|
211
|
-
[
|
|
212
|
-
FlowCancelled(
|
|
213
|
-
user_frame_to_cancel.flow_id, user_frame_to_cancel.step_id
|
|
214
|
-
),
|
|
215
|
-
]
|
|
216
|
-
)
|
|
217
|
-
|
|
218
|
-
update_stack_events = tracker.create_stack_updated_events(stack)
|
|
219
|
-
|
|
220
|
-
return applied_events + update_stack_events
|
|
221
|
-
|
|
222
|
-
def _collect_frames_to_cancel(
|
|
223
|
-
self, stack: DialogueStack, target_flow_id: str
|
|
224
|
-
) -> Tuple[List[DialogueStackFrame], Optional[UserFlowStackFrame]]:
|
|
225
|
-
"""Collect frames that need to be cancelled.
|
|
226
|
-
|
|
227
|
-
Args:
|
|
228
|
-
stack: The stack to collect frames from.
|
|
229
|
-
target_flow_id: The ID of the flow to cancel.
|
|
230
|
-
|
|
231
|
-
Returns:
|
|
232
|
-
A tuple containing (frames_to_cancel, frame_to_cancel).
|
|
233
|
-
"""
|
|
234
|
-
frames_to_cancel: List[DialogueStackFrame] = []
|
|
235
|
-
frame_found = False
|
|
236
|
-
frame_to_cancel = None
|
|
237
|
-
|
|
238
|
-
for frame in stack.frames:
|
|
239
|
-
if isinstance(frame, UserFlowStackFrame) and (
|
|
240
|
-
frame.frame_type == FlowStackFrameType.REGULAR
|
|
241
|
-
or frame.frame_type == FlowStackFrameType.INTERRUPT
|
|
242
|
-
):
|
|
243
|
-
if frame.flow_id == target_flow_id:
|
|
244
|
-
frames_to_cancel.append(frame)
|
|
245
|
-
frame_to_cancel = frame
|
|
246
|
-
frame_found = True
|
|
247
|
-
continue
|
|
248
|
-
elif frame_found:
|
|
249
|
-
break
|
|
250
|
-
|
|
251
|
-
if frame_found:
|
|
252
|
-
frames_to_cancel.append(frame)
|
|
253
|
-
|
|
254
|
-
return list(frames_to_cancel), frame_to_cancel
|
|
@@ -12,10 +12,6 @@ from rasa.dialogue_understanding.commands.free_form_answer_command import (
|
|
|
12
12
|
FreeFormAnswerCommand,
|
|
13
13
|
)
|
|
14
14
|
from rasa.dialogue_understanding.patterns.chitchat import ChitchatPatternFlowStackFrame
|
|
15
|
-
from rasa.dialogue_understanding.stack.frames.flow_stack_frame import (
|
|
16
|
-
AgentStackFrame,
|
|
17
|
-
AgentState,
|
|
18
|
-
)
|
|
19
15
|
from rasa.shared.core.events import Event
|
|
20
16
|
from rasa.shared.core.flows import FlowsList
|
|
21
17
|
from rasa.shared.core.trackers import DialogueStateTracker
|
|
@@ -56,13 +52,6 @@ class ChitChatAnswerCommand(FreeFormAnswerCommand):
|
|
|
56
52
|
The events to apply to the tracker.
|
|
57
53
|
"""
|
|
58
54
|
stack = tracker.stack
|
|
59
|
-
|
|
60
|
-
# if the top stack frame is an agent stack frame, we need to
|
|
61
|
-
# update the state to INTERRUPTED
|
|
62
|
-
if top_stack_frame := stack.top():
|
|
63
|
-
if isinstance(top_stack_frame, AgentStackFrame):
|
|
64
|
-
top_stack_frame.state = AgentState.INTERRUPTED
|
|
65
|
-
|
|
66
55
|
stack.push(ChitchatPatternFlowStackFrame())
|
|
67
56
|
return tracker.create_stack_updated_events(stack)
|
|
68
57
|
|
|
@@ -12,10 +12,6 @@ from rasa.dialogue_understanding.commands.free_form_answer_command import (
|
|
|
12
12
|
FreeFormAnswerCommand,
|
|
13
13
|
)
|
|
14
14
|
from rasa.dialogue_understanding.patterns.search import SearchPatternFlowStackFrame
|
|
15
|
-
from rasa.dialogue_understanding.stack.frames.flow_stack_frame import (
|
|
16
|
-
AgentStackFrame,
|
|
17
|
-
AgentState,
|
|
18
|
-
)
|
|
19
15
|
from rasa.shared.core.events import Event
|
|
20
16
|
from rasa.shared.core.flows import FlowsList
|
|
21
17
|
from rasa.shared.core.trackers import DialogueStateTracker
|
|
@@ -56,13 +52,6 @@ class KnowledgeAnswerCommand(FreeFormAnswerCommand):
|
|
|
56
52
|
The events to apply to the tracker.
|
|
57
53
|
"""
|
|
58
54
|
stack = tracker.stack
|
|
59
|
-
|
|
60
|
-
# if the top stack frame is an agent stack frame, we need to
|
|
61
|
-
# update the state to INTERRUPTED
|
|
62
|
-
if top_stack_frame := stack.top():
|
|
63
|
-
if isinstance(top_stack_frame, AgentStackFrame):
|
|
64
|
-
top_stack_frame.state = AgentState.INTERRUPTED
|
|
65
|
-
|
|
66
55
|
stack.push(SearchPatternFlowStackFrame())
|
|
67
56
|
return tracker.create_stack_updated_events(stack)
|
|
68
57
|
|
|
@@ -2,7 +2,7 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
import re
|
|
4
4
|
from dataclasses import dataclass
|
|
5
|
-
from typing import Any, Dict, List, Optional
|
|
5
|
+
from typing import Any, Dict, List, Optional
|
|
6
6
|
|
|
7
7
|
import structlog
|
|
8
8
|
|
|
@@ -11,13 +11,7 @@ from rasa.dialogue_understanding.commands.command_syntax_manager import (
|
|
|
11
11
|
CommandSyntaxManager,
|
|
12
12
|
CommandSyntaxVersion,
|
|
13
13
|
)
|
|
14
|
-
from rasa.dialogue_understanding.stack.dialogue_stack import DialogueStack
|
|
15
|
-
from rasa.dialogue_understanding.stack.frames.dialogue_stack_frame import (
|
|
16
|
-
DialogueStackFrame,
|
|
17
|
-
)
|
|
18
14
|
from rasa.dialogue_understanding.stack.frames.flow_stack_frame import (
|
|
19
|
-
AgentStackFrame,
|
|
20
|
-
AgentState,
|
|
21
15
|
FlowStackFrameType,
|
|
22
16
|
UserFlowStackFrame,
|
|
23
17
|
)
|
|
@@ -25,13 +19,7 @@ from rasa.dialogue_understanding.stack.utils import (
|
|
|
25
19
|
top_user_flow_frame,
|
|
26
20
|
user_flows_on_the_stack,
|
|
27
21
|
)
|
|
28
|
-
from rasa.shared.core.events import
|
|
29
|
-
AgentInterrupted,
|
|
30
|
-
AgentResumed,
|
|
31
|
-
Event,
|
|
32
|
-
FlowInterrupted,
|
|
33
|
-
FlowResumed,
|
|
34
|
-
)
|
|
22
|
+
from rasa.shared.core.events import Event, FlowInterrupted
|
|
35
23
|
from rasa.shared.core.flows import FlowsList
|
|
36
24
|
from rasa.shared.core.trackers import DialogueStateTracker
|
|
37
25
|
|
|
@@ -83,7 +71,12 @@ class StartFlowCommand(Command):
|
|
|
83
71
|
original_stack = original_tracker.stack
|
|
84
72
|
applied_events: List[Event] = []
|
|
85
73
|
|
|
86
|
-
if self.flow
|
|
74
|
+
if self.flow in user_flows_on_the_stack(stack):
|
|
75
|
+
structlogger.debug(
|
|
76
|
+
"start_flow_command.skip_command.already_started_flow", command=self
|
|
77
|
+
)
|
|
78
|
+
return []
|
|
79
|
+
elif self.flow not in all_flows.flow_ids:
|
|
87
80
|
structlogger.debug(
|
|
88
81
|
"start_flow_command.skip_command.start_invalid_flow_id", command=self
|
|
89
82
|
)
|
|
@@ -94,23 +87,9 @@ class StartFlowCommand(Command):
|
|
|
94
87
|
original_user_frame.flow(all_flows) if original_user_frame else None
|
|
95
88
|
)
|
|
96
89
|
|
|
97
|
-
# if the original top flow is the same as the flow to start, the flow is
|
|
98
|
-
# already active, do nothing
|
|
99
|
-
if original_top_flow is not None and original_top_flow.id == self.flow:
|
|
100
|
-
return []
|
|
101
|
-
|
|
102
|
-
# if the flow is already on the stack, resume it
|
|
103
|
-
if (
|
|
104
|
-
self.flow in user_flows_on_the_stack(stack)
|
|
105
|
-
and original_user_frame is not None
|
|
106
|
-
):
|
|
107
|
-
return self.resume_flow(tracker, stack, original_user_frame)
|
|
108
|
-
|
|
109
90
|
frame_type = FlowStackFrameType.REGULAR
|
|
110
91
|
|
|
111
92
|
if original_top_flow:
|
|
112
|
-
# if the original top flow is not the same as the flow to start,
|
|
113
|
-
# interrupt the current active flow
|
|
114
93
|
frame_type = FlowStackFrameType.INTERRUPT
|
|
115
94
|
|
|
116
95
|
if original_user_frame is not None:
|
|
@@ -120,24 +99,6 @@ class StartFlowCommand(Command):
|
|
|
120
99
|
)
|
|
121
100
|
)
|
|
122
101
|
|
|
123
|
-
# If there is an active agent frame, interrupt it
|
|
124
|
-
active_agent_stack_frame = stack.find_active_agent_frame()
|
|
125
|
-
if active_agent_stack_frame:
|
|
126
|
-
structlogger.debug(
|
|
127
|
-
"start_flow_command.interrupt_agent",
|
|
128
|
-
command=self,
|
|
129
|
-
agent_id=active_agent_stack_frame.agent_id,
|
|
130
|
-
frame_id=active_agent_stack_frame.frame_id,
|
|
131
|
-
flow_id=active_agent_stack_frame.flow_id,
|
|
132
|
-
)
|
|
133
|
-
active_agent_stack_frame.state = AgentState.INTERRUPTED
|
|
134
|
-
applied_events.append(
|
|
135
|
-
AgentInterrupted(
|
|
136
|
-
active_agent_stack_frame.agent_id,
|
|
137
|
-
active_agent_stack_frame.flow_id,
|
|
138
|
-
)
|
|
139
|
-
)
|
|
140
|
-
|
|
141
102
|
structlogger.debug("start_flow_command.start_flow", command=self)
|
|
142
103
|
stack.push(UserFlowStackFrame(flow_id=self.flow, frame_type=frame_type))
|
|
143
104
|
return applied_events + tracker.create_stack_updated_events(stack)
|
|
@@ -183,85 +144,3 @@ class StartFlowCommand(Command):
|
|
|
183
144
|
CommandSyntaxManager.get_syntax_version(),
|
|
184
145
|
mapper[CommandSyntaxManager.get_default_syntax_version()],
|
|
185
146
|
)
|
|
186
|
-
|
|
187
|
-
def resume_flow(
|
|
188
|
-
self,
|
|
189
|
-
tracker: DialogueStateTracker,
|
|
190
|
-
stack: DialogueStack,
|
|
191
|
-
original_user_frame: UserFlowStackFrame,
|
|
192
|
-
) -> List[Event]:
|
|
193
|
-
"""Resumes a flow by reordering frames."""
|
|
194
|
-
applied_events: List[Event] = []
|
|
195
|
-
|
|
196
|
-
# Resume existing flow by reordering frames
|
|
197
|
-
frames_to_resume, user_frame_to_resume = self._collect_frames_to_resume(
|
|
198
|
-
stack, self.flow
|
|
199
|
-
)
|
|
200
|
-
|
|
201
|
-
# if the flow is not on the stack, do nothing
|
|
202
|
-
# this should not happen, but just in case
|
|
203
|
-
if user_frame_to_resume is None:
|
|
204
|
-
structlogger.error(
|
|
205
|
-
"start_flow_command.resume_flow.no_user_frame_to_resume",
|
|
206
|
-
command=self,
|
|
207
|
-
)
|
|
208
|
-
return []
|
|
209
|
-
|
|
210
|
-
# move the frames to the top of the stack, e.g. reorder the frames
|
|
211
|
-
# on the stack
|
|
212
|
-
stack.move_frames_to_top(frames_to_resume)
|
|
213
|
-
agent_stack_frame = next(
|
|
214
|
-
(frame for frame in frames_to_resume if isinstance(frame, AgentStackFrame)),
|
|
215
|
-
None,
|
|
216
|
-
)
|
|
217
|
-
if agent_stack_frame:
|
|
218
|
-
agent_id = agent_stack_frame.agent_id
|
|
219
|
-
applied_events.append(AgentResumed(agent_id, agent_stack_frame.flow_id))
|
|
220
|
-
|
|
221
|
-
# Create flow interruption and resumption events
|
|
222
|
-
applied_events.extend(
|
|
223
|
-
[
|
|
224
|
-
# the current active flow is interrupted
|
|
225
|
-
FlowInterrupted(
|
|
226
|
-
original_user_frame.flow_id, original_user_frame.step_id
|
|
227
|
-
),
|
|
228
|
-
# the flow, which was on the stack, is resumed
|
|
229
|
-
FlowResumed(user_frame_to_resume.flow_id, user_frame_to_resume.step_id),
|
|
230
|
-
]
|
|
231
|
-
)
|
|
232
|
-
|
|
233
|
-
return applied_events + tracker.create_stack_updated_events(stack)
|
|
234
|
-
|
|
235
|
-
def _collect_frames_to_resume(
|
|
236
|
-
self, stack: DialogueStack, target_flow_id: str
|
|
237
|
-
) -> Tuple[List[DialogueStackFrame], Optional[UserFlowStackFrame]]:
|
|
238
|
-
"""Collect frames that need to be resumed for the target flow.
|
|
239
|
-
|
|
240
|
-
Args:
|
|
241
|
-
stack: The stack to collect frames from.
|
|
242
|
-
target_flow_id: The ID of the flow to resume.
|
|
243
|
-
|
|
244
|
-
Returns:
|
|
245
|
-
A tuple containing (frames_to_resume, frame_to_resume).
|
|
246
|
-
"""
|
|
247
|
-
frames_to_resume: List[DialogueStackFrame] = []
|
|
248
|
-
frame_found = False
|
|
249
|
-
frame_to_resume = None
|
|
250
|
-
|
|
251
|
-
for frame in stack.frames:
|
|
252
|
-
if isinstance(frame, UserFlowStackFrame) and (
|
|
253
|
-
frame.frame_type == FlowStackFrameType.REGULAR
|
|
254
|
-
or frame.frame_type == FlowStackFrameType.INTERRUPT
|
|
255
|
-
):
|
|
256
|
-
if frame.flow_id == target_flow_id:
|
|
257
|
-
frames_to_resume.append(frame)
|
|
258
|
-
frame_to_resume = frame
|
|
259
|
-
frame_found = True
|
|
260
|
-
continue
|
|
261
|
-
elif frame_found:
|
|
262
|
-
break
|
|
263
|
-
|
|
264
|
-
if frame_found:
|
|
265
|
-
frames_to_resume.append(frame)
|
|
266
|
-
|
|
267
|
-
return list(frames_to_resume), frame_to_resume
|
|
@@ -6,10 +6,7 @@ from rasa.dialogue_understanding.patterns.validate_slot import (
|
|
|
6
6
|
ValidateSlotPatternFlowStackFrame,
|
|
7
7
|
)
|
|
8
8
|
from rasa.shared.constants import ACTION_ASK_PREFIX, UTTER_ASK_PREFIX
|
|
9
|
-
from rasa.shared.core.events import
|
|
10
|
-
Event,
|
|
11
|
-
SlotSet,
|
|
12
|
-
)
|
|
9
|
+
from rasa.shared.core.events import Event, SlotSet
|
|
13
10
|
from rasa.shared.core.flows import FlowsList
|
|
14
11
|
from rasa.shared.core.slots import Slot
|
|
15
12
|
from rasa.shared.core.trackers import DialogueStateTracker
|
|
@@ -106,8 +103,7 @@ def create_validate_frames_from_slot_set_events(
|
|
|
106
103
|
Args:
|
|
107
104
|
tracker: The dialogue state tracker.
|
|
108
105
|
events: List of events to process.
|
|
109
|
-
|
|
110
|
-
should_break: whether to break after the first non-SlotSet event.
|
|
106
|
+
should_break: whether or not to break after the first non-SlotSet event.
|
|
111
107
|
if True, break out of the event loop as soon as the first non-SlotSet
|
|
112
108
|
event is encountered.
|
|
113
109
|
if False, continue processing the events until the end.
|
|
@@ -9,11 +9,9 @@ from rasa.dialogue_understanding.commands import (
|
|
|
9
9
|
ChitChatAnswerCommand,
|
|
10
10
|
ClarifyCommand,
|
|
11
11
|
Command,
|
|
12
|
-
ContinueAgentCommand,
|
|
13
12
|
HumanHandoffCommand,
|
|
14
13
|
KnowledgeAnswerCommand,
|
|
15
14
|
RepeatBotMessagesCommand,
|
|
16
|
-
RestartAgentCommand,
|
|
17
15
|
SetSlotCommand,
|
|
18
16
|
SkipQuestionCommand,
|
|
19
17
|
StartFlowCommand,
|
|
@@ -36,8 +34,6 @@ DEFAULT_COMMANDS = [
|
|
|
36
34
|
HumanHandoffCommand,
|
|
37
35
|
ClarifyCommand,
|
|
38
36
|
RepeatBotMessagesCommand,
|
|
39
|
-
ContinueAgentCommand,
|
|
40
|
-
RestartAgentCommand,
|
|
41
37
|
]
|
|
42
38
|
|
|
43
39
|
|
|
@@ -7,7 +7,6 @@ from jinja2 import Environment, Template, select_autoescape
|
|
|
7
7
|
|
|
8
8
|
import rasa.dialogue_understanding.generator.utils
|
|
9
9
|
import rasa.shared.utils.io
|
|
10
|
-
from rasa.core.available_agents import AvailableAgents
|
|
11
10
|
from rasa.dialogue_understanding.commands import (
|
|
12
11
|
Command,
|
|
13
12
|
SetSlotCommand,
|
|
@@ -32,7 +31,6 @@ from rasa.engine.storage.resource import Resource
|
|
|
32
31
|
from rasa.engine.storage.storage import ModelStorage
|
|
33
32
|
from rasa.shared.core.constants import SetSlotExtractor
|
|
34
33
|
from rasa.shared.core.domain import Domain
|
|
35
|
-
from rasa.shared.core.events import AgentStarted
|
|
36
34
|
from rasa.shared.core.flows import Flow, FlowsList, FlowStep
|
|
37
35
|
from rasa.shared.core.flows.steps.collect import CollectInformationFlowStep
|
|
38
36
|
from rasa.shared.core.slot_mappings import SlotFillingManager
|
|
@@ -227,7 +225,8 @@ class LLMBasedCommandGenerator(
|
|
|
227
225
|
|
|
228
226
|
@lru_cache
|
|
229
227
|
def compile_template(self, template: str) -> Template:
|
|
230
|
-
"""
|
|
228
|
+
"""
|
|
229
|
+
Compile the prompt template and register custom filters.
|
|
231
230
|
|
|
232
231
|
Compiling the template is an expensive operation,
|
|
233
232
|
so we cache the result.
|
|
@@ -362,24 +361,20 @@ class LLMBasedCommandGenerator(
|
|
|
362
361
|
)
|
|
363
362
|
|
|
364
363
|
def prepare_flows_for_template(
|
|
365
|
-
self,
|
|
366
|
-
flows: FlowsList,
|
|
367
|
-
tracker: DialogueStateTracker,
|
|
368
|
-
add_agent_info: bool = False,
|
|
364
|
+
self, flows: FlowsList, tracker: DialogueStateTracker
|
|
369
365
|
) -> List[Dict[str, Any]]:
|
|
370
366
|
"""Format data on available flows for insertion into the prompt template.
|
|
371
367
|
|
|
372
368
|
Args:
|
|
373
369
|
flows: The flows available to the user.
|
|
374
370
|
tracker: The tracker containing the current state of the conversation.
|
|
375
|
-
add_agent_info: Whether to add agent info to flows or not.
|
|
376
371
|
|
|
377
372
|
Returns:
|
|
378
373
|
The inputs for the prompt template.
|
|
379
374
|
"""
|
|
380
|
-
result
|
|
375
|
+
result = []
|
|
381
376
|
for flow in flows.user_flows:
|
|
382
|
-
slots_with_info
|
|
377
|
+
slots_with_info = [
|
|
383
378
|
{
|
|
384
379
|
"name": q.collect,
|
|
385
380
|
"description": q.description,
|
|
@@ -388,46 +383,13 @@ class LLMBasedCommandGenerator(
|
|
|
388
383
|
for q in flow.get_collect_steps()
|
|
389
384
|
if self.is_extractable(q, tracker)
|
|
390
385
|
]
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
if isinstance(event, AgentStarted) and event.flow_id == flow.id
|
|
399
|
-
]
|
|
400
|
-
available_agents = [
|
|
401
|
-
AvailableAgents.get_agent_config(event.agent_id)
|
|
402
|
-
for event in agent_events
|
|
403
|
-
]
|
|
404
|
-
if available_agents:
|
|
405
|
-
agent_info = [
|
|
406
|
-
{
|
|
407
|
-
"name": available_agent.agent.name,
|
|
408
|
-
"description": available_agent.agent.description,
|
|
409
|
-
}
|
|
410
|
-
for available_agent in available_agents
|
|
411
|
-
if available_agent is not None
|
|
412
|
-
]
|
|
413
|
-
|
|
414
|
-
if agent_info:
|
|
415
|
-
result.append(
|
|
416
|
-
{
|
|
417
|
-
"name": flow.id,
|
|
418
|
-
"description": flow.description,
|
|
419
|
-
"slots": slots_with_info,
|
|
420
|
-
"agent_info": agent_info,
|
|
421
|
-
}
|
|
422
|
-
)
|
|
423
|
-
else:
|
|
424
|
-
result.append(
|
|
425
|
-
{
|
|
426
|
-
"name": flow.id,
|
|
427
|
-
"description": flow.description,
|
|
428
|
-
"slots": slots_with_info,
|
|
429
|
-
}
|
|
430
|
-
)
|
|
386
|
+
result.append(
|
|
387
|
+
{
|
|
388
|
+
"name": flow.id,
|
|
389
|
+
"description": flow.description,
|
|
390
|
+
"slots": slots_with_info,
|
|
391
|
+
}
|
|
392
|
+
)
|
|
431
393
|
return result
|
|
432
394
|
|
|
433
395
|
@staticmethod
|