Crates.io | wit_owo |
lib.rs | wit_owo |
version | 1.3.2 |
created_at | 2023-10-15 11:05:04.186898+00 |
updated_at | 2025-08-25 18:56:51.10985+00 |
description | A Rust library for interacting with the Wit.ai API. |
homepage | |
repository | https://github.com/cliftontoaster-reid/wit_owo |
max_upload_size | |
id | 1003664 |
size | 867,801 |
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.
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.
This crate supports multiple feature flags to customize functionality based on your needs:
async
(default)Enables asynchronous API support using the Tokio runtime. This feature provides:
[dependencies]
wit_owo = "1.3.1" # async feature enabled by default
blocking
Enables synchronous (blocking) API support for simpler use cases:
[dependencies]
wit_owo = { version = "1.3.1", features = ["blocking"] }
You can enable both async and blocking features simultaneously:
[dependencies]
wit_owo = { version = "1.3.1", features = ["async", "blocking"] }
This allows you to use both synchronous and asynchronous APIs in the same application, choosing the most appropriate one for each use case.
π Comprehensive tutorials and examples are available on docs.rs
The documentation includes detailed tutorials for all major functionality:
Each tutorial includes:
Start with the API module documentation for an overview of all available tutorials.
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.
For the latest updates, announcements, and discussions about this crate, follow me on Mastodon:
π @CliftonToasterReid@floofy.tech
Feel free to reach out if you have questions, suggestions, or just want to share how you're using the crate!
To use this library, add the following to your Cargo.toml
:
[dependencies]
wit_owo = { git = "https://github.com/cliftontoaster-reid/wit_owo.git" }
- βοΈ 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
use dotenvy::dotenv;
use wit_owo::prelude::*;
#[tokio::main]
async fn main() -> Result<(), ApiError> {
dotenv().ok();
let token = std::env::var("WIT_API_TOKEN").expect("WIT_API_TOKEN not set");
let client = WitClient::new(&token);
let message = "Hello world";
let response = client.get_message(message).await?;
println!("Response: {:?}", response);
Ok(())
}
wit_owo::prelude
, which brings common types
like WitClient
and ApiError
into scope.main
function using the #[tokio::main]
macro.
This macro sets up the Tokio runtime so we can await
futures.WIT_API_TOKEN
environment variable. This is your personal API
token, required to authenticate with the Wit.ai service.WitClient
instance by calling WitClient::new(&token)
.
The client holds configuration and credentials needed for requests."Hello world"
) and call
client.get_message(message).await?
. This sends a GET request to the
/message
endpoint and asynchronously waits for a parsed response.Result::Ok
) using println!
. If it fails, the ?
operator will
return an Err(ApiError)
from main
, 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