public final class SmartReply

  1. Object
  2. 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.SessionReusable owner of a native Smart Reply backend.

Methods

public static boolean isSupported()
public static boolean isSupported(LanguageOptions options)Tests whether Smart Reply is available for a backend selection.
public static SmartReply.Session open(LanguageOptions options)Opens a reusable Smart Reply session.
public static AsyncResource<String[]> suggest(SmartReplyMessage[] conversation, LanguageOptions options)The conversation array and option values are copied before backend work begins.

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

options LanguageOptions
backend selection, or null for 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

options LanguageOptions
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

conversation SmartReplyMessage[]
chronological messages, oldest first
options LanguageOptions
backend options, or null

Returns

asynchronous suggestions, possibly an empty array