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 Type
    Method
    Description
    io.smallrye.mutiny.Multi<String>
    accumulate(io.smallrye.mutiny.Multi<String> tokens)
    Accumulate tokens before applying the guardrails.
  • Method Details

    • accumulate

      io.smallrye.mutiny.Multi<String> accumulate(io.smallrye.mutiny.Multi<String> tokens)
      Accumulate tokens before applying the guardrails. The guardrails are invoked for each item emitted by the produce Multi.

      If the returned Multi emits an error, the guardrail chain is not called and the error is propagated. If the returned Multi completes, the guardrail chain is called with the remaining accumulated tokens.

      Parameters:
      tokens - the input token stream
      Returns:
      the Multi producing the accumulated tokens