Crates.io | wit_ai_rs |
lib.rs | wit_ai_rs |
version | 0.2.0 |
source | src |
created_at | 2024-02-16 03:31:35.2301 |
updated_at | 2024-02-19 14:45:01.775951 |
description | An unofficial Rust crate for interacting with the wit.ai API |
homepage | |
repository | https://github.com/Brendon-Hablutzel/wit-ai-rs |
max_upload_size | |
id | 1142046 |
size | 99,941 |
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 textGET /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 nameWit 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 nameWit has built in intents, which are listed here
GET /language
- attempts to detect the language in a given piece of textSupported languages are listed here
GET /message
- analyzes a given piece of text for intent, entities, and traitsGET /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 nameWit 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 valuesSome 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