This crate acts as a wrapper for the wit.ai HTTP API, containing functions and types for interacting with the API programmatically using Rust. The core type is the WitClient
struct, which must be initialized before any endpoint can be called.
To get started, instantiate a WitClient
--this has all the methods required for sending requests to the wit API:
let wit_client = WitClient::new("TOKEN".to_string(), "20240215".to_string());
Note that a token is required to interact with the wit API. This can be found under the Settings
page in the dashboard for your app on the wit site. A token is associated with one app, and the app the token belongs to will be the app that the client acts upon.
This crate currently supports the following endpoints:
POST /dictation
- takes an audio stream of speech and returns a transcription with textPOST /speech
- takes an audio stream of speech and returns transcription as well as extracted meaning
GET /entities
- fetches all entities associated with the current appPOST /entities
- creates a new entity with the given name and rolesGET /entities/:entity
- fetches the entity with the given namePUT /entities/:entity
- updates an entity with the given nameDELETE /entities/:entity
- deletes the entity with the given name
Wit has built in entities, which are listed here
GET /intents
- fetches all intents associated with the current appPOST /intents
- creates a new intent with the given nameGET /intents/:intent
- fetches the intent with the given nameDELETE /intents/:intent
- deletes the intent with the given name
Wit has built in intents, which are listed here
GET /language
- attempts to detect the language in a given piece of text
Supported languages are listed here
GET /message
- analyzes a given piece of text for intent, entities, and traits
GET /traits
- fetches all traits associated with the current appPOST /traits
- creates a new trait with the given name and valuesGET /traits/:trait
- fetches all information about the trait with the given nameDELETE /traits/:trait
- deletes the trait with the given name
Wit has built in intents, which are listed here
GET /utterances
- fetches all the utterances associated with the current appPOST /utterances
- creates a new utterance with the given text, intent, entities, and traitsDELETE /utterances
- deletes one or more utterances, given their text values
Some tests use mockito, while others interact with the actual wit.ai API. The tests that interact with the wit API are ignored by default--to run them, you must set the WIT_TOKEN
environment variable to a token that has read and write access.
The latest version of the wit.ai HTTP API docs can be found here