Interface OutputTokenAccumulator
public interface OutputTokenAccumulator
Interface to accumulate tokens when output guardrails are applied on streamed responses.
Implementation should be CDI beans.
They are selected using their classname in the
OutputGuardrailAccumulator
annotation.-
Method Summary
Modifier and TypeMethodDescriptionio.smallrye.mutiny.Multi
<String> accumulate
(io.smallrye.mutiny.Multi<String> tokens) Accumulate tokens before applying the guardrails.
-
Method Details
-
accumulate
Accumulate tokens before applying the guardrails. The guardrails are invoked for each item emitted by the produceMulti
.If the returned
Multi
emits an error, the guardrail chain is not called and the error is propagated. If the returnedMulti
completes, the guardrail chain is called with the remaining accumulated tokens.- Parameters:
tokens
- the input token stream- Returns:
- the Multi producing the accumulated tokens
-