Struct rustcastai::Client [] [src]

pub struct Client<'a> {
    pub client: Client,
    // some fields omitted
}

Fields

Methods

impl<'a> Client<'a>
[src]

Create a new client

The token argument is your bot's request access token. You can find this token in your bot's settings on Recast.AI

Example

let client = Client::new("YOUR_REQUEST_ACCESS_TOKEN");

Set the language used to perform text_request, file_request and text_converse

The language as to be in the form of an isocode, like "en" for english For now, Recast.AI supports english and french

Example

client.set_language("en");

Call /request endpoint to analyze a text

This method will make an HTTP request on the /request endpoint of the Recast.AI API and will give you back the intent and metadata detected in your input.

Example

client.text_request("Hello, world.");

Call /request endpoint to analyze an audio file

This method will make an HTTP request on the /request endpoint of the Recast.AI API and will give you back the intent and metadata detected in the content of your audio file.

Example

client.file_request("test.wav");

Call the /converse endpoint to interact with a bot

This method will make an HTTP request on the /converse endpoint of the Recast.AI API and will give you back the action and metadata detected, along with the replies of your bot

Example

client.text_converse("Hello, what can you do?");

Reset the memory of your bot for a specific conversation.

Example

client.text_converse("I want to change my destination")
    .and_then(|res| client.reset_memory(&res.conversation_token));

Reset the entire conversation: both memory and flow.

Example

client.text_converse("Can we start all over again?")
    .and_then(|res| client.reset_conversation(&res.conversation_token));

Trait Implementations

impl<'a> Debug for Client<'a>
[src]

Formats the value using the given formatter.