Wit OwO revived
The fluffiest and the most powerful client for meta's natural language understanding service is back.
Though as the few people that used this crate might have realized; I did leave this bowl of fluff to die due to me having to do a lot of things at the same time, especially with my studies. And for that I would like to apologize to all who used this crate and one day found out it was not working any more, and that for so long, it did not work.
That is why for now I will try my best to, not forget and finally maintain this crate as you deserve to have one.
Description
The fluffiest and the most powerful client for meta's natural language understanding service, Wit.AI.
The goal of this crate is to provide a feature-full yet easy to use client for Wit.AI's API. It is designed to be as flexible as possible, allowing you to use it in any way you see fit while making use of Rust's safety and strictness.
Features
- Simple β¨: The client is designed to be as simple as possible to use, while still providing all the features of Wit.AI's API.
- Flexible π€Έ: The client is designed to be used in many ways, allowing you to use it in any way you see fit.
- Safe π‘οΈ: The client is designed to be as safe as possible, making use when possible of strict types, as well as enums to ensure that you can't make mistakes.
Legal Notice
This project is licensed under both the MIT and Apache 2.0 licences. You can find the full text of the licences in the LICENSE-MIT and LICENSE-APACHE files respectively. You are therefore allowed to use this project in any way you see fit, as long as you respect the terms of the licenses you decide to align with.
Please note that I am not affiliated with Wit.AI or Meta. This project is a personal endeavour and is not officially endorsed by Wit.AI or Meta.
Usage
To use this library, add the following to your Cargo.toml:
[]
= { = "https://github.com/cliftontoaster-reid/wit_owo.git" }
API paths support
- βοΈ Path supported and tested
- β οΈ Path supported but still being improved
- β Path not yet supported
-
β POST
/converse -
β POST
/event -
β POST
/speech -
βοΈ GET
/message -
β POST
/dictation -
β POST
/synthesize -
β GET
/language -
β GET
/intents -
β POST
/intents -
β GET
/intents/:intent -
β DELETE
/intents/:intent -
β GET
/entities -
β POST
/entities -
β GET
/entities/:entity -
β PUT
/entities/:entity -
β DELETE
/entities/:entity -
β DELETE
/entities/:entity:role -
β POST
/entities/:entity/keywords -
β DELETE
/entities/:entity/keywords/:keyword -
β POST
/entities/:entity/keywords/:keyword/synonyms -
β DELETE
/entities/:entity/keywords/:keyword/synonyms/:synonym -
β GET
/traits -
β POST
/traits -
β GET
/traits/:trait -
β DELETE
/traits/:trait -
β POST
/traits/:trait/values -
β DELETE
/traits/:trait/values/:value -
β GET
/utterances -
β POST
/utterances -
β DELETE
/utterances -
β GET
/apps -
β GET
/apps/:app -
β POST
/apps -
β PUT
/apps/:app -
β DELETE
/apps/:app -
β POST
/apps/:app/client_tokens -
β GET
/apps/:app/tags -
β GET
/apps/:app/tags/:tag -
β POST
/apps/:app/tags -
β PUT
/apps/:app/tags/:tag -
β DELETE
/apps/:app/tags/:tag -
β GET
/export -
β POST
/import -
β GET
/voices -
β GET
/voices/:voice
Example
use dotenv;
use *;
async
Explanation
- We import everything from
wit_owo::prelude, which brings common types likeWitClientandApiErrorinto scope. - We define an asynchronous
mainfunction using the#[tokio::main]macro. This macro sets up the Tokio runtime so we canawaitfutures. - We read the
WIT_API_TOKENenvironment variable. This is your personal API token, required to authenticate with the Wit.ai service. - We create a new
WitClientinstance by callingWitClient::new(&token). The client holds configuration and credentials needed for requests. - We prepare a text message (
"Hello world") and callclient.get_message(message).await?. This sends a GET request to the/messageendpoint and asynchronously waits for a parsed response. - If the request succeeds, we print out the structured response (wrapped in
Result::Ok) usingprintln!. If it fails, the?operator will return anErr(ApiError)frommain, causing the program to exit with an error.
This patternβreading a token, creating a client, making a request, then handling the resultβis the core workflow for all API calls in