dfagent 🤖
The dfagent is a package for the handling of Dialogflow agents. You can for example retrieve training examples and save into a preferred format, or you can use it to update an intent by simply feeding it training examples you stored in a preferred format.
Overview
- dfagent/ contains all the core code to extend dfagent.
Install
To install the dfagent package you only need to run install.sh script.
Usage
Once dfagent is installed you can simply import it in your code.
Save training phrases [remote]
The following snippet illustrates a simple example to get and save training examples from an online Dialogflow agent.
To create a Dialogflow agent you only need that
import dfagent
agent = dfagent.DialogFlowAgent(
local_path_or_url='my_gcp_project_id',
service_account='path/to/sa.json',
content_type='json',
output_format='default'
)
Then you can get a list of dialogflow examples for saving as follows
examples = agent.get_training_examples()
agent.save_training_examples(examples, output_dir='path/to/dir')
Update intent with new training phrases [remote]
In the following is a snippet that illustrates an example to update a remote Dialogflow agent using training phrases you stored as a raw text file. Remember that dfagent can be extended to support any input or output file format.
Once you instante a df agent
import dfagent
agent = dfagent.DialogFlowAgent(
local_path_or_url='my_gcp_project_id',
service_account='path/to/sa.json',
input_format='default',
)
You can update your remote Dialoflow agent in that way
response, raw_examples, df_examples = agent.add_training_examples(
intent_name='help.cooking',
input_dir_or_file='path/to/phrases.train',
lang='en'
)
From local or zip
In case you already have exported your Dialogflow on your local computer, you can give as local_path_or_url the path to the zip or unzipped exported agent.
import dfagent
agent = dfagent.DialogFlowAgent(
local_path_or_url='path/to/myagent.zip',
...
)
Metadata
Release files for dfagent 0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| dfagent-0.1.tar.gz | 10.3 kB | Without provenance | Details for dfagent-0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dfagent-0.1-py3-none-any.whl | Python 3 | none | any | Details for dfagent-0.1-py3-none-any.whl |
Total release size: 19.3 kB
Release files / dfagent-0.1.tar.gz
| Download URL | dfagent-0.1.tar.gz |
|---|---|
| Size | 10.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
12480ebacf99749f072fec43375785d2f89a9e1695026ab59f9856729dd46d4f
|
|
BLAKE2b-256 checksum How to use checksums |
48ea4102aa3b53ccba87499e2d8b863b277fc5ecaeb2652fe3f06f94daf6187a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.5
|
Release files / dfagent-0.1-py3-none-any.whl
| Download URL | dfagent-0.1-py3-none-any.whl |
|---|---|
| Size | 9.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
78d19c1598fab5b0c463e3812023e953e37991a7cc55adbc42e72c3fa8a56036
|
|
BLAKE2b-256 checksum How to use checksums |
f491dbcf465fe061efb97ab56a5e7e55cd97d5f52c0eee9fe12ff3271d347ea8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.5
|
Security for dfagent 0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.