Skip to content

v1.2.0

Compare
Choose a tag to compare
@kmaphoenix kmaphoenix released this 08 Feb 22:07
· 602 commits to main since this release

Features

Versions

You can now manage DFCX Versions directly from SCRAPI which includes all basic CRUD functions.

from dfcx_scrapi.core.versions import Versions
from dfcx_scrapi.core.flows import Flows

f = Flows(creds_path)
flows_map = f.get_flows_map(agent_id, reverse=True)

# List Versions
all_versions = v.list_versions(flows_map['Default Start Flow'])

# Get Version by Display Name
ver = v.get_version_by_display_name(display_name='dsf v2', flow_id=flows_map['Default Start Flow'])

# Load Version
lro = v.load_version(ver)

# Create Version
lro = v.create_version(flows_map['Default Start Flow'], 'patrick api ver', 'this came from SCRAPI')

# Compare Version
res = v.compare_versions(v0, v1, flows_map['Default Start Flow'])

# Delete Version
v.delete_version(v1)

Environments

As a compliment to Versions, the DFCX Environments functionality has also been added to SCRAPI.
Automatically manage the promotion of Flow Versions into various Environments within DFCX with this Class.

from dfcx_scrapi.core.environments import Environments
from dfcx_scrapi.core.operations import Operations

ops = Operations(creds_path)
envs = Environments(creds_path)

# List Envs
all_envs = envs.list_environments(agent_id)
prod_env = all_envs[0]

# Get Env
prod_env = envs.get_environment(prod_env.name)

# Get Env by Display Name
demo_env = envs.get_environment_by_display_name('PROD', agent_id)

# Create Enviornment
lro = envs.create_environment_by_display_name(
    display_name='DEMO2',
    version_configs=[
        ('Default Start Flow', 2),
        ('Confidence Demo',3),
        ('Sentiment Demo',1),
        ('Response Map Demo',1),
        ('Lists Demo',1),
        ('Multi Param Demo',1),
        ('Proper Names Demo',4),
        ('Entity Routing',1),
        ('[Redaction] Demo',1)
        ],
    description='This is my DEMO environment',
    agent_id=agent_id)

# Update Environment
lro = envs.update_environment(demo_env.name, display_name='DEMO_API_UPDATE')

# Delete Environment
envs.delete_environment(demo_env.name)

# Deploy Flow to Environment
lro = envs.deploy_flow_to_environment(demo_env.name, flow_ver_id))

# Lookup Environment History
history = envs.lookup_environment_history(demo_env.name)

# List Continuous Test Results
ct_res = envs.list_continuous_test_results(demo_env.name)

Security Settings

You can now manage CCAI Security Settings directly from SCRAPI! The CCAI Security Settings feature allows you to apply Data Loss Prevention (DLP) templates,Redaction Strategies and Retention Policies for conversations that are handled by Dialogflow CX.

from dfcx_scrapi.core.security_settings import SecuritySettings

ss = SecuritySettings(creds_path)

# List Security Settings
all_ss = ss.list_security_settings(location_id)

# Get Security Settings
# my_ss = ss.get_security_settings(my_ss.name)

# Create Security Settings from Obj
my_new_ss = my_ss
my_new_ss.display_name = "SCRAPI SS UPDATE"
my_new_ss.retention_window_days = 10
result = ss.create_security_settings(location_id, my_new_ss)

# Update Security Settings
result = ss.update_security_settings(my_ss.name, retention_window_days=30, display_name='SCRAPI SS API UPDATE')

# Delete Security Settings
result = ss.delete_security_settings(my_ss.name)

Utterance Generator Utils

This class is an extension of the UtteranceGenerator ML class introduced in Release v1.1.0.
This class provides additional methods that wrap the base class and allow the user to perform tasks like:

  • Create New Training Phrases
  • Create Test Dataset
  • Create Synthetic Dataset

Each of these are ML-powered, synthetically generated datasets meant to bootstrap your bot building experience or further automate the testing and QA of your bots.

from dfcx_scrapi.tools.utterance_generator_util import UtteranceGeneratorUtils
ug = UtteranceGeneratorUtils(creds_path=creds_path)

# Create New Training Phrases
df = ug.create_new_training_phrases(agent_id, ['context.people_names'], 10)
df.head(2)

# Create Test Dataset
df = ug.create_test_dataset(agent_id, ['context.people_names'], 10)
df.head(2)

# Create Synthetic Dataset
df = ug.create_synthetic_dataset(agent_id, ['context.people_names'], 10)
df.head(2)

Bug Fixes

  • adding src/dfcx_scrapi/core_async/init.py by @jmound in #21

Enhancements

  • Deprecated various methods across classes that were dependent on Python Requests library and implemented the methods based on the core Dialogflow CX library
  • Updated Dataframe outputs in Intents.bulk_intent_to_df() to provide a more consistent naming schema throughout the library

Docs

  • Updated licensing throughout library
  • Various Doc strings and Styles updated throughout the library
  • Renamed tools/utterance_generator_utils.py -> tools/utterance_generator_util.py for name space consistency
  • Renamed tools/webhook_utils.py -> tools/webhook_util.py for name space consistency
  • Moved soop/project.py -> core/project.py
  • Deleted unused soop folder
  • Renamed tools/analysis_util -> tools/levenshtein.py for more appropriate visibility

New Contributors