Class SmartReply.Session
java.lang.Object
com.codename1.ai.language.SmartReply.Session
- All Implemented Interfaces:
AutoCloseable
- Enclosing class:
SmartReply
Reusable owner of a native Smart Reply backend.
Calling close() prevents new requests immediately and defers
native release until suggestions already in progress have completed.
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes the session.suggest(SmartReplyMessage[] conversation) Generates reply suggestions without recreating the native backend.
-
Method Details
-
suggest
Generates reply suggestions without recreating the native backend. Cancelling the returned resource suppresses late callbacks without closing this reusable session.- Parameters:
conversation- chronological messages, oldest first;nullis treated as an empty conversation- Returns:
- asynchronous suggestions, possibly empty
- Throws:
IllegalStateException- if this session is closed
-
close
public void close()Closes the session. This method is idempotent; native release is deferred until pending suggestions finish.- Specified by:
closein interfaceAutoCloseable
-