public final class SmartReply
- Object
- SmartReply
Produces short reply suggestions for a chronological conversation without
uploading its messages. ML Kit may return no suggestions when the language
or conversation context is unsupported.
Nested types
class SmartReply.Session | Reusable owner of a native Smart Reply backend. |
Methods
Inherited methods
Method details
isSupported
public static boolean isSupported()Returns
whether automatic Smart Reply is available
isSupported
public static boolean isSupported(LanguageOptions options)Tests whether Smart Reply is available for a backend selection.
This capability check creates and closes a temporary native backend.
Retain a Session from open(LanguageOptions) when the
application will immediately request repeated suggestions.
Parameters
optionsLanguageOptions- backend selection, or
nullfor defaults
Returns
whether the selected backend supports Smart Reply
open
public static SmartReply.Session open(LanguageOptions options)Opens a reusable Smart Reply session. Reuse it for conversations that
need repeated suggestions to avoid recreating the native client.
Parameters
optionsLanguageOptions- backend options, or
null
Returns
a reusable session that owns one native language backend
Throws
UnsupportedOperationException- if the selected backend is absent
suggest
public static AsyncResource<String[]> suggest(SmartReplyMessage[] conversation, LanguageOptions options)The conversation array and option values are copied before backend work
begins.
SmartReplyMessage values are immutable.
Cancelling the returned resource suppresses late result callbacks; the
temporary backend is released after its pending native work settles.Parameters
conversationSmartReplyMessage[]- chronological messages, oldest first
optionsLanguageOptions- backend options, or
null
Returns
asynchronous suggestions, possibly an empty array