rasa-pro 3.13.0.dev20250612__py3-none-any.whl → 3.13.0rc1__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/__main__.py +0 -3
- rasa/api.py +1 -1
- rasa/cli/dialogue_understanding_test.py +1 -1
- rasa/cli/e2e_test.py +1 -8
- rasa/cli/evaluate.py +1 -1
- rasa/cli/export.py +3 -1
- rasa/cli/llm_fine_tuning.py +12 -11
- rasa/cli/project_templates/defaults.py +133 -0
- rasa/cli/project_templates/tutorial/config.yml +1 -1
- rasa/cli/project_templates/tutorial/endpoints.yml +1 -1
- rasa/cli/run.py +1 -1
- rasa/cli/studio/download.py +1 -23
- rasa/cli/studio/link.py +52 -0
- rasa/cli/studio/pull.py +79 -0
- rasa/cli/studio/push.py +78 -0
- rasa/cli/studio/studio.py +12 -0
- rasa/cli/studio/train.py +0 -1
- rasa/cli/studio/upload.py +8 -0
- rasa/cli/train.py +1 -1
- rasa/cli/utils.py +1 -1
- rasa/cli/x.py +1 -1
- rasa/constants.py +2 -0
- rasa/core/__init__.py +0 -16
- rasa/core/actions/action.py +5 -1
- rasa/core/actions/action_repeat_bot_messages.py +18 -22
- rasa/core/actions/action_run_slot_rejections.py +0 -1
- rasa/core/agent.py +16 -1
- rasa/core/available_endpoints.py +146 -0
- rasa/core/brokers/pika.py +1 -2
- rasa/core/channels/__init__.py +2 -0
- rasa/core/channels/botframework.py +2 -2
- rasa/core/channels/channel.py +2 -2
- rasa/core/channels/development_inspector.py +1 -1
- rasa/core/channels/facebook.py +1 -4
- rasa/core/channels/hangouts.py +8 -5
- rasa/core/channels/inspector/README.md +3 -3
- rasa/core/channels/inspector/dist/assets/{arc-c4b064fc.js → arc-371401b1.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{blockDiagram-38ab4fdb-215b5026.js → blockDiagram-38ab4fdb-3f126156.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{c4Diagram-3d4e48cf-2b54a0a3.js → c4Diagram-3d4e48cf-12f22eb7.js} +1 -1
- rasa/core/channels/inspector/dist/assets/channel-f1efda17.js +1 -0
- rasa/core/channels/inspector/dist/assets/{classDiagram-70f12bd4-daacea5f.js → classDiagram-70f12bd4-03b1d386.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{classDiagram-v2-f2320105-930d4dc2.js → classDiagram-v2-f2320105-84f69d63.js} +1 -1
- rasa/core/channels/inspector/dist/assets/clone-fdf164e2.js +1 -0
- rasa/core/channels/inspector/dist/assets/{createText-2e5e7dd3-83c206ba.js → createText-2e5e7dd3-ca47fd38.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{edges-e0da2a9e-b0eb01d0.js → edges-e0da2a9e-f837ca8a.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{erDiagram-9861fffd-17586500.js → erDiagram-9861fffd-8717ac54.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{flowDb-956e92f1-be2a1776.js → flowDb-956e92f1-94f38b83.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{flowDiagram-66a62f08-c2120ebd.js → flowDiagram-66a62f08-b616f9fb.js} +1 -1
- rasa/core/channels/inspector/dist/assets/flowDiagram-v2-96b9c2cf-7d7a1629.js +1 -0
- rasa/core/channels/inspector/dist/assets/{flowchart-elk-definition-4a651766-a6ab5c48.js → flowchart-elk-definition-4a651766-f5d24bb8.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{ganttDiagram-c361ad54-ef613457.js → ganttDiagram-c361ad54-b43ba8d9.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{gitGraphDiagram-72cf32ee-d59185b3.js → gitGraphDiagram-72cf32ee-c3aafaa5.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{graph-0f155405.js → graph-0d0a2c10.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{index-3862675e-d5f1d1b7.js → index-3862675e-58ea0305.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{index-47737d3a.js → index-cce6f8a1.js} +3 -3
- rasa/core/channels/inspector/dist/assets/{infoDiagram-f8f76790-b07d141f.js → infoDiagram-f8f76790-b8f60461.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{journeyDiagram-49397b02-1936d429.js → journeyDiagram-49397b02-95be5545.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{layout-dde8d0f3.js → layout-da885b9b.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{line-0c2c7ee0.js → line-f1c817d3.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{linear-35dd89a4.js → linear-d42801e6.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{mindmap-definition-fc14e90a-56192851.js → mindmap-definition-fc14e90a-a38923a6.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{pieDiagram-8a3498a8-fc21ed78.js → pieDiagram-8a3498a8-ca6e71e9.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{quadrantDiagram-120e2f19-25e98518.js → quadrantDiagram-120e2f19-b290dae9.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{requirementDiagram-deff3bca-546ff1f5.js → requirementDiagram-deff3bca-03f02ceb.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{sankeyDiagram-04a897e0-02d8b82d.js → sankeyDiagram-04a897e0-c49eee40.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{sequenceDiagram-704730f1-3ca5a92e.js → sequenceDiagram-704730f1-b2cd6a3d.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{stateDiagram-587899a1-128ea07c.js → stateDiagram-587899a1-e53a2028.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{stateDiagram-v2-d93cdb3a-95f290af.js → stateDiagram-v2-d93cdb3a-e1982a03.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{styles-6aaf32cf-4984898a.js → styles-6aaf32cf-d0226ca5.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{styles-9a916d00-1bf266ba.js → styles-9a916d00-0e21dc00.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{styles-c10674c1-60521c63.js → styles-c10674c1-9588494e.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{svgDrawCommon-08f97a94-a25b6e12.js → svgDrawCommon-08f97a94-be478d4f.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{timeline-definition-85554ec2-0fc086bf.js → timeline-definition-85554ec2-74631749.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{xychartDiagram-e933f94c-44ee592e.js → xychartDiagram-e933f94c-a043552f.js} +1 -1
- rasa/core/channels/inspector/dist/index.html +1 -1
- rasa/core/channels/inspector/src/components/RecruitmentPanel.tsx +1 -1
- rasa/core/channels/mattermost.py +1 -1
- rasa/core/channels/rasa_chat.py +2 -4
- rasa/core/channels/rest.py +5 -4
- rasa/core/channels/socketio.py +56 -41
- rasa/core/channels/studio_chat.py +314 -10
- rasa/core/channels/vier_cvg.py +1 -2
- rasa/core/channels/voice_ready/audiocodes.py +2 -9
- rasa/core/channels/voice_stream/asr/azure.py +9 -0
- rasa/core/channels/voice_stream/audiocodes.py +8 -5
- rasa/core/channels/voice_stream/browser_audio.py +1 -1
- rasa/core/channels/voice_stream/genesys.py +2 -2
- rasa/core/channels/voice_stream/jambonz.py +166 -0
- rasa/core/channels/voice_stream/tts/__init__.py +8 -0
- rasa/core/channels/voice_stream/twilio_media_streams.py +17 -5
- rasa/core/channels/voice_stream/voice_channel.py +44 -24
- rasa/core/exporter.py +36 -0
- rasa/core/http_interpreter.py +3 -7
- rasa/core/information_retrieval/faiss.py +18 -11
- rasa/core/information_retrieval/ingestion/faq_parser.py +158 -0
- rasa/core/jobs.py +2 -1
- rasa/core/nlg/contextual_response_rephraser.py +48 -12
- rasa/core/nlg/generator.py +0 -1
- rasa/core/nlg/interpolator.py +2 -3
- rasa/core/nlg/summarize.py +39 -5
- rasa/core/policies/enterprise_search_policy.py +298 -184
- rasa/core/policies/enterprise_search_policy_config.py +241 -0
- rasa/core/policies/enterprise_search_prompt_with_relevancy_check_and_citation_template.jinja2 +64 -0
- rasa/core/policies/flow_policy.py +1 -1
- rasa/core/policies/flows/flow_executor.py +96 -17
- rasa/core/policies/intentless_policy.py +71 -26
- rasa/core/processor.py +104 -51
- rasa/core/run.py +33 -11
- rasa/core/tracker_stores/tracker_store.py +1 -1
- rasa/core/training/interactive.py +1 -1
- rasa/core/utils.py +35 -99
- rasa/dialogue_understanding/coexistence/intent_based_router.py +2 -1
- rasa/dialogue_understanding/coexistence/llm_based_router.py +13 -17
- rasa/dialogue_understanding/commands/__init__.py +4 -0
- rasa/dialogue_understanding/commands/can_not_handle_command.py +2 -0
- rasa/dialogue_understanding/commands/cancel_flow_command.py +6 -2
- rasa/dialogue_understanding/commands/chit_chat_answer_command.py +2 -0
- rasa/dialogue_understanding/commands/clarify_command.py +7 -3
- rasa/dialogue_understanding/commands/command_syntax_manager.py +1 -0
- rasa/dialogue_understanding/commands/correct_slots_command.py +5 -6
- rasa/dialogue_understanding/commands/error_command.py +1 -1
- rasa/dialogue_understanding/commands/human_handoff_command.py +3 -3
- rasa/dialogue_understanding/commands/knowledge_answer_command.py +2 -0
- rasa/dialogue_understanding/commands/repeat_bot_messages_command.py +2 -0
- rasa/dialogue_understanding/commands/set_slot_command.py +15 -5
- rasa/dialogue_understanding/commands/skip_question_command.py +3 -3
- rasa/dialogue_understanding/commands/start_flow_command.py +7 -3
- rasa/dialogue_understanding/commands/utils.py +26 -2
- rasa/dialogue_understanding/generator/__init__.py +7 -1
- rasa/dialogue_understanding/generator/command_generator.py +15 -3
- rasa/dialogue_understanding/generator/command_parser.py +2 -2
- rasa/dialogue_understanding/generator/command_parser_validator.py +63 -0
- rasa/dialogue_understanding/generator/constants.py +2 -2
- rasa/dialogue_understanding/generator/nlu_command_adapter.py +2 -2
- rasa/dialogue_understanding/generator/prompt_templates/command_prompt_template.jinja2 +0 -2
- rasa/dialogue_understanding/generator/prompt_templates/command_prompt_v2_claude_3_5_sonnet_20240620_template.jinja2 +1 -0
- rasa/dialogue_understanding/generator/prompt_templates/command_prompt_v2_gpt_4o_2024_11_20_template.jinja2 +1 -0
- rasa/dialogue_understanding/generator/prompt_templates/command_prompt_v3_claude_3_5_sonnet_20240620_template.jinja2 +79 -0
- rasa/dialogue_understanding/generator/prompt_templates/command_prompt_v3_gpt_4o_2024_11_20_template.jinja2 +79 -0
- rasa/dialogue_understanding/generator/single_step/compact_llm_command_generator.py +28 -463
- rasa/dialogue_understanding/generator/single_step/search_ready_llm_command_generator.py +147 -0
- rasa/dialogue_understanding/generator/single_step/single_step_based_llm_command_generator.py +461 -0
- rasa/dialogue_understanding/generator/single_step/single_step_llm_command_generator.py +11 -64
- rasa/dialogue_understanding/patterns/cancel.py +1 -2
- rasa/dialogue_understanding/patterns/clarify.py +1 -1
- rasa/dialogue_understanding/patterns/correction.py +2 -2
- rasa/dialogue_understanding/patterns/default_flows_for_patterns.yml +37 -25
- rasa/dialogue_understanding/patterns/domain_for_patterns.py +190 -0
- rasa/dialogue_understanding/processor/command_processor.py +11 -12
- rasa/dialogue_understanding/processor/command_processor_component.py +3 -3
- rasa/dialogue_understanding/stack/frames/flow_stack_frame.py +17 -4
- rasa/dialogue_understanding/stack/utils.py +3 -1
- rasa/dialogue_understanding/utils.py +68 -12
- rasa/dialogue_understanding_test/du_test_case.py +1 -1
- rasa/dialogue_understanding_test/du_test_runner.py +4 -22
- rasa/dialogue_understanding_test/test_case_simulation/test_case_tracker_simulator.py +2 -6
- rasa/e2e_test/e2e_test_coverage_report.py +1 -1
- rasa/e2e_test/e2e_test_runner.py +1 -1
- rasa/engine/constants.py +1 -1
- rasa/engine/graph.py +2 -2
- rasa/engine/recipes/default_recipe.py +26 -2
- rasa/engine/validation.py +3 -2
- rasa/hooks.py +0 -28
- rasa/llm_fine_tuning/annotation_module.py +39 -9
- rasa/llm_fine_tuning/conversations.py +3 -0
- rasa/llm_fine_tuning/llm_data_preparation_module.py +66 -49
- rasa/llm_fine_tuning/paraphrasing/conversation_rephraser.py +5 -7
- rasa/llm_fine_tuning/paraphrasing/rephrase_validator.py +52 -44
- rasa/llm_fine_tuning/paraphrasing_module.py +10 -12
- rasa/llm_fine_tuning/storage.py +4 -4
- rasa/llm_fine_tuning/utils.py +63 -1
- rasa/model_manager/model_api.py +88 -0
- rasa/model_manager/trainer_service.py +4 -4
- rasa/plugin.py +1 -11
- rasa/privacy/__init__.py +0 -0
- rasa/privacy/constants.py +83 -0
- rasa/privacy/event_broker_utils.py +77 -0
- rasa/privacy/privacy_config.py +281 -0
- rasa/privacy/privacy_config_schema.json +86 -0
- rasa/privacy/privacy_filter.py +340 -0
- rasa/privacy/privacy_manager.py +576 -0
- rasa/server.py +23 -2
- rasa/shared/constants.py +18 -0
- rasa/shared/core/command_payload_reader.py +1 -5
- rasa/shared/core/constants.py +4 -3
- rasa/shared/core/domain.py +7 -0
- rasa/shared/core/events.py +38 -10
- rasa/shared/core/flows/constants.py +2 -0
- rasa/shared/core/flows/flow.py +127 -14
- rasa/shared/core/flows/flows_list.py +18 -1
- rasa/shared/core/flows/flows_yaml_schema.json +3 -0
- rasa/shared/core/flows/steps/collect.py +46 -2
- rasa/shared/core/flows/steps/link.py +7 -2
- rasa/shared/core/flows/validation.py +25 -5
- rasa/shared/core/slots.py +28 -0
- rasa/shared/core/training_data/story_reader/yaml_story_reader.py +1 -4
- rasa/shared/exceptions.py +4 -0
- rasa/shared/providers/_configs/azure_openai_client_config.py +6 -2
- rasa/shared/providers/_configs/default_litellm_client_config.py +1 -1
- rasa/shared/providers/_configs/huggingface_local_embedding_client_config.py +1 -1
- rasa/shared/providers/_configs/openai_client_config.py +5 -1
- rasa/shared/providers/_configs/rasa_llm_client_config.py +1 -1
- rasa/shared/providers/_configs/self_hosted_llm_client_config.py +1 -1
- rasa/shared/providers/_configs/utils.py +0 -99
- rasa/shared/providers/embedding/_base_litellm_embedding_client.py +3 -0
- rasa/shared/providers/llm/_base_litellm_client.py +5 -2
- rasa/shared/utils/common.py +1 -1
- rasa/shared/utils/configs.py +110 -0
- rasa/shared/utils/constants.py +0 -3
- rasa/shared/utils/llm.py +195 -9
- rasa/shared/utils/pykwalify_extensions.py +0 -9
- rasa/shared/utils/yaml.py +32 -0
- rasa/studio/constants.py +1 -0
- rasa/studio/data_handler.py +11 -4
- rasa/studio/download.py +167 -0
- rasa/studio/link.py +200 -0
- rasa/studio/prompts.py +223 -0
- rasa/studio/pull/__init__.py +0 -0
- rasa/studio/{download/flows.py → pull/data.py} +23 -160
- rasa/studio/{download → pull}/domains.py +1 -1
- rasa/studio/pull/pull.py +235 -0
- rasa/studio/push.py +136 -0
- rasa/studio/train.py +1 -1
- rasa/studio/upload.py +117 -67
- rasa/telemetry.py +82 -25
- rasa/tracing/config.py +3 -4
- rasa/tracing/constants.py +19 -1
- rasa/tracing/instrumentation/attribute_extractors.py +30 -8
- rasa/tracing/instrumentation/instrumentation.py +53 -2
- rasa/tracing/instrumentation/metrics.py +98 -15
- rasa/tracing/metric_instrument_provider.py +75 -3
- rasa/utils/common.py +7 -22
- rasa/utils/log_utils.py +1 -45
- rasa/validator.py +2 -8
- rasa/version.py +1 -1
- {rasa_pro-3.13.0.dev20250612.dist-info → rasa_pro-3.13.0rc1.dist-info}/METADATA +8 -9
- {rasa_pro-3.13.0.dev20250612.dist-info → rasa_pro-3.13.0rc1.dist-info}/RECORD +241 -220
- rasa/anonymization/__init__.py +0 -2
- rasa/anonymization/anonymisation_rule_yaml_reader.py +0 -91
- rasa/anonymization/anonymization_pipeline.py +0 -286
- rasa/anonymization/anonymization_rule_executor.py +0 -266
- rasa/anonymization/anonymization_rule_orchestrator.py +0 -119
- rasa/anonymization/schemas/config.yml +0 -47
- rasa/anonymization/utils.py +0 -118
- rasa/core/channels/inspector/dist/assets/channel-3730f5fd.js +0 -1
- rasa/core/channels/inspector/dist/assets/clone-e847561e.js +0 -1
- rasa/core/channels/inspector/dist/assets/flowDiagram-v2-96b9c2cf-efbbfe00.js +0 -1
- rasa/studio/download/download.py +0 -439
- /rasa/{studio/download → core/information_retrieval/ingestion}/__init__.py +0 -0
- {rasa_pro-3.13.0.dev20250612.dist-info → rasa_pro-3.13.0rc1.dist-info}/NOTICE +0 -0
- {rasa_pro-3.13.0.dev20250612.dist-info → rasa_pro-3.13.0rc1.dist-info}/WHEEL +0 -0
- {rasa_pro-3.13.0.dev20250612.dist-info → rasa_pro-3.13.0rc1.dist-info}/entry_points.txt +0 -0
rasa/telemetry.py
CHANGED
|
@@ -23,7 +23,6 @@ import structlog
|
|
|
23
23
|
from terminaltables import SingleTable
|
|
24
24
|
|
|
25
25
|
import rasa
|
|
26
|
-
import rasa.anonymization.utils
|
|
27
26
|
import rasa.shared.utils.io
|
|
28
27
|
import rasa.utils.io
|
|
29
28
|
from rasa import model
|
|
@@ -34,6 +33,7 @@ from rasa.constants import (
|
|
|
34
33
|
CONFIG_TELEMETRY_ID,
|
|
35
34
|
)
|
|
36
35
|
from rasa.engine.storage.local_model_storage import LocalModelStorage
|
|
36
|
+
from rasa.privacy.privacy_config import AnonymizationType, PrivacyConfig
|
|
37
37
|
from rasa.shared.constants import (
|
|
38
38
|
ASSISTANT_ID_KEY,
|
|
39
39
|
CONFIG_LANGUAGE_KEY,
|
|
@@ -62,10 +62,10 @@ from rasa.utils import common as rasa_utils
|
|
|
62
62
|
|
|
63
63
|
if typing.TYPE_CHECKING:
|
|
64
64
|
from rasa.core.agent import Agent
|
|
65
|
+
from rasa.core.available_endpoints import AvailableEndpoints
|
|
65
66
|
from rasa.core.brokers.broker import EventBroker
|
|
66
67
|
from rasa.core.channels.channel import InputChannel
|
|
67
68
|
from rasa.core.tracker_stores.tracker_store import TrackerStore
|
|
68
|
-
from rasa.core.utils import AvailableEndpoints
|
|
69
69
|
from rasa.e2e_test.e2e_test_case import Fixture, Metadata, TestCase
|
|
70
70
|
from rasa.shared.importers.importer import TrainingDataImporter
|
|
71
71
|
from rasa.shared.nlu.training_data.training_data import TrainingData
|
|
@@ -149,6 +149,7 @@ TELEMETRY_ENTERPRISE_SEARCH_POLICY_TRAINING_COMPLETED_EVENT = (
|
|
|
149
149
|
TELEMETRY_ENTERPRISE_SEARCH_POLICY_PREDICT_EVENT = "Enterprise Search Policy Predicted"
|
|
150
150
|
TELEMETRY_VALIDATION_ERROR_LOG_EVENT = "Validation Error Logged"
|
|
151
151
|
TELEMETRY_UPLOAD_TO_STUDIO_FAILED_EVENT = "Upload to Studio Failed"
|
|
152
|
+
TELEMETRY_PRIVACY_ENABLED_EVENT = "PII Management in CALM Enabled"
|
|
152
153
|
|
|
153
154
|
# licensing events
|
|
154
155
|
TELEMETRY_CONVERSATION_COUNT = "Conversation Count"
|
|
@@ -1129,6 +1130,7 @@ def _get_llm_command_generator_config(config: Dict[str, Any]) -> Optional[Dict]:
|
|
|
1129
1130
|
LLMBasedCommandGenerator,
|
|
1130
1131
|
LLMCommandGenerator,
|
|
1131
1132
|
MultiStepLLMCommandGenerator,
|
|
1133
|
+
SearchReadyLLMCommandGenerator,
|
|
1132
1134
|
SingleStepLLMCommandGenerator,
|
|
1133
1135
|
)
|
|
1134
1136
|
from rasa.dialogue_understanding.generator.constants import (
|
|
@@ -1156,6 +1158,7 @@ def _get_llm_command_generator_config(config: Dict[str, Any]) -> Optional[Dict]:
|
|
|
1156
1158
|
SingleStepLLMCommandGenerator.__name__,
|
|
1157
1159
|
MultiStepLLMCommandGenerator.__name__,
|
|
1158
1160
|
CompactLLMCommandGenerator.__name__,
|
|
1161
|
+
SearchReadyLLMCommandGenerator.__name__,
|
|
1159
1162
|
]:
|
|
1160
1163
|
return component
|
|
1161
1164
|
return None
|
|
@@ -1167,6 +1170,7 @@ def _get_llm_command_generator_config(config: Dict[str, Any]) -> Optional[Dict]:
|
|
|
1167
1170
|
SingleStepLLMCommandGenerator.__name__: SingleStepLLMCommandGenerator,
|
|
1168
1171
|
MultiStepLLMCommandGenerator.__name__: MultiStepLLMCommandGenerator,
|
|
1169
1172
|
CompactLLMCommandGenerator.__name__: CompactLLMCommandGenerator,
|
|
1173
|
+
SearchReadyLLMCommandGenerator.__name__: SearchReadyLLMCommandGenerator,
|
|
1170
1174
|
}
|
|
1171
1175
|
llm_config = component.get(LLM_CONFIG_KEY, {})
|
|
1172
1176
|
# Config at this stage is not yet resolved, so read from `model_group`
|
|
@@ -1353,7 +1357,7 @@ def track_server_start(
|
|
|
1353
1357
|
number_of_workers: number of used Sanic workers
|
|
1354
1358
|
is_api_enabled: whether the rasa API server is enabled
|
|
1355
1359
|
"""
|
|
1356
|
-
from rasa.core.
|
|
1360
|
+
from rasa.core.available_endpoints import AvailableEndpoints
|
|
1357
1361
|
|
|
1358
1362
|
def project_fingerprint_and_assistant_id_from_model(
|
|
1359
1363
|
_model_directory: Optional[Text],
|
|
@@ -1745,7 +1749,6 @@ def identify_endpoint_config_traits(
|
|
|
1745
1749
|
|
|
1746
1750
|
traits = append_tracing_trait(traits, endpoints_file)
|
|
1747
1751
|
traits = append_metrics_trait(traits, endpoints_file)
|
|
1748
|
-
traits = append_anonymization_trait(traits, endpoints_file)
|
|
1749
1752
|
|
|
1750
1753
|
_identify(traits, context)
|
|
1751
1754
|
|
|
@@ -1784,27 +1787,6 @@ def append_metrics_trait(
|
|
|
1784
1787
|
return traits
|
|
1785
1788
|
|
|
1786
1789
|
|
|
1787
|
-
def append_anonymization_trait(
|
|
1788
|
-
traits: Dict[str, Any], endpoints_file: Optional[str]
|
|
1789
|
-
) -> Dict[str, Any]:
|
|
1790
|
-
"""Append the anonymization trait to the traits dictionary."""
|
|
1791
|
-
from rasa.anonymization.anonymisation_rule_yaml_reader import (
|
|
1792
|
-
KEY_ANONYMIZATION_RULES,
|
|
1793
|
-
)
|
|
1794
|
-
|
|
1795
|
-
anonymization_config = rasa.anonymization.utils.read_endpoint_config(
|
|
1796
|
-
endpoints_file, KEY_ANONYMIZATION_RULES
|
|
1797
|
-
)
|
|
1798
|
-
|
|
1799
|
-
traits[KEY_ANONYMIZATION_RULES] = (
|
|
1800
|
-
rasa.anonymization.utils.extract_anonymization_traits(
|
|
1801
|
-
anonymization_config, KEY_ANONYMIZATION_RULES
|
|
1802
|
-
)
|
|
1803
|
-
)
|
|
1804
|
-
|
|
1805
|
-
return traits
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
1790
|
@ensure_telemetry_enabled
|
|
1809
1791
|
def track_enterprise_search_policy_train_started() -> None:
|
|
1810
1792
|
"""Track when a user starts training Enterprise Search policy."""
|
|
@@ -1821,6 +1803,7 @@ def track_enterprise_search_policy_train_completed(
|
|
|
1821
1803
|
llm_model: Optional[str],
|
|
1822
1804
|
llm_model_group_id: Optional[str],
|
|
1823
1805
|
citation_enabled: Optional[bool],
|
|
1806
|
+
relevancy_check_enabled: Optional[bool],
|
|
1824
1807
|
) -> None:
|
|
1825
1808
|
"""Track when a user completes training Enterprise Search policy."""
|
|
1826
1809
|
_track(
|
|
@@ -1834,6 +1817,7 @@ def track_enterprise_search_policy_train_completed(
|
|
|
1834
1817
|
"llm_model": llm_model,
|
|
1835
1818
|
"llm_model_group_id": llm_model_group_id,
|
|
1836
1819
|
"citation_enabled": citation_enabled,
|
|
1820
|
+
"relevancy_check_enabled": relevancy_check_enabled,
|
|
1837
1821
|
},
|
|
1838
1822
|
)
|
|
1839
1823
|
|
|
@@ -1848,6 +1832,7 @@ def track_enterprise_search_policy_predict(
|
|
|
1848
1832
|
llm_model: Optional[str],
|
|
1849
1833
|
llm_model_group_id: Optional[str],
|
|
1850
1834
|
citation_enabled: Optional[bool],
|
|
1835
|
+
relevancy_check_enabled: Optional[bool],
|
|
1851
1836
|
) -> None:
|
|
1852
1837
|
"""Track when a user predicts the next action using Enterprise Search policy."""
|
|
1853
1838
|
_track(
|
|
@@ -1861,6 +1846,7 @@ def track_enterprise_search_policy_predict(
|
|
|
1861
1846
|
"llm_model": llm_model,
|
|
1862
1847
|
"llm_model_group_id": llm_model_group_id,
|
|
1863
1848
|
"citation_enabled": citation_enabled,
|
|
1849
|
+
"relevancy_check_enabled": relevancy_check_enabled,
|
|
1864
1850
|
},
|
|
1865
1851
|
)
|
|
1866
1852
|
|
|
@@ -1946,3 +1932,74 @@ def track_upload_to_studio_failed(response_json: Dict[str, Any]) -> None:
|
|
|
1946
1932
|
TELEMETRY_UPLOAD_TO_STUDIO_FAILED_EVENT,
|
|
1947
1933
|
{"studio_response_json": response_json},
|
|
1948
1934
|
)
|
|
1935
|
+
|
|
1936
|
+
|
|
1937
|
+
def _extract_privacy_enabled_event_properties(
|
|
1938
|
+
privacy_config: "PrivacyConfig",
|
|
1939
|
+
stream_pii: bool,
|
|
1940
|
+
) -> Dict[str, Any]:
|
|
1941
|
+
"""Extract properties when PII management is enabled."""
|
|
1942
|
+
number_of_total_rules = len(privacy_config.anonymization_rules)
|
|
1943
|
+
count_of_redact = sum(
|
|
1944
|
+
1
|
|
1945
|
+
for rule in privacy_config.anonymization_rules.values()
|
|
1946
|
+
if rule.method_type == AnonymizationType.REDACT
|
|
1947
|
+
)
|
|
1948
|
+
count_of_mask = sum(
|
|
1949
|
+
1
|
|
1950
|
+
for rule in privacy_config.anonymization_rules.values()
|
|
1951
|
+
if rule.method_type == AnonymizationType.MASK
|
|
1952
|
+
)
|
|
1953
|
+
|
|
1954
|
+
tracker_store_anonymization_enabled = (
|
|
1955
|
+
privacy_config.tracker_store_settings is not None
|
|
1956
|
+
and privacy_config.tracker_store_settings.anonymization_policy is not None
|
|
1957
|
+
)
|
|
1958
|
+
anonymization_cron_trigger = (
|
|
1959
|
+
privacy_config.tracker_store_settings.anonymization_policy.cron # type: ignore[union-attr]
|
|
1960
|
+
if tracker_store_anonymization_enabled
|
|
1961
|
+
else None
|
|
1962
|
+
)
|
|
1963
|
+
|
|
1964
|
+
tracker_store_deletion_enabled = (
|
|
1965
|
+
privacy_config.tracker_store_settings is not None
|
|
1966
|
+
and privacy_config.tracker_store_settings.deletion_policy is not None
|
|
1967
|
+
)
|
|
1968
|
+
|
|
1969
|
+
deletion_cron_trigger = (
|
|
1970
|
+
privacy_config.tracker_store_settings.deletion_policy.cron # type: ignore[union-attr]
|
|
1971
|
+
if tracker_store_deletion_enabled
|
|
1972
|
+
else None
|
|
1973
|
+
)
|
|
1974
|
+
|
|
1975
|
+
return {
|
|
1976
|
+
"num_total_rules": number_of_total_rules,
|
|
1977
|
+
"redact_count": count_of_redact,
|
|
1978
|
+
"mask_count": count_of_mask,
|
|
1979
|
+
"stream_pii": stream_pii,
|
|
1980
|
+
"tracker_store_anonymization_enabled": tracker_store_anonymization_enabled,
|
|
1981
|
+
"tracker_store_deletion_enabled": tracker_store_deletion_enabled,
|
|
1982
|
+
"anonymization_cron_trigger": str(anonymization_cron_trigger),
|
|
1983
|
+
"deletion_cron_trigger": str(deletion_cron_trigger),
|
|
1984
|
+
}
|
|
1985
|
+
|
|
1986
|
+
|
|
1987
|
+
def _extract_stream_pii(event_broker: Optional["EventBroker"]) -> bool:
|
|
1988
|
+
"""Extract whether un-anonymized PII streaming is enabled for the event broker."""
|
|
1989
|
+
return (
|
|
1990
|
+
event_broker.stream_pii
|
|
1991
|
+
if event_broker is not None and hasattr(event_broker, "stream_pii")
|
|
1992
|
+
else False
|
|
1993
|
+
)
|
|
1994
|
+
|
|
1995
|
+
|
|
1996
|
+
@ensure_telemetry_enabled
|
|
1997
|
+
def track_privacy_enabled(
|
|
1998
|
+
privacy_config: "PrivacyConfig", event_broker: Optional["EventBroker"]
|
|
1999
|
+
) -> None:
|
|
2000
|
+
"""Track when PII management capability is enabled"""
|
|
2001
|
+
stream_pii = _extract_stream_pii(event_broker)
|
|
2002
|
+
privacy_properties = _extract_privacy_enabled_event_properties(
|
|
2003
|
+
privacy_config, stream_pii
|
|
2004
|
+
)
|
|
2005
|
+
_track(TELEMETRY_PRIVACY_ENABLED_EVENT, privacy_properties)
|
rasa/tracing/config.py
CHANGED
|
@@ -24,14 +24,12 @@ from rasa.core.actions.grpc_custom_action_executor import GRPCCustomActionExecut
|
|
|
24
24
|
from rasa.core.agent import Agent
|
|
25
25
|
from rasa.core.processor import MessageProcessor
|
|
26
26
|
from rasa.core.tracker_stores.tracker_store import TrackerStore
|
|
27
|
-
from rasa.dialogue_understanding.commands import
|
|
28
|
-
Command,
|
|
29
|
-
FreeFormAnswerCommand,
|
|
30
|
-
)
|
|
27
|
+
from rasa.dialogue_understanding.commands import Command, FreeFormAnswerCommand
|
|
31
28
|
from rasa.dialogue_understanding.generator import (
|
|
32
29
|
CompactLLMCommandGenerator,
|
|
33
30
|
LLMCommandGenerator,
|
|
34
31
|
MultiStepLLMCommandGenerator,
|
|
32
|
+
SearchReadyLLMCommandGenerator,
|
|
35
33
|
SingleStepLLMCommandGenerator,
|
|
36
34
|
)
|
|
37
35
|
from rasa.dialogue_understanding.generator.flow_retrieval import FlowRetrieval
|
|
@@ -112,6 +110,7 @@ def configure_tracing(tracer_provider: Optional[TracerProvider]) -> None:
|
|
|
112
110
|
grpc_custom_action_executor_class=GRPCCustomActionExecutor,
|
|
113
111
|
single_step_llm_command_generator_class=SingleStepLLMCommandGenerator,
|
|
114
112
|
compact_llm_command_generator_class=CompactLLMCommandGenerator,
|
|
113
|
+
search_ready_llm_command_generator_class=SearchReadyLLMCommandGenerator,
|
|
115
114
|
multi_step_llm_command_generator_class=MultiStepLLMCommandGenerator,
|
|
116
115
|
custom_action_executor_subclasses=custom_action_executor_subclasses,
|
|
117
116
|
flow_retrieval_class=FlowRetrieval,
|
rasa/tracing/constants.py
CHANGED
|
@@ -44,6 +44,18 @@ COMPACT_LLM_COMMAND_GENERATOR_PROMPT_TOKEN_USAGE_METRIC_NAME = (
|
|
|
44
44
|
COMPACT_LLM_COMMAND_GENERATOR_LLM_RESPONSE_DURATION_METRIC_NAME = (
|
|
45
45
|
"compact_llm_command_generator_llm_response_duration"
|
|
46
46
|
)
|
|
47
|
+
SEARCH_READY_LLM_COMMAND_GENERATOR_CPU_USAGE_METRIC_NAME = (
|
|
48
|
+
"search_ready_llm_command_generator_cpu_usage"
|
|
49
|
+
)
|
|
50
|
+
SEARCH_READY_LLM_COMMAND_GENERATOR_MEMORY_USAGE_METRIC_NAME = (
|
|
51
|
+
"search_ready_llm_command_generator_memory_usage"
|
|
52
|
+
)
|
|
53
|
+
SEARCH_READY_LLM_COMMAND_GENERATOR_PROMPT_TOKEN_USAGE_METRIC_NAME = (
|
|
54
|
+
"search_ready_llm_command_generator_prompt_token_usage"
|
|
55
|
+
)
|
|
56
|
+
SEARCH_READY_LLM_COMMAND_GENERATOR_LLM_RESPONSE_DURATION_METRIC_NAME = (
|
|
57
|
+
"search_ready_llm_command_generator_llm_response_duration"
|
|
58
|
+
)
|
|
47
59
|
MULTI_STEP_LLM_COMMAND_GENERATOR_CPU_USAGE_METRIC_NAME = (
|
|
48
60
|
"multi_step_llm_command_generator_cpu_usage"
|
|
49
61
|
)
|
|
@@ -56,7 +68,13 @@ MULTI_STEP_LLM_COMMAND_GENERATOR_PROMPT_TOKEN_USAGE_METRIC_NAME = (
|
|
|
56
68
|
MULTI_STEP_LLM_COMMAND_GENERATOR_LLM_RESPONSE_DURATION_METRIC_NAME = (
|
|
57
69
|
"multi_step_llm_command_generator_llm_response_duration"
|
|
58
70
|
)
|
|
59
|
-
|
|
71
|
+
ENTERPRISE_SEARCH_POLICY_CPU_USAGE_METRIC_NAME = "enterprise_search_policy_cpu_usage"
|
|
72
|
+
ENTERPRISE_SEARCH_POLICY_MEMORY_USAGE_METRIC_NAME = (
|
|
73
|
+
"enterprise_search_policy_memory_usage"
|
|
74
|
+
)
|
|
75
|
+
ENTERPRISE_SEARCH_POLICY_PROMPT_TOKEN_USAGE_METRIC_NAME = (
|
|
76
|
+
"enterprise_search_policy_prompt_token_usage"
|
|
77
|
+
)
|
|
60
78
|
ENTERPRISE_SEARCH_POLICY_LLM_RESPONSE_DURATION_METRIC_NAME = (
|
|
61
79
|
"enterprise_search_policy_llm_response_duration"
|
|
62
80
|
)
|
|
@@ -64,7 +64,10 @@ from rasa.shared.core.trackers import DialogueStateTracker
|
|
|
64
64
|
from rasa.shared.core.training_data.structures import StoryGraph
|
|
65
65
|
from rasa.shared.importers.importer import TrainingDataImporter
|
|
66
66
|
from rasa.shared.nlu.constants import INTENT_NAME_KEY, SET_SLOT_COMMAND
|
|
67
|
-
from rasa.shared.utils.llm import
|
|
67
|
+
from rasa.shared.utils.llm import (
|
|
68
|
+
combine_custom_and_default_config,
|
|
69
|
+
resolve_model_client_config,
|
|
70
|
+
)
|
|
68
71
|
from rasa.tracing.constants import (
|
|
69
72
|
PROMPT_TOKEN_LENGTH_ATTRIBUTE_NAME,
|
|
70
73
|
REQUEST_BODY_SIZE_IN_BYTES_ATTRIBUTE_NAME,
|
|
@@ -335,9 +338,8 @@ def extract_llm_config(
|
|
|
335
338
|
else:
|
|
336
339
|
config = self.config
|
|
337
340
|
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
)
|
|
341
|
+
llm_config = resolve_model_client_config(config.get(LLM_CONFIG_KEY))
|
|
342
|
+
llm_property = combine_custom_and_default_config(llm_config, default_llm_config)
|
|
341
343
|
|
|
342
344
|
if isinstance(self, LLMBasedCommandGenerator):
|
|
343
345
|
flow_retrieval_config = config.get(FLOW_RETRIEVAL_KEY, {}) or {}
|
|
@@ -346,8 +348,11 @@ def extract_llm_config(
|
|
|
346
348
|
default_embeddings_config,
|
|
347
349
|
)
|
|
348
350
|
else:
|
|
351
|
+
embeddings_config = resolve_model_client_config(
|
|
352
|
+
config.get(EMBEDDINGS_CONFIG_KEY)
|
|
353
|
+
)
|
|
349
354
|
embeddings_property = combine_custom_and_default_config(
|
|
350
|
-
|
|
355
|
+
embeddings_config, default_embeddings_config
|
|
351
356
|
)
|
|
352
357
|
|
|
353
358
|
attributes = {
|
|
@@ -767,8 +772,8 @@ def extract_attrs_for_intentless_policy_generate_llm_answer(
|
|
|
767
772
|
return extend_attributes_with_prompt_tokens_length(self, attributes, prompt)
|
|
768
773
|
|
|
769
774
|
|
|
770
|
-
def
|
|
771
|
-
self: "EnterpriseSearchPolicy",
|
|
775
|
+
def extract_attrs_for_enterprise_search_invoke_llm(
|
|
776
|
+
self: "EnterpriseSearchPolicy", prompt: str
|
|
772
777
|
) -> Dict[str, Any]:
|
|
773
778
|
from rasa.core.policies.enterprise_search_policy import (
|
|
774
779
|
DEFAULT_EMBEDDINGS_CONFIG,
|
|
@@ -784,6 +789,14 @@ def extract_attrs_for_enterprise_search_generate_llm_answer(
|
|
|
784
789
|
return extend_attributes_with_prompt_tokens_length(self, attributes, prompt)
|
|
785
790
|
|
|
786
791
|
|
|
792
|
+
def extract_attrs_for_enterprise_search_parse_llm_relevancy_check_response(
|
|
793
|
+
self: "EnterpriseSearchPolicy", llm_answer: str
|
|
794
|
+
) -> Dict[str, Any]:
|
|
795
|
+
return {
|
|
796
|
+
"llm_answer": llm_answer,
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
|
|
787
800
|
def extract_current_context_attribute(stack: DialogueStack) -> Dict[str, Any]:
|
|
788
801
|
"""Utility function to extract the current context from the dialogue stack."""
|
|
789
802
|
current_context = stack.current_context()
|
|
@@ -813,7 +826,16 @@ def compute_prompt_tokens_length(
|
|
|
813
826
|
)
|
|
814
827
|
model_name = f"{model_name}-0613"
|
|
815
828
|
|
|
816
|
-
|
|
829
|
+
try:
|
|
830
|
+
encoding = tiktoken.encoding_for_model(model_name)
|
|
831
|
+
except KeyError:
|
|
832
|
+
# Fallback for unknown models
|
|
833
|
+
logger.warning(
|
|
834
|
+
f"Unknown model name '{model_name}', "
|
|
835
|
+
f"using 'cl100k_base' encoding as fallback."
|
|
836
|
+
)
|
|
837
|
+
encoding = tiktoken.get_encoding("cl100k_base")
|
|
838
|
+
|
|
817
839
|
return len(encoding.encode(prompt))
|
|
818
840
|
|
|
819
841
|
|
|
@@ -44,6 +44,7 @@ from rasa.dialogue_understanding.generator import (
|
|
|
44
44
|
CompactLLMCommandGenerator,
|
|
45
45
|
LLMCommandGenerator,
|
|
46
46
|
MultiStepLLMCommandGenerator,
|
|
47
|
+
SearchReadyLLMCommandGenerator,
|
|
47
48
|
SingleStepLLMCommandGenerator,
|
|
48
49
|
)
|
|
49
50
|
from rasa.dialogue_understanding.generator.flow_retrieval import FlowRetrieval
|
|
@@ -66,9 +67,11 @@ from rasa.tracing.instrumentation.intentless_policy_instrumentation import (
|
|
|
66
67
|
from rasa.tracing.instrumentation.metrics import (
|
|
67
68
|
record_callable_duration_metrics,
|
|
68
69
|
record_compact_llm_command_generator_metrics,
|
|
70
|
+
record_enterprise_search_policy_metrics,
|
|
69
71
|
record_llm_command_generator_metrics,
|
|
70
72
|
record_multi_step_llm_command_generator_metrics,
|
|
71
73
|
record_request_size_in_bytes,
|
|
74
|
+
record_search_ready_llm_command_generator_metrics,
|
|
72
75
|
record_single_step_llm_command_generator_metrics,
|
|
73
76
|
)
|
|
74
77
|
from rasa.utils.endpoints import EndpointConfig, concat_url
|
|
@@ -291,6 +294,9 @@ SingleStepLLMCommandGeneratorType = TypeVar(
|
|
|
291
294
|
CompactLLMCommandGeneratorType = TypeVar(
|
|
292
295
|
"CompactLLMCommandGeneratorType", bound=CompactLLMCommandGenerator
|
|
293
296
|
)
|
|
297
|
+
SearchReadyLLMCommandGeneratorType = TypeVar(
|
|
298
|
+
"SearchReadyLLMCommandGeneratorType", bound=SearchReadyLLMCommandGenerator
|
|
299
|
+
)
|
|
294
300
|
MultiStepLLMCommandGeneratorType = TypeVar(
|
|
295
301
|
"MultiStepLLMCommandGeneratorType", bound=MultiStepLLMCommandGenerator
|
|
296
302
|
)
|
|
@@ -326,6 +332,9 @@ def instrument(
|
|
|
326
332
|
compact_llm_command_generator_class: Optional[
|
|
327
333
|
Type[CompactLLMCommandGeneratorType]
|
|
328
334
|
] = None,
|
|
335
|
+
search_ready_llm_command_generator_class: Optional[
|
|
336
|
+
Type[SearchReadyLLMCommandGeneratorType]
|
|
337
|
+
] = None,
|
|
329
338
|
multi_step_llm_command_generator_class: Optional[
|
|
330
339
|
Type[MultiStepLLMCommandGeneratorType]
|
|
331
340
|
] = None,
|
|
@@ -379,6 +388,9 @@ def instrument(
|
|
|
379
388
|
:param compact_llm_command_generator_class: The `CompactLLMCommandGenerator`
|
|
380
389
|
to be instrumented. If `None` is given, no `CompactLLMCommandGenerator` will
|
|
381
390
|
be instrumented.
|
|
391
|
+
:param search_ready_llm_command_generator_class: The`SearchReadyLLMCommandGenerator`
|
|
392
|
+
to be instrumented. If `None` is given, no `SearchReadyLLMCommandGenerator` will
|
|
393
|
+
be instrumented.
|
|
382
394
|
:param multi_step_llm_command_generator_class: The `MultiStepLLMCommandGenerator`
|
|
383
395
|
to be instrumented. If `None` is given, no `MultiStepLLMCommandGenerator` will
|
|
384
396
|
be instrumented.
|
|
@@ -527,6 +539,37 @@ def instrument(
|
|
|
527
539
|
)
|
|
528
540
|
mark_class_as_instrumented(compact_llm_command_generator_class)
|
|
529
541
|
|
|
542
|
+
if (
|
|
543
|
+
search_ready_llm_command_generator_class is not None
|
|
544
|
+
and not class_is_instrumented(search_ready_llm_command_generator_class)
|
|
545
|
+
):
|
|
546
|
+
_instrument_method(
|
|
547
|
+
tracer_provider.get_tracer(
|
|
548
|
+
search_ready_llm_command_generator_class.__module__
|
|
549
|
+
),
|
|
550
|
+
search_ready_llm_command_generator_class,
|
|
551
|
+
"invoke_llm",
|
|
552
|
+
attribute_extractors.extract_attrs_for_llm_based_command_generator,
|
|
553
|
+
metrics_recorder=record_search_ready_llm_command_generator_metrics,
|
|
554
|
+
)
|
|
555
|
+
_instrument_method(
|
|
556
|
+
tracer_provider.get_tracer(
|
|
557
|
+
search_ready_llm_command_generator_class.__module__
|
|
558
|
+
),
|
|
559
|
+
search_ready_llm_command_generator_class,
|
|
560
|
+
"_check_commands_against_startable_flows",
|
|
561
|
+
attribute_extractors.extract_attrs_for_check_commands_against_startable_flows,
|
|
562
|
+
)
|
|
563
|
+
_instrument_perform_health_check_method_for_component(
|
|
564
|
+
tracer_provider.get_tracer(
|
|
565
|
+
search_ready_llm_command_generator_class.__module__
|
|
566
|
+
),
|
|
567
|
+
search_ready_llm_command_generator_class,
|
|
568
|
+
"perform_llm_health_check",
|
|
569
|
+
attribute_extractors.extract_attrs_for_performing_health_check,
|
|
570
|
+
)
|
|
571
|
+
mark_class_as_instrumented(search_ready_llm_command_generator_class)
|
|
572
|
+
|
|
530
573
|
if multi_step_llm_command_generator_class is not None and not class_is_instrumented(
|
|
531
574
|
multi_step_llm_command_generator_class
|
|
532
575
|
):
|
|
@@ -562,6 +605,7 @@ def instrument(
|
|
|
562
605
|
llm_command_generator_class,
|
|
563
606
|
single_step_llm_command_generator_class,
|
|
564
607
|
compact_llm_command_generator_class,
|
|
608
|
+
search_ready_llm_command_generator_class,
|
|
565
609
|
multi_step_llm_command_generator_class,
|
|
566
610
|
)
|
|
567
611
|
)
|
|
@@ -847,8 +891,15 @@ def _instrument_enterprise_search_policy(
|
|
|
847
891
|
_instrument_method(
|
|
848
892
|
tracer,
|
|
849
893
|
policy_class,
|
|
850
|
-
"
|
|
851
|
-
attribute_extractors.
|
|
894
|
+
"_invoke_llm",
|
|
895
|
+
attribute_extractors.extract_attrs_for_enterprise_search_invoke_llm,
|
|
896
|
+
metrics_recorder=record_enterprise_search_policy_metrics,
|
|
897
|
+
)
|
|
898
|
+
_instrument_method(
|
|
899
|
+
tracer,
|
|
900
|
+
policy_class,
|
|
901
|
+
"_parse_llm_relevancy_check_response",
|
|
902
|
+
attribute_extractors.extract_attrs_for_enterprise_search_parse_llm_relevancy_check_response,
|
|
852
903
|
)
|
|
853
904
|
_instrument_perform_health_check_method_for_component(
|
|
854
905
|
tracer_provider.get_tracer(policy_class.__module__),
|
|
@@ -9,6 +9,7 @@ from rasa.dialogue_understanding.generator import (
|
|
|
9
9
|
CompactLLMCommandGenerator,
|
|
10
10
|
LLMCommandGenerator,
|
|
11
11
|
MultiStepLLMCommandGenerator,
|
|
12
|
+
SearchReadyLLMCommandGenerator,
|
|
12
13
|
SingleStepLLMCommandGenerator,
|
|
13
14
|
)
|
|
14
15
|
from rasa.tracing.constants import (
|
|
@@ -17,7 +18,10 @@ from rasa.tracing.constants import (
|
|
|
17
18
|
COMPACT_LLM_COMMAND_GENERATOR_MEMORY_USAGE_METRIC_NAME,
|
|
18
19
|
COMPACT_LLM_COMMAND_GENERATOR_PROMPT_TOKEN_USAGE_METRIC_NAME,
|
|
19
20
|
CONTEXTUAL_RESPONSE_REPHRASER_LLM_RESPONSE_DURATION_METRIC_NAME,
|
|
21
|
+
ENTERPRISE_SEARCH_POLICY_CPU_USAGE_METRIC_NAME,
|
|
20
22
|
ENTERPRISE_SEARCH_POLICY_LLM_RESPONSE_DURATION_METRIC_NAME,
|
|
23
|
+
ENTERPRISE_SEARCH_POLICY_MEMORY_USAGE_METRIC_NAME,
|
|
24
|
+
ENTERPRISE_SEARCH_POLICY_PROMPT_TOKEN_USAGE_METRIC_NAME,
|
|
21
25
|
INTENTLESS_POLICY_LLM_RESPONSE_DURATION_METRIC_NAME,
|
|
22
26
|
LLM_COMMAND_GENERATOR_CPU_USAGE_METRIC_NAME,
|
|
23
27
|
LLM_COMMAND_GENERATOR_LLM_RESPONSE_DURATION_METRIC_NAME,
|
|
@@ -31,6 +35,10 @@ from rasa.tracing.constants import (
|
|
|
31
35
|
RASA_CLIENT_REQUEST_BODY_SIZE_METRIC_NAME,
|
|
32
36
|
RASA_CLIENT_REQUEST_DURATION_METRIC_NAME,
|
|
33
37
|
REQUEST_BODY_SIZE_IN_BYTES_ATTRIBUTE_NAME,
|
|
38
|
+
SEARCH_READY_LLM_COMMAND_GENERATOR_CPU_USAGE_METRIC_NAME,
|
|
39
|
+
SEARCH_READY_LLM_COMMAND_GENERATOR_LLM_RESPONSE_DURATION_METRIC_NAME,
|
|
40
|
+
SEARCH_READY_LLM_COMMAND_GENERATOR_MEMORY_USAGE_METRIC_NAME,
|
|
41
|
+
SEARCH_READY_LLM_COMMAND_GENERATOR_PROMPT_TOKEN_USAGE_METRIC_NAME,
|
|
34
42
|
SINGLE_STEP_LLM_COMMAND_GENERATOR_CPU_USAGE_METRIC_NAME,
|
|
35
43
|
SINGLE_STEP_LLM_COMMAND_GENERATOR_LLM_RESPONSE_DURATION_METRIC_NAME,
|
|
36
44
|
SINGLE_STEP_LLM_COMMAND_GENERATOR_MEMORY_USAGE_METRIC_NAME,
|
|
@@ -40,7 +48,7 @@ from rasa.tracing.metric_instrument_provider import MetricInstrumentProvider
|
|
|
40
48
|
from rasa.utils.endpoints import EndpointConfig
|
|
41
49
|
|
|
42
50
|
|
|
43
|
-
def
|
|
51
|
+
def record_llm_based_component_cpu_usage(
|
|
44
52
|
metric_instrument_provider: MetricInstrumentProvider,
|
|
45
53
|
metric_name: str,
|
|
46
54
|
) -> None:
|
|
@@ -60,8 +68,10 @@ def record_llm_based_command_generator_cpu_usage(
|
|
|
60
68
|
cpu_usage = psutil.cpu_percent()
|
|
61
69
|
metric_instrument.record(amount=cpu_usage)
|
|
62
70
|
|
|
71
|
+
return None
|
|
63
72
|
|
|
64
|
-
|
|
73
|
+
|
|
74
|
+
def record_llm_based_component_memory_usage(
|
|
65
75
|
metric_instrument_provider: MetricInstrumentProvider,
|
|
66
76
|
metric_name: str,
|
|
67
77
|
) -> None:
|
|
@@ -81,8 +91,10 @@ def record_llm_based_command_generator_memory_usage(
|
|
|
81
91
|
memory_usage = psutil.virtual_memory().percent
|
|
82
92
|
metric_instrument.record(amount=memory_usage)
|
|
83
93
|
|
|
94
|
+
return None
|
|
95
|
+
|
|
84
96
|
|
|
85
|
-
def
|
|
97
|
+
def record_llm_based_component_prompt_token(
|
|
86
98
|
metric_instrument_provider: MetricInstrumentProvider,
|
|
87
99
|
attributes: Dict[str, Any],
|
|
88
100
|
metric_name: str,
|
|
@@ -116,6 +128,8 @@ def record_llm_based_command_generator_prompt_token(
|
|
|
116
128
|
amount=prompt_tokens_len,
|
|
117
129
|
)
|
|
118
130
|
|
|
131
|
+
return None
|
|
132
|
+
|
|
119
133
|
|
|
120
134
|
def record_llm_command_generator_metrics(attributes: Dict[str, Any]) -> None:
|
|
121
135
|
"""
|
|
@@ -132,17 +146,18 @@ def record_llm_command_generator_metrics(attributes: Dict[str, Any]) -> None:
|
|
|
132
146
|
if not instrument_provider.instruments:
|
|
133
147
|
return None
|
|
134
148
|
|
|
135
|
-
|
|
149
|
+
record_llm_based_component_cpu_usage(
|
|
136
150
|
instrument_provider, LLM_COMMAND_GENERATOR_CPU_USAGE_METRIC_NAME
|
|
137
151
|
)
|
|
138
|
-
|
|
152
|
+
record_llm_based_component_memory_usage(
|
|
139
153
|
instrument_provider, LLM_COMMAND_GENERATOR_MEMORY_USAGE_METRIC_NAME
|
|
140
154
|
)
|
|
141
|
-
|
|
155
|
+
record_llm_based_component_prompt_token(
|
|
142
156
|
instrument_provider,
|
|
143
157
|
attributes,
|
|
144
158
|
LLM_COMMAND_GENERATOR_PROMPT_TOKEN_USAGE_METRIC_NAME,
|
|
145
159
|
)
|
|
160
|
+
return None
|
|
146
161
|
|
|
147
162
|
|
|
148
163
|
def record_single_step_llm_command_generator_metrics(
|
|
@@ -162,17 +177,18 @@ def record_single_step_llm_command_generator_metrics(
|
|
|
162
177
|
if not instrument_provider.instruments:
|
|
163
178
|
return None
|
|
164
179
|
|
|
165
|
-
|
|
180
|
+
record_llm_based_component_cpu_usage(
|
|
166
181
|
instrument_provider, SINGLE_STEP_LLM_COMMAND_GENERATOR_CPU_USAGE_METRIC_NAME
|
|
167
182
|
)
|
|
168
|
-
|
|
183
|
+
record_llm_based_component_memory_usage(
|
|
169
184
|
instrument_provider, SINGLE_STEP_LLM_COMMAND_GENERATOR_MEMORY_USAGE_METRIC_NAME
|
|
170
185
|
)
|
|
171
|
-
|
|
186
|
+
record_llm_based_component_prompt_token(
|
|
172
187
|
instrument_provider,
|
|
173
188
|
attributes,
|
|
174
189
|
SINGLE_STEP_LLM_COMMAND_GENERATOR_PROMPT_TOKEN_USAGE_METRIC_NAME,
|
|
175
190
|
)
|
|
191
|
+
return None
|
|
176
192
|
|
|
177
193
|
|
|
178
194
|
def record_compact_llm_command_generator_metrics(
|
|
@@ -192,17 +208,49 @@ def record_compact_llm_command_generator_metrics(
|
|
|
192
208
|
if not instrument_provider.instruments:
|
|
193
209
|
return None
|
|
194
210
|
|
|
195
|
-
|
|
211
|
+
record_llm_based_component_cpu_usage(
|
|
196
212
|
instrument_provider, COMPACT_LLM_COMMAND_GENERATOR_CPU_USAGE_METRIC_NAME
|
|
197
213
|
)
|
|
198
|
-
|
|
214
|
+
record_llm_based_component_memory_usage(
|
|
199
215
|
instrument_provider, COMPACT_LLM_COMMAND_GENERATOR_MEMORY_USAGE_METRIC_NAME
|
|
200
216
|
)
|
|
201
|
-
|
|
217
|
+
record_llm_based_component_prompt_token(
|
|
202
218
|
instrument_provider,
|
|
203
219
|
attributes,
|
|
204
220
|
COMPACT_LLM_COMMAND_GENERATOR_PROMPT_TOKEN_USAGE_METRIC_NAME,
|
|
205
221
|
)
|
|
222
|
+
return None
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
def record_search_ready_llm_command_generator_metrics(
|
|
226
|
+
attributes: Dict[str, Any],
|
|
227
|
+
) -> None:
|
|
228
|
+
"""
|
|
229
|
+
Record measurements for SearchReadyLLMCommandGenerator specific metrics.
|
|
230
|
+
|
|
231
|
+
The recording is done by the opentelemetry.metrics.Histogram instruments.
|
|
232
|
+
These instruments are registered to the MetricInstrumentProvider internal singleton.
|
|
233
|
+
|
|
234
|
+
:param attributes: Extracted tracing attributes
|
|
235
|
+
:return: None
|
|
236
|
+
"""
|
|
237
|
+
instrument_provider = MetricInstrumentProvider()
|
|
238
|
+
|
|
239
|
+
if not instrument_provider.instruments:
|
|
240
|
+
return None
|
|
241
|
+
|
|
242
|
+
record_llm_based_component_cpu_usage(
|
|
243
|
+
instrument_provider, SEARCH_READY_LLM_COMMAND_GENERATOR_CPU_USAGE_METRIC_NAME
|
|
244
|
+
)
|
|
245
|
+
record_llm_based_component_memory_usage(
|
|
246
|
+
instrument_provider, SEARCH_READY_LLM_COMMAND_GENERATOR_MEMORY_USAGE_METRIC_NAME
|
|
247
|
+
)
|
|
248
|
+
record_llm_based_component_prompt_token(
|
|
249
|
+
instrument_provider,
|
|
250
|
+
attributes,
|
|
251
|
+
SEARCH_READY_LLM_COMMAND_GENERATOR_PROMPT_TOKEN_USAGE_METRIC_NAME,
|
|
252
|
+
)
|
|
253
|
+
return None
|
|
206
254
|
|
|
207
255
|
|
|
208
256
|
def record_multi_step_llm_command_generator_metrics(attributes: Dict[str, Any]) -> None:
|
|
@@ -220,17 +268,47 @@ def record_multi_step_llm_command_generator_metrics(attributes: Dict[str, Any])
|
|
|
220
268
|
if not instrument_provider.instruments:
|
|
221
269
|
return None
|
|
222
270
|
|
|
223
|
-
|
|
271
|
+
record_llm_based_component_cpu_usage(
|
|
224
272
|
instrument_provider, MULTI_STEP_LLM_COMMAND_GENERATOR_CPU_USAGE_METRIC_NAME
|
|
225
273
|
)
|
|
226
|
-
|
|
274
|
+
record_llm_based_component_memory_usage(
|
|
227
275
|
instrument_provider, MULTI_STEP_LLM_COMMAND_GENERATOR_MEMORY_USAGE_METRIC_NAME
|
|
228
276
|
)
|
|
229
|
-
|
|
277
|
+
record_llm_based_component_prompt_token(
|
|
230
278
|
instrument_provider,
|
|
231
279
|
attributes,
|
|
232
280
|
MULTI_STEP_LLM_COMMAND_GENERATOR_PROMPT_TOKEN_USAGE_METRIC_NAME,
|
|
233
281
|
)
|
|
282
|
+
return None
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
def record_enterprise_search_policy_metrics(attributes: Dict[str, Any]) -> None:
|
|
286
|
+
"""
|
|
287
|
+
Record measurements for EnterpriseSearchPolicy specific metrics.
|
|
288
|
+
|
|
289
|
+
The recording is done by the opentelemetry.metrics.Histogram instruments.
|
|
290
|
+
These instruments are registered to the MetricInstrumentProvider internal singleton.
|
|
291
|
+
|
|
292
|
+
:param attributes: Extracted tracing attributes
|
|
293
|
+
:return: None
|
|
294
|
+
"""
|
|
295
|
+
instrument_provider = MetricInstrumentProvider()
|
|
296
|
+
|
|
297
|
+
if not instrument_provider.instruments:
|
|
298
|
+
return None
|
|
299
|
+
|
|
300
|
+
record_llm_based_component_cpu_usage(
|
|
301
|
+
instrument_provider, ENTERPRISE_SEARCH_POLICY_CPU_USAGE_METRIC_NAME
|
|
302
|
+
)
|
|
303
|
+
record_llm_based_component_memory_usage(
|
|
304
|
+
instrument_provider, ENTERPRISE_SEARCH_POLICY_MEMORY_USAGE_METRIC_NAME
|
|
305
|
+
)
|
|
306
|
+
record_llm_based_component_prompt_token(
|
|
307
|
+
instrument_provider,
|
|
308
|
+
attributes,
|
|
309
|
+
ENTERPRISE_SEARCH_POLICY_PROMPT_TOKEN_USAGE_METRIC_NAME,
|
|
310
|
+
)
|
|
311
|
+
return None
|
|
234
312
|
|
|
235
313
|
|
|
236
314
|
def record_callable_duration_metrics(
|
|
@@ -276,6 +354,11 @@ def record_callable_duration_metrics(
|
|
|
276
354
|
COMPACT_LLM_COMMAND_GENERATOR_LLM_RESPONSE_DURATION_METRIC_NAME
|
|
277
355
|
)
|
|
278
356
|
|
|
357
|
+
if type(self) == SearchReadyLLMCommandGenerator:
|
|
358
|
+
metric_instrument = instrument_provider.get_instrument(
|
|
359
|
+
SEARCH_READY_LLM_COMMAND_GENERATOR_LLM_RESPONSE_DURATION_METRIC_NAME
|
|
360
|
+
)
|
|
361
|
+
|
|
279
362
|
if type(self) == MultiStepLLMCommandGenerator:
|
|
280
363
|
metric_instrument = instrument_provider.get_instrument(
|
|
281
364
|
MULTI_STEP_LLM_COMMAND_GENERATOR_LLM_RESPONSE_DURATION_METRIC_NAME
|