@@ -51,8 +51,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
5151 - Introduced a new ` Aggregation ` dataclass to represent both the aggregated ` text ` and
5252 a string identifying the ` type ` of aggregation (ex. "sentence", "word", "my custom
5353 aggregation")
54- # MRKB TODO -- don't break. leave pattern_id as-is and remove 'type', so that the old
55- remove param can remain
5654 - ** BREAKING** : ` BaseTextAggregator.text ` now returns an ` Aggregation ` (instead of ` str ` ).
5755 To update: ` aggregated_text = myAggregator.text ` -> ` aggregated_text = myAggregator.text.text `
5856 - ** BREAKING** : ` BaseTextAggregator.aggregate() ` now returns ` Optional[Aggregation] `
@@ -65,36 +63,31 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6563 - `SimpleTextAggregator`, `SkipTagsAggregator`, `PatternPairAggregator` updated to
6664 produce/consume `Aggregation` objects.
6765
68- - Augmented the `PatterPairAggregator`:
69- - **BREAKING CHANGES**: Support for the items below resulted in two breaking changes to the
70- `PatternPairAggregator` methods
71- 1. The `add_pattern_pair` method arguments have changed:
72- - The `pattern_id` argument is now `type`
73- - The `remove_match` argument has been replaced with the `action` argument. To update,
74- change `remove_match: True` to `action: MatchAction.REMOVE` or `remove_match: False` to
75- `action: MatchAction.KEEP`
76- 2. The `PatternMatch` type returned to handlers registered via `on_pattern_match` has been
77- updated to subclass from the new `Aggregation` type, which means that `content` has been
78- replaced with `text` and `pattern_id` has been replaced with `type`:
79- ```
80- async dev on_match_tag(match: PatternMatch):
81- pattern = match.type # instead of match.pattern_id
82- text = match.text # instead of match.content
83- ```
84- - `PatternPairAggregator` now supports `type` and `action` per pattern.
85- - New `MatchAction` enum: `REMOVE`, `KEEP`, `AGGREGATE`, allowing customization for how
86- a match should be handled.
87- - `REMOVE`: The text along with its delimiters will be removed from the streaming text.
88- Sentence aggregation will continue on as if this text did not exist.
89- - `KEEP`: The delimiters will be removed, but the content between them will be kept.
90- Sentence aggregation will continue on with the internal text included.
91- - `AGGREGATE`: The delimiters will be removed and the content between will be treated
92- as a separate aggregation. Any text before the start of the pattern will be
93- returned early, whether or not a complete sentence was found. Then the pattern
94- will be returned. Then the aggregation will continue on sentence matching after
95- the closing delimiter is found. The content between the delimiters is not
96- aggregated by sentence. It is aggregated as one single block of text.
97- - `PatternMatch` now extends `Aggregation` and provides richer info to handlers.
66+ - Augmented the `PatternPairAggregator`:
67+ - Introduced a new, preferred version of `add_pattern` to support a new option for treating a
68+ match as a separate aggregation returned from `aggregate()`. This replaces the now
69+ deprecated `add_pattern_pair` method and you provide a `MatchAction` in lieu of the `remove_match` field.
70+ - `MatchAction` enum: `REMOVE`, `KEEP`, `AGGREGATE`, allowing customization for how
71+ a match should be handled.
72+ - `REMOVE`: The text along with its delimiters will be removed from the streaming text.
73+ Sentence aggregation will continue on as if this text did not exist.
74+ - `KEEP`: The delimiters will be removed, but the content between them will be kept.
75+ Sentence aggregation will continue on with the internal text included.
76+ - `AGGREGATE`: The delimiters will be removed and the content between will be treated
77+ as a separate aggregation. Any text before the start of the pattern will be
78+ returned early, whether or not a complete sentence was found. Then the pattern
79+ will be returned. Then the aggregation will continue on sentence matching after
80+ the closing delimiter is found. The content between the delimiters is not
81+ aggregated by sentence. It is aggregated as one single block of text.
82+ - `PatternMatch` now extends `Aggregation` and provides richer info to handlers.
83+ - **BREAKING**: The `PatternMatch` type returned to handlers registered via `on_pattern_match`
84+ has been updated to subclass from the new `Aggregation` type, which means that `content`
85+ has been replaced with `text` and `pattern_id` has been replaced with `type`:
86+ ```
87+ async dev on_match_tag(match: PatternMatch):
88+ pattern = match.type # instead of match.pattern_id
89+ text = match.text # instead of match.content
90+ ```
9891
9992### Changed
10093
@@ -127,6 +120,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
127120 behavior, but if you want to override the aggregation behavior, you should use the new
128121 processor.
129122
123+ - Deprecated `add_pattern_pair` in the `PatternPairAggregator` which takes a `pattern_id`
124+ and `remove_match` field in favor of the new `add_pattern` method which takes a `type` and an
125+ `action`
126+
130127### Fixed
131128
132129- Fixed subtle issue of assistant context messages ending up with double spaces
0 commit comments