rasa-pro 3.8.18__py3-none-any.whl → 3.9.15__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.
- README.md +6 -42
- rasa/__main__.py +14 -9
- rasa/anonymization/anonymization_pipeline.py +0 -1
- rasa/anonymization/anonymization_rule_executor.py +3 -3
- rasa/anonymization/utils.py +4 -3
- rasa/api.py +2 -2
- rasa/cli/arguments/default_arguments.py +1 -1
- rasa/cli/arguments/run.py +2 -2
- rasa/cli/arguments/test.py +1 -1
- rasa/cli/arguments/train.py +10 -10
- rasa/cli/e2e_test.py +27 -7
- rasa/cli/export.py +0 -1
- rasa/cli/license.py +3 -3
- rasa/cli/project_templates/calm/actions/action_template.py +1 -1
- rasa/cli/project_templates/calm/config.yml +1 -1
- rasa/cli/project_templates/calm/credentials.yml +1 -1
- rasa/cli/project_templates/calm/data/flows/add_contact.yml +1 -1
- rasa/cli/project_templates/calm/data/flows/remove_contact.yml +1 -1
- rasa/cli/project_templates/calm/domain/add_contact.yml +8 -2
- rasa/cli/project_templates/calm/domain/list_contacts.yml +3 -0
- rasa/cli/project_templates/calm/domain/remove_contact.yml +9 -2
- rasa/cli/project_templates/calm/domain/shared.yml +5 -0
- rasa/cli/project_templates/calm/endpoints.yml +4 -4
- rasa/cli/project_templates/default/actions/actions.py +1 -1
- rasa/cli/project_templates/default/config.yml +5 -5
- rasa/cli/project_templates/default/credentials.yml +1 -1
- rasa/cli/project_templates/default/endpoints.yml +4 -4
- rasa/cli/project_templates/default/tests/test_stories.yml +1 -1
- rasa/cli/project_templates/tutorial/config.yml +1 -1
- rasa/cli/project_templates/tutorial/credentials.yml +1 -1
- rasa/cli/project_templates/tutorial/data/patterns.yml +6 -0
- rasa/cli/project_templates/tutorial/domain.yml +4 -0
- rasa/cli/project_templates/tutorial/endpoints.yml +6 -6
- rasa/cli/run.py +0 -1
- rasa/cli/scaffold.py +3 -2
- rasa/cli/studio/download.py +11 -0
- rasa/cli/studio/studio.py +180 -24
- rasa/cli/studio/upload.py +0 -8
- rasa/cli/telemetry.py +18 -6
- rasa/cli/utils.py +21 -10
- rasa/cli/x.py +3 -2
- rasa/constants.py +1 -1
- rasa/core/actions/action.py +90 -315
- rasa/core/actions/action_exceptions.py +24 -0
- rasa/core/actions/constants.py +3 -0
- rasa/core/actions/custom_action_executor.py +188 -0
- rasa/core/actions/forms.py +11 -7
- rasa/core/actions/grpc_custom_action_executor.py +251 -0
- rasa/core/actions/http_custom_action_executor.py +140 -0
- rasa/core/actions/loops.py +3 -0
- rasa/core/actions/two_stage_fallback.py +1 -1
- rasa/core/agent.py +2 -4
- rasa/core/brokers/pika.py +1 -2
- rasa/core/channels/audiocodes.py +1 -1
- rasa/core/channels/botframework.py +0 -1
- rasa/core/channels/callback.py +0 -1
- rasa/core/channels/console.py +6 -8
- rasa/core/channels/development_inspector.py +1 -1
- rasa/core/channels/facebook.py +0 -3
- rasa/core/channels/hangouts.py +0 -6
- rasa/core/channels/inspector/dist/assets/{arc-5623b6dc.js → arc-b6e548fe.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{c4Diagram-d0fbc5ce-685c106a.js → c4Diagram-d0fbc5ce-fa03ac9e.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{classDiagram-936ed81e-8cbed007.js → classDiagram-936ed81e-ee67392a.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{classDiagram-v2-c3cb15f1-5889cf12.js → classDiagram-v2-c3cb15f1-9b283fae.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{createText-62fc7601-24c249d7.js → createText-62fc7601-8b6fcc2a.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{edges-f2ad444c-7dd06a75.js → edges-f2ad444c-22e77f4f.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{erDiagram-9d236eb7-62c1e54c.js → erDiagram-9d236eb7-60ffc87f.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{flowDb-1972c806-ce49b86f.js → flowDb-1972c806-9dd802e4.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{flowDiagram-7ea5b25a-4067e48f.js → flowDiagram-7ea5b25a-5fa1912f.js} +1 -1
- rasa/core/channels/inspector/dist/assets/flowDiagram-v2-855bc5b3-1844e5a5.js +1 -0
- rasa/core/channels/inspector/dist/assets/{flowchart-elk-definition-abe16c3d-59fe4051.js → flowchart-elk-definition-abe16c3d-622a1fd2.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{ganttDiagram-9b5ea136-47e3a43b.js → ganttDiagram-9b5ea136-e285a63a.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{gitGraphDiagram-99d0ae7c-5a2ac0d9.js → gitGraphDiagram-99d0ae7c-f237bdca.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{index-2c4b9a3b-dfb8efc4.js → index-2c4b9a3b-4b03d70e.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{index-268a75c0.js → index-a5d3e69d.js} +4 -4
- rasa/core/channels/inspector/dist/assets/{infoDiagram-736b4530-b0c470f2.js → infoDiagram-736b4530-72a0fa5f.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{journeyDiagram-df861f2b-2edb829a.js → journeyDiagram-df861f2b-82218c41.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{layout-b6873d69.js → layout-78cff630.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{line-1efc5781.js → line-5038b469.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{linear-661e9b94.js → linear-c4fc4098.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{mindmap-definition-beec6740-2d2e727f.js → mindmap-definition-beec6740-c33c8ea6.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{pieDiagram-dbbf0591-9d3ea93d.js → pieDiagram-dbbf0591-a8d03059.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{quadrantDiagram-4d7f4fd6-06a178a2.js → quadrantDiagram-4d7f4fd6-6a0e56b2.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{requirementDiagram-6fc4c22a-0bfedffc.js → requirementDiagram-6fc4c22a-2dc7c7bd.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{sankeyDiagram-8f13d901-d76d0a04.js → sankeyDiagram-8f13d901-2360fe39.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{sequenceDiagram-b655622a-37bb4341.js → sequenceDiagram-b655622a-41b9f9ad.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{stateDiagram-59f0c015-f52f7f57.js → stateDiagram-59f0c015-0aad326f.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{stateDiagram-v2-2b26beab-4a986a20.js → stateDiagram-v2-2b26beab-9847d984.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{styles-080da4f6-7dd9ae12.js → styles-080da4f6-564d890e.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{styles-3dcbcfbf-46e1ca14.js → styles-3dcbcfbf-38957613.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{styles-9c745c82-4a97439a.js → styles-9c745c82-f0fc6921.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{svgDrawCommon-4835440b-823917a3.js → svgDrawCommon-4835440b-ef3c5a77.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{timeline-definition-5b62e21b-9ea72896.js → timeline-definition-5b62e21b-bf3e91c1.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{xychartDiagram-2b33534f-b631a8b6.js → xychartDiagram-2b33534f-4d4026c0.js} +1 -1
- rasa/core/channels/inspector/dist/index.html +1 -1
- rasa/core/channels/inspector/src/components/DiagramFlow.tsx +10 -0
- rasa/core/channels/inspector/src/helpers/formatters.test.ts +4 -7
- rasa/core/channels/inspector/src/helpers/formatters.ts +3 -2
- rasa/core/channels/rest.py +36 -21
- rasa/core/channels/rocketchat.py +0 -1
- rasa/core/channels/socketio.py +1 -1
- rasa/core/channels/telegram.py +3 -3
- rasa/core/channels/webexteams.py +0 -1
- rasa/core/concurrent_lock_store.py +1 -1
- rasa/core/evaluation/marker_base.py +1 -3
- rasa/core/evaluation/marker_stats.py +1 -2
- rasa/core/featurizers/single_state_featurizer.py +3 -26
- rasa/core/featurizers/tracker_featurizers.py +18 -122
- rasa/core/information_retrieval/__init__.py +7 -0
- rasa/core/information_retrieval/faiss.py +9 -4
- rasa/core/information_retrieval/information_retrieval.py +64 -7
- rasa/core/information_retrieval/milvus.py +7 -14
- rasa/core/information_retrieval/qdrant.py +8 -15
- rasa/core/lock_store.py +0 -1
- rasa/core/migrate.py +1 -2
- rasa/core/nlg/callback.py +3 -4
- rasa/core/policies/enterprise_search_policy.py +86 -22
- rasa/core/policies/enterprise_search_prompt_template.jinja2 +4 -41
- rasa/core/policies/enterprise_search_prompt_with_citation_template.jinja2 +60 -0
- rasa/core/policies/flows/flow_executor.py +104 -2
- rasa/core/policies/intentless_policy.py +7 -9
- rasa/core/policies/memoization.py +3 -3
- rasa/core/policies/policy.py +18 -9
- rasa/core/policies/rule_policy.py +8 -11
- rasa/core/policies/ted_policy.py +61 -88
- rasa/core/policies/unexpected_intent_policy.py +8 -17
- rasa/core/processor.py +136 -47
- rasa/core/run.py +41 -25
- rasa/core/secrets_manager/endpoints.py +2 -2
- rasa/core/secrets_manager/vault.py +6 -8
- rasa/core/test.py +3 -5
- rasa/core/tracker_store.py +49 -14
- rasa/core/train.py +1 -3
- rasa/core/training/interactive.py +9 -6
- rasa/core/utils.py +5 -10
- rasa/dialogue_understanding/coexistence/intent_based_router.py +11 -4
- rasa/dialogue_understanding/coexistence/llm_based_router.py +2 -3
- rasa/dialogue_understanding/commands/__init__.py +4 -0
- rasa/dialogue_understanding/commands/can_not_handle_command.py +9 -0
- rasa/dialogue_understanding/commands/cancel_flow_command.py +9 -0
- rasa/dialogue_understanding/commands/change_flow_command.py +38 -0
- rasa/dialogue_understanding/commands/chit_chat_answer_command.py +9 -0
- rasa/dialogue_understanding/commands/clarify_command.py +9 -0
- rasa/dialogue_understanding/commands/correct_slots_command.py +9 -0
- rasa/dialogue_understanding/commands/error_command.py +12 -0
- rasa/dialogue_understanding/commands/handle_code_change_command.py +9 -0
- rasa/dialogue_understanding/commands/human_handoff_command.py +9 -0
- rasa/dialogue_understanding/commands/knowledge_answer_command.py +9 -0
- rasa/dialogue_understanding/commands/noop_command.py +9 -0
- rasa/dialogue_understanding/commands/set_slot_command.py +38 -3
- rasa/dialogue_understanding/commands/skip_question_command.py +9 -0
- rasa/dialogue_understanding/commands/start_flow_command.py +9 -0
- rasa/dialogue_understanding/generator/__init__.py +16 -1
- rasa/dialogue_understanding/generator/command_generator.py +92 -6
- rasa/dialogue_understanding/generator/constants.py +18 -0
- rasa/dialogue_understanding/generator/flow_retrieval.py +7 -5
- rasa/dialogue_understanding/generator/llm_based_command_generator.py +467 -0
- rasa/dialogue_understanding/generator/llm_command_generator.py +39 -609
- rasa/dialogue_understanding/generator/multi_step/__init__.py +0 -0
- rasa/dialogue_understanding/generator/multi_step/fill_slots_prompt.jinja2 +62 -0
- rasa/dialogue_understanding/generator/multi_step/handle_flows_prompt.jinja2 +38 -0
- rasa/dialogue_understanding/generator/multi_step/multi_step_llm_command_generator.py +827 -0
- rasa/dialogue_understanding/generator/nlu_command_adapter.py +69 -8
- rasa/dialogue_understanding/generator/single_step/__init__.py +0 -0
- rasa/dialogue_understanding/generator/single_step/single_step_llm_command_generator.py +345 -0
- rasa/dialogue_understanding/patterns/default_flows_for_patterns.yml +36 -31
- rasa/dialogue_understanding/processor/command_processor.py +112 -3
- rasa/e2e_test/constants.py +1 -0
- rasa/e2e_test/e2e_test_case.py +44 -0
- rasa/e2e_test/e2e_test_runner.py +114 -11
- rasa/e2e_test/e2e_test_schema.yml +18 -0
- rasa/engine/caching.py +0 -1
- rasa/engine/graph.py +18 -6
- rasa/engine/recipes/config_files/default_config.yml +3 -3
- rasa/engine/recipes/default_components.py +1 -1
- rasa/engine/recipes/default_recipe.py +4 -5
- rasa/engine/recipes/recipe.py +1 -1
- rasa/engine/runner/dask.py +3 -9
- rasa/engine/storage/local_model_storage.py +0 -2
- rasa/engine/validation.py +179 -145
- rasa/exceptions.py +2 -2
- rasa/graph_components/validators/default_recipe_validator.py +3 -5
- rasa/hooks.py +0 -1
- rasa/model.py +1 -1
- rasa/model_training.py +1 -0
- rasa/nlu/classifiers/diet_classifier.py +33 -52
- rasa/nlu/classifiers/logistic_regression_classifier.py +9 -22
- rasa/nlu/classifiers/sklearn_intent_classifier.py +16 -37
- rasa/nlu/extractors/crf_entity_extractor.py +54 -97
- rasa/nlu/extractors/duckling_entity_extractor.py +1 -1
- rasa/nlu/featurizers/dense_featurizer/convert_featurizer.py +1 -5
- rasa/nlu/featurizers/dense_featurizer/lm_featurizer.py +0 -4
- rasa/nlu/featurizers/featurizer.py +1 -1
- rasa/nlu/featurizers/sparse_featurizer/count_vectors_featurizer.py +18 -49
- rasa/nlu/featurizers/sparse_featurizer/lexical_syntactic_featurizer.py +26 -64
- rasa/nlu/featurizers/sparse_featurizer/regex_featurizer.py +3 -5
- rasa/nlu/persistor.py +68 -26
- rasa/nlu/selectors/response_selector.py +7 -10
- rasa/nlu/test.py +0 -3
- rasa/nlu/utils/hugging_face/registry.py +1 -1
- rasa/nlu/utils/spacy_utils.py +1 -3
- rasa/server.py +22 -7
- rasa/shared/constants.py +12 -1
- rasa/shared/core/command_payload_reader.py +109 -0
- rasa/shared/core/constants.py +4 -5
- rasa/shared/core/domain.py +57 -56
- rasa/shared/core/events.py +4 -7
- rasa/shared/core/flows/flow.py +9 -0
- rasa/shared/core/flows/flows_list.py +12 -0
- rasa/shared/core/flows/steps/action.py +7 -2
- rasa/shared/core/generator.py +12 -11
- rasa/shared/core/slot_mappings.py +315 -24
- rasa/shared/core/slots.py +4 -2
- rasa/shared/core/trackers.py +32 -14
- rasa/shared/core/training_data/loading.py +0 -1
- rasa/shared/core/training_data/story_reader/story_reader.py +3 -3
- rasa/shared/core/training_data/story_reader/yaml_story_reader.py +11 -11
- rasa/shared/core/training_data/story_writer/yaml_story_writer.py +5 -3
- rasa/shared/core/training_data/structures.py +1 -1
- rasa/shared/core/training_data/visualization.py +1 -1
- rasa/shared/data.py +58 -1
- rasa/shared/exceptions.py +36 -2
- rasa/shared/importers/importer.py +1 -2
- rasa/shared/importers/rasa.py +0 -1
- rasa/shared/nlu/constants.py +2 -0
- rasa/shared/nlu/training_data/entities_parser.py +1 -2
- rasa/shared/nlu/training_data/features.py +2 -120
- rasa/shared/nlu/training_data/formats/dialogflow.py +3 -2
- rasa/shared/nlu/training_data/formats/rasa_yaml.py +3 -5
- rasa/shared/nlu/training_data/formats/readerwriter.py +0 -1
- rasa/shared/nlu/training_data/message.py +13 -0
- rasa/shared/nlu/training_data/training_data.py +0 -2
- rasa/shared/providers/openai/session_handler.py +2 -2
- rasa/shared/utils/constants.py +3 -0
- rasa/shared/utils/io.py +11 -1
- rasa/shared/utils/llm.py +1 -2
- rasa/shared/utils/pykwalify_extensions.py +1 -0
- rasa/shared/utils/schemas/domain.yml +3 -0
- rasa/shared/utils/yaml.py +44 -35
- rasa/studio/auth.py +26 -10
- rasa/studio/constants.py +2 -0
- rasa/studio/data_handler.py +114 -107
- rasa/studio/download.py +160 -27
- rasa/studio/results_logger.py +137 -0
- rasa/studio/train.py +6 -7
- rasa/studio/upload.py +159 -134
- rasa/telemetry.py +188 -34
- rasa/tracing/config.py +18 -3
- rasa/tracing/constants.py +26 -2
- rasa/tracing/instrumentation/attribute_extractors.py +50 -41
- rasa/tracing/instrumentation/instrumentation.py +290 -44
- rasa/tracing/instrumentation/intentless_policy_instrumentation.py +7 -5
- rasa/tracing/instrumentation/metrics.py +109 -21
- rasa/tracing/metric_instrument_provider.py +83 -3
- rasa/utils/cli.py +2 -1
- rasa/utils/common.py +1 -1
- rasa/utils/endpoints.py +1 -2
- rasa/utils/io.py +72 -6
- rasa/utils/licensing.py +246 -31
- rasa/utils/ml_utils.py +1 -1
- rasa/utils/tensorflow/data_generator.py +1 -1
- rasa/utils/tensorflow/environment.py +1 -1
- rasa/utils/tensorflow/model_data.py +201 -12
- rasa/utils/tensorflow/model_data_utils.py +499 -500
- rasa/utils/tensorflow/models.py +5 -6
- rasa/utils/tensorflow/rasa_layers.py +15 -15
- rasa/utils/train_utils.py +1 -1
- rasa/utils/url_tools.py +53 -0
- rasa/validator.py +305 -3
- rasa/version.py +1 -1
- {rasa_pro-3.8.18.dist-info → rasa_pro-3.9.15.dist-info}/METADATA +25 -61
- {rasa_pro-3.8.18.dist-info → rasa_pro-3.9.15.dist-info}/RECORD +276 -259
- rasa/core/channels/inspector/dist/assets/flowDiagram-v2-855bc5b3-85583a23.js +0 -1
- rasa/utils/tensorflow/feature_array.py +0 -370
- /rasa/dialogue_understanding/generator/{command_prompt_template.jinja2 → single_step/command_prompt_template.jinja2} +0 -0
- {rasa_pro-3.8.18.dist-info → rasa_pro-3.9.15.dist-info}/NOTICE +0 -0
- {rasa_pro-3.8.18.dist-info → rasa_pro-3.9.15.dist-info}/WHEEL +0 -0
- {rasa_pro-3.8.18.dist-info → rasa_pro-3.9.15.dist-info}/entry_points.txt +0 -0
rasa/telemetry.py
CHANGED
|
@@ -32,6 +32,7 @@ from rasa.constants import (
|
|
|
32
32
|
CONFIG_TELEMETRY_ENABLED,
|
|
33
33
|
CONFIG_TELEMETRY_ID,
|
|
34
34
|
)
|
|
35
|
+
from rasa.shared.constants import PROMPT_CONFIG_KEY, PROMPT_TEMPLATE_CONFIG_KEY
|
|
35
36
|
from rasa.engine.storage.local_model_storage import LocalModelStorage
|
|
36
37
|
from rasa.shared.constants import DOCS_URL_TELEMETRY, UTTER_ASK_PREFIX
|
|
37
38
|
from rasa.shared.core.flows import Flow
|
|
@@ -43,7 +44,6 @@ from rasa.shared.core.flows.steps import (
|
|
|
43
44
|
)
|
|
44
45
|
from rasa.shared.exceptions import RasaException
|
|
45
46
|
from rasa.utils import common as rasa_utils
|
|
46
|
-
from rasa.utils.licensing import property_of_active_license, get_license_hash
|
|
47
47
|
|
|
48
48
|
if typing.TYPE_CHECKING:
|
|
49
49
|
from rasa.core.brokers.broker import EventBroker
|
|
@@ -53,7 +53,7 @@ if typing.TYPE_CHECKING:
|
|
|
53
53
|
from rasa.shared.nlu.training_data.training_data import TrainingData
|
|
54
54
|
from rasa.shared.importers.importer import TrainingDataImporter
|
|
55
55
|
from rasa.core.utils import AvailableEndpoints
|
|
56
|
-
from rasa.e2e_test.e2e_test_case import TestCase, Fixture
|
|
56
|
+
from rasa.e2e_test.e2e_test_case import TestCase, Fixture, Metadata
|
|
57
57
|
|
|
58
58
|
logger = logging.getLogger(__name__)
|
|
59
59
|
|
|
@@ -93,7 +93,8 @@ CI_ENVIRONMENT_TELL = [
|
|
|
93
93
|
]
|
|
94
94
|
|
|
95
95
|
# If updating or creating a new event, remember to update
|
|
96
|
-
# https://rasa.com/docs/rasa/telemetry
|
|
96
|
+
# https://rasa.com/docs/rasa-pro/telemetry/telemetry OR
|
|
97
|
+
# https://rasa.com/docs/rasa-pro/telemetry/reference
|
|
97
98
|
TRAINING_STARTED_EVENT = "Training Started"
|
|
98
99
|
TRAINING_COMPLETED_EVENT = "Training Completed"
|
|
99
100
|
TELEMETRY_DISABLED_EVENT = "Telemetry Disabled"
|
|
@@ -124,6 +125,18 @@ TELEMETRY_INTENTLESS_POLICY_PREDICT_EVENT = "Intentless Policy Predicted"
|
|
|
124
125
|
TELEMETRY_LLM_INTENT_PREDICT_EVENT = "LLM Intent Predicted"
|
|
125
126
|
TELEMETRY_LLM_INTENT_TRAIN_COMPLETED_EVENT = "LLM Intent Training Completed"
|
|
126
127
|
TELEMETRY_E2E_TEST_RUN_STARTED_EVENT = "E2E Test Run Started"
|
|
128
|
+
TELEMETRY_ENTERPRISE_SEARCH_POLICY_TRAINING_STARTED_EVENT = (
|
|
129
|
+
"Enterprise Search Policy Training Started"
|
|
130
|
+
)
|
|
131
|
+
TELEMETRY_ENTERPRISE_SEARCH_POLICY_TRAINING_COMPLETED_EVENT = (
|
|
132
|
+
"Enterprise Search Policy Training Completed"
|
|
133
|
+
)
|
|
134
|
+
TELEMETRY_ENTERPRISE_SEARCH_POLICY_PREDICT_EVENT = "Enterprise Search Policy Predicted"
|
|
135
|
+
|
|
136
|
+
# licensing events
|
|
137
|
+
TELEMETRY_CONVERSATION_COUNT = "Conversation Count"
|
|
138
|
+
TELEMETRY_CONVERSATION_SOFT_LIMIT_REACHED = "Conversation Soft Limit Reached"
|
|
139
|
+
TELEMETRY_CONVERSATION_HARD_LIMIT_REACHED = "Conversation Hard Limit Reached"
|
|
127
140
|
|
|
128
141
|
# used to calculate the context on the first call and cache it afterwards
|
|
129
142
|
TELEMETRY_CONTEXT = None
|
|
@@ -147,6 +160,12 @@ NUM_CALL_STEPS = "num_call_steps"
|
|
|
147
160
|
NUM_SHARED_SLOTS_BETWEEN_FLOWS = "num_shared_slots_between_flows"
|
|
148
161
|
LLM_COMMAND_GENERATOR_MODEL_NAME = "llm_command_generator_model_name"
|
|
149
162
|
LLM_COMMAND_GENERATOR_CUSTOM_PROMPT_USED = "llm_command_generator_custom_prompt_used"
|
|
163
|
+
MULTI_STEP_LLM_COMMAND_GENERATOR_HANDLE_FLOWS_PROMPT_USED = (
|
|
164
|
+
"multi_step_llm_command_generator_custom_handle_flows_prompt_used"
|
|
165
|
+
)
|
|
166
|
+
MULTI_STEP_LLM_COMMAND_GENERATOR_FILL_SLOTS_PROMPT_USED = (
|
|
167
|
+
"multi_step_llm_command_generator_custom_fill_slots_prompt_used"
|
|
168
|
+
)
|
|
150
169
|
FLOW_RETRIEVAL_ENABLED = "flow_retrieval_enabled"
|
|
151
170
|
FLOW_RETRIEVAL_EMBEDDING_MODEL_NAME = "flow_retrieval_embedding_model_name"
|
|
152
171
|
TRACING_BACKEND = "tracing_backend"
|
|
@@ -158,7 +177,7 @@ def print_telemetry_reporting_info() -> None:
|
|
|
158
177
|
"""Print telemetry information to std out."""
|
|
159
178
|
message = textwrap.dedent(
|
|
160
179
|
f"""
|
|
161
|
-
Rasa
|
|
180
|
+
Rasa Pro reports anonymous usage telemetry to help improve the product
|
|
162
181
|
for all its users.
|
|
163
182
|
|
|
164
183
|
If you'd like to opt-out, you can use `rasa telemetry disable`.
|
|
@@ -225,6 +244,12 @@ def is_telemetry_enabled() -> bool:
|
|
|
225
244
|
Returns:
|
|
226
245
|
`True`, if telemetry is enabled, `False` otherwise.
|
|
227
246
|
"""
|
|
247
|
+
from rasa.utils import licensing
|
|
248
|
+
|
|
249
|
+
if licensing.is_champion_server_license():
|
|
250
|
+
logger.debug("Telemetry is enabled for developer licenses.")
|
|
251
|
+
return True
|
|
252
|
+
|
|
228
253
|
telemetry_environ = os.environ.get(TELEMETRY_ENABLED_ENVIRONMENT_VARIABLE)
|
|
229
254
|
|
|
230
255
|
if telemetry_environ is not None:
|
|
@@ -336,7 +361,7 @@ def telemetry_write_key() -> Optional[Text]:
|
|
|
336
361
|
"""Read the Segment write key from the segment key text file.
|
|
337
362
|
|
|
338
363
|
The segment key text file should by present only in wheel/sdist packaged
|
|
339
|
-
versions of Rasa
|
|
364
|
+
versions of Rasa Pro. This avoids running telemetry locally when
|
|
340
365
|
developing on Rasa or when running CI builds.
|
|
341
366
|
|
|
342
367
|
In local development, this should always return `None` to avoid logging telemetry.
|
|
@@ -542,7 +567,7 @@ def _is_docker() -> bool:
|
|
|
542
567
|
|
|
543
568
|
|
|
544
569
|
def with_default_context_fields(
|
|
545
|
-
context: Optional[Dict[Text, Any]] = None
|
|
570
|
+
context: Optional[Dict[Text, Any]] = None,
|
|
546
571
|
) -> Dict[Text, Any]:
|
|
547
572
|
"""Return a new context dictionary with default and provided field values merged.
|
|
548
573
|
|
|
@@ -565,6 +590,8 @@ def _default_context_fields() -> Dict[Text, Any]:
|
|
|
565
590
|
Return:
|
|
566
591
|
A new context containing information about the runtime environment.
|
|
567
592
|
"""
|
|
593
|
+
from rasa.utils.licensing import property_of_active_license, get_license_hash
|
|
594
|
+
|
|
568
595
|
global TELEMETRY_CONTEXT
|
|
569
596
|
|
|
570
597
|
if not TELEMETRY_CONTEXT:
|
|
@@ -600,7 +627,7 @@ def _track(
|
|
|
600
627
|
|
|
601
628
|
It is OK to use this function from outside telemetry.py, but note that it
|
|
602
629
|
is recommended to create a new track_xyz() function for complex telemetry
|
|
603
|
-
events, or events that are generated from many parts of the Rasa
|
|
630
|
+
events, or events that are generated from many parts of the Rasa Pro code.
|
|
604
631
|
|
|
605
632
|
Args:
|
|
606
633
|
event_name: Name of the event.
|
|
@@ -714,6 +741,8 @@ def get_telemetry_id() -> Optional[Text]:
|
|
|
714
741
|
Returns:
|
|
715
742
|
The identifier, if it is configured correctly.
|
|
716
743
|
"""
|
|
744
|
+
from rasa.utils.licensing import property_of_active_license
|
|
745
|
+
|
|
717
746
|
return property_of_active_license(lambda active_license: active_license.jti)
|
|
718
747
|
|
|
719
748
|
|
|
@@ -1043,12 +1072,25 @@ def _collect_flow_statistics(flows: List[Flow]) -> Dict[str, Any]:
|
|
|
1043
1072
|
|
|
1044
1073
|
|
|
1045
1074
|
def _get_llm_command_generator_config(config: Dict[str, Any]) -> Optional[Dict]:
|
|
1046
|
-
"""Returns the configuration for the LLMCommandGenerator
|
|
1047
|
-
|
|
1048
|
-
|
|
1075
|
+
"""Returns the configuration for the LLMCommandGenerator.
|
|
1076
|
+
|
|
1077
|
+
Includes the model name, whether a custom prompt is used, whether flow
|
|
1078
|
+
retrieval is enabled, and flow retrieval embedding model.
|
|
1049
1079
|
"""
|
|
1050
|
-
from rasa.
|
|
1051
|
-
|
|
1080
|
+
from rasa.shared.constants import (
|
|
1081
|
+
MODEL_CONFIG_KEY,
|
|
1082
|
+
MODEL_NAME_CONFIG_KEY,
|
|
1083
|
+
)
|
|
1084
|
+
from rasa.dialogue_understanding.generator import (
|
|
1085
|
+
LLMCommandGenerator,
|
|
1086
|
+
SingleStepLLMCommandGenerator,
|
|
1087
|
+
MultiStepLLMCommandGenerator,
|
|
1088
|
+
)
|
|
1089
|
+
from rasa.dialogue_understanding.generator.multi_step.multi_step_llm_command_generator import ( # noqa: E501
|
|
1090
|
+
HANDLE_FLOWS_KEY,
|
|
1091
|
+
FILL_SLOTS_KEY,
|
|
1092
|
+
)
|
|
1093
|
+
from rasa.dialogue_understanding.generator.constants import (
|
|
1052
1094
|
LLM_CONFIG_KEY,
|
|
1053
1095
|
DEFAULT_LLM_CONFIG,
|
|
1054
1096
|
FLOW_RETRIEVAL_KEY,
|
|
@@ -1060,15 +1102,21 @@ def _get_llm_command_generator_config(config: Dict[str, Any]) -> Optional[Dict]:
|
|
|
1060
1102
|
def find_command_generator_component(pipeline: List) -> Optional[Dict]:
|
|
1061
1103
|
"""Finds the LLMCommandGenerator component in the pipeline."""
|
|
1062
1104
|
for component in pipeline:
|
|
1063
|
-
if component["name"]
|
|
1105
|
+
if component["name"] in [
|
|
1106
|
+
LLMCommandGenerator.__name__,
|
|
1107
|
+
SingleStepLLMCommandGenerator.__name__,
|
|
1108
|
+
MultiStepLLMCommandGenerator.__name__,
|
|
1109
|
+
]:
|
|
1064
1110
|
return component
|
|
1065
1111
|
return None
|
|
1066
1112
|
|
|
1067
1113
|
def extract_settings(component: Dict) -> Dict:
|
|
1068
1114
|
"""Extracts the settings from the command generator component."""
|
|
1069
|
-
|
|
1070
|
-
llm_model_name =
|
|
1071
|
-
|
|
1115
|
+
llm_config = component.get(LLM_CONFIG_KEY, {})
|
|
1116
|
+
llm_model_name = (
|
|
1117
|
+
llm_config.get(MODEL_CONFIG_KEY)
|
|
1118
|
+
or llm_config.get(MODEL_NAME_CONFIG_KEY)
|
|
1119
|
+
or DEFAULT_LLM_CONFIG[MODEL_NAME_CONFIG_KEY]
|
|
1072
1120
|
)
|
|
1073
1121
|
flow_retrieval_config = component.get(FLOW_RETRIEVAL_KEY, {})
|
|
1074
1122
|
flow_retrieval_enabled = flow_retrieval_config.get("active", True)
|
|
@@ -1081,7 +1129,12 @@ def _get_llm_command_generator_config(config: Dict[str, Any]) -> Optional[Dict]:
|
|
|
1081
1129
|
)
|
|
1082
1130
|
return {
|
|
1083
1131
|
LLM_COMMAND_GENERATOR_MODEL_NAME: llm_model_name,
|
|
1084
|
-
LLM_COMMAND_GENERATOR_CUSTOM_PROMPT_USED:
|
|
1132
|
+
LLM_COMMAND_GENERATOR_CUSTOM_PROMPT_USED: PROMPT_CONFIG_KEY in component
|
|
1133
|
+
or PROMPT_TEMPLATE_CONFIG_KEY in component,
|
|
1134
|
+
MULTI_STEP_LLM_COMMAND_GENERATOR_HANDLE_FLOWS_PROMPT_USED: HANDLE_FLOWS_KEY
|
|
1135
|
+
in component.get("prompt_templates", {}),
|
|
1136
|
+
MULTI_STEP_LLM_COMMAND_GENERATOR_FILL_SLOTS_PROMPT_USED: FILL_SLOTS_KEY
|
|
1137
|
+
in component.get("prompt_templates", {}),
|
|
1085
1138
|
FLOW_RETRIEVAL_ENABLED: flow_retrieval_enabled,
|
|
1086
1139
|
FLOW_RETRIEVAL_EMBEDDING_MODEL_NAME: flow_retrieval_embedding_model_name,
|
|
1087
1140
|
}
|
|
@@ -1089,6 +1142,8 @@ def _get_llm_command_generator_config(config: Dict[str, Any]) -> Optional[Dict]:
|
|
|
1089
1142
|
command_generator_config = {
|
|
1090
1143
|
LLM_COMMAND_GENERATOR_MODEL_NAME: None,
|
|
1091
1144
|
LLM_COMMAND_GENERATOR_CUSTOM_PROMPT_USED: None,
|
|
1145
|
+
MULTI_STEP_LLM_COMMAND_GENERATOR_HANDLE_FLOWS_PROMPT_USED: None,
|
|
1146
|
+
MULTI_STEP_LLM_COMMAND_GENERATOR_FILL_SLOTS_PROMPT_USED: None,
|
|
1092
1147
|
FLOW_RETRIEVAL_ENABLED: None,
|
|
1093
1148
|
FLOW_RETRIEVAL_EMBEDDING_MODEL_NAME: None,
|
|
1094
1149
|
}
|
|
@@ -1230,19 +1285,19 @@ def track_server_start(
|
|
|
1230
1285
|
"number_of_workers": number_of_workers,
|
|
1231
1286
|
"endpoints_nlg": endpoints.nlg.type if endpoints.nlg else None,
|
|
1232
1287
|
"endpoints_nlu": endpoints.nlu.type if endpoints.nlu else None,
|
|
1233
|
-
"endpoints_action_server":
|
|
1234
|
-
|
|
1235
|
-
|
|
1288
|
+
"endpoints_action_server": endpoints.action.type
|
|
1289
|
+
if endpoints.action
|
|
1290
|
+
else None,
|
|
1236
1291
|
"endpoints_model_server": endpoints.model.type if endpoints.model else None,
|
|
1237
|
-
"endpoints_tracker_store":
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
"endpoints_lock_store":
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
"endpoints_event_broker":
|
|
1244
|
-
|
|
1245
|
-
|
|
1292
|
+
"endpoints_tracker_store": endpoints.tracker_store.type
|
|
1293
|
+
if endpoints.tracker_store
|
|
1294
|
+
else None,
|
|
1295
|
+
"endpoints_lock_store": endpoints.lock_store.type
|
|
1296
|
+
if endpoints.lock_store
|
|
1297
|
+
else None,
|
|
1298
|
+
"endpoints_event_broker": endpoints.event_broker.type
|
|
1299
|
+
if endpoints.event_broker
|
|
1300
|
+
else None,
|
|
1246
1301
|
"project": project_fingerprint_from_model(model_directory),
|
|
1247
1302
|
},
|
|
1248
1303
|
)
|
|
@@ -1386,7 +1441,9 @@ def track_markers_parsed_count(
|
|
|
1386
1441
|
|
|
1387
1442
|
@ensure_telemetry_enabled
|
|
1388
1443
|
def track_e2e_test_run(
|
|
1389
|
-
input_test_cases: List["TestCase"],
|
|
1444
|
+
input_test_cases: List["TestCase"],
|
|
1445
|
+
input_fixtures: List["Fixture"],
|
|
1446
|
+
input_metadata: List["Metadata"],
|
|
1390
1447
|
) -> None:
|
|
1391
1448
|
"""Track an end-to-end test run."""
|
|
1392
1449
|
_track(
|
|
@@ -1395,6 +1452,8 @@ def track_e2e_test_run(
|
|
|
1395
1452
|
"number_of_test_cases": len(input_test_cases),
|
|
1396
1453
|
"number_of_fixtures": len(input_fixtures),
|
|
1397
1454
|
"uses_fixtures": len(input_fixtures) > 0,
|
|
1455
|
+
"uses_metadata": len(input_metadata) > 0,
|
|
1456
|
+
"number_of_metadata": len(input_metadata),
|
|
1398
1457
|
},
|
|
1399
1458
|
)
|
|
1400
1459
|
|
|
@@ -1574,10 +1633,105 @@ def append_anonymization_trait(
|
|
|
1574
1633
|
endpoints_file, KEY_ANONYMIZATION_RULES
|
|
1575
1634
|
)
|
|
1576
1635
|
|
|
1577
|
-
traits[
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1636
|
+
traits[KEY_ANONYMIZATION_RULES] = (
|
|
1637
|
+
rasa.anonymization.utils.extract_anonymization_traits(
|
|
1638
|
+
anonymization_config, KEY_ANONYMIZATION_RULES
|
|
1639
|
+
)
|
|
1581
1640
|
)
|
|
1582
1641
|
|
|
1583
1642
|
return traits
|
|
1643
|
+
|
|
1644
|
+
|
|
1645
|
+
@ensure_telemetry_enabled
|
|
1646
|
+
def track_enterprise_search_policy_train_started() -> None:
|
|
1647
|
+
"""Track when a user starts training Enterprise Search policy."""
|
|
1648
|
+
_track(TELEMETRY_ENTERPRISE_SEARCH_POLICY_TRAINING_STARTED_EVENT)
|
|
1649
|
+
|
|
1650
|
+
|
|
1651
|
+
@ensure_telemetry_enabled
|
|
1652
|
+
def track_enterprise_search_policy_train_completed(
|
|
1653
|
+
vector_store_type: Optional[str],
|
|
1654
|
+
embeddings_type: Optional[str],
|
|
1655
|
+
embeddings_model: Optional[str],
|
|
1656
|
+
llm_type: Optional[str],
|
|
1657
|
+
llm_model: Optional[str],
|
|
1658
|
+
citation_enabled: Optional[bool],
|
|
1659
|
+
) -> None:
|
|
1660
|
+
"""Track when a user completes training Enterprise Search policy."""
|
|
1661
|
+
_track(
|
|
1662
|
+
TELEMETRY_ENTERPRISE_SEARCH_POLICY_TRAINING_COMPLETED_EVENT,
|
|
1663
|
+
{
|
|
1664
|
+
"vector_store_type": vector_store_type,
|
|
1665
|
+
"embeddings_type": embeddings_type,
|
|
1666
|
+
"embeddings_model": embeddings_model,
|
|
1667
|
+
"llm_type": llm_type,
|
|
1668
|
+
"llm_model": llm_model,
|
|
1669
|
+
"citation_enabled": citation_enabled,
|
|
1670
|
+
},
|
|
1671
|
+
)
|
|
1672
|
+
|
|
1673
|
+
|
|
1674
|
+
@ensure_telemetry_enabled
|
|
1675
|
+
def track_enterprise_search_policy_predict(
|
|
1676
|
+
vector_store_type: Optional[str],
|
|
1677
|
+
embeddings_type: Optional[str],
|
|
1678
|
+
embeddings_model: Optional[str],
|
|
1679
|
+
llm_type: Optional[str],
|
|
1680
|
+
llm_model: Optional[str],
|
|
1681
|
+
citation_enabled: Optional[bool],
|
|
1682
|
+
) -> None:
|
|
1683
|
+
"""Track when a user predicts the next action using Enterprise Search policy."""
|
|
1684
|
+
_track(
|
|
1685
|
+
TELEMETRY_ENTERPRISE_SEARCH_POLICY_PREDICT_EVENT,
|
|
1686
|
+
{
|
|
1687
|
+
"vector_store_type": vector_store_type,
|
|
1688
|
+
"embeddings_type": embeddings_type,
|
|
1689
|
+
"embeddings_model": embeddings_model,
|
|
1690
|
+
"llm_type": llm_type,
|
|
1691
|
+
"llm_model": llm_model,
|
|
1692
|
+
"citation_enabled": citation_enabled,
|
|
1693
|
+
},
|
|
1694
|
+
)
|
|
1695
|
+
|
|
1696
|
+
|
|
1697
|
+
@ensure_telemetry_enabled
|
|
1698
|
+
def track_conversation_count_hard_limit(
|
|
1699
|
+
conversation_count: int, tracked_month: datetime
|
|
1700
|
+
) -> None:
|
|
1701
|
+
"""Track when the number of conversations reaches the hard limit."""
|
|
1702
|
+
_track(
|
|
1703
|
+
TELEMETRY_CONVERSATION_HARD_LIMIT_REACHED,
|
|
1704
|
+
{
|
|
1705
|
+
"conversation_count": conversation_count,
|
|
1706
|
+
"year": tracked_month.year,
|
|
1707
|
+
"month": tracked_month.month,
|
|
1708
|
+
},
|
|
1709
|
+
)
|
|
1710
|
+
|
|
1711
|
+
|
|
1712
|
+
@ensure_telemetry_enabled
|
|
1713
|
+
def track_conversation_count_soft_limit(
|
|
1714
|
+
conversation_count: int, tracked_month: datetime
|
|
1715
|
+
) -> None:
|
|
1716
|
+
"""Track when the number of conversations reaches the soft limit."""
|
|
1717
|
+
_track(
|
|
1718
|
+
TELEMETRY_CONVERSATION_SOFT_LIMIT_REACHED,
|
|
1719
|
+
{
|
|
1720
|
+
"conversation_count": conversation_count,
|
|
1721
|
+
"year": tracked_month.year,
|
|
1722
|
+
"month": tracked_month.month,
|
|
1723
|
+
},
|
|
1724
|
+
)
|
|
1725
|
+
|
|
1726
|
+
|
|
1727
|
+
@ensure_telemetry_enabled
|
|
1728
|
+
def track_conversation_count(conversation_count: int, tracked_month: datetime) -> None:
|
|
1729
|
+
"""Track the number of conversations."""
|
|
1730
|
+
_track(
|
|
1731
|
+
TELEMETRY_CONVERSATION_COUNT,
|
|
1732
|
+
{
|
|
1733
|
+
"conversation_count": conversation_count,
|
|
1734
|
+
"year": tracked_month.year,
|
|
1735
|
+
"month": tracked_month.month,
|
|
1736
|
+
},
|
|
1737
|
+
)
|
rasa/tracing/config.py
CHANGED
|
@@ -16,6 +16,11 @@ from opentelemetry.sdk.resources import SERVICE_NAME, Resource
|
|
|
16
16
|
from opentelemetry.sdk.trace import TracerProvider
|
|
17
17
|
from opentelemetry.sdk.trace.export import BatchSpanProcessor
|
|
18
18
|
|
|
19
|
+
from rasa.core.actions.custom_action_executor import (
|
|
20
|
+
CustomActionExecutor,
|
|
21
|
+
RetryCustomActionExecutor,
|
|
22
|
+
)
|
|
23
|
+
from rasa.core.actions.grpc_custom_action_executor import GRPCCustomActionExecutor
|
|
19
24
|
from rasa.core.agent import Agent
|
|
20
25
|
from rasa.core.processor import MessageProcessor
|
|
21
26
|
from rasa.core.tracker_store import TrackerStore
|
|
@@ -23,8 +28,10 @@ from rasa.dialogue_understanding.commands import (
|
|
|
23
28
|
Command,
|
|
24
29
|
FreeFormAnswerCommand,
|
|
25
30
|
)
|
|
26
|
-
from rasa.dialogue_understanding.generator
|
|
31
|
+
from rasa.dialogue_understanding.generator import (
|
|
27
32
|
LLMCommandGenerator,
|
|
33
|
+
SingleStepLLMCommandGenerator,
|
|
34
|
+
MultiStepLLMCommandGenerator,
|
|
28
35
|
)
|
|
29
36
|
from rasa.dialogue_understanding.generator.nlu_command_adapter import NLUCommandAdapter
|
|
30
37
|
from rasa.engine.graph import GraphNode
|
|
@@ -38,11 +45,10 @@ from rasa.tracing.constants import (
|
|
|
38
45
|
ENDPOINTS_ROOT_CERTIFICATES_KEY,
|
|
39
46
|
ENDPOINTS_METRICS_KEY,
|
|
40
47
|
)
|
|
48
|
+
from rasa.tracing.instrumentation import instrumentation
|
|
41
49
|
from rasa.tracing.metric_instrument_provider import MetricInstrumentProvider
|
|
42
50
|
from rasa.utils.endpoints import EndpointConfig, read_endpoint_config
|
|
43
51
|
|
|
44
|
-
from rasa.tracing.instrumentation import instrumentation
|
|
45
|
-
|
|
46
52
|
TRACING_SERVICE_NAME = os.environ.get("TRACING_SERVICE_NAME", "rasa")
|
|
47
53
|
|
|
48
54
|
logger = logging.getLogger(__name__)
|
|
@@ -82,6 +88,11 @@ def configure_tracing(tracer_provider: Optional[TracerProvider]) -> None:
|
|
|
82
88
|
for vector_store_class in InformationRetrieval.__subclasses__()
|
|
83
89
|
]
|
|
84
90
|
|
|
91
|
+
custom_action_executor_subclasses = []
|
|
92
|
+
for custom_action_executor_class in CustomActionExecutor.__subclasses__():
|
|
93
|
+
if custom_action_executor_class != RetryCustomActionExecutor:
|
|
94
|
+
custom_action_executor_subclasses.append(custom_action_executor_class)
|
|
95
|
+
|
|
85
96
|
instrumentation.instrument(
|
|
86
97
|
tracer_provider=tracer_provider,
|
|
87
98
|
agent_class=Agent,
|
|
@@ -96,6 +107,10 @@ def configure_tracing(tracer_provider: Optional[TracerProvider]) -> None:
|
|
|
96
107
|
vector_store_subclasses=vector_store_subclasses,
|
|
97
108
|
nlu_command_adapter_class=NLUCommandAdapter,
|
|
98
109
|
endpoint_config_class=EndpointConfig,
|
|
110
|
+
grpc_custom_action_executor_class=GRPCCustomActionExecutor,
|
|
111
|
+
single_step_llm_command_generator_class=SingleStepLLMCommandGenerator,
|
|
112
|
+
multi_step_llm_command_generator_class=MultiStepLLMCommandGenerator,
|
|
113
|
+
custom_action_executor_subclasses=custom_action_executor_subclasses,
|
|
99
114
|
)
|
|
100
115
|
|
|
101
116
|
|
rasa/tracing/constants.py
CHANGED
|
@@ -9,7 +9,7 @@ ENDPOINTS_OTLP_BACKEND_TYPE = "otlp"
|
|
|
9
9
|
|
|
10
10
|
# tracing attributes
|
|
11
11
|
PROMPT_TOKEN_LENGTH_ATTRIBUTE_NAME = "len_prompt_tokens"
|
|
12
|
-
|
|
12
|
+
REQUEST_BODY_SIZE_IN_BYTES_ATTRIBUTE_NAME = "request_body_size_in_bytes"
|
|
13
13
|
|
|
14
14
|
# metrics constants
|
|
15
15
|
LLM_COMMAND_GENERATOR_CPU_USAGE_METRIC_NAME = "llm_command_generator_cpu_usage"
|
|
@@ -20,6 +20,30 @@ LLM_COMMAND_GENERATOR_PROMPT_TOKEN_USAGE_METRIC_NAME = (
|
|
|
20
20
|
LLM_COMMAND_GENERATOR_LLM_RESPONSE_DURATION_METRIC_NAME = (
|
|
21
21
|
"llm_command_generator_llm_response_duration"
|
|
22
22
|
)
|
|
23
|
+
SINGLE_STEP_LLM_COMMAND_GENERATOR_CPU_USAGE_METRIC_NAME = (
|
|
24
|
+
"single_step_llm_command_generator_cpu_usage"
|
|
25
|
+
)
|
|
26
|
+
SINGLE_STEP_LLM_COMMAND_GENERATOR_MEMORY_USAGE_METRIC_NAME = (
|
|
27
|
+
"single_step_llm_command_generator_memory_usage"
|
|
28
|
+
)
|
|
29
|
+
SINGLE_STEP_LLM_COMMAND_GENERATOR_PROMPT_TOKEN_USAGE_METRIC_NAME = (
|
|
30
|
+
"single_step_llm_command_generator_prompt_token_usage"
|
|
31
|
+
)
|
|
32
|
+
SINGLE_STEP_LLM_COMMAND_GENERATOR_LLM_RESPONSE_DURATION_METRIC_NAME = (
|
|
33
|
+
"single_step_llm_command_generator_llm_response_duration"
|
|
34
|
+
)
|
|
35
|
+
MULTI_STEP_LLM_COMMAND_GENERATOR_CPU_USAGE_METRIC_NAME = (
|
|
36
|
+
"multi_step_llm_command_generator_cpu_usage"
|
|
37
|
+
)
|
|
38
|
+
MULTI_STEP_LLM_COMMAND_GENERATOR_MEMORY_USAGE_METRIC_NAME = (
|
|
39
|
+
"multi_step_llm_command_generator_memory_usage"
|
|
40
|
+
)
|
|
41
|
+
MULTI_STEP_LLM_COMMAND_GENERATOR_PROMPT_TOKEN_USAGE_METRIC_NAME = (
|
|
42
|
+
"multi_step_llm_command_generator_prompt_token_usage"
|
|
43
|
+
)
|
|
44
|
+
MULTI_STEP_LLM_COMMAND_GENERATOR_LLM_RESPONSE_DURATION_METRIC_NAME = (
|
|
45
|
+
"multi_step_llm_command_generator_llm_response_duration"
|
|
46
|
+
)
|
|
23
47
|
|
|
24
48
|
ENTERPRISE_SEARCH_POLICY_LLM_RESPONSE_DURATION_METRIC_NAME = (
|
|
25
49
|
"enterprise_search_policy_llm_response_duration"
|
|
@@ -34,5 +58,5 @@ CONTEXTUAL_RESPONSE_REPHRASER_LLM_RESPONSE_DURATION_METRIC_NAME = (
|
|
|
34
58
|
RASA_CLIENT_REQUEST_DURATION_METRIC_NAME = "rasa_client_request_duration"
|
|
35
59
|
RASA_CLIENT_REQUEST_BODY_SIZE_METRIC_NAME = "rasa_client_request_body_size"
|
|
36
60
|
|
|
37
|
-
|
|
61
|
+
LLM_BASED_COMMAND_GENERATOR_CPU_MEMORY_USAGE_UNIT_NAME = "percentage"
|
|
38
62
|
DURATION_UNIT_NAME = "ms"
|
|
@@ -1,46 +1,48 @@
|
|
|
1
1
|
import json
|
|
2
2
|
import logging
|
|
3
3
|
from pathlib import Path
|
|
4
|
-
from typing import Any, Dict, List, Optional,
|
|
4
|
+
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Text, Tuple, Union
|
|
5
5
|
|
|
6
6
|
import tiktoken
|
|
7
7
|
from numpy import ndarray
|
|
8
|
+
from rasa_sdk.grpc_py import action_webhook_pb2
|
|
8
9
|
|
|
10
|
+
from rasa.core.actions.grpc_custom_action_executor import GRPCCustomActionExecutor
|
|
11
|
+
from rasa.core.actions.http_custom_action_executor import HTTPCustomActionExecutor
|
|
9
12
|
from rasa.core.agent import Agent
|
|
10
13
|
from rasa.core.brokers.broker import EventBroker
|
|
11
14
|
from rasa.core.channels import UserMessage
|
|
12
|
-
from rasa.core.nlg.contextual_response_rephraser import ContextualResponseRephraser
|
|
13
15
|
from rasa.core.lock_store import LOCK_LIFETIME, LockStore
|
|
16
|
+
from rasa.core.nlg.contextual_response_rephraser import ContextualResponseRephraser
|
|
14
17
|
from rasa.core.processor import MessageProcessor
|
|
15
18
|
from rasa.core.tracker_store import TrackerStore
|
|
16
19
|
from rasa.dialogue_understanding.commands import Command
|
|
17
|
-
from rasa.dialogue_understanding.generator.llm_command_generator import (
|
|
18
|
-
LLMCommandGenerator,
|
|
19
|
-
)
|
|
20
20
|
from rasa.dialogue_understanding.stack.dialogue_stack import DialogueStack
|
|
21
|
-
from rasa.engine.graph import GraphModelConfiguration, GraphNode
|
|
21
|
+
from rasa.engine.graph import ExecutionContext, GraphModelConfiguration, GraphNode
|
|
22
22
|
from rasa.engine.training.graph_trainer import GraphTrainer
|
|
23
23
|
from rasa.shared.core.constants import REQUESTED_SLOT
|
|
24
24
|
from rasa.shared.core.domain import Domain
|
|
25
25
|
from rasa.shared.core.events import DialogueStackUpdated, Event
|
|
26
|
-
from rasa.shared.core.flows import Flow,
|
|
26
|
+
from rasa.shared.core.flows import Flow, FlowsList, FlowStep
|
|
27
27
|
from rasa.shared.core.trackers import DialogueStateTracker
|
|
28
28
|
from rasa.shared.importers.importer import TrainingDataImporter
|
|
29
|
-
from rasa.shared.nlu.constants import INTENT_NAME_KEY
|
|
29
|
+
from rasa.shared.nlu.constants import INTENT_NAME_KEY, SET_SLOT_COMMAND
|
|
30
30
|
from rasa.shared.utils.llm import combine_custom_and_default_config
|
|
31
31
|
from rasa.tracing.constants import (
|
|
32
32
|
PROMPT_TOKEN_LENGTH_ATTRIBUTE_NAME,
|
|
33
|
-
|
|
33
|
+
REQUEST_BODY_SIZE_IN_BYTES_ATTRIBUTE_NAME,
|
|
34
34
|
)
|
|
35
|
-
from rasa.utils.endpoints import concat_url
|
|
36
35
|
|
|
37
36
|
if TYPE_CHECKING:
|
|
38
37
|
from langchain.llms.base import BaseLLM
|
|
38
|
+
|
|
39
39
|
from rasa.core.policies.enterprise_search_policy import EnterpriseSearchPolicy
|
|
40
40
|
from rasa.core.policies.intentless_policy import IntentlessPolicy
|
|
41
41
|
from rasa.core.policies.policy import PolicyPrediction
|
|
42
|
-
from rasa.dialogue_understanding.generator
|
|
43
|
-
|
|
42
|
+
from rasa.dialogue_understanding.generator import (
|
|
43
|
+
CommandGenerator,
|
|
44
|
+
LLMBasedCommandGenerator,
|
|
45
|
+
)
|
|
44
46
|
|
|
45
47
|
# This file contains all attribute extractors for tracing instrumentation.
|
|
46
48
|
# These are functions that are applied to the arguments of the wrapped function to be
|
|
@@ -84,7 +86,7 @@ def extract_llm_command_generator_attrs(
|
|
|
84
86
|
command_name = command.get("command")
|
|
85
87
|
commands_list.append(command_name)
|
|
86
88
|
|
|
87
|
-
if command_name ==
|
|
89
|
+
if command_name == SET_SLOT_COMMAND:
|
|
88
90
|
attributes["slot_name"] = command.get("name")
|
|
89
91
|
|
|
90
92
|
if command_name == "start flow":
|
|
@@ -247,7 +249,10 @@ def extract_attrs_for_graph_trainer(
|
|
|
247
249
|
}
|
|
248
250
|
|
|
249
251
|
|
|
250
|
-
def extract_headers(
|
|
252
|
+
def extract_headers(
|
|
253
|
+
message: UserMessage,
|
|
254
|
+
**kwargs: Any,
|
|
255
|
+
) -> Any:
|
|
251
256
|
"""Extract the headers from the `UserMessage`."""
|
|
252
257
|
if message.headers:
|
|
253
258
|
return message.headers
|
|
@@ -269,7 +274,7 @@ def extract_intent_name_and_slots(
|
|
|
269
274
|
slots[slot_name] = slot_value.value
|
|
270
275
|
break
|
|
271
276
|
return {
|
|
272
|
-
"intent_name": str(tracker.latest_message.intent.get(INTENT_NAME_KEY)), # type: ignore[union-attr]
|
|
277
|
+
"intent_name": str(tracker.latest_message.intent.get(INTENT_NAME_KEY)), # type: ignore[union-attr]
|
|
273
278
|
**slots,
|
|
274
279
|
}
|
|
275
280
|
|
|
@@ -315,11 +320,11 @@ def extract_llm_config(self: Any, default_llm_config: Dict[str, Any]) -> Dict[st
|
|
|
315
320
|
return attributes
|
|
316
321
|
|
|
317
322
|
|
|
318
|
-
def
|
|
319
|
-
self:
|
|
323
|
+
def extract_attrs_for_llm_based_command_generator(
|
|
324
|
+
self: "LLMBasedCommandGenerator",
|
|
320
325
|
prompt: str,
|
|
321
326
|
) -> Dict[str, Any]:
|
|
322
|
-
from rasa.dialogue_understanding.generator.
|
|
327
|
+
from rasa.dialogue_understanding.generator.constants import (
|
|
323
328
|
DEFAULT_LLM_CONFIG,
|
|
324
329
|
)
|
|
325
330
|
|
|
@@ -382,7 +387,7 @@ def extract_attrs_for_validate_state_of_commands(
|
|
|
382
387
|
command_type = command.command()
|
|
383
388
|
command_as_dict = command.as_dict()
|
|
384
389
|
|
|
385
|
-
if command_type ==
|
|
390
|
+
if command_type == SET_SLOT_COMMAND:
|
|
386
391
|
command_as_dict.pop("value", None)
|
|
387
392
|
|
|
388
393
|
if command_type == "correct slot":
|
|
@@ -414,7 +419,7 @@ def extract_attrs_for_clean_up_commands(
|
|
|
414
419
|
command_type = command.command()
|
|
415
420
|
command_as_dict = command.as_dict()
|
|
416
421
|
|
|
417
|
-
if command_type ==
|
|
422
|
+
if command_type == SET_SLOT_COMMAND:
|
|
418
423
|
command_as_dict.pop("value", None)
|
|
419
424
|
|
|
420
425
|
commands_list.append(command_as_dict)
|
|
@@ -467,7 +472,7 @@ def extract_attrs_for_check_commands_against_startable_flows(
|
|
|
467
472
|
command_as_dict = command.as_dict()
|
|
468
473
|
command_type = command.command()
|
|
469
474
|
|
|
470
|
-
if command_type ==
|
|
475
|
+
if command_type == SET_SLOT_COMMAND:
|
|
471
476
|
slot_value = command_as_dict.pop("value", None)
|
|
472
477
|
command_as_dict["is_slot_value_missing_or_none"] = slot_value is None
|
|
473
478
|
|
|
@@ -523,7 +528,6 @@ def extract_attrs_for_policy_prediction(
|
|
|
523
528
|
diagnostic_data: Optional[Dict[Text, Any]] = None,
|
|
524
529
|
action_metadata: Optional[Dict[Text, Any]] = None,
|
|
525
530
|
) -> Dict[str, Any]:
|
|
526
|
-
|
|
527
531
|
# diagnostic_data can contain ndarray type values which need to be converted
|
|
528
532
|
# into a list since the returning values have to be JSON serializable.
|
|
529
533
|
if isinstance(diagnostic_data, dict):
|
|
@@ -638,26 +642,31 @@ def extend_attributes_with_prompt_tokens_length(
|
|
|
638
642
|
return attributes
|
|
639
643
|
|
|
640
644
|
|
|
641
|
-
def
|
|
642
|
-
self:
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
compress: bool = False,
|
|
647
|
-
**kwargs: Any,
|
|
645
|
+
def extract_attrs_for_custom_action_executor_run(
|
|
646
|
+
self: Union[HTTPCustomActionExecutor, GRPCCustomActionExecutor],
|
|
647
|
+
tracker: DialogueStateTracker,
|
|
648
|
+
domain: Domain,
|
|
649
|
+
include_domain: bool = False,
|
|
648
650
|
) -> Dict[str, Any]:
|
|
649
|
-
|
|
650
|
-
|
|
651
|
+
attrs: Dict[str, Any] = {
|
|
652
|
+
"class_name": self.__class__.__name__,
|
|
653
|
+
"action_name": self.action_name if hasattr(self, "action_name") else "None",
|
|
654
|
+
"sender_id": tracker.sender_id,
|
|
655
|
+
"url": self.action_endpoint.url if hasattr(self, "action_endpoint") else "None",
|
|
656
|
+
}
|
|
657
|
+
return attrs
|
|
651
658
|
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
659
|
+
|
|
660
|
+
def extract_attrs_for_grpc_custom_action_executor_request(
|
|
661
|
+
self: GRPCCustomActionExecutor,
|
|
662
|
+
request: action_webhook_pb2.WebhookRequest,
|
|
663
|
+
) -> Dict[str, Any]:
|
|
664
|
+
attrs: Dict[str, Any] = {"url": self.action_endpoint.url}
|
|
665
|
+
|
|
666
|
+
attrs.update(
|
|
667
|
+
{
|
|
668
|
+
REQUEST_BODY_SIZE_IN_BYTES_ATTRIBUTE_NAME: request.ByteSize(),
|
|
669
|
+
}
|
|
670
|
+
)
|
|
662
671
|
|
|
663
672
|
return attrs
|