# Class SmartReply

java.lang.Object
com.codename1.ai.language.SmartReply

public final class SmartReply extends Object
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 Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static final class`
  `SmartReply.Session`
  Reusable owner of a native Smart Reply backend.

- ## Method Summary

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

  ### Methods inherited from class Object

  `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## 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 `SmartReply.Session` from `open(LanguageOptions)` when the application will immediately request repeated suggestions.

    Parameters:
      `options` - 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` - 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` - chronological messages, oldest first
      `options` - backend options, or `null`
    Returns:
      asynchronous suggestions, possibly an empty array