Class GenerationListeners
java.lang.Object
smile.llm.GenerationListeners
Helpers for composing and adapting
GenerationListeners.-
Method Summary
Modifier and TypeMethodDescriptionstatic GenerationListenercompose(GenerationListener... listeners) Returns a single listener that fans out to every non-null argument.static GenerationListenertoPublisher(SubmissionPublisher<String> publisher) ForwardsGenerationListener.onText(String)topublisher.
-
Method Details
-
toPublisher
ForwardsGenerationListener.onText(String)topublisher. Does not close the publisher.- Parameters:
publisher- destination for streamed text; must not benull.- Returns:
- a listener that only implements text forwarding.
-
compose
Returns a single listener that fans out to every non-null argument.- Parameters:
listeners- listeners to compose;nullentries are ignored.- Returns:
- a composite listener, or
nullwhen nothing to compose.
-