wit-crystal

Crystal SDK for wit.ai

wit-crystal

Crystal SDK for Wit.ai.

Supports Wit.ai API version 20160526. Runs on Crystal >= 0.17.2.

Installation

Add this to your application's shard.yml:

dependencies:
  wit:
    github: spalladino/wit-crystal

Examples

Understand

A query to the /message endpoint can be issued by running:

crystal examples/understand.cr <access-token> In Buenos Aires
> Extracted entities from 'In Buenos Aires'
>  location=[{"confidence" => 0.957859, "type" => "value", "value" => "Buenos Aires", "suggested" => true}]

Context

Shows how using a context changes how message entities are understood, by processing message Last week both with and without a reference time.

crystal examples/context.cr <access-token>
> Understanding message 'Last week'
>  Without context:  2016-05-09T00:00:00.000-07:00
>  Ref 2012-03-08:   2012-02-27T00:00:00.000Z

Quickstart

The code for the quickstart weather application can be executed by running:

crystal examples/quickstart.cr <access-token>

Usage

wit-crystal provides a Wit::App class with the following methods:

  • message - the Wit message API
  • converse - the low-level Wit converse API
  • run_actions - a higher-level method to the Wit converse API
  • interactive - starts an interactive conversation with your bot

Refer to the examples folder for sample usage.

TODOs

  • Generate and upload documentation
  • Add more specs using webmock or similar tool

Acknowledgements

  • The Wit.ai team for building such an awesome tool
  • The developers of the Ruby SDK for Wit.ai, on which this library is heavily inspired

Contributors

  • spalladino Santiago Palladino - creator, maintainer
Repository

wit-crystal

Owner
Statistic
  • 13
  • 3
  • 0
  • 1
  • 0
  • over 2 years ago
  • May 19, 2016
License

MIT License

Links
Synced at

Thu, 21 Nov 2024 19:36:19 GMT

Languages