Git Product home page Git Product logo

dialog-flow's Introduction

DialogFlow.AI

The DialogFlow.AI Java SDK makes it easy to integrate speech recognition with DialogFlow.AI natural language processing API on Android devices. API.AI allows using voice commands and integration with dialog scenarios defined for a particular agent in API.AI.

Authentication is accomplished through setting the client access token when initializing an AIConfiguration object. The client access token specifies which agent will be used for natural language processing.

Note: The DialogFlow.AI Java SDK only makes query requests, and cannot be used to manage entities and intents. Instead, use the API.AI user interface or REST API to create, retrieve, update, and delete entities and intents.

Dialogflow API Java examples

These samples demonstrate the use of the Dialogflow API.

These samples show how to detect intents with text, audio, and streaming audio.

These samples show how to manage contexts, entities, entity types, and intents

Java Version

This sample requires you to have Java8.

Download Maven

To get started, download and install it.

Setup

  • Create a project with the Google Cloud Console, and enable the Dialogflow API.

  • Set up authentication. For example, from the Cloud Console, create a service account, download its json credentials file, then set the appropriate environment variable:

    export GOOGLE_APPLICATION_CREDENTIALS=/path/to/your-project-credentials.json
  • To run tests, set GOOGLE_CLOUD_PROJECT to your PROJECT_ID:

    export GOOGLE_CLOUD_PROJECT=PROJECT_ID
    
    mvn clean verify
    
  • Set PROJECT_ID in pom.xml to your Google Cloud Project Id.

  • Set SESSION_ID in pom.xml to a session name of your choice. (Defaults to SESSION_ID)

  • Set CONTEXT_ID in pom.xml to a context name of your choice. (Defaults to CONTEXT_ID)

Run the sample

To build the sample, we use Maven.

mvn clean package

Set up the Agent

Import the sample agent (RoomReservation.zip) from the resources directory to your Dialogflow Project using the following guide: Versioning with Import/Export

Samples

Detect Intent Texts

DialogFlow API Detect Intent sample with text inputs.

mvn exec:java -DDetectIntentTexts

Detect Intent Audio

DialogFlow API Detect Intent sample with audio files. Returns the result of detect intent with an audio file as input.

Note: Execute the following commands in order to yield reasonable outputs.

mvn exec:java -DDetectIntentAudioBookARoom
mvn exec:java -DDetectIntentAudioMountainView
mvn exec:java -DDetectIntentAudioToday
mvn exec:java -DDetectIntentAudio230PM
mvn exec:java -DDetectIntentAudioHalfAnHour
mvn exec:java -DDetectIntentAudioTwoPeople

Detect Intent Stream

DialogFlow API Detect Intent sample with audio files processes as an audio stream.

mvn exec:java -DDetectIntentStreamBookARoom
mvn exec:java -DDetectIntentStreamMountainView

Context Management

DialogFlow API Context sample.

Lists contexts

mvn exec:java -DContextManagementList

Create an entity type

mvn exec:java -DContextManagementCreate

Delete entity type

mvn exec:java -DContextManagementDelete

Entity Management

DialogFlow API Entity sample.

List entities

mvn exec:java -DEntityManagementList

Create an entity

mvn exec:java -DEntityManagementCreate

Delete entity

mvn exec:java -DEntityManagementDelete

Entity Type Management

DialogFlow API EntityType sample.

List entity types

mvn exec:java -DEntityTypeManagementList

Create an entity type

mvn exec:java -DEntityTypeManagementCreate

Delete entity type

mvn exec:java -DEntityTypeManagementDelete

Intent Management

DialogFlow API Intent sample.

List intents

mvn exec:java -DIntentManagementList

Create an intent

mvn exec:java -DIntentManagementCreate

Delete intent

mvn exec:java -DIntentManagementDelete

Session Entity Type Management

DialogFlow API SessionEntityType sample.

List session entity types

mvn exec:java -DSessionEntityTypeManagementList

Create session entity type

mvn exec:java -DSessionEntityTypeManagementCreate

Delete session entity type

mvn exec:java -DSessionEntityTypeManagementDelete

dialog-flow's People

Contributors

jamajama 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.