Last updated:
0 purchases
learning smart reply
ML Smart Reply #
The easy way to use ML Kit for generating smart replies in Flutter.
With ML Kit's Smart Reply, you can automatically generate relevant replies to messages. Smart Reply helps your users respond to messages quickly, and makes it easier to reply to messages on devices with limited input capabilities.
Getting Started #
Add dependency to your flutter project:
$ flutter pub add learning_smart_reply
copied to clipboard
or
dependencies:
learning_smart_reply: ^0.0.2
copied to clipboard
Then run flutter pub get.
Usage #
import 'package:learning_smart_reply/learning_smart_reply.dart';
copied to clipboard
Generating Smart Replies #
We can generate smart replies by feeding chat message history to SmartReplyGenerator.
SmartReplyGenerator smartReply = SmartReplyGenerator();
Uuid uuid = Uuid();
String userId = uuid.v4();
int now = DateTime.now().millisecondsSinceEpoch;
List<Message> history = [
Message('Hi', user: userId, timestamp: now - (60*60*1000)),
Message('How are you?', timestamp: now - (20*60*1000)),
Message('I am fine. Thanks.', user: userId, timestamp: now - (10*60*1000)),
];
List result = await _smartReply.generateReplies(history);
print('Result:');
print(result);
copied to clipboard
Dispose #
smartReply.dispose();
copied to clipboard
Example Project #
You can learn more from example project here.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.