Class StreamingListener.Adapter
java.lang.Object
com.codename1.ai.StreamingListener.Adapter
- All Implemented Interfaces:
StreamingListener
- Enclosing interface:
StreamingListener
No-op default implementation. Subclass and override only what
you need.
-
Nested Class Summary
Nested classes/interfaces inherited from interface StreamingListener
StreamingListener.Adapter -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidonContentDelta(String textDelta) A chunk of assistant text.voidMid-stream error (e.g. connection reset).voidonToolCallDelta(int index, String id, String name, String argumentsFragment) A tool-call fragment.voidToken-accounting update.
-
Constructor Details
-
Adapter
public Adapter()
-
-
Method Details
-
onContentDelta
Description copied from interface:StreamingListenerA chunk of assistant text. Append it to whatever text buffer you're rendering.- Specified by:
onContentDeltain interfaceStreamingListener
-
onToolCallDelta
Description copied from interface:StreamingListenerA tool-call fragment.indexlets you correlate fragments that belong to the same call when multiple tools are streamed in parallel.nameis non-null on the first fragment for each call.argumentsFragmentis the next slice of the arguments JSON; concatenate fragments for the sameindexto reassemble.idis the provider's tool-call id, present on the first fragment.- Specified by:
onToolCallDeltain interfaceStreamingListener
-
onUsage
Description copied from interface:StreamingListenerToken-accounting update. Most providers send this once at the end; some send incremental counts.- Specified by:
onUsagein interfaceStreamingListener
-
onError
Description copied from interface:StreamingListenerMid-stream error (e.g. connection reset). TheAsyncResourcereturned bychatStreamwill also complete with this same exception, so listeners can typically ignore this and react to the resource. Implemented for parity with other SDKs.- Specified by:
onErrorin interfaceStreamingListener
-