Giter VIP home page Giter VIP logo

dfcx-scrapi's Introduction

Scrappy, the SCRAPI mascot!

Python Dialogflow CX Scripting API (SCRAPI)

A high level scripting API for bot builders, developers, and maintainers.

Table of Contents
  1. Introduction
  2. Getting Started
  3. Usage
  4. Library Composition
  5. Contributing
  6. License
  7. Contact
  8. Acknowledgements

Introduction

The Python Dialogflow CX Scripting API (DFCX SCRAPI) is a high level API that extends the official Google Python Client for Dialogflow CX. SCRAPI makes using DFCX easier, more friendly, and more pythonic for bot builders, developers, and maintainers.

SCRAPI --> Python Dialogflow CX
as
Keras --> Tensorflow

What Can I Do With DFCX SCRAPI?

With DFCX SCRAPI you can perform many bot building and maintenance actions at scale including, but not limited to:

  • Create, Update, Delete, Get, and List for all CX resources types (i.e. Intents, Entity Types, Pages, Flows, etc.)
  • Convert commonly accessed CX Resources to Pandas Dataframes
  • Have fully automated conversations with a CX agent (powerful for regression testing!)
  • Extract Validation information
  • Extract Change History information
  • Search across all Flows/Pages/Routes to find a specific parameter or utterance using Search Util functions
  • Quickly move CX resources between agents using Copy Util functions!
  • Build the fundamental protobuf objects that CX uses for each resource type using Maker/Builder Util functions
  • ...and much, much more!

Built With

  • Python 3.8+

Getting Started

Environment Setup

Set up Google Cloud Platform credentials and install dependencies.

gcloud auth login
gcloud auth application-default login
gcloud config set project <project name>
python3 -m venv venv
source ./venv/bin/activate
pip install -r requirements.txt

Authentication

In order to use the functions and API calls to Dialogflow CX, you will need a Service Account that has appropriate access to your GCP project.
For more information and to view the official documentation for service accounts go to Creating and Managing GCP Service Accounts.

Usage

To run a simple bit of code you can do the following:

  • Import a Class from dfcx_scrapi.core
  • Assign your Service Account to a local variable
from dfcx_scrapi.core.intents import Intents

creds_path = '<PATH_TO_YOUR_SERVICE_ACCOUNT_JSON_FILE>'
agent_path = '<FULL_DFCX_AGENT_ID_PATH>'

# DFCX Agent ID paths are in this format:
# 'projects/<project_id>/locations/<location_id>/agents/<agent_id>'

# Instantiate your class object and pass in your credentials
i = Intents(creds_path, agent_id=agent_path)

# Retrieve all Intents and Training Phrases from an Agent and push to a Pandas DataFrame
df = i.bulk_intent_to_df()

For more examples, please refer to Examples or Tools.

Library Composition

Here is a brief overview of the SCRAPI library's structure and the motivation behind that structure.

Core

The Core folder is synonymous with the core Resource types in the DFCX Agents like:

  • agents
  • intents
  • entity_types
  • etc.

The Core folder is meant to contain the fundamental building blocks for even higher level customized tools and applications that can be built with this library.

Tools

The Tools folder contains various customized toolkits that allow you to do more complex bot management tasks, such as

  • Manipulate Agent Resource types into various DataFrame structures
  • Copy Agent Resources between Agents and GCP Projects on a resource by resource level
  • Move data to and from DFCX and other GCP Services like BigQuery, Sheets, etc.
  • Create customized search queries inside of your agent resources

Contributing

We welcome any contributions or feature requests you would like to submit!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the Apache 2.0 License. See LICENSE for more information.

Contact

Patrick Marlow - [email protected] - @kmaphoenix
David "DC" Collier - [email protected] - @DCsan
Henry Drescher - [email protected] - @Hgithubacct

Project Link: https://github.com/GoogleCloudPlatform/dfcx-scrapi

Acknowledgements

Dialogflow CX Python Client Library
Hugging Face - Pegasus Paraphrase

dfcx-scrapi's People

Contributors

dcsan avatar karkipra avatar katherinez22 avatar kmaphoenix avatar omerside avatar zya-codes avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.