Features
- Added `update_entity_type()` method to `entity_types.py`
- Added new functionality to `bulk_intent_to_df` in `intents.py` that allows a user to define a subset of intents to extract from an Agent instead of extracting all Intents and Training Phrases
- Added a new method in `intents.py` called `modify_training_phrase_df()` that is meant to be used in tandem with the following functions:
- `bulk_intent_to_df(mode='advanced')` located in `intents.py`
- `bulk_update_intents_from_dataframe()` located in `dataframe_functions.py`
The new `modify_training_phrase_df()` method allows you to define a third Pandas DataFrame to define "Actions" that you want to take on a subset of the Intent and Training Phrase combinations that you have in your `["phrases"]` dataframe returned from `bulk_intent_to_df(mode='advanced')`. The two primary actions you can perform are `add` and `delete`. You can consider an action such as `move` the combination of `delete` + `add`.
For example, if I wanted to move a Training Phrase `hi` from `IntentA` to `IntentB` I would perform the following actions:
- `delete`, `hi`, `IntentA`
- `add`, `hi`, `IntentB`
The combination of the above is essentially a `move` function.
Bug Fixes
- Fixed an issue in `route_groups_to_dataframe` that caused a failure when the Fulfillment message length was < 1
Enhancements
- Added support for all fulfillment option types in `route_groups_to_dataframe` in `transition_route_groups.py` including `custom_payload`, `liveAgentHandoff`, `conversationSuccess`, `playAudio`, `outputAudioText`
- Improved support for `fulfillment_message` type so that it supports single item fulfillment or lists as supported in the UI. If the UI designer provides more than one fulfillment message, the dataframe will provide the messages back in list format
Misc.
- Fixed relative links in README
Code Samples
Easy Entity Update
python
e_map = e.get_entities_map(agent_id=scratch_agent, reverse=True)
e.update_entity_type(e_map['people'], display_name='people_updated')
Complex MACDs for Intents and Training Phrases
python
Grab your Intents
my_intents = i.bulk_intent_to_df(agent_id=scratch_agent, mode='advanced')
Define your Actions
actions = pd.DataFrame(
columns=['display_name', 'phrase', 'action'],
data=[
['Default Welcome Intent', 'hi', 'delete'],
['Default Welcome Intent', 'what is up, how are you', 'add'],
['Default Welcome Intent', 'yes', 'delete'],
['support.yes', 'yes', 'add']
]
)
Modify your Training Phrases
myactions = i.modify_training_phrase_df(actions, my_intents['phrases'])
Push your Updates!
dffx.bulk_update_intents_from_dataframe(
agent_id=scratch_agent,
tp_df=myactions['updated_training_phrases_df'],
params_df=my_intents['parameters'],
update_flag=True)