wit_ai 0.0.2

  • Readme
  • Changelog
  • Example
  • Installing
  • 57

wit_ai #

This is a simple client that makes API requests to your Wit.ai app.

Wit.ai is an NLP tool for developers. It makes it easy for developers to build applications and devices that you can talk or text to.

Currently this package supports the "message" feature of Wit.ai. If you would like more features, please open a ticket with the enhancement label.

Usage #

Using this client is very simple. Start by importing the package into your class

import 'package:wit_ai/wit_ai.dart';

Next, create a Wit object with your access token:

final wit = Wit(accessToken: ACCESS_TOKEN_HERE);

NOTE: The access token can be found in the Settings tab on your wit.ai console. It should be titled Client Access Token.

message() #

The message method takes a String input to send to your Wit app. It returns a dynamic object.

final wit = Wit(accessToken: ACCESS_TOKEN_HERE); // New Wit object

dynamic response = await wit.message("Hello");

The message method returns a JSON decoded response, so you can call a specific key directly without a hassle.

Example of a response from Wit:

{
    "msg_id" : "dd526480-5784-43fa-a0f9-a3587fadc95d",
    "_text" : "temperature",
    "stats" : {
      "total_time" : 185
    },
    "entities" : {
      "intent" : [ {
        "confidence" : 0.6081958281101719,
        "value" : "temperature_get"
      }, {
        "confidence" : 0.3918041718898281,
        "value" : "temperature_set"
      } ]
    }
  }

Getting entities from the response:

print(response['entities']);

Flutter #

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

[0.0.2] - 04/27/2020 #

  • Added an example as well as follow health recommendations from pub.dev

[0.0.1] - 04/27/2020 #

  • Added message() method to talk to Wit app

example/example.dart

import 'package:wit_ai/wit_ai.dart';

callWit() async {
  final wit = Wit(accessToken: "6EQHTQPEZPQ6NJ45EHAIPLHEZU6QCTD4");

  dynamic response = await wit.message("Hello");

  return(response['entities']);
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  wit_ai: ^0.0.2

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:wit_ai/wit_ai.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
19
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
57
Learn more about scoring.

We analyzed this package on Jul 11, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.15
  • Flutter: 1.17.5

Analysis suggestions

Package not compatible with SDK dart

Because:

  • wit_ai that is a package requiring null.

Maintenance suggestions

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
http ^0.12.0+2 0.12.1
Transitive dependencies
charcode 1.1.3
collection 1.14.12 1.14.13
http_parser 3.1.4
meta 1.1.8 1.2.2
path 1.7.0
pedantic 1.9.0 1.9.2
sky_engine 0.0.99
source_span 1.7.0
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6 1.2.0
vector_math 2.0.8 2.1.0-nullsafety
Dev dependencies
flutter_test