rasa-pro 3.11.11__py3-none-any.whl → 3.11.13__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/keys ADDED
@@ -0,0 +1 @@
1
+ {"segment": "CcvVD1I68Nkkxrv93cIqv1twIwrwG8nz", "sentry": "a283f1fde04347b099c8d729109dd450@o251570"}
@@ -1,10 +1,12 @@
1
1
  from __future__ import annotations
2
2
 
3
- from collections import OrderedDict
4
- from enum import Enum
5
3
  import logging
4
+ import shutil
6
5
  import typing
7
- from typing import Any, Dict, List, Optional, Text, Tuple, Callable, Type
6
+ from collections import OrderedDict
7
+ from enum import Enum
8
+ from pathlib import Path
9
+ from typing import Any, Callable, Dict, List, Optional, Text, Tuple, Type
8
10
 
9
11
  import numpy as np
10
12
 
@@ -43,6 +45,10 @@ if typing.TYPE_CHECKING:
43
45
 
44
46
  CONFIG_FEATURES = "features"
45
47
 
48
+ TAGGERS_DIR = "taggers"
49
+ CRFSUITE_MODEL_FILE_NAME = "model.crfsuite"
50
+ PLAIN_CRF_MODEL_FILE_NAME = "model.txt"
51
+
46
52
 
47
53
  class CRFToken:
48
54
  def __init__(
@@ -419,19 +425,11 @@ class CRFEntityExtractor(GraphComponent, EntityExtractorMixin):
419
425
  """Loads trained component (see parent class for full docstring)."""
420
426
  try:
421
427
  with model_storage.read_from(resource) as model_dir:
422
- dataset = rasa.shared.utils.io.read_json_file(
423
- model_dir / "crf_dataset.json"
424
- )
425
428
  crf_order = rasa.shared.utils.io.read_json_file(
426
429
  model_dir / "crf_order.json"
427
430
  )
428
431
 
429
- dataset = [
430
- [CRFToken.create_from_dict(token_data) for token_data in sub_list]
431
- for sub_list in dataset
432
- ]
433
-
434
- entity_taggers = cls.train_model(dataset, config, crf_order)
432
+ entity_taggers = cls._load_taggers(model_dir, config)
435
433
 
436
434
  entity_extractor = cls(config, model_storage, resource, entity_taggers)
437
435
  entity_extractor.crf_order = crf_order
@@ -443,19 +441,71 @@ class CRFEntityExtractor(GraphComponent, EntityExtractorMixin):
443
441
  )
444
442
  return cls(config, model_storage, resource)
445
443
 
444
+ @classmethod
445
+ def _load_taggers(
446
+ cls, model_dir: Path, config: Dict[Text, Any]
447
+ ) -> Dict[str, "CRF"]:
448
+ """
449
+ Load taggers from model directory that persists trained binary
450
+ `model.crfsuite` files.
451
+ """
452
+
453
+ import pycrfsuite
454
+ import sklearn_crfsuite
455
+
456
+ # Get tagger directories
457
+ taggers_base = model_dir / TAGGERS_DIR
458
+ if not taggers_base.exists():
459
+ return {}
460
+
461
+ taggers_dirs = [
462
+ directory for directory in taggers_base.iterdir() if directory.is_dir()
463
+ ]
464
+
465
+ entity_taggers: Dict[str, "CRF"] = {}
466
+
467
+ for tagger_dir in taggers_dirs:
468
+ # Instantiate sklearns CRF wrapper for the pycrfsuite's Tagger
469
+ entity_tagger = sklearn_crfsuite.CRF(
470
+ algorithm="lbfgs",
471
+ # coefficient for L1 penalty
472
+ c1=config["L1_c"],
473
+ # coefficient for L2 penalty
474
+ c2=config["L2_c"],
475
+ # stop earlier
476
+ max_iterations=config["max_iterations"],
477
+ # include transitions that are possible, but not observed
478
+ all_possible_transitions=True,
479
+ )
480
+
481
+ # Load pycrfsuite tagger from the persisted binary model.crfsuite file
482
+ entity_tagger._tagger = pycrfsuite.Tagger()
483
+ entity_tagger._tagger.open(str(tagger_dir / CRFSUITE_MODEL_FILE_NAME))
484
+
485
+ entity_taggers[tagger_dir.name] = entity_tagger
486
+
487
+ return entity_taggers
488
+
446
489
  def persist(self, dataset: List[List[CRFToken]]) -> None:
447
490
  """Persist this model into the passed directory."""
448
491
  with self._model_storage.write_to(self._resource) as model_dir:
449
- data_to_store = [
450
- [token.to_dict() for token in sub_list] for sub_list in dataset
451
- ]
452
-
453
- rasa.shared.utils.io.dump_obj_as_json_to_file(
454
- model_dir / "crf_dataset.json", data_to_store
455
- )
456
492
  rasa.shared.utils.io.dump_obj_as_json_to_file(
457
493
  model_dir / "crf_order.json", self.crf_order
458
494
  )
495
+ if self.entity_taggers is not None:
496
+ for tag_name, entity_tagger in self.entity_taggers.items():
497
+ # Create the directories for storing the CRF model
498
+ tagger_dir = model_dir / TAGGERS_DIR / tag_name
499
+ tagger_dir.mkdir(parents=True, exist_ok=True)
500
+ # Create a plain text version of the CRF model
501
+ entity_tagger.tagger_.dump(
502
+ str(tagger_dir / PLAIN_CRF_MODEL_FILE_NAME)
503
+ )
504
+ # Persist binary version of the model.crfsuite
505
+ shutil.copy2(
506
+ src=entity_tagger.modelfile.name,
507
+ dst=tagger_dir / CRFSUITE_MODEL_FILE_NAME,
508
+ )
459
509
 
460
510
  @classmethod
461
511
  def _crf_tokens_to_features(
rasa/telemetry.py CHANGED
@@ -903,7 +903,7 @@ def initialize_error_reporting() -> None:
903
903
  OSError,
904
904
  ],
905
905
  in_app_include=["rasa"], # only submit errors in this package
906
- with_locals=False, # don't submit local variables
906
+ include_local_variables=False, # don't submit local variables
907
907
  release=f"rasa-{rasa.__version__}",
908
908
  default_integrations=False,
909
909
  environment="development" if in_continuous_integration() else "production",
rasa/version.py CHANGED
@@ -1,3 +1,3 @@
1
1
  # this file will automatically be changed,
2
2
  # do not add anything but the version number here!
3
- __version__ = "3.11.11"
3
+ __version__ = "3.11.13"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: rasa-pro
3
- Version: 3.11.11
3
+ Version: 3.11.13
4
4
  Summary: State-of-the-art open-core Conversational AI framework for Enterprises that natively leverages generative AI for effortless assistant development.
5
5
  Keywords: nlp,machine-learning,machine-learning-library,bot,bots,botkit,rasa conversational-agents,conversational-ai,chatbot,chatbot-framework,bot-framework
6
6
  Author: Rasa Technologies GmbH
@@ -27,7 +27,7 @@ Requires-Dist: SQLAlchemy (>=2.0.22,<2.1.0)
27
27
  Requires-Dist: absl-py (>=2.0,<2.1)
28
28
  Requires-Dist: aio-pika (>=8.2.3,<9.4.4)
29
29
  Requires-Dist: aiogram (>=2.15,<2.26)
30
- Requires-Dist: aiohttp (>=3.9.4,<3.10)
30
+ Requires-Dist: aiohttp (>=3.10.11,<3.11)
31
31
  Requires-Dist: apscheduler (>=3.10,<3.11)
32
32
  Requires-Dist: attrs (>=23.1,<23.2)
33
33
  Requires-Dist: azure-storage-blob (>=12.16.0,<12.17.0)
@@ -115,7 +115,7 @@ Requires-Dist: sanic-routing (>=22.8.0,<23.0.0)
115
115
  Requires-Dist: scikit-learn (>=1.5.1,<1.6.0)
116
116
  Requires-Dist: scipy (>=1.13.1,<1.14.0)
117
117
  Requires-Dist: sentencepiece[sentencepiece] (>=0.1.99,<0.2.0) ; extra == "transformers" or extra == "full"
118
- Requires-Dist: sentry-sdk (>=1.14.0,<1.15.0)
118
+ Requires-Dist: sentry-sdk (>=2.8.0,<3)
119
119
  Requires-Dist: setuptools (>=78.1.0,<78.2.0)
120
120
  Requires-Dist: sklearn-crfsuite (>=0.3.6,<0.4.0)
121
121
  Requires-Dist: skops (>=0.10.0,<0.11.0)
@@ -495,6 +495,7 @@ rasa/graph_components/validators/default_recipe_validator.py,sha256=BHrF6NTfJz42
495
495
  rasa/graph_components/validators/finetuning_validator.py,sha256=38AcwmV8cF5TIlWhUIzh98wtZf934ix04HcczCJiWkU,12863
496
496
  rasa/hooks.py,sha256=3nsfCA142V56mBQ7ktBXhD_RyaSrfj7fY3t7HnsD4Pc,3709
497
497
  rasa/jupyter.py,sha256=x_GF9PK2zMhltb48GEIV9YZ4pRhCto8nV5SioYSCljI,1782
498
+ rasa/keys,sha256=2Stg1fstgJ203cOoW1B2gGMY29fhEnjIfTVxKv_fqPo,101
498
499
  rasa/llm_fine_tuning/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
499
500
  rasa/llm_fine_tuning/annotation_module.py,sha256=wFmW3d6lI5o49OWmdbYQlgr24rqHDgA0T0hLM1pSb9U,8578
500
501
  rasa/llm_fine_tuning/conversations.py,sha256=iW2hoR23Km5wnMC7t8pOXH2Zj3LVcA62xrx2aKDRP78,5208
@@ -544,7 +545,7 @@ rasa/nlu/emulators/luis.py,sha256=AWMGI17Su1q6PcE8l1S1mDJpwfVtx7ibY9rwBmg3Maw,30
544
545
  rasa/nlu/emulators/no_emulator.py,sha256=tLJ2DyWhOtaIBudVf7mJGsubca9Vunb6VhJB_tWJ8wU,334
545
546
  rasa/nlu/emulators/wit.py,sha256=0eMj_q49JGj0Z6JZjR7rHIABNF-F3POX7s5W5OkANyo,1930
546
547
  rasa/nlu/extractors/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
547
- rasa/nlu/extractors/crf_entity_extractor.py,sha256=5IW7Fa4lLLUxMrbHiRmBD7Y6B7TmS_o66USoSxYBOZk,27532
548
+ rasa/nlu/extractors/crf_entity_extractor.py,sha256=pLiM6vEybqSW4refbBRr68QbE-9haxyHQo7vslymyI0,29400
548
549
  rasa/nlu/extractors/duckling_entity_extractor.py,sha256=XooWjw6eDC0sxZ-T1YgDnrLcRTBx6B40SFGLjHTHg-w,7686
549
550
  rasa/nlu/extractors/entity_synonyms.py,sha256=WShheUF7wbP7VWfpCNw3J4NouAcFjAupDsT4oAj_TUc,7148
550
551
  rasa/nlu/extractors/extractor.py,sha256=m6p07GDBZi1VhgYCkYJrWs_Zk87okV77hvoiwG_1xxA,17539
@@ -733,7 +734,7 @@ rasa/studio/download.py,sha256=9uE4KKaHnID_3-Tt_E5_D00XTwhLlj4oxORY8CZRrZc,17188
733
734
  rasa/studio/results_logger.py,sha256=0gCkEaZ1CeFmxRHArK5my_DsLYjApZrxfiRMT5asE6A,4963
734
735
  rasa/studio/train.py,sha256=gfPtirITzBDo9gV4hqDNSwPYtVp_22cq8OWI6YIBgyk,4243
735
736
  rasa/studio/upload.py,sha256=OQwO5JRJpEag-bSiZh14hMtxA83ZcCHZ47ErD9yO4Qc,17397
736
- rasa/telemetry.py,sha256=huwxc0bqbE87DoPhzc8KqxdQ6H8Hcyh3ZZolmrRYciQ,64598
737
+ rasa/telemetry.py,sha256=HDjdl3ipkYNkri-fjJau3HN6DpKxMQscgzbIhyoHu38,64610
737
738
  rasa/tracing/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
738
739
  rasa/tracing/config.py,sha256=kA-xEY2oAc07gw1RzGeMuNnDKd_ZrVXT_B63pxGW-uI,12860
739
740
  rasa/tracing/constants.py,sha256=N_MJLStE3IkmPKQCQv42epd3jdBMJ4Ith1dVO65N5ho,2425
@@ -779,9 +780,9 @@ rasa/utils/train_utils.py,sha256=f1NWpp5y6al0dzoQyyio4hc4Nf73DRoRSHDzEK6-C4E,212
779
780
  rasa/utils/url_tools.py,sha256=JQcHL2aLqLHu82k7_d9imUoETCm2bmlHaDpOJ-dKqBc,1218
780
781
  rasa/utils/yaml.py,sha256=KjbZq5C94ZP7Jdsw8bYYF7HASI6K4-C_kdHfrnPLpSI,2000
781
782
  rasa/validator.py,sha256=O1wjCeV7ITJ0luvb3GCWy8x1fGgzWVbClEMlPnLBowQ,67265
782
- rasa/version.py,sha256=_ZBgTfcNiibsOC-yzALLSC5ZIpzax2a9zTS3lVn3J3s,118
783
- rasa_pro-3.11.11.dist-info/METADATA,sha256=rZj6MixMKB8347G-ug6_VB0ArvBxd2HI-s0_EHHrSMU,10729
784
- rasa_pro-3.11.11.dist-info/NOTICE,sha256=7HlBoMHJY9CL2GlYSfTQ-PZsVmLmVkYmMiPlTjhuCqA,218
785
- rasa_pro-3.11.11.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
786
- rasa_pro-3.11.11.dist-info/entry_points.txt,sha256=ckJ2SfEyTPgBqj_I6vm_tqY9dZF_LAPJZA335Xp0Q9U,43
787
- rasa_pro-3.11.11.dist-info/RECORD,,
783
+ rasa/version.py,sha256=3r8ysmoLP5ymCD1Aeoay8QhahkZGfvHZa3qxvpzZ4Rk,118
784
+ rasa_pro-3.11.13.dist-info/METADATA,sha256=YMwprxaU0dmJWM7IiqIRbX4zpEV6Y5J_4SaA5-zJVKA,10725
785
+ rasa_pro-3.11.13.dist-info/NOTICE,sha256=7HlBoMHJY9CL2GlYSfTQ-PZsVmLmVkYmMiPlTjhuCqA,218
786
+ rasa_pro-3.11.13.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
787
+ rasa_pro-3.11.13.dist-info/entry_points.txt,sha256=ckJ2SfEyTPgBqj_I6vm_tqY9dZF_LAPJZA335Xp0Q9U,43
788
+ rasa_pro-3.11.13.dist-info/RECORD,,