watson_assistant 0.0.3

Flutter Android iOS web

Unofficial implementation of IBM Watson Assistant API for Flutter.

watson_assistant #

Unofficial implementation of IBM Watson Assistant API for Flutter.

Usage #

To use this plugin, add watson_assistant as a dependency in your pubspec.yaml file.

Example #

import 'package:watson_assistant/watson_assistant.dart';
/* add async in your function */

WatsonAssistantCredential credential = WatsonAssistantCredential(username: [USERNAME], password: [PASSWORD], workspaceId: [WORKSPACEID]);

WatsonAssistantApiV1 watsonAssistant = WatsonAssistantApiV1(watsonAssistantCredential: credential);

WatsonAssistantContext watsonAssistantContext =WatsonAssistantContext(context: {});

WatsonAssistantResult watsonAssistantResponse;

/*First interaction*/
watsonAssistantResponse = await watsonAssistant.sendMessage("Hello", watsonAssistantContext);  // context of the conversation initially void

watsonAssistantContext = watsonAssistantResponse.context;        // to store the progress of the conversation
print(watsonAssistantResponse.resultText);                       // -->  "Hi i'm Watson Assistant!"

/*Second interaction*/
watsonAssistantResponse = await watsonAssistant.sendMessage("what's the weather tomorrow?", watsonAssistantContext);

watsonAssistantContext = watsonAssistantResponse.context;        // to store the progress of the conversation
print(watsonAssistantResponse.resultText);                       // -->  "It will be sunny tomorrow"



/*Reset the context*/
watsonAssistantContext.resetContext();

0
likes
90
pub points
38%
popularity

Unofficial implementation of IBM Watson Assistant API for Flutter.

Repository (GitHub)
View/report issues

Documentation

API reference

Uploader

davide.bolzoni59@gmail.com

License

unknown (LICENSE)

Dependencies

flutter, http

More

Packages that depend on watson_assistant